From 132a0d77268204038b126022820ded61f93455a0 Mon Sep 17 00:00:00 2001 From: Marius Ducea Date: Tue, 31 Aug 2010 14:11:23 -0700 Subject: [PATCH] nodejs cookbook added --- etckeeper/recipes/default.rb | 1 + nodejs/README.rdoc | 49 ++++++++++++++++++++++++++++++++++++ nodejs/attributes/default.rb | 22 ++++++++++++++++ nodejs/metadata.json | 34 +++++++++++++++++++++++++ nodejs/metadata.rb | 11 ++++++++ nodejs/recipes/default.rb | 43 +++++++++++++++++++++++++++++++ nodejs/recipes/npm.rb | 34 +++++++++++++++++++++++++ 7 files changed, 194 insertions(+) create mode 100644 nodejs/README.rdoc create mode 100644 nodejs/attributes/default.rb create mode 100644 nodejs/metadata.json create mode 100644 nodejs/metadata.rb create mode 100644 nodejs/recipes/default.rb create mode 100644 nodejs/recipes/npm.rb diff --git a/etckeeper/recipes/default.rb b/etckeeper/recipes/default.rb index e2ccfaa..3d1be4d 100644 --- a/etckeeper/recipes/default.rb +++ b/etckeeper/recipes/default.rb @@ -1,4 +1,5 @@ # +# Author:: Marius Ducea (marius@promethost.com) # Cookbook Name:: etckeeper # Recipe:: default # diff --git a/nodejs/README.rdoc b/nodejs/README.rdoc new file mode 100644 index 0000000..83be9a8 --- /dev/null +++ b/nodejs/README.rdoc @@ -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 (marius@promethost.com) + +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. diff --git a/nodejs/attributes/default.rb b/nodejs/attributes/default.rb new file mode 100644 index 0000000..81d8b69 --- /dev/null +++ b/nodejs/attributes/default.rb @@ -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" diff --git a/nodejs/metadata.json b/nodejs/metadata.json new file mode 100644 index 0000000..ca6afe3 --- /dev/null +++ b/nodejs/metadata.json @@ -0,0 +1,34 @@ +{ + "recipes": { + "nodejs::npm": "Installs npm - a package manager for node", + "nodejs": "Installs Node.JS from source" + }, + "replacing": { + }, + "attributes": { + }, + "maintainer_email": "marius@promethost.com", + "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 (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", + "suggestions": { + }, + "platforms": { + }, + "license": "Apache 2.0", + "version": "0.1.1", + "conflicting": { + }, + "name": "nodejs", + "providing": { + }, + "description": "Installs/Configures nodejs", + "maintainer": "Promet Solutions" + } \ No newline at end of file diff --git a/nodejs/metadata.rb b/nodejs/metadata.rb new file mode 100644 index 0000000..eb5859d --- /dev/null +++ b/nodejs/metadata.rb @@ -0,0 +1,11 @@ +maintainer "Promet Solutions" +maintainer_email "marius@promethost.com" +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" + diff --git a/nodejs/recipes/default.rb b/nodejs/recipes/default.rb new file mode 100644 index 0000000..e881c04 --- /dev/null +++ b/nodejs/recipes/default.rb @@ -0,0 +1,43 @@ +# +# Author:: Marius Ducea (marius@promethost.com) +# 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 + diff --git a/nodejs/recipes/npm.rb b/nodejs/recipes/npm.rb new file mode 100644 index 0000000..e79cefb --- /dev/null +++ b/nodejs/recipes/npm.rb @@ -0,0 +1,34 @@ +# +# Author:: Marius Ducea (marius@promethost.com) +# 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 +