vagrantup 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/Gemfile +17 -0
  4. data/README.md +45 -0
  5. data/Rakefile +41 -0
  6. data/VERSION +1 -0
  7. data/bin/.gitignore +0 -0
  8. data/bin/vagrant +15 -0
  9. data/bin/vagrant-box +35 -0
  10. data/bin/vagrant-down +28 -0
  11. data/bin/vagrant-halt +29 -0
  12. data/bin/vagrant-init +28 -0
  13. data/bin/vagrant-package +30 -0
  14. data/bin/vagrant-reload +30 -0
  15. data/bin/vagrant-resume +28 -0
  16. data/bin/vagrant-ssh +28 -0
  17. data/bin/vagrant-suspend +28 -0
  18. data/bin/vagrant-up +30 -0
  19. data/config/default.rb +29 -0
  20. data/lib/vagrant.rb +14 -0
  21. data/lib/vagrant/actions/base.rb +93 -0
  22. data/lib/vagrant/actions/box/add.rb +22 -0
  23. data/lib/vagrant/actions/box/destroy.rb +14 -0
  24. data/lib/vagrant/actions/box/download.rb +63 -0
  25. data/lib/vagrant/actions/box/unpackage.rb +49 -0
  26. data/lib/vagrant/actions/runner.rb +128 -0
  27. data/lib/vagrant/actions/vm/destroy.rb +14 -0
  28. data/lib/vagrant/actions/vm/down.rb +12 -0
  29. data/lib/vagrant/actions/vm/export.rb +41 -0
  30. data/lib/vagrant/actions/vm/forward_ports.rb +32 -0
  31. data/lib/vagrant/actions/vm/halt.rb +14 -0
  32. data/lib/vagrant/actions/vm/import.rb +17 -0
  33. data/lib/vagrant/actions/vm/move_hard_drive.rb +53 -0
  34. data/lib/vagrant/actions/vm/package.rb +61 -0
  35. data/lib/vagrant/actions/vm/provision.rb +71 -0
  36. data/lib/vagrant/actions/vm/reload.rb +17 -0
  37. data/lib/vagrant/actions/vm/resume.rb +16 -0
  38. data/lib/vagrant/actions/vm/shared_folders.rb +69 -0
  39. data/lib/vagrant/actions/vm/start.rb +50 -0
  40. data/lib/vagrant/actions/vm/suspend.rb +16 -0
  41. data/lib/vagrant/actions/vm/up.rb +35 -0
  42. data/lib/vagrant/box.rb +129 -0
  43. data/lib/vagrant/busy.rb +73 -0
  44. data/lib/vagrant/commands.rb +174 -0
  45. data/lib/vagrant/config.rb +156 -0
  46. data/lib/vagrant/downloaders/base.rb +13 -0
  47. data/lib/vagrant/downloaders/file.rb +21 -0
  48. data/lib/vagrant/downloaders/http.rb +47 -0
  49. data/lib/vagrant/env.rb +140 -0
  50. data/lib/vagrant/ssh.rb +43 -0
  51. data/lib/vagrant/util.rb +45 -0
  52. data/lib/vagrant/vm.rb +57 -0
  53. data/script/vagrant-ssh-expect.sh +22 -0
  54. data/templates/Vagrantfile +8 -0
  55. data/test/test_helper.rb +91 -0
  56. data/test/vagrant/actions/base_test.rb +32 -0
  57. data/test/vagrant/actions/box/add_test.rb +37 -0
  58. data/test/vagrant/actions/box/destroy_test.rb +18 -0
  59. data/test/vagrant/actions/box/download_test.rb +118 -0
  60. data/test/vagrant/actions/box/unpackage_test.rb +101 -0
  61. data/test/vagrant/actions/runner_test.rb +236 -0
  62. data/test/vagrant/actions/vm/destroy_test.rb +24 -0
  63. data/test/vagrant/actions/vm/down_test.rb +32 -0
  64. data/test/vagrant/actions/vm/export_test.rb +88 -0
  65. data/test/vagrant/actions/vm/forward_ports_test.rb +50 -0
  66. data/test/vagrant/actions/vm/halt_test.rb +27 -0
  67. data/test/vagrant/actions/vm/import_test.rb +36 -0
  68. data/test/vagrant/actions/vm/move_hard_drive_test.rb +108 -0
  69. data/test/vagrant/actions/vm/package_test.rb +155 -0
  70. data/test/vagrant/actions/vm/provision_test.rb +103 -0
  71. data/test/vagrant/actions/vm/reload_test.rb +44 -0
  72. data/test/vagrant/actions/vm/resume_test.rb +27 -0
  73. data/test/vagrant/actions/vm/shared_folders_test.rb +117 -0
  74. data/test/vagrant/actions/vm/start_test.rb +55 -0
  75. data/test/vagrant/actions/vm/suspend_test.rb +27 -0
  76. data/test/vagrant/actions/vm/up_test.rb +76 -0
  77. data/test/vagrant/box_test.rb +92 -0
  78. data/test/vagrant/busy_test.rb +81 -0
  79. data/test/vagrant/commands_test.rb +252 -0
  80. data/test/vagrant/config_test.rb +123 -0
  81. data/test/vagrant/downloaders/base_test.rb +20 -0
  82. data/test/vagrant/downloaders/file_test.rb +32 -0
  83. data/test/vagrant/downloaders/http_test.rb +40 -0
  84. data/test/vagrant/env_test.rb +293 -0
  85. data/test/vagrant/ssh_test.rb +95 -0
  86. data/test/vagrant/util_test.rb +64 -0
  87. data/test/vagrant/vm_test.rb +96 -0
  88. metadata +263 -0
@@ -0,0 +1,64 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'test_helper')
2
+
3
+ class UtilTest < Test::Unit::TestCase
4
+ class RegUtil
5
+ extend Vagrant::Util
6
+ end
7
+
8
+ context "erroring" do
9
+ # TODO: Any way to stub Kernel.exit? Can't test nicely
10
+ # otherwise
11
+ end
12
+
13
+ context "logger" do
14
+ class OtherUtil
15
+ extend Vagrant::Util
16
+ end
17
+
18
+ setup do
19
+ @config = Vagrant::Config::Top.new
20
+ @config.stubs(:loaded?).returns(true)
21
+ @config.vagrant.log_output = STDOUT
22
+ Vagrant::Config.stubs(:config).returns(@config)
23
+ Vagrant::Logger.reset_logger!
24
+ end
25
+
26
+ teardown do
27
+ Vagrant::Logger.reset_logger!
28
+ end
29
+
30
+ should "return a logger to nil if config is not loaded" do
31
+ @config.expects(:loaded?).returns(false)
32
+ logger = RegUtil.logger
33
+ assert_nil logger.instance_variable_get(:@logdev)
34
+ end
35
+
36
+ should "return a logger using the configured output" do
37
+ logger = RegUtil.logger
38
+ logdev = logger.instance_variable_get(:@logdev)
39
+ assert logger
40
+ assert !logdev.nil?
41
+ assert_equal STDOUT, logdev.dev
42
+ end
43
+
44
+ should "only instantiate a logger once" do
45
+ Vagrant::Logger.expects(:new).once.returns("GOOD")
46
+ RegUtil.logger
47
+ RegUtil.logger
48
+ end
49
+
50
+ should "be able to reset the logger" do
51
+ Vagrant::Logger.expects(:new).twice
52
+ RegUtil.logger
53
+ Vagrant::Logger.reset_logger!
54
+ RegUtil.logger
55
+ end
56
+
57
+ should "return the same logger across classes" do
58
+ logger = RegUtil.logger
59
+ other = OtherUtil.logger
60
+
61
+ assert logger.equal?(other)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,96 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'test_helper')
2
+
3
+ class VMTest < Test::Unit::TestCase
4
+ setup do
5
+ @mock_vm = mock("vm")
6
+ mock_config
7
+
8
+ @persisted_vm = mock("persisted_vm")
9
+ Vagrant::Env.stubs(:persisted_vm).returns(@persisted_vm)
10
+
11
+ Net::SSH.stubs(:start)
12
+ end
13
+
14
+ context "being an action runner" do
15
+ should "be an action runner" do
16
+ vm = Vagrant::VM.new
17
+ assert vm.is_a?(Vagrant::Actions::Runner)
18
+ end
19
+ end
20
+
21
+ context "finding a VM" do
22
+ should "return nil if the VM is not found" do
23
+ VirtualBox::VM.expects(:find).returns(nil)
24
+ assert_nil Vagrant::VM.find("foo")
25
+ end
26
+
27
+ should "return a Vagrant::VM object for that VM otherwise" do
28
+ VirtualBox::VM.expects(:find).with("foo").returns("bar")
29
+ result = Vagrant::VM.find("foo")
30
+ assert result.is_a?(Vagrant::VM)
31
+ assert_equal "bar", result.vm
32
+ end
33
+ end
34
+
35
+ context "vagrant VM instance" do
36
+ setup do
37
+ @vm = Vagrant::VM.new(@mock_vm)
38
+ end
39
+
40
+ context "packaging" do
41
+ should "queue up the actions and execute" do
42
+ out_path = mock("out_path")
43
+ action_seq = sequence("actions")
44
+ @vm.expects(:add_action).with(Vagrant::Actions::VM::Export).once.in_sequence(action_seq)
45
+ @vm.expects(:add_action).with(Vagrant::Actions::VM::Package, out_path, []).once.in_sequence(action_seq)
46
+ @vm.expects(:execute!).in_sequence(action_seq)
47
+ @vm.package(out_path)
48
+ end
49
+ end
50
+
51
+ context "destroying" do
52
+ should "execute the down action" do
53
+ @vm.expects(:execute!).with(Vagrant::Actions::VM::Down).once
54
+ @vm.destroy
55
+ end
56
+ end
57
+
58
+ context "suspending" do
59
+ should "execute the suspend action" do
60
+ @vm.expects(:execute!).with(Vagrant::Actions::VM::Suspend).once
61
+ @vm.suspend
62
+ end
63
+ end
64
+
65
+ context "resuming" do
66
+ should "execute the resume action" do
67
+ @vm.expects(:execute!).with(Vagrant::Actions::VM::Resume).once
68
+ @vm.resume
69
+ end
70
+ end
71
+
72
+ context "starting" do
73
+ setup do
74
+ @mock_vm.stubs(:running?).returns(false)
75
+ end
76
+
77
+ should "not do anything if the VM is already running" do
78
+ @mock_vm.stubs(:running?).returns(true)
79
+ @vm.expects(:execute!).never
80
+ @vm.start
81
+ end
82
+
83
+ should "add and execute the proper actions" do
84
+ actions = [Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders, Vagrant::Actions::VM::Start]
85
+
86
+ action_seq = sequence("action_seq")
87
+ actions.each do |action|
88
+ @vm.expects(:add_action).with(action).in_sequence(action_seq)
89
+ end
90
+
91
+ @vm.expects(:execute!).once.in_sequence(action_seq)
92
+ @vm.start
93
+ end
94
+ end
95
+ end
96
+ end
metadata ADDED
@@ -0,0 +1,263 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrantup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mitchell Hashimoto
8
+ - John Bender
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2010-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: virtualbox
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.5.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 0.5.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: net-ssh
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 2.0.19
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: 2.0.19
42
+ - !ruby/object:Gem::Dependency
43
+ name: net-scp
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.0.2
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.2
56
+ - !ruby/object:Gem::Dependency
57
+ name: json
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.2.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.2.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: git-style-binaries
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 0.1.10
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: 0.1.10
84
+ - !ruby/object:Gem::Dependency
85
+ name: tarruby
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: 0.1.5
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: 0.1.5
98
+ description: Vagrant is a tool for building and distributing virtualized development
99
+ environments.
100
+ email:
101
+ - mitchell.hashimoto@gmail.com
102
+ - john.m.bender@gmail.com
103
+ executables:
104
+ - vagrant
105
+ - vagrant-box
106
+ - vagrant-down
107
+ - vagrant-halt
108
+ - vagrant-init
109
+ - vagrant-package
110
+ - vagrant-reload
111
+ - vagrant-resume
112
+ - vagrant-ssh
113
+ - vagrant-suspend
114
+ - vagrant-up
115
+ extensions: []
116
+ extra_rdoc_files:
117
+ - README.md
118
+ files:
119
+ - .gitignore
120
+ - Gemfile
121
+ - README.md
122
+ - Rakefile
123
+ - VERSION
124
+ - bin/.gitignore
125
+ - bin/vagrant
126
+ - bin/vagrant-box
127
+ - bin/vagrant-down
128
+ - bin/vagrant-halt
129
+ - bin/vagrant-init
130
+ - bin/vagrant-package
131
+ - bin/vagrant-reload
132
+ - bin/vagrant-resume
133
+ - bin/vagrant-ssh
134
+ - bin/vagrant-suspend
135
+ - bin/vagrant-up
136
+ - config/default.rb
137
+ - lib/vagrant.rb
138
+ - lib/vagrant/actions/base.rb
139
+ - lib/vagrant/actions/box/add.rb
140
+ - lib/vagrant/actions/box/destroy.rb
141
+ - lib/vagrant/actions/box/download.rb
142
+ - lib/vagrant/actions/box/unpackage.rb
143
+ - lib/vagrant/actions/runner.rb
144
+ - lib/vagrant/actions/vm/destroy.rb
145
+ - lib/vagrant/actions/vm/down.rb
146
+ - lib/vagrant/actions/vm/export.rb
147
+ - lib/vagrant/actions/vm/forward_ports.rb
148
+ - lib/vagrant/actions/vm/halt.rb
149
+ - lib/vagrant/actions/vm/import.rb
150
+ - lib/vagrant/actions/vm/move_hard_drive.rb
151
+ - lib/vagrant/actions/vm/package.rb
152
+ - lib/vagrant/actions/vm/provision.rb
153
+ - lib/vagrant/actions/vm/reload.rb
154
+ - lib/vagrant/actions/vm/resume.rb
155
+ - lib/vagrant/actions/vm/shared_folders.rb
156
+ - lib/vagrant/actions/vm/start.rb
157
+ - lib/vagrant/actions/vm/suspend.rb
158
+ - lib/vagrant/actions/vm/up.rb
159
+ - lib/vagrant/box.rb
160
+ - lib/vagrant/busy.rb
161
+ - lib/vagrant/commands.rb
162
+ - lib/vagrant/config.rb
163
+ - lib/vagrant/downloaders/base.rb
164
+ - lib/vagrant/downloaders/file.rb
165
+ - lib/vagrant/downloaders/http.rb
166
+ - lib/vagrant/env.rb
167
+ - lib/vagrant/ssh.rb
168
+ - lib/vagrant/util.rb
169
+ - lib/vagrant/vm.rb
170
+ - script/vagrant-ssh-expect.sh
171
+ - templates/Vagrantfile
172
+ - test/test_helper.rb
173
+ - test/vagrant/actions/base_test.rb
174
+ - test/vagrant/actions/box/add_test.rb
175
+ - test/vagrant/actions/box/destroy_test.rb
176
+ - test/vagrant/actions/box/download_test.rb
177
+ - test/vagrant/actions/box/unpackage_test.rb
178
+ - test/vagrant/actions/runner_test.rb
179
+ - test/vagrant/actions/vm/destroy_test.rb
180
+ - test/vagrant/actions/vm/down_test.rb
181
+ - test/vagrant/actions/vm/export_test.rb
182
+ - test/vagrant/actions/vm/forward_ports_test.rb
183
+ - test/vagrant/actions/vm/halt_test.rb
184
+ - test/vagrant/actions/vm/import_test.rb
185
+ - test/vagrant/actions/vm/move_hard_drive_test.rb
186
+ - test/vagrant/actions/vm/package_test.rb
187
+ - test/vagrant/actions/vm/provision_test.rb
188
+ - test/vagrant/actions/vm/reload_test.rb
189
+ - test/vagrant/actions/vm/resume_test.rb
190
+ - test/vagrant/actions/vm/shared_folders_test.rb
191
+ - test/vagrant/actions/vm/start_test.rb
192
+ - test/vagrant/actions/vm/suspend_test.rb
193
+ - test/vagrant/actions/vm/up_test.rb
194
+ - test/vagrant/box_test.rb
195
+ - test/vagrant/busy_test.rb
196
+ - test/vagrant/commands_test.rb
197
+ - test/vagrant/config_test.rb
198
+ - test/vagrant/downloaders/base_test.rb
199
+ - test/vagrant/downloaders/file_test.rb
200
+ - test/vagrant/downloaders/http_test.rb
201
+ - test/vagrant/env_test.rb
202
+ - test/vagrant/ssh_test.rb
203
+ - test/vagrant/util_test.rb
204
+ - test/vagrant/vm_test.rb
205
+ homepage: http://github.com/mitchellh/vagrant
206
+ licenses: []
207
+ metadata: {}
208
+ post_install_message:
209
+ rdoc_options:
210
+ - --charset=UTF-8
211
+ require_paths:
212
+ - lib
213
+ required_ruby_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - '>='
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ requirements: []
224
+ rubyforge_project:
225
+ rubygems_version: 2.0.0
226
+ signing_key:
227
+ specification_version: 3
228
+ summary: Vagrant is a tool for building and distributing virtualized development environments.
229
+ test_files:
230
+ - test/test_helper.rb
231
+ - test/vagrant/actions/base_test.rb
232
+ - test/vagrant/actions/box/add_test.rb
233
+ - test/vagrant/actions/box/destroy_test.rb
234
+ - test/vagrant/actions/box/download_test.rb
235
+ - test/vagrant/actions/box/unpackage_test.rb
236
+ - test/vagrant/actions/runner_test.rb
237
+ - test/vagrant/actions/vm/destroy_test.rb
238
+ - test/vagrant/actions/vm/down_test.rb
239
+ - test/vagrant/actions/vm/export_test.rb
240
+ - test/vagrant/actions/vm/forward_ports_test.rb
241
+ - test/vagrant/actions/vm/halt_test.rb
242
+ - test/vagrant/actions/vm/import_test.rb
243
+ - test/vagrant/actions/vm/move_hard_drive_test.rb
244
+ - test/vagrant/actions/vm/package_test.rb
245
+ - test/vagrant/actions/vm/provision_test.rb
246
+ - test/vagrant/actions/vm/reload_test.rb
247
+ - test/vagrant/actions/vm/resume_test.rb
248
+ - test/vagrant/actions/vm/shared_folders_test.rb
249
+ - test/vagrant/actions/vm/start_test.rb
250
+ - test/vagrant/actions/vm/suspend_test.rb
251
+ - test/vagrant/actions/vm/up_test.rb
252
+ - test/vagrant/box_test.rb
253
+ - test/vagrant/busy_test.rb
254
+ - test/vagrant/commands_test.rb
255
+ - test/vagrant/config_test.rb
256
+ - test/vagrant/downloaders/base_test.rb
257
+ - test/vagrant/downloaders/file_test.rb
258
+ - test/vagrant/downloaders/http_test.rb
259
+ - test/vagrant/env_test.rb
260
+ - test/vagrant/ssh_test.rb
261
+ - test/vagrant/util_test.rb
262
+ - test/vagrant/vm_test.rb
263
+ has_rdoc: