Skip to content

Commit

Permalink
Merge branch 'chef-vendor-nodejs'
Browse files Browse the repository at this point in the history
Conflicts:
	nodejs/attributes/default.rb
  • Loading branch information
smith committed Feb 24, 2012
2 parents 9caa979 + 175d4e1 commit 9e59451
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 33 deletions.
5 changes: 3 additions & 2 deletions attributes/default.rb
Expand Up @@ -17,6 +17,7 @@
# limitations under the License.
#

default.nodejs[:version] = "0.4.8"
default.nodejs[:version] = "0.6.8"
default.nodejs[:checksum] = "e6cbfc5ccdbe10128dbbd4dc7a88c154d80f8a39c3a8477092cf7d25eef78c9c"
default.nodejs[:dir] = "/usr/local"
default.nodejs[:npm] = "1.0.101"
default.nodejs[:npm] = "1.0.105"
38 changes: 18 additions & 20 deletions metadata.json
@@ -1,34 +1,32 @@
{
"name": "nodejs",
"description": "Installs/Configures nodejs",
"long_description": "= DESCRIPTION:\n\nInstalls Node.JS from source.\n\n= REQUIREMENTS:\n\n== Platform:\n\nTested on Debian Lenny. Should work fine on Ubuntu, Centos, etc.\n\n== Cookbooks:\n\nOpscode cookbooks (http://github.com/opscode/cookbooks/tree/master)\n\n* build-essential\n\n= ATTRIBUTES:\n\n* nodejs[:version] - release version of node to install\n* nodejs[:dir] - location where node will be installed, default /usr/local\n* nodejs[:npm] - version of npm to install\n\n= USAGE:\n\nInclude the nodejs recipe to install node from source on your system:\n\n include_recipe \"nodejs\"\n\nInclude the npm recipe to install npm:\n \n include_recipe \"nodejs::npm\"\n\n= LICENSE and AUTHOR:\n\nAuthor:: Marius Ducea (marius@promethost.com)\n\nCopyright:: 2010, Promet Solutions\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"maintainer": "Promet Solutions",
"maintainer_email": "marius@promethost.com",
"groupings": {
},
"attributes": {
},
"recommendations": {
"license": "Apache 2.0",
"platforms": {
},
"dependencies": {
"build-essential": [

]
"build-essential": ">= 0.0.0"
},
"recipes": {
"nodejs::npm": "Installs npm - a package manager for node",
"nodejs": "Installs Node.JS from source"
"recommendations": {
},
"suggestions": {
},
"platforms": {
},
"license": "Apache 2.0",
"version": "0.5.1",
"conflicting": {
},
"providing": {
},
"long_description": "= DESCRIPTION:\n\nInstalls Node.JS from source.\n\n= REQUIREMENTS:\n\n== Platform:\n\nTested on Debian Lenny. Should work fine on Ubuntu, Centos, etc.\n\n== Cookbooks:\n\nOpscode cookbooks (http://github.com/opscode/cookbooks/tree/master)\n\n* build-essential\n\n= ATTRIBUTES:\n\n* nodejs[:version] - release version of node to install\n* nodejs[:dir] - location where node will be installed, default /usr/local\n* nodejs[:npm] - version of npm to install\n\n= USAGE:\n\nInclude the nodejs recipe to install node from source on your system:\n\n include_recipe \"nodejs\"\n\nInclude the npm recipe to install npm:\n \n include_recipe \"nodejs::npm\"\n\n= LICENSE and AUTHOR:\n\nAuthor:: Marius Ducea (marius@promethost.com)\n\nCopyright:: 2010, Promet Solutions\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"name": "nodejs",
"maintainer": "Promet Solutions",
"description": "Installs/Configures nodejs",
"replacing": {
}
},
"attributes": {
},
"groupings": {
},
"recipes": {
"nodejs": "Installs Node.JS from source",
"nodejs::npm": "Installs npm - a package manager for node"
},
"version": "0.6.8"
}
2 changes: 1 addition & 1 deletion metadata.rb
Expand Up @@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs/Configures nodejs"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.5.1"
version "0.6.8"
recipe "nodejs", "Installs Node.JS from source"
recipe "nodejs::npm", "Installs npm - a package manager for node"

Expand Down
40 changes: 30 additions & 10 deletions recipes/default.rb
Expand Up @@ -8,9 +8,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -27,16 +27,36 @@
package "libssl-dev"
end

bash "install nodejs from source" do
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}"
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/node-v#{node[:nodejs][:version]}.tar.gz && \
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 9e59451

Please sign in to comment.