Skip to content

Commit

Permalink
Merge branch 'master' of github.com:laggyluke/mdxp-cookbooks
Browse files Browse the repository at this point in the history
Conflicts:
	nodejs/attributes/default.rb
  • Loading branch information
gmiroshnykov committed Jan 22, 2012
2 parents bf6554b + 91a8720 commit 0c91f19
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
5 changes: 3 additions & 2 deletions nodejs/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# limitations under the License.
#

default.nodejs[:version] = "0.6.7"
default.nodejs[:version] = "0.6.8"
default.nodejs[:checksum] = "e6cbfc5ccdbe10128dbbd4dc7a88c154d80f8a39c3a8477092cf7d25eef78c9c"
default.nodejs[:dir] = "/usr/local"
default.nodejs[:npm] = "1.0.106"
default.nodejs[:npm] = "1.0.105"
30 changes: 21 additions & 9 deletions nodejs/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,34 @@
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

execute "tar 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 0c91f19

Please sign in to comment.