bmabey-vagrant 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/.gitignore +12 -0
  2. data/Gemfile +17 -0
  3. data/LICENSE +21 -0
  4. data/README.md +53 -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 +34 -0
  10. data/bin/vagrant-down +27 -0
  11. data/bin/vagrant-halt +28 -0
  12. data/bin/vagrant-init +27 -0
  13. data/bin/vagrant-package +29 -0
  14. data/bin/vagrant-reload +29 -0
  15. data/bin/vagrant-resume +27 -0
  16. data/bin/vagrant-ssh +27 -0
  17. data/bin/vagrant-status +29 -0
  18. data/bin/vagrant-suspend +27 -0
  19. data/bin/vagrant-up +29 -0
  20. data/config/default.rb +26 -0
  21. data/keys/README.md +10 -0
  22. data/keys/vagrant +27 -0
  23. data/keys/vagrant.pub +1 -0
  24. data/lib/vagrant.rb +19 -0
  25. data/lib/vagrant/actions/base.rb +118 -0
  26. data/lib/vagrant/actions/box/add.rb +22 -0
  27. data/lib/vagrant/actions/box/destroy.rb +14 -0
  28. data/lib/vagrant/actions/box/download.rb +72 -0
  29. data/lib/vagrant/actions/box/unpackage.rb +43 -0
  30. data/lib/vagrant/actions/collection.rb +36 -0
  31. data/lib/vagrant/actions/runner.rb +132 -0
  32. data/lib/vagrant/actions/vm/boot.rb +47 -0
  33. data/lib/vagrant/actions/vm/customize.rb +17 -0
  34. data/lib/vagrant/actions/vm/destroy.rb +23 -0
  35. data/lib/vagrant/actions/vm/down.rb +12 -0
  36. data/lib/vagrant/actions/vm/export.rb +41 -0
  37. data/lib/vagrant/actions/vm/forward_ports.rb +46 -0
  38. data/lib/vagrant/actions/vm/halt.rb +14 -0
  39. data/lib/vagrant/actions/vm/import.rb +18 -0
  40. data/lib/vagrant/actions/vm/move_hard_drive.rb +51 -0
  41. data/lib/vagrant/actions/vm/package.rb +65 -0
  42. data/lib/vagrant/actions/vm/provision.rb +49 -0
  43. data/lib/vagrant/actions/vm/reload.rb +17 -0
  44. data/lib/vagrant/actions/vm/resume.rb +16 -0
  45. data/lib/vagrant/actions/vm/shared_folders.rb +81 -0
  46. data/lib/vagrant/actions/vm/start.rb +18 -0
  47. data/lib/vagrant/actions/vm/suspend.rb +16 -0
  48. data/lib/vagrant/actions/vm/up.rb +40 -0
  49. data/lib/vagrant/active_list.rb +73 -0
  50. data/lib/vagrant/box.rb +152 -0
  51. data/lib/vagrant/busy.rb +73 -0
  52. data/lib/vagrant/commands.rb +219 -0
  53. data/lib/vagrant/config.rb +183 -0
  54. data/lib/vagrant/downloaders/base.rb +16 -0
  55. data/lib/vagrant/downloaders/file.rb +17 -0
  56. data/lib/vagrant/downloaders/http.rb +47 -0
  57. data/lib/vagrant/environment.rb +263 -0
  58. data/lib/vagrant/provisioners/base.rb +29 -0
  59. data/lib/vagrant/provisioners/chef.rb +103 -0
  60. data/lib/vagrant/provisioners/chef_server.rb +84 -0
  61. data/lib/vagrant/provisioners/chef_solo.rb +97 -0
  62. data/lib/vagrant/ssh.rb +104 -0
  63. data/lib/vagrant/util.rb +51 -0
  64. data/lib/vagrant/util/errors.rb +36 -0
  65. data/lib/vagrant/util/stacked_proc_runner.rb +35 -0
  66. data/lib/vagrant/util/template_renderer.rb +83 -0
  67. data/lib/vagrant/vm.rb +61 -0
  68. data/templates/Vagrantfile.erb +8 -0
  69. data/templates/errors.yml +117 -0
  70. data/test/test_helper.rb +163 -0
  71. data/test/vagrant/actions/base_test.rb +32 -0
  72. data/test/vagrant/actions/box/add_test.rb +37 -0
  73. data/test/vagrant/actions/box/destroy_test.rb +18 -0
  74. data/test/vagrant/actions/box/download_test.rb +131 -0
  75. data/test/vagrant/actions/box/unpackage_test.rb +100 -0
  76. data/test/vagrant/actions/collection_test.rb +110 -0
  77. data/test/vagrant/actions/runner_test.rb +265 -0
  78. data/test/vagrant/actions/vm/boot_test.rb +55 -0
  79. data/test/vagrant/actions/vm/customize_test.rb +16 -0
  80. data/test/vagrant/actions/vm/destroy_test.rb +36 -0
  81. data/test/vagrant/actions/vm/down_test.rb +32 -0
  82. data/test/vagrant/actions/vm/export_test.rb +88 -0
  83. data/test/vagrant/actions/vm/forward_ports_test.rb +104 -0
  84. data/test/vagrant/actions/vm/halt_test.rb +27 -0
  85. data/test/vagrant/actions/vm/import_test.rb +43 -0
  86. data/test/vagrant/actions/vm/move_hard_drive_test.rb +108 -0
  87. data/test/vagrant/actions/vm/package_test.rb +181 -0
  88. data/test/vagrant/actions/vm/provision_test.rb +108 -0
  89. data/test/vagrant/actions/vm/reload_test.rb +47 -0
  90. data/test/vagrant/actions/vm/resume_test.rb +27 -0
  91. data/test/vagrant/actions/vm/shared_folders_test.rb +176 -0
  92. data/test/vagrant/actions/vm/start_test.rb +36 -0
  93. data/test/vagrant/actions/vm/suspend_test.rb +27 -0
  94. data/test/vagrant/actions/vm/up_test.rb +107 -0
  95. data/test/vagrant/active_list_test.rb +190 -0
  96. data/test/vagrant/box_test.rb +151 -0
  97. data/test/vagrant/busy_test.rb +83 -0
  98. data/test/vagrant/commands_test.rb +307 -0
  99. data/test/vagrant/config_test.rb +256 -0
  100. data/test/vagrant/downloaders/base_test.rb +27 -0
  101. data/test/vagrant/downloaders/file_test.rb +26 -0
  102. data/test/vagrant/downloaders/http_test.rb +40 -0
  103. data/test/vagrant/environment_test.rb +607 -0
  104. data/test/vagrant/provisioners/base_test.rb +33 -0
  105. data/test/vagrant/provisioners/chef_server_test.rb +187 -0
  106. data/test/vagrant/provisioners/chef_solo_test.rb +149 -0
  107. data/test/vagrant/provisioners/chef_test.rb +117 -0
  108. data/test/vagrant/ssh_test.rb +222 -0
  109. data/test/vagrant/util/errors_test.rb +57 -0
  110. data/test/vagrant/util/stacked_proc_runner_test.rb +43 -0
  111. data/test/vagrant/util/template_renderer_test.rb +138 -0
  112. data/test/vagrant/util_test.rb +64 -0
  113. data/test/vagrant/vm_test.rb +114 -0
  114. data/vagrant.gemspec +216 -0
  115. metadata +285 -0
@@ -0,0 +1,12 @@
1
+ pkg/*
2
+ Vagrantfile
3
+ .vagrant
4
+ .bundle
5
+ *.lock
6
+ cookbooks/*
7
+ _site/*
8
+ !templates/*
9
+ *.org
10
+ .yardoc/
11
+ doc/
12
+ *.sw?
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source :gemcutter
2
+
3
+ # Gems required for the lib to even run
4
+ gem "virtualbox", ">= 0.5.4"
5
+ gem "net-ssh", ">= 2.0.19"
6
+ gem "net-scp", ">= 1.0.2"
7
+ gem "git-style-binaries", ">= 0.1.10"
8
+ gem "json_pure", ">= 1.2.0"
9
+ gem "archive-tar-minitar", ">= 0.5.2"
10
+
11
+ # Gems required for testing only. To install run
12
+ # gem bundle test
13
+ group :test do
14
+ gem "contest", ">= 0.1.2"
15
+ gem "mocha"
16
+ gem "ruby-debug", ">= 0.10.3" if RUBY_VERSION < '1.9'
17
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Mitchell Hashimoto and John Bender
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,53 @@
1
+ # Vagrant
2
+
3
+ * Website: [http://vagrantup.com](http://vagrantup.com)
4
+ * IRC: `#vagrant` on Freenode
5
+ * Mailng list: [Google Groups](http://groups.google.com/group/vagrant-up)
6
+
7
+ Vagrant is a tool for building and distributing virtualized development environments.
8
+
9
+ By providing automated creation and provisioning of virtual machines using [Sun’s VirtualBox](http://www.virtualbox.org),
10
+ Vagrant provides the tools to create and configure lightweight, reproducible, and portable
11
+ virtual environments. For more information, see the part of the getting started guide
12
+ on ”[Why Vagrant?](http://vagrantup.com/docs/getting-started/index.html)”
13
+
14
+ ## Quick Start
15
+
16
+ First, make sure your development machine has [VirtualBox](http://www.virtualbox.org)
17
+ installed. The setup from that point forward is very easy, since Vagrant is simply
18
+ a rubygem.
19
+
20
+ sudo gem install vagrant
21
+
22
+ To build your first virtual environment:
23
+
24
+ vagrant init
25
+ vagrant box add base http://files.vagrantup.com/base.box
26
+ vagrant up
27
+
28
+ ## Getting Started Guide and Video
29
+
30
+ To learn how to build a fully functional rails development environment, view the
31
+ [getting started guide](http://vagrantup.com/getting-started/index.html).
32
+
33
+ There is also a fairly short (12 minute) [getting started video](http://vimeo.com/9976342) which
34
+ explains how to build a fully functional LAMP development environment, which
35
+ covers a few parts of Vagrant in more detail than the website guide.
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
+
45
+ ## Contributing to Vagrant
46
+
47
+ To hack on vagrant, you'll need [bundler](http://github.com/carlhuda/bundler) which can
48
+ be installed with a simple `sudo gem install bundler`. Afterwords, do the following:
49
+
50
+ bundle install
51
+ rake
52
+
53
+ This will run the test suite, which should come back all green! Then you're good to go!
@@ -0,0 +1,41 @@
1
+ require 'rake/testtask'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gemspec|
6
+ gemspec.name = "bmabey-vagrant"
7
+ gemspec.summary = "Vagrant is a tool for building and distributing virtualized development environments."
8
+ gemspec.description = "Vagrant is a tool for building and distributing virtualized development environments."
9
+ gemspec.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
10
+ gemspec.homepage = "http://github.com/mitchellh/vagrant"
11
+ gemspec.authors = ["Mitchell Hashimoto", "John Bender"]
12
+
13
+ gemspec.add_dependency('virtualbox', '>= 0.5.4')
14
+ gemspec.add_dependency('net-ssh', '>= 2.0.19')
15
+ gemspec.add_dependency('net-scp', '>= 1.0.2')
16
+ gemspec.add_dependency('json_pure', '>= 1.2.0')
17
+ gemspec.add_dependency('git-style-binaries', '>= 0.1.10')
18
+ gemspec.add_dependency('archive-tar-minitar', '= 0.5.2')
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ task :default => :test
26
+
27
+ Rake::TestTask.new do |t|
28
+ t.libs << "test"
29
+ t.pattern = 'test/**/*_test.rb'
30
+ end
31
+
32
+ begin
33
+ require 'yard'
34
+ YARD::Rake::YardocTask.new do |t|
35
+ t.options = ['--main', 'README.md', '--markup', 'markdown']
36
+ t.options += ['--title', 'Vagrant Developer Documentation']
37
+ end
38
+ rescue LoadError
39
+ puts "Yard not available. Install it with: gem install yard"
40
+ puts "if you wish to be able to generate developer documentation."
41
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
File without changes
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ GitStyleBinary.primary do
12
+ version "0.2.0"
13
+
14
+ run { educate }
15
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "manage boxes"
17
+ banner <<-EOS
18
+ Usage:
19
+
20
+ #{command.full_name} add name uri
21
+ #{command.full_name} remove name
22
+
23
+ Add and remove vagrant boxes.
24
+
25
+ EOS
26
+
27
+ run do |command|
28
+ begin
29
+ Vagrant::Commands.execute(:box, command.argv)
30
+ rescue ArgumentError
31
+ educate
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "destroys the vagrant environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Destroys the vagrant environment.
21
+
22
+ EOS
23
+
24
+ run do |command|
25
+ Vagrant::Commands.execute(:down)
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "forcibly halts the vagrant environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Forcibly halts the vagrant environment. This is the equivalent
21
+ of pulling the power on your computer.
22
+
23
+ EOS
24
+
25
+ run do |command|
26
+ Vagrant::Commands.execute(:halt)
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "initializes directory for vagrant use"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Creates the initial files required for using vagrant.
21
+
22
+ EOS
23
+
24
+ run do |command|
25
+ Vagrant::Commands.init(command.argv[0])
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "package the current vagrant environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Package the current vagrant environment into a box.
21
+
22
+ EOS
23
+
24
+ opt :include, "files to include in the package", :type => :strings
25
+
26
+ run do |command|
27
+ Vagrant::Commands.execute(:package, command.argv[0], command.opts[:include])
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "reload the vagrant environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Reloads the vagrant environment. This forces a shutdown of the VM,
21
+ updates the metadata (forwarded ports, shared folders, etc.), restarts
22
+ the VM, and reruns the chef recipes.
23
+
24
+ EOS
25
+
26
+ run do |command|
27
+ Vagrant::Commands.execute(:reload)
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "resumes the vagrant environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Resumes the vagrant environment.
21
+
22
+ EOS
23
+
24
+ run do |command|
25
+ Vagrant::Commands.execute(:resume)
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "opens an SSH connection into the VM"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Opens an SSH connection into the created VM.
21
+
22
+ EOS
23
+
24
+ run do |command|
25
+ Vagrant::Commands.execute(:ssh)
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "Outputs the status of the current environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ This command outputs the status of the current environment. This command
21
+ tells you whether the environment is created, running, suspended,
22
+ etc.
23
+
24
+ EOS
25
+
26
+ run do |command|
27
+ Vagrant::Commands.execute(:status)
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ # Fallback on rubygems
6
+ require "rubygems"
7
+ end
8
+
9
+ require 'git-style-binary/command'
10
+
11
+ # Get library
12
+ libdir = File.join(File.dirname(__FILE__), '..', 'lib')
13
+ require File.expand_path('vagrant', libdir)
14
+
15
+ GitStyleBinary.command do
16
+ short_desc "suspends the vagrant environment"
17
+ banner <<-EOS
18
+ Usage: #{command.full_name} #{all_options_string}
19
+
20
+ Suspends the vagrant environment.
21
+
22
+ EOS
23
+
24
+ run do |command|
25
+ Vagrant::Commands.execute(:suspend)
26
+ end
27
+ end