Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 92c25692a2f787aa65ffc800e49af4b1fbccb362 1 parent 2710c02
@fnichol fnichol authored
View
8 attributes/default.rb
@@ -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"
View
7 recipes/install_from_source.rb
@@ -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
2  recipes/npm.rb
@@ -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']}'"
Please sign in to comment.
Something went wrong with that request. Please try again.