Permalink
Browse files

All manner of things that I can't be arsed to split into loads of com…

…mits
  • Loading branch information...
1 parent 552e5bb commit 1dd3c8e6dde260b44cf3b2559cf78a7cd29a9cef James Laver committed Oct 22, 2013
Showing with 67 additions and 17 deletions.
  1. +29 −6 Vagrantfile
  2. +1 −2 modules/oyster/manifests/packages.pp
  3. +25 −0 modules/oyster/manifests/pbrew.pp
  4. +12 −9 modules/oyster/manifests/perl.pp
View
35 Vagrantfile
@@ -4,19 +4,30 @@
def parse_environment(env)
parsed = { # We may want to change these defaults
name: "Oyster",
- cpus: "1",
- memory: "512",
+ gui: false, # Whether to show a GUI
+ cpus: "1", # Number of CPUs
+ memory: "512", # Megabytes
+ cpulimit: "0", # Maximum % of CPU used
}
+
parsed[:name] = ENV["name"] if ENV["name"]
+ parsed[:gui] = true if ENV.has_key?("OYSTER_GUI") and ENV['OYSTER_GUI']
+
begin
- parsed.cpus = Integer(ENV["OYSTER_CPUS"])
+ parsed[:cpus] = Integer(ENV["OYSTER_CPUS"]).to_s
rescue
end
+
begin
- parsed.memory = Integer(ENV["OYSTER_CPUS"])
+ parsed[:memory] = Integer(ENV["OYSTER_CPUS"]).to_s
rescue
end
-
+
+ begin
+ parsed[:cpulimit] = Integer(ENV["OYSTER_CPULIMIT"]).to_s
+ rescue
+ end
+
return parsed
end
@@ -44,12 +55,24 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder code_root, '/srv/oyster/code'
config.vm.provider :virtualbox do |vb|
- vb.customize [
+ vb.gui = args[:gui]
+ custs = [
"modifyvm", :id,
"--name", args[:name],
"--cpus", args[:cpus],
"--memory", args[:memory],
]
+ custs.push("--cpuexecutioncap", args[:cpulimit]) if args[:cpulimit]
+ vb.customize custs
+ end
+
+ config.vm.provider :vmware_fusion do |vf, override|
+ vf.gui = args[:gui]
+ vf.vmx['displayName'] = args[:name]
+ vf.vmx['memsize'] = args[:memory]
+ vf.vmx['numvcpus'] = args[:cpus]
+ override.vm.box = "precise64_vmware"
+ override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
end
config.vm.provision :puppet do |puppet|
View
3 modules/oyster/manifests/packages.pp
@@ -3,14 +3,13 @@
exec {'apt-get update':
command => '/usr/bin/apt-get update'
- }
+ } ->
package {[
'perl',
'perl-doc',
]:
ensure => 'latest',
- after => Exec['apt-get update']
}
}
View
25 modules/oyster/manifests/pbrew.pp
@@ -0,0 +1,25 @@
+
+class oyster::pbrew {
+
+ define lib ($lib) {
+ exec {
+ "oyster_pbrew_lib_${lib}":
+ command => "/bin/sh -c 'umask 022; /usr/bin/env PERLBREW_ROOT=${perlbrew::params::perlbrew_root} ${perlbrew::params::perlbrew_bin} lib create oyster@${lib}'",
+ user => 'vagrant',
+ group => 'vagrant',
+ timeout => 10,
+ creates => "/home/vagrant/.perlbrew/libs/oyster@${lib}",
+ require => Class['perlbrew'],
+ }
+ }
+
+ define install_module($lib) {
+ exec {
+ "oyster_pbrew_install_module_${name}":
+ command => "/bin/sh -c 'umask 022; /usr/bin/env PERLBREW_ROOT=${perlbrew::params::perlbrew_root} PERLBREW_LIB=$lib PERLBREW_PERL=oyster ${perlbrew::params::perlbrew_root}/perls/oyster/bin/cpanm ${name}'",
+# Need to figure out a good one for this
+# unless => "${perlbrew::params::perlbrew_root}/perls/oyster/bin/perl -m${name} -e1",
+ timeout => 1800,
+ }
+ }
+}
View
21 modules/oyster/manifests/perl.pp
@@ -1,22 +1,25 @@
class oyster::perl {
include perlbrew
+
+ class {'oyster::pbrew':}
package {'patchperl':
name => 'libdevel-patchperl-perl',
- }
+ } ->
perlbrew::build {'oyster':
version => 'perl-5.18.1',
- after => Package['patchperl']
- }
+ } ->
- perlbrew::install_cpanm {'oyster':}
+ perlbrew::install_cpanm {'oyster':} ->
- perlbrew::install_module{[
- 'Module::Starter',
- 'Moo',
- ]:
- perl => 'oyster'
+ oyster::pbrew::lib {'oyster':
+ lib => 'oyster'
+ } ->
+
+ oyster::pbrew::install_module {'Acme::Code::Police':
+ lib => 'oyster',
}
+
}

0 comments on commit 1dd3c8e

Please sign in to comment.