Skip to content

Instantly share code, notes, and snippets.

@am
Created April 23, 2013 11:00
Show Gist options
  • Save am/5442663 to your computer and use it in GitHub Desktop.
Save am/5442663 to your computer and use it in GitHub Desktop.
Vagrant box to compile stasis projects (gems: stasis, haml, coffee-script, sass, rhc).
$as_vagrant = 'sudo -u vagrant -H bash -l -c'
$home = '/home/vagrant'
Exec {
path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin']
}
# --- Preinstall Stage ---------------------------------------------------------
stage { 'preinstall':
before => Stage['main']
}
class apt_get_update {
exec { 'apt-get -y update':
unless => "test -e ${home}/.rvm"
}
}
class { 'apt_get_update':
stage => preinstall
}
# --- Packages -----------------------------------------------------------------
package { 'curl':
ensure => installed
}
package { 'build-essential':
ensure => installed
}
package { 'git-core':
ensure => installed
}
# ExecJS runtime.
package { 'nodejs':
ensure => installed
}
# --- Ruby ---------------------------------------------------------------------
exec { 'install_rvm':
command => "${as_vagrant} 'curl -L https://get.rvm.io | bash -s stable'",
creates => "${home}/.rvm",
require => Package['curl']
}
exec { 'install_ruby':
command => "${as_vagrant} '${home}/.rvm/bin/rvm install 2.0.0 --latest-binary --autolibs=enabled && rvm --fuzzy alias create default 2.0.0'",
creates => "${home}/.rvm/bin/ruby",
require => Exec['install_rvm']
}
exec { "${as_vagrant} 'gem install bundler --no-rdoc --no-ri'":
creates => "${home}/.rvm/bin/bundle",
require => Exec['install_ruby']
}
exec { "${as_vagrant} 'gem install stasis'":
require => Exec['install_ruby']
}
exec { "${as_vagrant} 'gem install haml'":
require => Exec['install_ruby']
}
exec { "${as_vagrant} 'gem install coffee-script'":
require => Exec['install_ruby']
}
exec { "${as_vagrant} 'gem install sass'":
require => Exec['install_ruby']
}
exec { "${as_vagrant} 'gem install rhc'":
require => Exec['install_ruby']
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "/Users/am/Downloads/precise64.box"
config.vm.network :forwarded_port, guest: 4000, host: 4000
config.vm.hostname = 'stasis-box'
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment