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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 74e5ef6c6f360e06f1c6ff6ab9b8f906745f23a6
4
+ data.tar.gz: f55a897b43459c928370a0914c1ff8e2245448f5
5
+ SHA512:
6
+ metadata.gz: 1545a0dd45bc68242a624ea00f3af69dc6db6dbcd99c0e42d81d824a9d19fafd12f0ae332c206677d4435a82ad55e2fb3727594fe1264f06ebfc5eb25d69841b
7
+ data.tar.gz: 076ed7d2360bfd733ec2e5fbd8493659b46323bcb16ddb1ed35dc21dc630977c3f096038459c5a8ea7d28194aa2db9341ecb91a841eab99755a7a9b80ad170f3
@@ -0,0 +1,11 @@
1
+ pkg/*
2
+ Vagrantfile
3
+ .vagrant
4
+ .bundle
5
+ *.lock
6
+ cookbooks/*
7
+ _site/*
8
+ !templates/*
9
+ *.org
10
+ .yardoc/
11
+ doc/
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.0"
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", ">= 1.2.0"
9
+ gem "tarruby", ">= 0.1.5"
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
@@ -0,0 +1,45 @@
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
+ ## Contributing to Vagrant
38
+
39
+ To hack on vagrant, you'll need [bundler](http://github.com/carlhuda/bundler) which can
40
+ be installed with a simple `sudo gem install bundler`. Afterwords, do the following:
41
+
42
+ bundle install
43
+ rake
44
+
45
+ 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 = "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.0')
14
+ gemspec.add_dependency('net-ssh', '>= 2.0.19')
15
+ gemspec.add_dependency('net-scp', '>= 1.0.2')
16
+ gemspec.add_dependency('json', '>= 1.2.0')
17
+ gemspec.add_dependency('git-style-binaries', '>= 0.1.10')
18
+ gemspec.add_dependency('tarruby', '>= 0.1.5')
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.1.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 "Somewhere between 0 and 0.1"
13
+
14
+ run { educate }
15
+ end
@@ -0,0 +1,35 @@
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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "manage boxes"
18
+ banner <<-EOS
19
+ Usage:
20
+
21
+ #{command.full_name} add name uri
22
+ #{command.full_name} remove name
23
+
24
+ Add and remove vagrant boxes.
25
+
26
+ EOS
27
+
28
+ run do |command|
29
+ begin
30
+ Vagrant::Commands.box(command.argv)
31
+ rescue ArgumentError
32
+ educate
33
+ end
34
+ end
35
+ 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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "destroys the vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Destroys the vagrant environment.
22
+
23
+ EOS
24
+
25
+ run do |command|
26
+ Vagrant::Commands.down
27
+ end
28
+ 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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "forcibly halts the vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Forcibly halts the vagrant environment. This is the equivalent
22
+ of pulling the power on your computer.
23
+
24
+ EOS
25
+
26
+ run do |command|
27
+ Vagrant::Commands.halt
28
+ end
29
+ 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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "initializes directory for vagrant use"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Creates the initial files required for using vagrant.
22
+
23
+ EOS
24
+
25
+ run do |command|
26
+ Vagrant::Commands.init
27
+ end
28
+ end
@@ -0,0 +1,30 @@
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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "package the current vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Package the current vagrant environment into a box.
22
+
23
+ EOS
24
+
25
+ opt :include, "files to include in the package", :type => :strings
26
+
27
+ run do |command|
28
+ Vagrant::Commands.package(command.argv[0], command.opts[:include])
29
+ end
30
+ end
@@ -0,0 +1,30 @@
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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "reload the vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Reloads the vagrant environment. This forces a shutdown of the VM,
22
+ updates the metadata (forwarded ports, shared folders, etc.), restarts
23
+ the VM, and reruns the chef recipes.
24
+
25
+ EOS
26
+
27
+ run do |command|
28
+ Vagrant::Commands.reload
29
+ end
30
+ 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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "resumes the vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Resumes the vagrant environment.
22
+
23
+ EOS
24
+
25
+ run do |command|
26
+ Vagrant::Commands.resume
27
+ end
28
+ 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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "opens an SSH connection into the VM"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Opens an SSH connection into the created VM.
22
+
23
+ EOS
24
+
25
+ run do |command|
26
+ Vagrant::Commands.ssh
27
+ end
28
+ 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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "suspends the vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Suspends the vagrant environment.
22
+
23
+ EOS
24
+
25
+ run do |command|
26
+ Vagrant::Commands.suspend
27
+ end
28
+ end
@@ -0,0 +1,30 @@
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
+ $:.unshift(libdir) unless $:.include?(libdir)
14
+ require 'vagrant'
15
+
16
+ GitStyleBinary.command do
17
+ short_desc "create the vagrant environment"
18
+ banner <<-EOS
19
+ Usage: #{command.full_name} #{all_options_string}
20
+
21
+ Create the vagrant environment if it doesn't exist,
22
+ otherwise start the vagrant environment if its not
23
+ already running.
24
+
25
+ EOS
26
+
27
+ run do |command|
28
+ Vagrant::Commands.up
29
+ end
30
+ end