vagrant 0.1.3 → 0.1.4.pre.a

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gem "net-ssh", ">= 2.0.19"
6
6
  gem "net-scp", ">= 1.0.2"
7
7
  gem "git-style-binaries", ">= 0.1.10"
8
8
  gem "json", ">= 1.2.0"
9
- gem "tarruby", ">= 0.1.5"
9
+ gem "archive-tar-minitar", ">= 0.5.2"
10
10
 
11
11
  # Gems required for testing only. To install run
12
12
  # gem bundle test
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('tarruby', '>= 0.1.5')
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.3
1
+ 0.1.4.pre.a
@@ -9,7 +9,7 @@ end
9
9
  require 'git-style-binary/command'
10
10
 
11
11
  GitStyleBinary.primary do
12
- version "0.1.3"
12
+ version "0.1.4.pre"
13
13
 
14
14
  run { educate }
15
15
  end
@@ -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 ftools json pathname logger uri net/http virtualbox net/ssh tarruby
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
 
@@ -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.open(@runner.temp_path, *TAR_OPTIONS) do |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
- Tar.open(tar_path, File::CREAT | File::WRONLY, 0644, Tar::GNU) do |tar|
42
- begin
43
- current_dir = FileUtils.pwd
44
- @include_files.each do |f|
45
- logger.info "Packaging additional file: #{f}"
46
- tar.append_file(f)
47
- end
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
- FileUtils.cd(temp_path)
51
+ FileUtils.cd(temp_path)
50
52
 
51
- # Append tree will append the entire directory tree unless a relative folder reference is used
52
- tar.append_tree(".")
53
- ensure
54
- FileUtils.cd(current_dir)
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
@@ -21,7 +21,7 @@ error
21
21
  end
22
22
 
23
23
  # Copy over the rootfile template into this directory
24
- File.copy(File.join(PROJECT_ROOT, "templates", Env::ROOTFILE_NAME), rootfile_path)
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
@@ -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
- @tar = mock("tar")
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
- @tar = mock("tar")
74
- Tar.stubs(:open).yields(@tar)
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
- Tar.expects(:open).with(@tar_path, File::CREAT | File::WRONLY, 0644, Tar::GNU).once
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 Tar.open
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
- @tar.expects(:append_tree).with(".").in_sequence(compress_seq)
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
- include_files = ['foo', 'bar']
106
- action = mock_action(Vagrant::Actions::VM::Package, "bing", include_files).last
107
- action.stubs(:temp_path).returns("foo")
108
- @tar.expects(:append_tree).with(".")
109
- include_files.each { |f| @tar.expects(:append_file).with(f) }
110
- action.compress
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(:append_tree).with(".")
115
- @tar.expects(:append_file).never
140
+ @tar.expects(:pack_file).never
141
+ Dir.expects(:glob).once.returns([])
116
142
  @action.compress
117
143
  end
118
144
  end
@@ -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(1)
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
- File.stubs(:copy)
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
- File.expects(:copy).with(@template_path, @rootfile_path).once
28
+ FileUtils.expects(:cp).with(@template_path, @rootfile_path).once
29
29
  Vagrant::Commands.init
30
30
  end
31
31
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vagrant}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4.pre.a"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mitchell Hashimoto", "John Bender"]
12
- s.date = %q{2010-03-08}
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<tarruby>, [">= 0.1.5"])
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<tarruby>, [">= 0.1.5"])
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<tarruby>, [">= 0.1.5"])
179
+ s.add_dependency(%q<archive-tar-minitar>, [">= 0.5.2"])
180
180
  end
181
181
  end
182
182
 
metadata CHANGED
@@ -1,12 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ - pre
10
+ - a
11
+ version: 0.1.4.pre.a
10
12
  platform: ruby
11
13
  authors:
12
14
  - Mitchell Hashimoto
@@ -15,7 +17,7 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2010-03-08 00:00:00 -08:00
20
+ date: 2010-03-09 00:00:00 -08:00
19
21
  default_executable:
20
22
  dependencies:
21
23
  - !ruby/object:Gem::Dependency
@@ -89,7 +91,7 @@ dependencies:
89
91
  type: :runtime
90
92
  version_requirements: *id005
91
93
  - !ruby/object:Gem::Dependency
92
- name: tarruby
94
+ name: archive-tar-minitar
93
95
  prerelease: false
94
96
  requirement: &id006 !ruby/object:Gem::Requirement
95
97
  requirements:
@@ -97,9 +99,9 @@ dependencies:
97
99
  - !ruby/object:Gem::Version
98
100
  segments:
99
101
  - 0
100
- - 1
101
102
  - 5
102
- version: 0.1.5
103
+ - 2
104
+ version: 0.5.2
103
105
  type: :runtime
104
106
  version_requirements: *id006
105
107
  description: Vagrant is a tool for building and distributing virtualized development environments.
@@ -232,11 +234,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
234
  version: "0"
233
235
  required_rubygems_version: !ruby/object:Gem::Requirement
234
236
  requirements:
235
- - - ">="
237
+ - - ">"
236
238
  - !ruby/object:Gem::Version
237
239
  segments:
238
- - 0
239
- version: "0"
240
+ - 1
241
+ - 3
242
+ - 1
243
+ version: 1.3.1
240
244
  requirements: []
241
245
 
242
246
  rubyforge_project: