vagrant-host-shell 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .vagrant
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-host-shell.gemspec
4
+ gemspec
5
+
6
+ # We depend on Vagrant for development, but we don't add it as a
7
+ # gem dependency because we expect to be installed within the
8
+ # Vagrant environment itself using `vagrant plugin`.
9
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Paul Hinze
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # vagrant-host-shell plugin
2
+
3
+ a vagrant provisioner to run commands on the host when a VM boots.
4
+
5
+ simple example based on question asked [on vagrant mailing list](https://groups.google.com/forum/#!topic/vagrant-up/CsNx-FErplY)
6
+
7
+ ## example usage
8
+
9
+ Install as a plugin:
10
+
11
+ ```
12
+ vagrant plugin install vagrant-host-shell
13
+ ```
14
+
15
+ Add this to `Vagrantfile`:
16
+
17
+ ```ruby
18
+ config.vm.provision :host_shell do |host_shell|
19
+ host_shell.inline = 'touch /tmp/hostshell-works'
20
+ end
21
+ ```
22
+
23
+ Run `vagrant up` (or `vagrant provision` if machine is already running.)
24
+
25
+ Observe that `/tmp/hostshell-works` is present on your host.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,13 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
5
+ require 'vagrant-host-shell'
6
+
7
+ Vagrant.configure("2") do |config|
8
+ config.vm.box = "precise64"
9
+
10
+ config.vm.provision :host_shell do |host_shell|
11
+ host_shell.inline = 'touch /tmp/hostshell-works'
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ module VagrantPlugins
2
+ module HostShell
3
+ end
4
+ end
5
+
6
+ require 'vagrant-host-shell/plugin'
@@ -0,0 +1,23 @@
1
+ module VagrantPlugins::HostShell
2
+ class Config < Vagrant.plugin('2', :config)
3
+ attr_accessor :inline
4
+
5
+ def initialize
6
+ @inline = UNSET_VALUE
7
+ end
8
+
9
+ def finalize!
10
+ @inline = nil if @inline == UNSET_VALUE
11
+ end
12
+
13
+ def validate(machine)
14
+ errors = _detected_errors
15
+
16
+ unless inline
17
+ errors << ':host_shell provisioner requires inline to be set'
18
+ end
19
+
20
+ { 'host shell provisioner' => errors }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ raise 'The vagrant-host-shell plugin must be run within Vagrant.'
5
+ end
6
+
7
+ module VagrantPlugins::HostShell
8
+ class Plugin < Vagrant.plugin('2')
9
+ name 'vagrant-host-shell'
10
+ description <<-DESC.gsub(/^ +/, '')
11
+ A simple provisioner to run commands on the host at machine
12
+ boot, instead of the guest.
13
+ DESC
14
+
15
+ config(:host_shell, :provisioner) do
16
+ require_relative 'config'
17
+ Config
18
+ end
19
+
20
+ provisioner(:host_shell) do
21
+ require_relative 'provisioner'
22
+ Provisioner
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ module VagrantPlugins::HostShell
2
+ class Provisioner < Vagrant.plugin('2', :provisioner)
3
+ def provision
4
+ Vagrant::Util::Subprocess.execute(
5
+ '/bin/bash',
6
+ '-c',
7
+ config.inline
8
+ )
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module HostShell
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'vagrant-host-shell/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "vagrant-host-shell"
9
+ spec.version = VagrantPlugins::HostShell::VERSION
10
+ spec.authors = ["Paul Hinze"]
11
+ spec.email = ["paul.t.hinze@gmail.com"]
12
+ spec.description = %q{a vagrant provisioner to run commands on the host}
13
+ spec.summary = %q{a vagrant provisioner to run commands on the host}
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-host-shell
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paul Hinze
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: a vagrant provisioner to run commands on the host
47
+ email:
48
+ - paul.t.hinze@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - examples/Vagrantfile
59
+ - lib/vagrant-host-shell.rb
60
+ - lib/vagrant-host-shell/config.rb
61
+ - lib/vagrant-host-shell/plugin.rb
62
+ - lib/vagrant-host-shell/provisioner.rb
63
+ - lib/vagrant-host-shell/version.rb
64
+ - vagrant-host-shell.gemspec
65
+ homepage: ''
66
+ licenses:
67
+ - MIT
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.23
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: a vagrant provisioner to run commands on the host
90
+ test_files: []
91
+ has_rdoc: