vagrant-sandbox 0.1.0

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.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.1"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.1)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.8.7)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.5.1)
19
+ rcov
20
+ shoulda
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ Copyright 2010 Matt Tanase. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above
11
+ copyright notice, this list of conditions and the following
12
+ disclaimer in the documentation and/or other materials provided
13
+ with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY MATT TANASE ``AS IS'' AND ANY EXPRESS
16
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL MATT TANASE OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25
+ THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ The views and conclusions contained in the software and documentation
28
+ are those of the authors and should not be interpreted as representing
29
+ official policies, either expressed or implied, of Matt Tanase.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # vagrant-sandbox
2
+
3
+ `vagrant-sandbox` is a plugin for [Vagrant](http://vagrantup.com) which allows
4
+ a developer to execute sandbox tasks on the host using the `vagrant rake` command
5
+ and have them be invoked on the guest. This alleviates the need to SSH into
6
+ the VM to interact with sandboxes.
7
+
8
+ Built from mitchellh's [vagrant-rake](http://github.com/mitchellh/vagrant-rake) example
9
+
10
+
11
+ ## Installing / Getting Started
12
+
13
+ 'gem install vagrant-sandbox'
14
+
15
+ ## TODO
16
+
17
+ - vagrant sandbox use foo should drop user into sandbox foo (vagrant ssh; sandbox use foo)
18
+ - stream stdout/stderr
19
+ - bash completion
20
+ - usage messages
21
+ - shared folder assistance?
22
+
23
+
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "vagrant-sandbox"
16
+ gem.homepage = "http://github.com/zenmatt/vagrant-sandbox"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{run sandbox commands inside a VM using vagrant}
19
+ gem.description = %Q{A plugin to use sandbox commands with vagrant.}
20
+ gem.email = "matt@devstructure.com"
21
+ gem.authors = ["matt tanase"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+
27
+ # gem.add_runtime_dependency 'vagrant', '> 0.6.0'
28
+ # gem.add_runtime_dependency 'bundler', '>= 1.0.0'
29
+ end
30
+
31
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,13 @@
1
+ require 'vagrant'
2
+ require 'vagrant-sandbox/command'
3
+ require 'vagrant-sandbox/config'
4
+ require 'vagrant-sandbox/middleware'
5
+
6
+ sandbox = Vagrant::Action::Builder.new do
7
+ use VagrantSandbox::Middleware
8
+ end
9
+
10
+ Vagrant::Action.register(:sandbox, sandbox)
11
+
12
+ # Put this back in to avoid translation error message
13
+ I18n.load_path << File.expand_path("../../locales/en.yml", __FILE__)
@@ -0,0 +1,19 @@
1
+ module VagrantSandbox
2
+ class Command < Vagrant::Command::Base
3
+ register "sandbox", "Use the sandbox command with arguments"
4
+ argument :sandbox_command, :type => :array, :required => false, :desc => "The command to run on the VM via sandbox"
5
+
6
+ def execute
7
+ command = (sandbox_command || []).join(" ")
8
+ target_vms.each { |vm| execute_on_vm(vm, command) }
9
+ end
10
+
11
+ protected
12
+
13
+ # Executes a command on a specific VM.
14
+ def execute_on_vm(vm, command)
15
+ vm.env.actions.run(:sandbox, "sandbox.command" => command)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module VagrantSandbox
2
+
3
+ class Config < Vagrant::Config::Base
4
+ configures :sandbox
5
+
6
+ # for future configuration options in Vagrantfile
7
+ end
8
+
9
+ end
@@ -0,0 +1,30 @@
1
+ module VagrantSandbox
2
+
3
+ class Middleware
4
+
5
+ def initialize(app, env)
6
+ @app = app
7
+ @env = env
8
+ end
9
+
10
+ def call(env)
11
+ if env["vm"].created? && env["vm"].vm.running?
12
+ command = "sandbox #{env["sandbox.command"]}".strip
13
+
14
+ env["vm"].ssh.execute do |ssh|
15
+ env.ui.info I18n.t("vagrant.plugins.sandbox.executing", :command => command)
16
+
17
+ ssh.exec!("cd /home/vagrant; #{command}") do |channel, type, data|
18
+ $stdout.print(data) if type != :exit_status
19
+ end
20
+
21
+ $stdout.puts
22
+ end
23
+
24
+ end
25
+ @app.call(env)
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1 @@
1
+ require 'vagrant-sandbox'
data/locales/en.yml ADDED
@@ -0,0 +1,5 @@
1
+ en:
2
+ vagrant:
3
+ plugins:
4
+ sandbox:
5
+ executing: "Executing: %{command}"
Binary file
Binary file
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{vagrant-sandbox}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["matt tanase"]
12
+ s.date = %q{2010-12-03}
13
+ s.description = %q{A plugin to use sandbox commands with vagrant.}
14
+ s.email = %q{matt@devstructure.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "LICENSE",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/vagrant-sandbox.rb",
27
+ "lib/vagrant-sandbox/command.rb",
28
+ "lib/vagrant-sandbox/config.rb",
29
+ "lib/vagrant-sandbox/middleware.rb",
30
+ "lib/vagrant_init.rb",
31
+ "locales/en.yml",
32
+ "pkg/vagrant-sandbox-0.0.0.gem",
33
+ "pkg/vagrant-sandbox-0.0.1.gem",
34
+ "vagrant-sandbox.gemspec"
35
+ ]
36
+ s.homepage = %q{http://github.com/zenmatt/vagrant-sandbox}
37
+ s.licenses = ["MIT"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.7}
40
+ s.summary = %q{run sandbox commands inside a VM using vagrant}
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
48
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
49
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
50
+ s.add_development_dependency(%q<rcov>, [">= 0"])
51
+ else
52
+ s.add_dependency(%q<shoulda>, [">= 0"])
53
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
55
+ s.add_dependency(%q<rcov>, [">= 0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<shoulda>, [">= 0"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
61
+ s.add_dependency(%q<rcov>, [">= 0"])
62
+ end
63
+ end
64
+
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-sandbox
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - matt tanase
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-03 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: shoulda
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ prerelease: false
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 1
42
+ - 0
43
+ - 0
44
+ version: 1.0.0
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: jeweler
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 5
58
+ - 1
59
+ version: 1.5.1
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: rcov
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: *id004
76
+ description: A plugin to use sandbox commands with vagrant.
77
+ email: matt@devstructure.com
78
+ executables: []
79
+
80
+ extensions: []
81
+
82
+ extra_rdoc_files:
83
+ - LICENSE
84
+ - README.md
85
+ files:
86
+ - Gemfile
87
+ - Gemfile.lock
88
+ - LICENSE
89
+ - README.md
90
+ - Rakefile
91
+ - VERSION
92
+ - lib/vagrant-sandbox.rb
93
+ - lib/vagrant-sandbox/command.rb
94
+ - lib/vagrant-sandbox/config.rb
95
+ - lib/vagrant-sandbox/middleware.rb
96
+ - lib/vagrant_init.rb
97
+ - locales/en.yml
98
+ - pkg/vagrant-sandbox-0.0.0.gem
99
+ - pkg/vagrant-sandbox-0.0.1.gem
100
+ - vagrant-sandbox.gemspec
101
+ has_rdoc: true
102
+ homepage: http://github.com/zenmatt/vagrant-sandbox
103
+ licenses:
104
+ - MIT
105
+ post_install_message:
106
+ rdoc_options: []
107
+
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: -303641567179287884
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.7
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: run sandbox commands inside a VM using vagrant
134
+ test_files: []
135
+