nise-bosh-vagrant 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,26 +15,47 @@ Based on nise-bosh from NTT Labs and Vagrant from HashiCorp
15
15
  Requires Vagrant >= 1.2
16
16
 
17
17
  Usage:
18
- nise-bosh-vagrant [options] <BOSH Release>+
18
+ nise-bosh-vagrant [options] <BOSH Release>
19
19
 
20
20
  Options:
21
21
  EOS
22
22
 
23
23
  opt :manifest, "Path to manifest file", :type => :string
24
24
  opt :nise, "Path to nise-bosh if you don't wish to pull HEAD of master from GitHub", :type => :string
25
+ opt :install, "Run install script after preparing the VM"
26
+ opt :start, "Start all jobs after installing them (implies --install)"
25
27
  end
26
28
 
27
- Trollop::die :manifest, "must provilde a manifest file" if opts[:manifest].nil?
29
+ Trollop::die :manifest, "must provide a manifest file" if opts[:manifest].nil?
28
30
  Trollop::die :manifest, "must exist" unless File.exist?(opts[:manifest])
29
31
 
30
32
  opts[:release] = ARGV[0]
31
33
 
34
+ if opts[:start]
35
+ opts[:install] = true
36
+ end
37
+
38
+ # Generate, start and prepare a fresh VM
32
39
  runner = NiseBOSHVagrant::Runner.new(opts)
33
40
  runner.generate_vagrantfile
34
41
  runner.copy_manifest
35
42
  runner.generate_install_script
43
+ puts "---> Starting Vagrant VM"
36
44
  runner.start_vm
45
+ puts "---> Preparing Vagrant VM"
37
46
  runner.prepare_vm
47
+
48
+ # If instructed, install the release
49
+ if opts[:install]
50
+ puts "---> Installing release"
51
+ runner.install_release
52
+ end
53
+
54
+ # If instructed, start the release
55
+ if opts[:start]
56
+ puts "---> Starting release"
57
+ runner.start_release
58
+ end
38
59
  end
39
60
 
40
61
  end
@@ -85,5 +85,15 @@ module NiseBOSHVagrant
85
85
  prepare_cmd = "cd #{release_path} ; vagrant ssh -c \"/home/vagrant/scripts/prepare.sh\""
86
86
  self.exec(prepare_cmd)
87
87
  end
88
+
89
+ def install_release(release_path=@release_path)
90
+ install_cmd = "cd #{release_path} ; vagrant ssh -c \"/home/vagrant/install_release.sh\""
91
+ self.exec(install_cmd)
92
+ end
93
+
94
+ def start_release(release_path=@release_path)
95
+ start_cmd = "cd #{release_path} ; vagrant ssh -c \"/home/vagrant/start.sh\""
96
+ self.exec(start_cmd)
97
+ end
88
98
  end
89
99
  end
@@ -1,3 +1,3 @@
1
1
  module NiseBOSHVagrant
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nise-bosh-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-20 00:00:00.000000000 Z
12
+ date: 2013-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  segments:
67
67
  - 0
68
- hash: -2824202946495717039
68
+ hash: 113629617636424666
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements: