Permalink
Browse files

Add src_url and npm_src_url attributes.

Useful in situations where there are network issues, hosting problems,
and close local mirrors are present.
  • Loading branch information...
1 parent 2710c02 commit 92c25692a2f787aa65ffc800e49af4b1fbccb362 @fnichol fnichol committed Mar 9, 2012
Showing with 10 additions and 7 deletions.
  1. +8 −0 attributes/default.rb
  2. +1 −6 recipes/install_from_source.rb
  3. +1 −1 recipes/npm.rb
View
@@ -22,3 +22,11 @@
default['nodejs']['checksum'] = '94bbdb2d62645fd2ad5b96e41cfec68abf004fd03fabaaf7d71c48b39013cbd1'
default['nodejs']['dir'] = '/usr/local'
default['nodejs']['npm'] = '1.1.2'
+
+nodejs_tar_path = "node-v#{node['nodejs']['version']}.tar.gz"
+if node['nodejs']['version'].split('.')[1].to_i >= 5
+ nodejs_tar_path = "v#{node['nodejs']['version']}/#{nodejs_tar_path}"
+end
+
+default['nodejs']['src_url'] = "http://nodejs.org/dist/#{nodejs_tar_path}"
+default['nodejs']['npm_src_url'] = "http://registry.npmjs.org/npm/-/npm-#{node['nodejs']['npm']}.tgz"
@@ -28,14 +28,9 @@
end
nodejs_tar = "node-v#{node['nodejs']['version']}.tar.gz"
-nodejs_tar_path = nodejs_tar
-
-if node['nodejs']['version'].split('.')[1].to_i >= 5
- nodejs_tar_path = "v#{node['nodejs']['version']}/#{nodejs_tar_path}"
-end
remote_file "/usr/local/src/#{nodejs_tar}" do
- source "http://nodejs.org/dist/#{nodejs_tar_path}"
+ source node['nodejs']['src_url']
checksum node['nodejs']['checksum']
mode 0644
end
View
@@ -28,7 +28,7 @@
code <<-EOH
mkdir -p npm-v#{node['nodejs']['npm']} && \
cd npm-v#{node['nodejs']['npm']}
- curl -L http://registry.npmjs.org/npm/-/npm-#{node['nodejs']['npm']}.tgz | tar xzf - --strip-components=1 && \
+ curl -L #{node['nodejs']['npm_src_url']} | tar xzf - --strip-components=1 && \
make uninstall dev
EOH
not_if "#{node['nodejs']['dir']}/bin/npm -v 2>&1 | grep '#{node['nodejs']['npm']}'"

0 comments on commit 92c2569

Please sign in to comment.