vagrant-hostruby 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 +17 -0
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +1 -0
- data/lib/vagrant-hostruby.rb +36 -0
- data/vagrant-hostruby.gemspec +22 -0
- metadata +67 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# vagrant-hostruby
|
2
|
+
|
3
|
+
Provision Vagrant boxes with Ruby (on the host machine).
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
Add this line to your `Gemfile`:
|
8
|
+
|
9
|
+
gem "vagrant-hostruby"
|
10
|
+
|
11
|
+
And run:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Then, at the top of your `Vagrantfile` add:
|
16
|
+
|
17
|
+
require "vagrant-hostruby"
|
18
|
+
|
19
|
+
## Why?
|
20
|
+
|
21
|
+
Why use `vagrant-hostruby` when Vagrant itself already provides an API for
|
22
|
+
writing provisioners in Ruby?
|
23
|
+
|
24
|
+
Because the `:hostruby` provisioner lets you write a "micro-provisioner",
|
25
|
+
straigt into your `Vagrantfile`.
|
26
|
+
|
27
|
+
For example:
|
28
|
+
|
29
|
+
Vagrant::Config.run do |config|
|
30
|
+
|
31
|
+
config.vm.box = "precise64"
|
32
|
+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
33
|
+
|
34
|
+
config.vm.network :hostonly, "192.168.48.10"
|
35
|
+
|
36
|
+
config.vm.provision :hostruby, :provision => lambda { |env|
|
37
|
+
system "ansible-playbook setup.yml --limit=myvm -vv --private-key=#{env[:vm].env.default_private_key_path}"
|
38
|
+
}
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
## Details
|
43
|
+
|
44
|
+
The `:hostruby` provisioner takes 3 optional arguments:
|
45
|
+
|
46
|
+
* `:prepare`
|
47
|
+
* `:provision`
|
48
|
+
* `:cleanup`
|
49
|
+
|
50
|
+
Each takes a `Proc` to be called at the named stage during provisioning, which
|
51
|
+
will be yielded the same `env` variable that Vagrant makes available to
|
52
|
+
provisioners.
|
53
|
+
|
54
|
+
## Copyright
|
55
|
+
|
56
|
+
The MIT License
|
57
|
+
|
58
|
+
Copyright (C) 2012 by Chris Berkhout (http://chrisberkhout.com)
|
59
|
+
|
60
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
61
|
+
of this software and associated documentation files (the "Software"), to deal
|
62
|
+
in the Software without restriction, including without limitation the rights
|
63
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
64
|
+
copies of the Software, and to permit persons to whom the Software is
|
65
|
+
furnished to do so, subject to the following conditions:
|
66
|
+
|
67
|
+
The above copyright notice and this permission notice shall be included in
|
68
|
+
all copies or substantial portions of the Software.
|
69
|
+
|
70
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
71
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
72
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
73
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
74
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
75
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
76
|
+
THE SOFTWARE.
|
77
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module Vagrant
|
4
|
+
module Provisioners
|
5
|
+
class Hostruby < Base
|
6
|
+
|
7
|
+
VERSION = "0.0.1"
|
8
|
+
|
9
|
+
class Config < Config::Base
|
10
|
+
attr_accessor :prepare
|
11
|
+
attr_accessor :provision
|
12
|
+
attr_accessor :cleanup
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.config_class
|
16
|
+
Config
|
17
|
+
end
|
18
|
+
|
19
|
+
def prepare
|
20
|
+
config.prepare.call(env) if config.prepare
|
21
|
+
end
|
22
|
+
|
23
|
+
def provision!
|
24
|
+
config.provision.call(env) if config.provision
|
25
|
+
end
|
26
|
+
|
27
|
+
def cleanup
|
28
|
+
config.cleanup.call(env) if config.cleanup
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Vagrant.provisioners.register(:hostruby, Vagrant::Provisioners::Hostruby)
|
36
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "vagrant-hostruby"
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "vagrant-hostruby"
|
8
|
+
gem.version = Vagrant::Provisioners::Hostruby::VERSION
|
9
|
+
gem.authors = ["Chris Berkhout"]
|
10
|
+
gem.email = ["chrisberkhout@gmail.com"]
|
11
|
+
gem.description = %q{Provision Vagrant boxes with Ruby (on the host machine)}
|
12
|
+
gem.summary = %q{Provision Vagrant boxes with Ruby (on the host machine)}
|
13
|
+
gem.homepage = "https://github.com/chrisberkhout/vagrant-hostruby"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency("vagrant")
|
21
|
+
end
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-hostruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris Berkhout
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: vagrant
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Provision Vagrant boxes with Ruby (on the host machine)
|
31
|
+
email:
|
32
|
+
- chrisberkhout@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- Gemfile
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- lib/vagrant-hostruby.rb
|
42
|
+
- vagrant-hostruby.gemspec
|
43
|
+
homepage: https://github.com/chrisberkhout/vagrant-hostruby
|
44
|
+
licenses: []
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.8.24
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Provision Vagrant boxes with Ruby (on the host machine)
|
67
|
+
test_files: []
|