Skip to content

Instantly share code, notes, and snippets.

@johnreilly
Created August 5, 2010 20:21
Show Gist options
  • Save johnreilly/510314 to your computer and use it in GitHub Desktop.
Save johnreilly/510314 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: nodejs
# Recipe:: default
#
if ['solo'].include?(node[:instance_role])
nodejs_file = "node-v0.1.101.tar.gz"
nodejs_dir = "node-v0.1.101"
nodejs_url = "http://nodejs.org/dist/#{nodejs_file}"
ey_cloud_report "nodejs" do
message "configuring nodejs (#{nodejs_dir})"
end
directory "/data/nodejs" do
owner 'root'
group 'root'
mode 0755
recursive true
end
# download nodejs
remote_file "/data/nodejs/#{nodejs_file}" do
source "#{nodejs_url}"
owner 'root'
group 'root'
mode 0644
backup 0
not_if { FileTest.exists?("/data/nodejs/#{nodejs_file}") }
end
execute "unarchive nodejs" do
command "cd /data/nodejs && tar zxf #{nodejs_file} && sync"
not_if { FileTest.directory?("/data/nodejs/#{nodejs_dir}") }
end
# compile nodejs
execute "configure nodejs" do
command "cd /data/nodejs/#{nodejs_dir} && ./configure"
not_if { FileTest.exists?("/data/nodejs/#{nodejs_dir}/node") }
end
execute "build nodejs" do
command "cd /data/nodejs/#{nodejs_dir} && make"
not_if { FileTest.exists?("/data/nodejs/#{nodejs_dir}/node") }
end
execute "symlink nodejs" do
command "ln -s /data/nodejs/#{nodejs_dir}/node /data/nodejs/node"
not_if { FileTest.exists?("/data/nodejs/node") }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment