From c259beaa032e31fd9ea2cce8c51047854539ee49 Mon Sep 17 00:00:00 2001 From: Ben Sedat Date: Sun, 21 Sep 2014 18:04:18 -0700 Subject: [PATCH 1/2] Delay attribute interpolation of basename to grab values for the version and machine late --- attributes/default.rb | 2 +- recipes/source.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 51a7743..1fc045b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -46,4 +46,4 @@ # The name of the tarball to download (this is automatically calculated from # the phantomjs version and kernel type) -default['phantomjs']['basename'] = "phantomjs-#{node['phantomjs']['version']}-linux-#{node['kernel']['machine']}" +default['phantomjs']['basename'] = "phantomjs-%{version}-linux-%{machine}" diff --git a/recipes/source.rb b/recipes/source.rb index ae17671..8bb9578 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -30,7 +30,7 @@ version = node['phantomjs']['version'] base_url = node['phantomjs']['base_url'] src_dir = node['phantomjs']['src_dir'] -basename = node['phantomjs']['basename'] +basename = node['phantomjs']['basename'] % { version: version, machine: node['kernel']['machine'] } checksum = node['phantomjs']['checksum'] remote_file "#{src_dir}/#{basename}.tar.bz2" do From 6522c119ad4afc7f30cd19d4c91520725dffd7cb Mon Sep 17 00:00:00 2001 From: Ben Sedat Date: Sun, 21 Sep 2014 18:05:00 -0700 Subject: [PATCH 2/2] Delay attribute interpolation of base_url to provide version information (to pull GitHub releases for example) --- recipes/source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/source.rb b/recipes/source.rb index 8bb9578..181d70f 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -28,7 +28,7 @@ node['phantomjs']['packages'].each { |name| package name } version = node['phantomjs']['version'] -base_url = node['phantomjs']['base_url'] +base_url = node['phantomjs']['base_url'] % { version: version } src_dir = node['phantomjs']['src_dir'] basename = node['phantomjs']['basename'] % { version: version, machine: node['kernel']['machine'] } checksum = node['phantomjs']['checksum']