Permalink
Browse files

Merge pull request #15 from laggyluke/master

[nodejs]: made download, compilation and installation a bit more granular
  • Loading branch information...
2 parents cd9e9ae + fd993b8 commit 73dfaf0a4dc692dc35f19569afb94beb8da435fb @mdxp committed Jan 24, 2012
Showing with 25 additions and 10 deletions.
  1. +2 −1 nodejs/attributes/default.rb
  2. +23 −9 nodejs/recipes/default.rb
@@ -17,6 +17,7 @@
# limitations under the License.
#
-default.nodejs[:version] = "0.6.5"
+default.nodejs[:version] = "0.6.8"
+default.nodejs[:checksum] = "e6cbfc5ccdbe10128dbbd4dc7a88c154d80f8a39c3a8477092cf7d25eef78c9c"
default.nodejs[:dir] = "/usr/local"
default.nodejs[:npm] = "1.0.105"
View
@@ -27,22 +27,36 @@
package "libssl-dev"
end
-nodejs_tar_path = "node-v#{node[:nodejs][:version]}.tar.gz"
+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
-bash "install nodejs from source" do
+remote_file "/usr/local/src/#{nodejs_tar}" do
+ source "http://nodejs.org/dist/#{nodejs_tar_path}"
+ checksum node[:nodejs][:checksum]
+ mode 0644
+end
+
+# --no-same-owner required overcome "Cannot change ownership" bug
+# on NFS-mounted filesystem
+execute "tar --no-same-owner -zxf #{nodejs_tar}" do
cwd "/usr/local/src"
- user "root"
+ creates "/usr/local/src/node-v#{node[:nodejs][:version]}"
+end
+
+bash "compile node.js" do
+ cwd "/usr/local/src/node-v#{node[:nodejs][:version]}"
code <<-EOH
- wget http://nodejs.org/dist/#{nodejs_tar_path} && \
- tar zxf node-v#{node[:nodejs][:version]}.tar.gz && \
- cd node-v#{node[:nodejs][:version]} && \
./configure --prefix=#{node[:nodejs][:dir]} && \
- make && \
- make install
+ make
EOH
- not_if "#{node[:nodejs][:dir]}/bin/node -v 2>&1 | grep 'v#{node[:nodejs][:version]}'"
+ creates "/usr/local/src/node-v#{node[:nodejs][:version]}/node"
+end
+
+execute "make install" do
+ cwd "/usr/local/src/node-v#{node[:nodejs][:version]}"
+ not_if "test `#{node[:nodejs][:dir]}/bin/node` == 'v#{node[:nodejs][:version]}'"
end

0 comments on commit 73dfaf0

Please sign in to comment.