sahara 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,39 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sahara (0.0.8)
4
+ sahara (0.0.9)
5
5
  popen4 (~> 0.1.2)
6
6
  thor (~> 0.14.6)
7
- vagrant (~> 0.8.2)
7
+ vagrant (~> 0.9)
8
8
 
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
12
  Platform (0.4.0)
13
13
  archive-tar-minitar (0.5.2)
14
+ childprocess (0.3.1)
15
+ ffi (~> 1.0.6)
14
16
  erubis (2.7.0)
15
- ffi (1.0.9)
16
- i18n (0.5.0)
17
- json (1.5.3)
17
+ ffi (1.0.11)
18
+ i18n (0.6.0)
19
+ json (1.5.4)
20
+ log4r (1.1.10)
18
21
  net-scp (1.0.4)
19
22
  net-ssh (>= 1.99.1)
20
- net-ssh (2.1.4)
21
- open4 (1.1.0)
23
+ net-ssh (2.2.2)
24
+ open4 (1.3.0)
22
25
  popen4 (0.1.2)
23
26
  Platform (>= 0.4.0)
24
27
  open4 (>= 0.4.0)
25
28
  thor (0.14.6)
26
- vagrant (0.8.2)
29
+ vagrant (0.9.5)
27
30
  archive-tar-minitar (= 0.5.2)
31
+ childprocess (~> 0.3.0)
28
32
  erubis (~> 2.7.0)
29
- i18n (~> 0.5.0)
33
+ i18n (~> 0.6.0)
30
34
  json (~> 1.5.1)
35
+ log4r (~> 1.1.9)
31
36
  net-scp (~> 1.0.4)
32
- net-ssh (~> 2.1.4)
33
- thor (~> 0.14.6)
34
- virtualbox (~> 0.9.1)
35
- virtualbox (0.9.1)
36
- ffi (~> 1.0.9)
37
+ net-ssh (~> 2.2.2)
37
38
 
38
39
  PLATFORMS
39
40
  ruby
data/lib/sahara.rb CHANGED
@@ -1,2 +1 @@
1
1
  require 'vagrant'
2
- require 'sahara/command'
@@ -0,0 +1,26 @@
1
+ module Sahara
2
+ module Command
3
+ class Commit < ::Vagrant::Command::Base
4
+ def execute
5
+
6
+ options = {}
7
+
8
+ opts = OptionParser.new do |opts|
9
+ opts.banner = "Commits changes - moves sandbox initial state to currentstate"
10
+ opts.separator ""
11
+ opts.separator "Usage: vagrant sandbox commit <vmname>"
12
+
13
+ end
14
+
15
+ # Parse the options
16
+ argv = parse_options(opts)
17
+ return if !argv
18
+
19
+ boxname=argv[0]
20
+ begin
21
+ Sahara::Session.commit(boxname)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Sahara
2
+ module Command
3
+ class Off < ::Vagrant::Command::Base
4
+ def execute
5
+
6
+ options = {}
7
+
8
+ opts = OptionParser.new do |opts|
9
+ opts.banner = "Leaves sandbox state"
10
+ opts.separator ""
11
+ opts.separator "Usage: vagrant sandbox off <vmname>"
12
+
13
+ end
14
+
15
+ # Parse the options
16
+ argv = parse_options(opts)
17
+ return if !argv
18
+
19
+ boxname=argv[0]
20
+ begin
21
+ Sahara::Session.off(boxname)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Sahara
2
+ module Command
3
+ class On < ::Vagrant::Command::Base
4
+ def execute
5
+
6
+ options = {}
7
+
8
+ opts = OptionParser.new do |opts|
9
+ opts.banner = "Enters sandbox state"
10
+ opts.separator ""
11
+ opts.separator "Usage: vagrant sandbox on <vmname>"
12
+
13
+ end
14
+
15
+ # Parse the options
16
+ argv = parse_options(opts)
17
+ return if !argv
18
+
19
+ boxname=argv[0]
20
+ begin
21
+ Sahara::Session.on(boxname)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Sahara
2
+ module Command
3
+ class Rollback < ::Vagrant::Command::Base
4
+ def execute
5
+
6
+ options = {}
7
+
8
+ opts = OptionParser.new do |opts|
9
+ opts.banner = "Rollback changes since sandbox state was entered"
10
+ opts.separator ""
11
+ opts.separator "Usage: vagrant sandbox rollback <vmname>"
12
+
13
+ end
14
+
15
+ # Parse the options
16
+ argv = parse_options(opts)
17
+ return if !argv
18
+
19
+ boxname=argv[0]
20
+ begin
21
+ Sahara::Session.rollback(boxname)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,65 @@
1
+ require 'sahara'
2
+ require 'optparse'
3
+ require 'sahara/command/status'
4
+ require 'sahara/command/on'
5
+ require 'sahara/command/commit'
6
+ require 'sahara/command/rollback'
7
+ require 'sahara/command/off'
8
+
9
+ module Sahara
10
+ module Command
11
+ class Sandbox < ::Vagrant::Command::Base
12
+ def initialize(argv,env)
13
+ super
14
+
15
+ @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
16
+
17
+ @subcommands = ::Vagrant::Registry.new
18
+ @subcommands.register(:status) { Sahara::Command::Status }
19
+ @subcommands.register(:on) { Sahara::Command::On }
20
+ @subcommands.register(:off) { Sahara::Command::Off }
21
+ @subcommands.register(:commit) { Sahara::Command::Commit }
22
+ @subcommands.register(:rollback) { Sahara::Command::Rollback }
23
+ end
24
+
25
+ def execute
26
+ if @main_args.include?("-h") || @main_args.include?("--help")
27
+ # Print the help for all the box commands.
28
+ return help
29
+ end
30
+
31
+ # If we reached this far then we must have a subcommand. If not,
32
+ # then we also just print the help and exit.
33
+ command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
34
+ return help if !command_class || !@sub_command
35
+ @logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
36
+
37
+ # Initialize and execute the command class
38
+ command_class.new(@sub_args, @env).execute
39
+ end
40
+
41
+ # Prints the help out for this command
42
+ def help
43
+ opts = OptionParser.new do |opts|
44
+ opts.banner = "Usage: vagrant sandbox <command> [<args>]"
45
+ opts.separator ""
46
+ opts.separator "Available subcommands:"
47
+
48
+ # Add the available subcommands as separators in order to print them
49
+ # out as well.
50
+ keys = []
51
+ @subcommands.each { |key, value| keys << key.to_s }
52
+
53
+ keys.sort.each do |key|
54
+ opts.separator " #{key}"
55
+ end
56
+
57
+ opts.separator ""
58
+ opts.separator "For help on any individual command run `vagrant sandbox COMMAND -h`"
59
+ end
60
+
61
+ @env.ui.info(opts.help, :prefix => false)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,29 @@
1
+ require 'optparse'
2
+
3
+ module Sahara
4
+ module Command
5
+ class Status < ::Vagrant::Command::Base
6
+
7
+ def execute
8
+
9
+ options = {}
10
+
11
+ opts = OptionParser.new do |opts|
12
+ opts.banner = "Shows the status of the sandbox"
13
+ opts.separator ""
14
+ opts.separator "Usage: vagrant sandbox status <vmname>"
15
+
16
+ end
17
+
18
+ # Parse the options
19
+ argv = parse_options(opts)
20
+ return if !argv
21
+
22
+ boxname=argv[0]
23
+ begin
24
+ Sahara::Session.status(boxname)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ require 'sahara'
2
+ require 'sahara/session'
3
+ require 'sahara/command/sandbox'
4
+
5
+ Vagrant.commands.register(:sandbox) { Sahara::Command::Sandbox }
@@ -1,3 +1,3 @@
1
1
  module Sahara
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/vagrant_init.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  begin
2
- require 'sahara'
2
+ require 'vagrant'
3
+ require 'sahara/command/vagrant'
3
4
  rescue LoadError
4
5
  require 'rubygems'
5
- require 'sahara'
6
+ require 'vagrant'
7
+ require 'sahara/command/vagrant'
6
8
  end
data/sahara.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.rubyforge_project = "sahara"
16
16
 
17
- s.add_dependency "vagrant", "~> 0.8.2"
17
+ s.add_dependency "vagrant", "~> 0.9"
18
18
  s.add_dependency "popen4", "~> 0.1.2"
19
19
  s.add_dependency "thor", "~> 0.14.6"
20
20
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sahara
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Debois
@@ -15,27 +15,26 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-14 00:00:00 +01:00
19
- default_executable:
18
+ date: 2012-02-07 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ type: :runtime
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- hash: 59
27
+ hash: 25
28
28
  segments:
29
29
  - 0
30
- - 8
31
- - 2
32
- version: 0.8.2
33
- type: :runtime
34
- requirement: *id001
35
- name: vagrant
30
+ - 9
31
+ version: "0.9"
36
32
  prerelease: false
33
+ name: vagrant
34
+ version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ type: :runtime
37
+ requirement: &id002 !ruby/object:Gem::Requirement
39
38
  none: false
40
39
  requirements:
41
40
  - - ~>
@@ -46,12 +45,12 @@ dependencies:
46
45
  - 1
47
46
  - 2
48
47
  version: 0.1.2
49
- type: :runtime
50
- requirement: *id002
51
- name: popen4
52
48
  prerelease: false
49
+ name: popen4
50
+ version_requirements: *id002
53
51
  - !ruby/object:Gem::Dependency
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ type: :runtime
53
+ requirement: &id003 !ruby/object:Gem::Requirement
55
54
  none: false
56
55
  requirements:
57
56
  - - ~>
@@ -62,12 +61,12 @@ dependencies:
62
61
  - 14
63
62
  - 6
64
63
  version: 0.14.6
65
- type: :runtime
66
- requirement: *id003
67
- name: thor
68
64
  prerelease: false
65
+ name: thor
66
+ version_requirements: *id003
69
67
  - !ruby/object:Gem::Dependency
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
71
70
  none: false
72
71
  requirements:
73
72
  - - ">="
@@ -78,10 +77,9 @@ dependencies:
78
77
  - 0
79
78
  - 0
80
79
  version: 1.0.0
81
- type: :development
82
- requirement: *id004
83
- name: bundler
84
80
  prerelease: false
81
+ name: bundler
82
+ version_requirements: *id004
85
83
  description: Allows you to sandbox your vagrant
86
84
  email:
87
85
  - patrick.debois@jedi.be
@@ -101,13 +99,18 @@ files:
101
99
  - Vagrantfile.multi
102
100
  - Vagrantfile.single
103
101
  - lib/sahara.rb
104
- - lib/sahara/command.rb
102
+ - lib/sahara/command/commit.rb
103
+ - lib/sahara/command/off.rb
104
+ - lib/sahara/command/on.rb
105
+ - lib/sahara/command/rollback.rb
106
+ - lib/sahara/command/sandbox.rb
107
+ - lib/sahara/command/status.rb
108
+ - lib/sahara/command/vagrant.rb
105
109
  - lib/sahara/session.rb
106
110
  - lib/sahara/shell.rb
107
111
  - lib/sahara/version.rb
108
112
  - lib/vagrant_init.rb
109
113
  - sahara.gemspec
110
- has_rdoc: true
111
114
  homepage: http://github.com/jedi4ever/sahara/
112
115
  licenses: []
113
116
 
@@ -139,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
142
  requirements: []
140
143
 
141
144
  rubyforge_project: sahara
142
- rubygems_version: 1.4.2
145
+ rubygems_version: 1.8.12
143
146
  signing_key:
144
147
  specification_version: 3
145
148
  summary: Vagrant box creation
@@ -1,33 +0,0 @@
1
- require 'sahara/session'
2
-
3
- module Sahara
4
- class Command < Vagrant::Command::GroupBase
5
- register "sandbox","Manages a sandbox"
6
-
7
- desc "status [NAME]", "Shows the status of the sandbox"
8
- def status(boxname=nil)
9
- Sahara::Session.status(boxname)
10
- end
11
-
12
- desc "on [NAME]", "Enters sandbox state"
13
- def on(boxname=nil)
14
- Sahara::Session.on(boxname)
15
- end
16
-
17
- desc "commit [NAME]", "Commits changes - moves sandbox initial state to currentstate"
18
- def commit(boxname=nil)
19
- Sahara::Session.commit(boxname)
20
- end
21
-
22
- desc "rollback [NAME]", "Rollback changes since sandbox state was entered "
23
- def rollback(boxname=nil)
24
- Sahara::Session.rollback(boxname)
25
- end
26
-
27
- desc "off [NAME] ", "Leaves sandbox state"
28
- def off(boxname=nil)
29
- Sahara::Session.off(boxname)
30
- end
31
-
32
- end
33
- end