Skip to content

Commit

Permalink
nodejs cookbook added
Browse files Browse the repository at this point in the history
  • Loading branch information
mdxp committed Aug 31, 2010
1 parent d755c22 commit 132a0d7
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 0 deletions.
1 change: 1 addition & 0 deletions etckeeper/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
# Author:: Marius Ducea ([email protected])
# Cookbook Name:: etckeeper
# Recipe:: default
#
Expand Down
49 changes: 49 additions & 0 deletions nodejs/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
= DESCRIPTION:

Installs Node.JS from source.

= REQUIREMENTS:

== Platform:

Tested on Debian Lenny. Should work fine on Ubuntu, Centos, etc.

== Cookbooks:

Opscode cookbooks (http://github.com/opscode/cookbooks/tree/master)

* build-essential

= ATTRIBUTES:

* nodejs[:version] - release version of node to install
* nodejs[:dir] - location where node will be installed, default /usr/local
* nodejs[:npm] - version of npm to install

= USAGE:

Include the nodejs recipe to install node from source on your system:

include_recipe "nodejs"

Include the npm recipe to install npm:

include_recipe "nodejs::npm"

= LICENSE and AUTHOR:

Author:: Marius Ducea ([email protected])

Copyright:: 2010, Promet Solutions

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.
See the License for the specific language governing permissions and
limitations under the License.
22 changes: 22 additions & 0 deletions nodejs/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Cookbook Name:: nodejs
# Attributes:: nodejs
#
# Copyright 2010, Promet Solutions
#
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
#

default.nodejs[:version] = "0.2.0"
default.nodejs[:dir] = "/usr/local"
default.nodejs[:npm] = "0.1.27-12"
34 changes: 34 additions & 0 deletions nodejs/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"recipes": {
"nodejs::npm": "Installs npm - a package manager for node",
"nodejs": "Installs Node.JS from source"
},
"replacing": {
},
"attributes": {
},
"maintainer_email": "[email protected]",
"groupings": {
},
"dependencies": {
"build-essential": [

]
},
"recommendations": {
},
"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 ([email protected])\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",
"suggestions": {
},
"platforms": {
},
"license": "Apache 2.0",
"version": "0.1.1",
"conflicting": {
},
"name": "nodejs",
"providing": {
},
"description": "Installs/Configures nodejs",
"maintainer": "Promet Solutions"
}
11 changes: 11 additions & 0 deletions nodejs/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
maintainer "Promet Solutions"
maintainer_email "[email protected]"
license "Apache 2.0"
description "Installs/Configures nodejs"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.1.1"
recipe "nodejs", "Installs Node.JS from source"
recipe "nodejs::npm", "Installs npm - a package manager for node"

depends "build-essential"

43 changes: 43 additions & 0 deletions nodejs/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Author:: Marius Ducea ([email protected])
# Cookbook Name:: nodejs
# Recipe:: default
#
# Copyright 2010, Promet Solutions
#
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include_recipe "build-essential"

case node[:platform]
when "centos","redhat","fedora"
package "openssl-devel"
when "debian","ubuntu"
package "libssl-dev"
end

bash "install nodejs from source" do
cwd "/usr/local/src"
user "root"
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
EOH
not_if {File.exists?("/usr/local/src/node-v#{node[:nodejs][:version]}/node")}
end

34 changes: 34 additions & 0 deletions nodejs/recipes/npm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Author:: Marius Ducea ([email protected])
# Cookbook Name:: nodejs
# Recipe:: npm
#
# Copyright 2010, Promet Solutions
#
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include_recipe "nodejs"

bash "install npm - package manager for node" do
cwd "/usr/local/src"
user "root"
code <<-EOH
mkdir -p npm-v#{node[:nodejs][:npm]} && \
cd npm-v#{node[:nodejs][:npm]}
curl -L http://github.com/isaacs/npm/tarball/v#{node[:nodejs][:npm]} | tar xzf - --strip-components=1 && \
make uninstall install
EOH
not_if {File.exists?("/usr/local/bin/npm-#{node[:nodejs][:npm]}")}
end

0 comments on commit 132a0d7

Please sign in to comment.