Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bluebox #15

Merged
merged 2 commits into from

2 participants

@ChrisLundquist
  • Move to platform_family
  • add some integration testing
@balbeko balbeko merged commit ba77781 into mdxp:master
@ChrisLundquist

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 8, 2012
  1. move to platform_family syntax

    Chris Lundquist authored
This page is out of date. Refresh to see the latest.
View
2  Berksfile
@@ -0,0 +1,2 @@
+cookbook 'apt'
+cookbook 'build-essential'
View
78 Vagrantfile
@@ -0,0 +1,78 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+begin
+ require 'active_support/core_ext/hash/deep_merge'
+rescue LoadError => e
+ STDERR.puts '', "[!] ERROR -- Please install ActiveSupport (gem install activesupport)", '-'*80, ''
+ raise e
+end
+
+# Automatically install and mount cookbooks from Berksfile
+#
+require 'berkshelf/vagrant'
+
+distributions = {
+ 'opscode-ubuntu-12.04' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ },
+
+ 'opscode-ubuntu-12.04-i386' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04-i386.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ },
+
+ 'opscode-ubuntu-10.04' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-10.04.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ },
+
+ 'opscode-centos6.3' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-6.3.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ }
+}
+
+node_config = {
+}
+
+Vagrant::Config.run do |config|
+
+ distributions.each_pair do |name, options|
+
+ config.vm.define name, :options => options[:primary] do |box_config|
+
+ box_config.vm.box = name.to_s
+ box_config.vm.box_url = options[:url]
+
+ box_config.vm.host_name = name.to_s
+
+ # Install latest Chef on the machine
+
+ box_config.vm.provision :shell do |shell|
+ version = ENV['CHEF'].match(/^\d+/) ? ENV['CHEF'] : nil
+ shell.inline = %Q{
+ test -d "apt-get" && apt-get update
+ test -d "chef-solo" || curl -# -L http://www.opscode.com/chef/install.sh | sudo bash -s -- #{version ? "-v #{version}" : ''}
+ }
+ end if ENV['CHEF']
+
+ # Provision the machine with Chef Solo
+ #
+ box_config.vm.provision :chef_solo do |chef|
+ chef.cookbooks_path = ['..', './tmp/cookbooks']
+ chef.provisioning_path = '/etc/vagrant-chef'
+ chef.log_level = :debug
+
+ chef.run_list = options[:run_list]
+ chef.json = node_config.deep_merge(options[:node])
+ end
+ end
+
+ end
+
+end
View
3  metadata.rb
@@ -4,6 +4,8 @@
description "Installs/Configures nodejs"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.1"
+name "nodejs"
+provides "nodejs"
recipe "nodejs", "Installs Node.JS based on the default installation method"
recipe "nodejs::install_from_source", "Installs Node.JS from source"
@@ -11,6 +13,7 @@
recipe "nodejs::npm", "Installs npm from source - a package manager for node"
depends "build-essential"
+recommends "apt"
%w{ debian ubuntu centos redhat }.each do |os|
supports os
View
6 recipes/install_from_package.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-case node['platform']
- when 'centos', 'redhat', 'scientific', 'amazon', 'fedora'
+case node['platform_family']
+ when 'rhel', 'fedora'
file = '/usr/local/src/nodejs-stable-release.noarch.rpm'
remote_file file do
@@ -35,7 +35,7 @@
%w{ nodejs nodejs-compat-symlinks npm }.each do |pkg|
package pkg
end
- when 'ubuntu'
+ when 'debian'
apt_repository 'node.js' do
uri 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu'
distribution node['lsb']['codename']
View
8 recipes/install_from_source.rb
@@ -20,10 +20,10 @@
include_recipe "build-essential"
-case node['platform']
- when 'centos','redhat','fedora','amazon','scientific'
+case node['platform_family']
+ when 'rhel','fedora'
package "openssl-devel"
- when 'debian','ubuntu'
+ when 'debian'
package "libssl-dev"
end
@@ -38,7 +38,7 @@
source nodejs_src_url
checksum node['nodejs']['checksum']
mode 0644
- action :create_if_missing
+ action :create_if_missing
end
# --no-same-owner required overcome "Cannot change ownership" bug
Something went wrong with that request. Please try again.