Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…mits
  • Loading branch information...
commit 1dd3c8e6dde260b44cf3b2559cf78a7cd29a9cef 1 parent 552e5bb
James Laver authored
35 Vagrantfile
@@ -4,19 +4,30 @@
4 4 def parse_environment(env)
5 5 parsed = { # We may want to change these defaults
6 6 name: "Oyster",
7   - cpus: "1",
8   - memory: "512",
  7 + gui: false, # Whether to show a GUI
  8 + cpus: "1", # Number of CPUs
  9 + memory: "512", # Megabytes
  10 + cpulimit: "0", # Maximum % of CPU used
9 11 }
  12 +
10 13 parsed[:name] = ENV["name"] if ENV["name"]
  14 + parsed[:gui] = true if ENV.has_key?("OYSTER_GUI") and ENV['OYSTER_GUI']
  15 +
11 16 begin
12   - parsed.cpus = Integer(ENV["OYSTER_CPUS"])
  17 + parsed[:cpus] = Integer(ENV["OYSTER_CPUS"]).to_s
13 18 rescue
14 19 end
  20 +
15 21 begin
16   - parsed.memory = Integer(ENV["OYSTER_CPUS"])
  22 + parsed[:memory] = Integer(ENV["OYSTER_CPUS"]).to_s
17 23 rescue
18 24 end
19   -
  25 +
  26 + begin
  27 + parsed[:cpulimit] = Integer(ENV["OYSTER_CPULIMIT"]).to_s
  28 + rescue
  29 + end
  30 +
20 31 return parsed
21 32 end
22 33
@@ -44,12 +55,24 @@ Vagrant.configure("2") do |config|
44 55 config.vm.synced_folder code_root, '/srv/oyster/code'
45 56
46 57 config.vm.provider :virtualbox do |vb|
47   - vb.customize [
  58 + vb.gui = args[:gui]
  59 + custs = [
48 60 "modifyvm", :id,
49 61 "--name", args[:name],
50 62 "--cpus", args[:cpus],
51 63 "--memory", args[:memory],
52 64 ]
  65 + custs.push("--cpuexecutioncap", args[:cpulimit]) if args[:cpulimit]
  66 + vb.customize custs
  67 + end
  68 +
  69 + config.vm.provider :vmware_fusion do |vf, override|
  70 + vf.gui = args[:gui]
  71 + vf.vmx['displayName'] = args[:name]
  72 + vf.vmx['memsize'] = args[:memory]
  73 + vf.vmx['numvcpus'] = args[:cpus]
  74 + override.vm.box = "precise64_vmware"
  75 + override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
53 76 end
54 77
55 78 config.vm.provision :puppet do |puppet|
3  modules/oyster/manifests/packages.pp
@@ -3,14 +3,13 @@
3 3
4 4 exec {'apt-get update':
5 5 command => '/usr/bin/apt-get update'
6   - }
  6 + } ->
7 7
8 8 package {[
9 9 'perl',
10 10 'perl-doc',
11 11 ]:
12 12 ensure => 'latest',
13   - after => Exec['apt-get update']
14 13 }
15 14
16 15 }
25 modules/oyster/manifests/pbrew.pp
... ... @@ -0,0 +1,25 @@
  1 +
  2 +class oyster::pbrew {
  3 +
  4 + define lib ($lib) {
  5 + exec {
  6 + "oyster_pbrew_lib_${lib}":
  7 + command => "/bin/sh -c 'umask 022; /usr/bin/env PERLBREW_ROOT=${perlbrew::params::perlbrew_root} ${perlbrew::params::perlbrew_bin} lib create oyster@${lib}'",
  8 + user => 'vagrant',
  9 + group => 'vagrant',
  10 + timeout => 10,
  11 + creates => "/home/vagrant/.perlbrew/libs/oyster@${lib}",
  12 + require => Class['perlbrew'],
  13 + }
  14 + }
  15 +
  16 + define install_module($lib) {
  17 + exec {
  18 + "oyster_pbrew_install_module_${name}":
  19 + 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}'",
  20 +# Need to figure out a good one for this
  21 +# unless => "${perlbrew::params::perlbrew_root}/perls/oyster/bin/perl -m${name} -e1",
  22 + timeout => 1800,
  23 + }
  24 + }
  25 +}
21 modules/oyster/manifests/perl.pp
... ... @@ -1,22 +1,25 @@
1 1
2 2 class oyster::perl {
3 3 include perlbrew
  4 +
  5 + class {'oyster::pbrew':}
4 6
5 7 package {'patchperl':
6 8 name => 'libdevel-patchperl-perl',
7   - }
  9 + } ->
8 10
9 11 perlbrew::build {'oyster':
10 12 version => 'perl-5.18.1',
11   - after => Package['patchperl']
12   - }
  13 + } ->
13 14
14   - perlbrew::install_cpanm {'oyster':}
  15 + perlbrew::install_cpanm {'oyster':} ->
15 16
16   - perlbrew::install_module{[
17   - 'Module::Starter',
18   - 'Moo',
19   - ]:
20   - perl => 'oyster'
  17 + oyster::pbrew::lib {'oyster':
  18 + lib => 'oyster'
  19 + } ->
  20 +
  21 + oyster::pbrew::install_module {'Acme::Code::Police':
  22 + lib => 'oyster',
21 23 }
  24 +
22 25 }

0 comments on commit 1dd3c8e

Please sign in to comment.
Something went wrong with that request. Please try again.