Permalink
Browse files

Merge pull request #31 from mdxp/legacy_packages

Legacy packages for 0.8.x support (0.10.x default for packages). Remove rpm support. Closes #30 and #19
  • Loading branch information...
2 parents 452edb6 + ac4ebdd commit b9399305a55359d1588dc8e7f1cce846522a505e @mdxp committed Mar 16, 2013
Showing with 25 additions and 26 deletions.
  1. +4 −0 CHANGELOG.md
  2. +3 −0 attributes/default.rb
  3. +1 −1 metadata.rb
  4. +17 −25 recipes/install_from_package.rb
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## v1.1.0:
+ * rewrite the package install; remove rpm support since there are no longer any packages available anywhere
+ * add support to install `legacy_packages` from ubuntu repo as well as the latest 0.10.x branch (this is default).
+
## v1.0.4:
* add support for binary installation method ([@JulesAU][])
View
3 attributes/default.rb
@@ -25,3 +25,6 @@
default['nodejs']['dir'] = '/usr/local'
default['nodejs']['npm'] = '1.2.0'
default['nodejs']['src_url'] = "http://nodejs.org/dist"
+
+# Set this to true to install the legacy packages (0.8.x) from ubuntu/debian repositories; default is false (using the latest stable 0.10.x)
+default['nodejs']['legacy_packages'] = false
View
2 metadata.rb
@@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs/Configures nodejs"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "1.0.4"
+version "1.1.0"
name "nodejs"
provides "nodejs"
View
42 recipes/install_from_package.rb
@@ -1,9 +1,11 @@
#
# Author:: Nathan L Smith (nlloyds@gmail.com)
+# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: package
#
# Copyright 2012, Cramer Development, Inc.
+# Copyright 2013, Opscale
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,39 +21,29 @@
#
case node['platform_family']
- when 'rhel', 'fedora'
- file = '/usr/local/src/nodejs-stable-release.noarch.rpm'
-
- remote_file file do
- source 'http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm'
- action :create_if_missing
- end
-
- yum_package 'nodejs-stable-release' do
- source file
- options '--nogpgcheck'
- end
-
- %w{ nodejs nodejs-compat-symlinks npm }.each do |pkg|
- package pkg
- end
when 'debian'
+ if node['nodejs']['legacy_packages'] == true
+ repo = 'http://ppa.launchpad.net/chris-lea/node.js-legacy/ubuntu'
+ packages = %w{ nodejs npm }
+ else
+ repo = 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu'
+ packages = %w{ nodejs }
+ end
apt_repository 'node.js' do
- uri 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu'
+ uri repo
distribution node['lsb']['codename']
components ['main']
keyserver "keyserver.ubuntu.com"
key "C7917B12"
action :add
end
-
- %w{ nodejs npm }.each do |pkg|
- package pkg
- end
when 'smartos'
- %w{ nodejs }.each do |pkg|
- package pkg
- end
+ packages = %w{ nodejs }
else
- include_recipe "nodejs::install_from_source"
+ Chef::Log.error "There are no nodejs packages for this platform; please use the source or binary method to install node"
+ return
+end
+
+packages.each do |node_pkg|
+ package node_pkg
end

0 comments on commit b939930

Please sign in to comment.