vagrantup 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +8 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/bin/vagrant +1 -1
- data/lib/vagrant/actions/box/unpackage.rb +2 -5
- data/lib/vagrant/actions/runner.rb +11 -1
- data/lib/vagrant/actions/vm/package.rb +16 -12
- data/lib/vagrant/commands.rb +1 -1
- data/lib/vagrant/env.rb +4 -1
- data/lib/vagrant.rb +2 -2
- data/test/vagrant/actions/box/unpackage_test.rb +2 -3
- data/test/vagrant/actions/runner_test.rb +28 -2
- data/test/vagrant/actions/vm/package_test.rb +39 -13
- data/test/vagrant/busy_test.rb +3 -1
- data/test/vagrant/commands_test.rb +2 -2
- data/test/vagrant/env_test.rb +6 -1
- data/vagrant.gemspec +5 -5
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd836a15024ed281e1843a1d9641c8f2d8c12e6
|
4
|
+
data.tar.gz: d44a4add3767e321e8a58a111be37258912c7c24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c915f5739663561b7434c2c4bbf0c265b22fdb758e86d7caf4d621bf465b94475c6f5a749243ffde3f9c709a94f6da38a02f41eee0b8f08436506c2487bf9b1a
|
7
|
+
data.tar.gz: a08b020df05c86b6c4eef07b4bb7810f08c9188c449593f1e4c599e7e6b1df40637749e323b7dcaa0a07110e3f9a2929c735e661e2a893f762767e6f5dde0e0c
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -34,6 +34,14 @@ There is also a fairly short (12 minute) [getting started video](http://vimeo.co
|
|
34
34
|
explains how to build a fully functional LAMP development environment, which
|
35
35
|
covers a few parts of Vagrant in more detail than the website guide.
|
36
36
|
|
37
|
+
## Installing the Gem from Git
|
38
|
+
|
39
|
+
If you want the bleeding edge version of Vagrant, we try to keep master pretty stable
|
40
|
+
and you're welcome to give it a shot. The following is an example showing how to do this:
|
41
|
+
|
42
|
+
rake build
|
43
|
+
sudo rake install
|
44
|
+
|
37
45
|
## Contributing to Vagrant
|
38
46
|
|
39
47
|
To hack on vagrant, you'll need [bundler](http://github.com/carlhuda/bundler) which can
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ begin
|
|
15
15
|
gemspec.add_dependency('net-scp', '>= 1.0.2')
|
16
16
|
gemspec.add_dependency('json', '>= 1.2.0')
|
17
17
|
gemspec.add_dependency('git-style-binaries', '>= 0.1.10')
|
18
|
-
gemspec.add_dependency('
|
18
|
+
gemspec.add_dependency('archive-tar-minitar', '= 0.5.2')
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
21
21
|
rescue LoadError
|
@@ -38,4 +38,4 @@ begin
|
|
38
38
|
rescue LoadError
|
39
39
|
puts "Yard not available. Install it with: gem install yard"
|
40
40
|
puts "if you wish to be able to generate developer documentation."
|
41
|
-
end
|
41
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/bin/vagrant
CHANGED
@@ -4,7 +4,6 @@ module Vagrant
|
|
4
4
|
# This action unpackages a downloaded box file into its final
|
5
5
|
# box destination within the vagrant home folder.
|
6
6
|
class Unpackage < Base
|
7
|
-
TAR_OPTIONS = [File::RDONLY, 0644, Tar::GNU]
|
8
7
|
|
9
8
|
def execute!
|
10
9
|
@runner.invoke_around_callback(:unpackage) do
|
@@ -38,12 +37,10 @@ msg
|
|
38
37
|
def decompress
|
39
38
|
Dir.chdir(box_dir) do
|
40
39
|
logger.info "Extracting box to #{box_dir}..."
|
41
|
-
Tar.
|
42
|
-
tar.extract_all
|
43
|
-
end
|
40
|
+
Archive::Tar::Minitar.unpack(@runner.temp_path, box_dir)
|
44
41
|
end
|
45
42
|
end
|
46
43
|
end
|
47
44
|
end
|
48
45
|
end
|
49
|
-
end
|
46
|
+
end
|
@@ -69,11 +69,15 @@ module Vagrant
|
|
69
69
|
# to execute a single action on an instance. The syntax for executing a
|
70
70
|
# single method on an instance is the same as the {execute!} class method.
|
71
71
|
def execute!(single_action=nil, *args)
|
72
|
+
|
72
73
|
if single_action
|
73
74
|
actions.clear
|
74
75
|
add_action(single_action, *args)
|
75
76
|
end
|
76
77
|
|
78
|
+
# Raising it here might be too late and hard debug where the actions are comming from (meta actions)
|
79
|
+
raise DuplicateActionException.new if action_klasses.uniq.size < action_klasses.size
|
80
|
+
|
77
81
|
# Call the prepare method on each once its
|
78
82
|
# initialized, then call the execute! method
|
79
83
|
begin
|
@@ -123,6 +127,12 @@ module Vagrant
|
|
123
127
|
end
|
124
128
|
results
|
125
129
|
end
|
130
|
+
|
131
|
+
def action_klasses
|
132
|
+
actions.map { |a| a.class }
|
133
|
+
end
|
126
134
|
end
|
135
|
+
|
136
|
+
class DuplicateActionException < Exception; end
|
127
137
|
end
|
128
|
-
end
|
138
|
+
end
|
@@ -38,20 +38,24 @@ module Vagrant
|
|
38
38
|
|
39
39
|
def compress
|
40
40
|
logger.info "Packaging VM into #{tar_path} ..."
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
File.open(tar_path, File::CREAT | File::WRONLY, 0644) do |tar|
|
42
|
+
Archive::Tar::Minitar::Output.open(tar) do |output|
|
43
|
+
begin
|
44
|
+
current_dir = FileUtils.pwd
|
45
|
+
|
46
|
+
include_files.each do |f|
|
47
|
+
logger.info "Packaging additional file: #{f}"
|
48
|
+
Archive::Tar::Minitar.pack_file(f, output)
|
49
|
+
end
|
48
50
|
|
49
|
-
|
51
|
+
FileUtils.cd(temp_path)
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
Dir.glob(File.join(".", "*")).each do |entry|
|
54
|
+
Archive::Tar::Minitar.pack_file(entry, output)
|
55
|
+
end
|
56
|
+
ensure
|
57
|
+
FileUtils.cd(current_dir)
|
58
|
+
end
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
data/lib/vagrant/commands.rb
CHANGED
@@ -21,7 +21,7 @@ error
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# Copy over the rootfile template into this directory
|
24
|
-
|
24
|
+
FileUtils.cp(File.join(PROJECT_ROOT, "templates", Env::ROOTFILE_NAME), rootfile_path)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Bring up a vagrant instance. This handles everything from importing
|
data/lib/vagrant/env.rb
CHANGED
@@ -89,7 +89,10 @@ module Vagrant
|
|
89
89
|
def load_root_path!(path=nil)
|
90
90
|
path ||= Pathname.new(Dir.pwd)
|
91
91
|
|
92
|
-
|
92
|
+
# Stop if we're at the root. 2nd regex matches windows drives
|
93
|
+
# such as C:. and Z:. Portability of this check will need to be
|
94
|
+
# researched.
|
95
|
+
return false if path.to_s == '/' || path.to_s =~ /^[A-Z]:\.$/
|
93
96
|
|
94
97
|
file = "#{path}/#{ROOTFILE_NAME}"
|
95
98
|
if File.exist?(file)
|
data/lib/vagrant.rb
CHANGED
@@ -3,8 +3,8 @@ $:.unshift(libdir)
|
|
3
3
|
PROJECT_ROOT = File.join(libdir, '..') unless defined?(PROJECT_ROOT)
|
4
4
|
|
5
5
|
# The libs which must be loaded prior to the rest
|
6
|
-
%w{tempfile open-uri
|
7
|
-
net/scp fileutils vagrant/util vagrant/actions/base vagrant/downloaders/base}.each do |f|
|
6
|
+
%w{tempfile open-uri json pathname logger uri net/http virtualbox net/ssh archive/tar/minitar
|
7
|
+
net/scp fileutils vagrant/util vagrant/actions/base vagrant/downloaders/base vagrant/actions/runner}.each do |f|
|
8
8
|
require f
|
9
9
|
end
|
10
10
|
|
@@ -84,6 +84,7 @@ class UnpackageBoxActionTest < Test::Unit::TestCase
|
|
84
84
|
|
85
85
|
@action.stubs(:box_dir).returns(@box_dir)
|
86
86
|
Dir.stubs(:chdir).yields
|
87
|
+
Archive::Tar::Minitar.stubs(:unpack)
|
87
88
|
end
|
88
89
|
|
89
90
|
should "change to the box directory" do
|
@@ -92,9 +93,7 @@ class UnpackageBoxActionTest < Test::Unit::TestCase
|
|
92
93
|
end
|
93
94
|
|
94
95
|
should "open the tar file within the new directory, and extract it all" do
|
95
|
-
@
|
96
|
-
@tar.expects(:extract_all).once
|
97
|
-
Tar.expects(:open).with(@runner.temp_path, anything, anything, anything).yields(@tar)
|
96
|
+
Archive::Tar::Minitar.expects(:unpack).with(@runner.temp_path, @box_dir).once
|
98
97
|
@action.decompress
|
99
98
|
end
|
100
99
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
2
|
|
3
3
|
class ActionRunnerTest < Test::Unit::TestCase
|
4
|
-
def mock_fake_action
|
5
|
-
action = mock("action")
|
4
|
+
def mock_fake_action(action_klass = nil, runner = nil)
|
5
|
+
action = action_klass ? action_klass.new(runner) : mock("action")
|
6
6
|
action.stubs(:prepare)
|
7
7
|
action.stubs(:execute!)
|
8
8
|
action.stubs(:cleanup)
|
@@ -129,6 +129,7 @@ class ActionRunnerTest < Test::Unit::TestCase
|
|
129
129
|
context "instance method execute" do
|
130
130
|
setup do
|
131
131
|
@runner = Vagrant::Actions::Runner.new
|
132
|
+
@runner.stubs(:action_klasses).returns([Vagrant::Actions::Base])
|
132
133
|
end
|
133
134
|
|
134
135
|
should "clear the actions and run a single action if given to execute!" do
|
@@ -233,4 +234,29 @@ class ActionRunnerTest < Test::Unit::TestCase
|
|
233
234
|
assert @runner.actions.empty?
|
234
235
|
end
|
235
236
|
end
|
237
|
+
|
238
|
+
context "duplicate action exceptions" do
|
239
|
+
setup do
|
240
|
+
@runner = Vagrant::Actions::Runner.new
|
241
|
+
end
|
242
|
+
|
243
|
+
should "should be raised when a duplicate is added" do
|
244
|
+
action = mock_fake_action
|
245
|
+
2.times {@runner.actions << action }
|
246
|
+
assert_raise Vagrant::Actions::DuplicateActionException do
|
247
|
+
@runner.execute!
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
should "should not be raise when no duplicate actions are present" do
|
252
|
+
@runner.actions << mock_fake_action(Vagrant::Actions::Base, @runner)
|
253
|
+
@runner.actions << mock_fake_action(Vagrant::Actions::VM::Halt, @runner)
|
254
|
+
|
255
|
+
assert_nothing_raised { @runner.execute! }
|
256
|
+
end
|
257
|
+
|
258
|
+
should "should not raise when a single action is specified" do
|
259
|
+
assert_nothing_raised { @runner.execute!(Vagrant::Actions::Base) }
|
260
|
+
end
|
261
|
+
end
|
236
262
|
end
|
@@ -66,27 +66,49 @@ class PackageActionTest < Test::Unit::TestCase
|
|
66
66
|
@temp_path = "foo"
|
67
67
|
@action.stubs(:temp_path).returns(@temp_path)
|
68
68
|
|
69
|
+
@include_files = []
|
70
|
+
@action.stubs(:include_files).returns(@include_files)
|
71
|
+
|
69
72
|
@pwd = "bar"
|
70
73
|
FileUtils.stubs(:pwd).returns(@pwd)
|
71
74
|
FileUtils.stubs(:cd)
|
72
75
|
|
73
|
-
@
|
74
|
-
|
76
|
+
@file = mock("file")
|
77
|
+
File.stubs(:open).yields(@file)
|
78
|
+
|
79
|
+
@output = mock("output")
|
80
|
+
@tar = Archive::Tar::Minitar
|
81
|
+
Archive::Tar::Minitar::Output.stubs(:open).yields(@output)
|
82
|
+
@tar.stubs(:pack_file)
|
75
83
|
end
|
76
84
|
|
77
85
|
should "open the tar file with the tar path properly" do
|
78
|
-
|
86
|
+
File.expects(:open).with(@tar_path, File::CREAT | File::WRONLY, 0644).once
|
87
|
+
@action.compress
|
88
|
+
end
|
89
|
+
|
90
|
+
should "open tar file" do
|
91
|
+
Archive::Tar::Minitar::Output.expects(:open).with(@file).once
|
79
92
|
@action.compress
|
80
93
|
end
|
81
94
|
|
82
95
|
#----------------------------------------------------------------
|
83
|
-
# Methods below this comment test the block yielded by
|
96
|
+
# Methods below this comment test the block yielded by Minitar open
|
84
97
|
#----------------------------------------------------------------
|
85
98
|
should "cd to the directory and append the directory" do
|
99
|
+
@files = []
|
86
100
|
compress_seq = sequence("compress_seq")
|
101
|
+
|
87
102
|
FileUtils.expects(:pwd).once.returns(@pwd).in_sequence(compress_seq)
|
88
103
|
FileUtils.expects(:cd).with(@temp_path).in_sequence(compress_seq)
|
89
|
-
|
104
|
+
Dir.expects(:glob).returns(@files).in_sequence(compress_seq)
|
105
|
+
|
106
|
+
5.times do |i|
|
107
|
+
file = mock("file#{i}")
|
108
|
+
@tar.expects(:pack_file).with(file, @output).once.in_sequence(compress_seq)
|
109
|
+
@files << file
|
110
|
+
end
|
111
|
+
|
90
112
|
FileUtils.expects(:cd).with(@pwd).in_sequence(compress_seq)
|
91
113
|
@action.compress
|
92
114
|
end
|
@@ -102,17 +124,21 @@ class PackageActionTest < Test::Unit::TestCase
|
|
102
124
|
end
|
103
125
|
|
104
126
|
should "add included files when passed" do
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
127
|
+
compress_seq = sequence("compress")
|
128
|
+
@files = []
|
129
|
+
5.times do |i|
|
130
|
+
file = mock("file#{i}")
|
131
|
+
@tar.expects(:pack_file).with(file, @output).once.in_sequence(compress_seq)
|
132
|
+
@files << file
|
133
|
+
end
|
134
|
+
|
135
|
+
@action.expects(:include_files).returns(@files)
|
136
|
+
@action.compress
|
111
137
|
end
|
112
138
|
|
113
139
|
should "not add files when none are specified" do
|
114
|
-
@tar.expects(:
|
115
|
-
|
140
|
+
@tar.expects(:pack_file).never
|
141
|
+
Dir.expects(:glob).once.returns([])
|
116
142
|
@action.compress
|
117
143
|
end
|
118
144
|
end
|
data/test/vagrant/busy_test.rb
CHANGED
@@ -54,9 +54,11 @@ class BusyTest < Test::Unit::TestCase
|
|
54
54
|
should "report busy to the outside world regardless of thread" do
|
55
55
|
Thread.new do
|
56
56
|
Vagrant.busy do
|
57
|
-
sleep(
|
57
|
+
sleep(2)
|
58
58
|
end
|
59
59
|
end
|
60
|
+
# Give the thread time to start
|
61
|
+
sleep(1)
|
60
62
|
|
61
63
|
# While the above thread is executing vagrant should be busy
|
62
64
|
assert Vagrant.busy?
|
@@ -12,7 +12,7 @@ class CommandsTest < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
context "init" do
|
14
14
|
setup do
|
15
|
-
|
15
|
+
FileUtils.stubs(:cp)
|
16
16
|
@rootfile_path = File.join(Dir.pwd, Vagrant::Env::ROOTFILE_NAME)
|
17
17
|
@template_path = File.join(PROJECT_ROOT, "templates", Vagrant::Env::ROOTFILE_NAME)
|
18
18
|
end
|
@@ -25,7 +25,7 @@ class CommandsTest < Test::Unit::TestCase
|
|
25
25
|
|
26
26
|
should "copy the templated rootfile to the current path" do
|
27
27
|
File.expects(:exist?).with(@rootfile_path).returns(false)
|
28
|
-
|
28
|
+
FileUtils.expects(:cp).with(@template_path, @rootfile_path).once
|
29
29
|
Vagrant::Commands.init
|
30
30
|
end
|
31
31
|
end
|
data/test/vagrant/env_test.rb
CHANGED
@@ -218,11 +218,16 @@ class EnvTest < Test::Unit::TestCase
|
|
218
218
|
assert !Vagrant::Env.load_root_path!(paths.first)
|
219
219
|
end
|
220
220
|
|
221
|
-
should "
|
221
|
+
should "return false if not found" do
|
222
222
|
path = Pathname.new("/")
|
223
223
|
assert !Vagrant::Env.load_root_path!(path)
|
224
224
|
end
|
225
225
|
|
226
|
+
should "return false if not found on windows-style root" do
|
227
|
+
path = Pathname.new("C:.")
|
228
|
+
assert !Vagrant::Env.load_root_path!(path)
|
229
|
+
end
|
230
|
+
|
226
231
|
should "should set the path for the rootfile" do
|
227
232
|
path = "/foo"
|
228
233
|
File.expects(:exist?).with("#{path}/#{Vagrant::Env::ROOTFILE_NAME}").returns(true)
|
data/vagrant.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{vagrantup}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mitchell Hashimoto", "John Bender"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-09}
|
13
13
|
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
|
14
14
|
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
|
15
15
|
s.executables = ["vagrant", "vagrant-box", "vagrant-down", "vagrant-halt", "vagrant-init", "vagrant-package", "vagrant-reload", "vagrant-resume", "vagrant-ssh", "vagrant-suspend", "vagrant-up"]
|
@@ -161,14 +161,14 @@ Gem::Specification.new do |s|
|
|
161
161
|
s.add_runtime_dependency(%q<net-scp>, [">= 1.0.2"])
|
162
162
|
s.add_runtime_dependency(%q<json>, [">= 1.2.0"])
|
163
163
|
s.add_runtime_dependency(%q<git-style-binaries>, [">= 0.1.10"])
|
164
|
-
s.add_runtime_dependency(%q<
|
164
|
+
s.add_runtime_dependency(%q<archive-tar-minitar>, ["= 0.5.2"])
|
165
165
|
else
|
166
166
|
s.add_dependency(%q<virtualbox>, [">= 0.5.0"])
|
167
167
|
s.add_dependency(%q<net-ssh>, [">= 2.0.19"])
|
168
168
|
s.add_dependency(%q<net-scp>, [">= 1.0.2"])
|
169
169
|
s.add_dependency(%q<json>, [">= 1.2.0"])
|
170
170
|
s.add_dependency(%q<git-style-binaries>, [">= 0.1.10"])
|
171
|
-
s.add_dependency(%q<
|
171
|
+
s.add_dependency(%q<archive-tar-minitar>, ["= 0.5.2"])
|
172
172
|
end
|
173
173
|
else
|
174
174
|
s.add_dependency(%q<virtualbox>, [">= 0.5.0"])
|
@@ -176,7 +176,7 @@ Gem::Specification.new do |s|
|
|
176
176
|
s.add_dependency(%q<net-scp>, [">= 1.0.2"])
|
177
177
|
s.add_dependency(%q<json>, [">= 1.2.0"])
|
178
178
|
s.add_dependency(%q<git-style-binaries>, [">= 0.1.10"])
|
179
|
-
s.add_dependency(%q<
|
179
|
+
s.add_dependency(%q<archive-tar-minitar>, ["= 0.5.2"])
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrantup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hashimoto
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtualbox
|
@@ -82,19 +82,19 @@ dependencies:
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 0.1.10
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: archive-tar-minitar
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - '
|
88
|
+
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
90
|
+
version: 0.5.2
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - '
|
95
|
+
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.
|
97
|
+
version: 0.5.2
|
98
98
|
description: Vagrant is a tool for building and distributing virtualized development
|
99
99
|
environments.
|
100
100
|
email:
|