vagrant-babushka 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +58 -19
- data/Vagrantfile +30 -0
- data/lib/vagrant-babushka/config.rb +46 -4
- data/lib/vagrant-babushka/dep.rb +82 -0
- data/lib/vagrant-babushka/plugin.rb +5 -1
- data/lib/vagrant-babushka/provisioner.rb +27 -4
- data/lib/vagrant-babushka/version.rb +1 -1
- data/lib/vagrant-babushka.rb +7 -1
- data/spec/spec_helper.rb +14 -0
- data/spec/unit/vagrant-babushka/config_spec.rb +65 -0
- data/spec/unit/vagrant-babushka/dep_spec.rb +73 -0
- data/vagrant-babushka.gemspec +8 -3
- metadata +77 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d8d6401a57d7fe37be1f75b453417e0bebfe344
|
4
|
+
data.tar.gz: ba4180b390bdbcea4612f3c05bf378b23bb0af86
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1d2a4980561b92ef73a65112896fd274e8523994620949eb9a04255eac5a54e97e105559ffee1b8bac1d45598d54a0b5b61e09ba750e9fd20d44759ae6ff7a55
|
7
|
+
data.tar.gz: 80bada052a188da60332fc2e3e1711e229eb391d4328c10324117e8f802d37d50ee2808798c0be658886834810168ea9303ba90fc166579018b318a98f9492fc
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -2,3 +2,10 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in vagrant-babushka.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
# Depend on Vagrant for development and testing. It isn't added to
|
8
|
+
# the Gem specification, because it's not usually required for normal
|
9
|
+
# use.
|
10
|
+
gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :tag => 'v1.3.5'
|
11
|
+
end
|
data/LICENSE.txt
CHANGED
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
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.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,30 +1,66 @@
|
|
1
|
-
# Vagrant Provisioner Babushka
|
1
|
+
# Vagrant Provisioner Babushka
|
2
|
+
|
3
|
+
A [Vagrant][1] plugin which allows virtual machines to be provisioned
|
4
|
+
using [Babushka][2].
|
5
|
+
|
6
|
+
Based on a [plugin concept][3] by @tcurdt.
|
7
|
+
|
8
|
+
[1]: <https://www.vagrantup.com>
|
9
|
+
[2]: <https://babushka.me>
|
10
|
+
[3]: <https://github.com/tcurdt/vagrant-boxes/blob/master/plugins/babushka_provisioner.rb>
|
2
11
|
|
3
|
-
Based on plugin created by @tcurdt
|
4
|
-
https://github.com/tcurdt/vagrant-boxes/blob/master/plugins/babushka_provisioner.rb
|
5
12
|
|
6
13
|
## Installation
|
7
14
|
|
8
|
-
|
15
|
+
```bash
|
16
|
+
vagrant plugin install vagrant-babushka
|
17
|
+
```
|
18
|
+
|
9
19
|
|
10
20
|
## Usage
|
11
21
|
|
12
|
-
|
22
|
+
Add a Babushka provision block to your project's Vagrantfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
config.vm.provision :babushka do |babushka|
|
26
|
+
# Set the Git branch of Babushka to install on the guest (defaults to master)
|
27
|
+
babushka.bootstrap_branch = 'master'
|
28
|
+
|
29
|
+
# Share a directory of local Babushka deps with the VM
|
30
|
+
# This example shares the '.deps/' directory (relative to this
|
31
|
+
# Vagrantfile) to '~/babushka-deps' on the guest machine (in the home
|
32
|
+
# directory of the main SSH user on the guest)
|
33
|
+
babushka.local_deps_path = '.deps'
|
34
|
+
|
35
|
+
# Meet a local dep
|
36
|
+
# Assuming a dep named 'htop' is defined in a file under './.deps'
|
37
|
+
babushka.meet 'htop'
|
38
|
+
|
39
|
+
# Meet a remote dep
|
40
|
+
# Assuming source 'tcurdt' has a dep named 'rbenv system'
|
41
|
+
babushka.meet 'rbenv system', :source => 'tcurdt'
|
13
42
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
43
|
+
# Also, you can set options for deps
|
44
|
+
babushka.meet 'rbenv system', :params => {:key => "value"}
|
45
|
+
# or for remote dep
|
46
|
+
babushka.meet 'rbenv system', :source => 'tcurdt', :params => {:key => "value"}
|
47
|
+
|
48
|
+
|
49
|
+
# Old, **DEPRECATED**, but working syntax
|
50
|
+
|
51
|
+
# Meet a local dep
|
52
|
+
# Assuming a dep named 'htop' is defined in a file under './.deps'
|
53
|
+
babushka.local_dep 'htop'
|
54
|
+
|
55
|
+
# Meet a remote dep
|
56
|
+
# Assuming source 'tcurdt' has a dep named 'rbenv system'
|
57
|
+
babushka.remote_dep 'tcurdt', 'rbenv system'
|
58
|
+
|
59
|
+
# Also, you can set options for deps, using a hash as the third parameter
|
60
|
+
babushka.remote_dep 'tcurdt', 'rbenv system', :path => '/opt/rbenv'
|
61
|
+
end
|
62
|
+
```
|
26
63
|
|
27
|
-
Also you can add options to deps giving hash as third parameter
|
28
64
|
|
29
65
|
## Contributing
|
30
66
|
|
@@ -34,10 +70,13 @@ Also you can add options to deps giving hash as third parameter
|
|
34
70
|
4. Push to the branch (`git push origin my-new-feature`)
|
35
71
|
5. Create new Pull Request
|
36
72
|
|
73
|
+
|
37
74
|
## Thanks
|
75
|
+
|
38
76
|
[patcon](https://github.com/patcon)
|
39
77
|
[wakeless](https://github.com/wakeless)
|
40
|
-
[Val](https://github.com/Val)
|
78
|
+
[Val](https://github.com/Val)
|
79
|
+
[bradfeehan](https://github.com/bradfeehan)
|
41
80
|
|
42
81
|
## License
|
43
82
|
|
data/Vagrantfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
# All Vagrant configuration is done here. The most common configuration
|
9
|
+
# options are documented and commented below. For a complete reference,
|
10
|
+
# please see the online documentation at vagrantup.com.
|
11
|
+
|
12
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
13
|
+
config.vm.box = "precise64"
|
14
|
+
|
15
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
16
|
+
# doesn't already exist on the user's system.
|
17
|
+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
18
|
+
|
19
|
+
# Create a private network, which allows host-only access to the machine
|
20
|
+
# using a specific IP.
|
21
|
+
config.vm.network :private_network, ip: "192.168.33.10"
|
22
|
+
|
23
|
+
# Add the vagrant-babushka plugin to bundled Vagrant
|
24
|
+
Vagrant.require_plugin "vagrant-babushka"
|
25
|
+
|
26
|
+
# Provision using Babushka
|
27
|
+
config.vm.provision :babushka do |babushka|
|
28
|
+
#
|
29
|
+
end
|
30
|
+
end
|
@@ -1,27 +1,69 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Babushka
|
3
|
+
# Main configuration object for Vagrant Babushka provisioner
|
3
4
|
class Config < Vagrant.plugin("2", :config)
|
4
5
|
attr_accessor :args, :deps, :local_deps_path, :bootstrap_branch
|
6
|
+
attr_reader :messages
|
5
7
|
|
6
8
|
def initialize
|
7
9
|
super
|
8
10
|
@deps = []
|
9
11
|
@local_deps_path = UNSET_VALUE
|
10
12
|
@bootstrap_branch = UNSET_VALUE
|
13
|
+
@messages = []
|
11
14
|
end
|
12
15
|
|
16
|
+
# This is called as a last-minute hook that allows the
|
17
|
+
# configuration object to finalize itself before it will be put
|
18
|
+
# into use. This is a useful place to do some defaults in the
|
19
|
+
# case the user didn't configure something or so on.
|
13
20
|
def finalize!
|
14
21
|
@deps = [] if @deps == UNSET_VALUE
|
15
22
|
@local_deps_path = nil if @local_deps_path == UNSET_VALUE
|
16
23
|
@bootstrap_branch = nil if @bootstrap_branch == UNSET_VALUE
|
17
24
|
end
|
18
25
|
|
19
|
-
|
20
|
-
|
26
|
+
# Meets a local dep on the guest
|
27
|
+
#
|
28
|
+
# NOTE: This method is deprecated. Please use the new #meet
|
29
|
+
# instead.
|
30
|
+
#
|
31
|
+
# * dep_name: The name of the dep to meet
|
32
|
+
# * params: Parameter options to pass to the dep (optional)
|
33
|
+
def local_dep(dep_name, params = {})
|
34
|
+
@messages << [:warn, "#local_dep is deprecated, use #meet", caller]
|
35
|
+
@deps << Dep.new(dep_name, :params => params)
|
21
36
|
end
|
22
37
|
|
23
|
-
|
24
|
-
|
38
|
+
# Meets a remote dep on the guest
|
39
|
+
#
|
40
|
+
# NOTE: This method is deprecated. Please use the new #meet
|
41
|
+
# instead.
|
42
|
+
#
|
43
|
+
# * source: The name of the dep's source (GitHub username)
|
44
|
+
# * dep_name: The name of the dep to meet
|
45
|
+
# * params: Parameter options to pass to the dep (optional)
|
46
|
+
def remote_dep(source, dep_name, params = {})
|
47
|
+
@messages << [:warn, "#remote_dep is deprecated, use #meet", caller]
|
48
|
+
@deps << Dep.new(dep_name, :source => source, :params => params)
|
49
|
+
end
|
50
|
+
|
51
|
+
# The main method to meet deps on the guest virtual machine
|
52
|
+
#
|
53
|
+
# This method adds a single dep to a list of deps to be met on
|
54
|
+
# the virtual machine. This method replaces the older #local_dep
|
55
|
+
# and #remote_dep, unifying the interface for both remote and
|
56
|
+
# local deps.
|
57
|
+
#
|
58
|
+
# * dep_name: The name of the dep (excluding source prefix)
|
59
|
+
# * options: A Hash of options. Valid keys:
|
60
|
+
# * source: The name of the source containing the dep
|
61
|
+
# (will be used as a source prefix if provided,
|
62
|
+
# otherwise no source prefix will be used)
|
63
|
+
# * params: A Hash of parameters to pass to the dep
|
64
|
+
# (mapping parameter names as keys to values)
|
65
|
+
def meet(dep_name, options = {})
|
66
|
+
@deps << Dep.new(dep_name, options)
|
25
67
|
end
|
26
68
|
end
|
27
69
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Babushka
|
3
|
+
# A class representing a Babushka dep that should be met
|
4
|
+
#
|
5
|
+
# This represents the dep after parameters are bound (if there are
|
6
|
+
# any). So it's not so much a "dep", but more in line with the
|
7
|
+
# "DepRequirement" class from Babushka itself.
|
8
|
+
class Dep
|
9
|
+
attr_reader :dep_name
|
10
|
+
|
11
|
+
# Initialezes a dep from a name and options
|
12
|
+
#
|
13
|
+
# * dep_name: The name of the dep (excluding source prefix)
|
14
|
+
# * options: A Hash of options. Valid keys:
|
15
|
+
# * source: The name of the source containing the dep
|
16
|
+
# (will be used as a source prefix if provided,
|
17
|
+
# otherwise no source prefix will be used)
|
18
|
+
# * params: A Hash of parameters to pass to the dep
|
19
|
+
# (mapping parameter names as keys to values)
|
20
|
+
def initialize(dep_name, options = {})
|
21
|
+
@dep_name = dep_name.to_s
|
22
|
+
@options = options
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieves the full name of this dep (including source prefix)
|
26
|
+
#
|
27
|
+
# This will be in the format "source:dep_name" if a source was
|
28
|
+
# specified, otherwise it will be the bare dep name (in which
|
29
|
+
# case Babushka would look for it in the default sources).
|
30
|
+
def id
|
31
|
+
if source
|
32
|
+
"#{source}:#{dep_name}"
|
33
|
+
else
|
34
|
+
dep_name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Determines the source that this dep belongs to
|
39
|
+
#
|
40
|
+
# If the source can't be determined (a source wasn't specified),
|
41
|
+
# nil is returned.
|
42
|
+
def source
|
43
|
+
@options[:source] ? @options[:source].to_s : nil
|
44
|
+
end
|
45
|
+
|
46
|
+
# Retrieves the parameters for the dep
|
47
|
+
#
|
48
|
+
# Parameters are values for variables that the dep accepts. This
|
49
|
+
# method returns a Hash mapping parameter names as keys to their
|
50
|
+
# values.
|
51
|
+
def params
|
52
|
+
@options[:params] || Hash.new
|
53
|
+
end
|
54
|
+
|
55
|
+
# Creates a command string to use for this dep on the command line
|
56
|
+
#
|
57
|
+
# This will return a string which can be used as an argument to
|
58
|
+
# "babushka meet" to meet this dep with its parameters.
|
59
|
+
def command
|
60
|
+
values = params.map {|k, v| "#{escape k}=#{escape v}" }
|
61
|
+
[escape(id), values].flatten.join(" ")
|
62
|
+
end
|
63
|
+
|
64
|
+
def ==(other)
|
65
|
+
other.class == self.class && other.state == state
|
66
|
+
end
|
67
|
+
alias_method :eql?, :==
|
68
|
+
|
69
|
+
protected
|
70
|
+
# An array of state data used to compare and test for equality
|
71
|
+
def state
|
72
|
+
[@dep_name, @options[:params], @options[:source]]
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
# Alias for Shellwords.escape
|
77
|
+
def escape(string)
|
78
|
+
Shellwords.escape(string.to_s)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -2,6 +2,10 @@ module VagrantPlugins
|
|
2
2
|
module Babushka
|
3
3
|
class Plugin < Vagrant.plugin("2")
|
4
4
|
name "Babushka"
|
5
|
+
description <<-END
|
6
|
+
Provides support for provisioning your virtual machines using
|
7
|
+
Babushka.
|
8
|
+
END
|
5
9
|
|
6
10
|
config :babushka, :provisioner do
|
7
11
|
require_relative "config"
|
@@ -14,4 +18,4 @@ module VagrantPlugins
|
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
17
|
-
end
|
21
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Babushka
|
3
|
+
# The main implementation class for the Babushka provisioner
|
3
4
|
class Provisioner < Vagrant.plugin("2", :provisioner)
|
4
5
|
|
5
6
|
def initialize(machine, config)
|
@@ -7,7 +8,7 @@ module VagrantPlugins
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def configure(root_config)
|
10
|
-
@username = root_config.ssh.username
|
11
|
+
@username = root_config.ssh.username || root_config.ssh.default.username
|
11
12
|
@hostname = root_config.vm.hostname
|
12
13
|
if @config.local_deps_path
|
13
14
|
local_path = @config.local_deps_path
|
@@ -17,16 +18,33 @@ module VagrantPlugins
|
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
21
|
+
# This is the method called when the actual provisioning should
|
22
|
+
# be done. The communicator is guaranteed to be ready at this
|
23
|
+
# point, and any shared folders or networds are already set up.
|
20
24
|
def provision
|
25
|
+
render_messages!
|
21
26
|
bootstrap_babushka! unless @machine.communicate.test('babushka --version')
|
22
|
-
@config.deps.map do |
|
23
|
-
|
24
|
-
run_remote "babushka --update --defaults --colour #{dep_source}'#{dep_name}' #{args}"
|
27
|
+
@config.deps.map do |dep|
|
28
|
+
run_remote "babushka --update --defaults --color #{dep.command}"
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
28
32
|
private
|
33
|
+
# Renders the messages to the log output
|
34
|
+
#
|
35
|
+
# The config object maintains a list of "messages" to be shown
|
36
|
+
# when provisioning occurs, since there's no way to show messages
|
37
|
+
# at the time of configuration actually occurring. This displays
|
38
|
+
# the messages that were saved.
|
39
|
+
def render_messages!
|
40
|
+
@config.messages.each do |(level, info, caller)|
|
41
|
+
info = "vagrant-babushka: #{info}"
|
42
|
+
info += "\nIn #{caller.first}" unless caller.nil?
|
43
|
+
@machine.env.ui.send level.to_sym, info.to_s, :scope => @machine.name
|
44
|
+
end
|
45
|
+
end
|
29
46
|
|
47
|
+
# Installs Babushka on the guest using the bootstrap script
|
30
48
|
def bootstrap_babushka!
|
31
49
|
require 'net/http'
|
32
50
|
@machine.env.ui.info("Installing babushka on #{@hostname}.")
|
@@ -36,6 +54,7 @@ module VagrantPlugins
|
|
36
54
|
run_remote "#{proxy_env} sh #{remote_tmpfile}"
|
37
55
|
end
|
38
56
|
|
57
|
+
# Extracts the HTTPS proxy from the host environment variables
|
39
58
|
def proxy_env
|
40
59
|
vars = ''
|
41
60
|
vars_from_env = ENV.select { |k, _| /https_proxy/i.match(k) }
|
@@ -43,12 +62,16 @@ module VagrantPlugins
|
|
43
62
|
vars
|
44
63
|
end
|
45
64
|
|
65
|
+
# Retrieves the URL to use to bootstrap Babushka on the guest
|
46
66
|
def babushka_uri
|
47
67
|
uri = 'https://babushka.me/up'
|
48
68
|
uri = "#{uri}/#{@config.bootstrap_branch}" unless @config.bootstrap_branch.nil?
|
49
69
|
uri
|
50
70
|
end
|
51
71
|
|
72
|
+
# Executes a command on the guest and handles logging the output
|
73
|
+
#
|
74
|
+
# * command: The command to execute (as a string)
|
52
75
|
def run_remote(command)
|
53
76
|
@machine.communicate.sudo(command) do |type, data|
|
54
77
|
color = type == :stdout ? :green : :red
|
data/lib/vagrant-babushka.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "vagrant-babushka must be loaded from within Vagrant."
|
5
|
+
end
|
6
|
+
|
1
7
|
require "vagrant-babushka/version"
|
8
|
+
require "vagrant-babushka/dep"
|
2
9
|
require "vagrant-babushka/config"
|
3
10
|
require "vagrant-babushka/provisioner"
|
4
11
|
require "vagrant-babushka/plugin"
|
5
|
-
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "vagrant-babushka"
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
# Forbid .should syntax
|
5
|
+
config.expect_with :rspec do |c|
|
6
|
+
c.syntax = :expect
|
7
|
+
end
|
8
|
+
|
9
|
+
# Run specs in random order to surface order dependencies. If you find an
|
10
|
+
# order dependency and want to debug it, you can fix the order by providing
|
11
|
+
# the seed, which is printed after each run.
|
12
|
+
# --seed 1234
|
13
|
+
config.order = "random"
|
14
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VagrantPlugins::Babushka::Config do
|
4
|
+
let(:unset_value) { described_class::UNSET_VALUE }
|
5
|
+
let(:config) { described_class.new }
|
6
|
+
|
7
|
+
context "with default configuration" do
|
8
|
+
before { subject.finalize! }
|
9
|
+
its(:deps) { should eq [] }
|
10
|
+
its(:local_deps_path) { should be_nil }
|
11
|
+
its(:bootstrap_branch) { should be_nil }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#local_deps_path" do
|
15
|
+
before { subject.local_deps_path = '.deps' }
|
16
|
+
its(:local_deps_path) { should eq '.deps' }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#bootstrap_branch" do
|
20
|
+
before { subject.bootstrap_branch = 'new' }
|
21
|
+
its(:bootstrap_branch) { should eq 'new' }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#local_dep" do
|
25
|
+
before do
|
26
|
+
subject.local_dep 'foobar', :baz => :qux
|
27
|
+
subject.local_dep 'testme', :one => :two
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should store the deps correctly" do
|
31
|
+
expect(subject.deps).to eq [
|
32
|
+
VagrantPlugins::Babushka::Dep.new('foobar', :params => {:baz => :qux}),
|
33
|
+
VagrantPlugins::Babushka::Dep.new('testme', :params => {:one => :two}),
|
34
|
+
]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#remote_dep" do
|
39
|
+
before do
|
40
|
+
subject.remote_dep 'user1', 'foobar', :baz => :qux
|
41
|
+
subject.remote_dep 'user2', 'testme', :one => :two
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should store the deps correctly" do
|
45
|
+
expect(subject.deps).to eq [
|
46
|
+
VagrantPlugins::Babushka::Dep.new('foobar', :params => {:baz => :qux}, :source => 'user1'),
|
47
|
+
VagrantPlugins::Babushka::Dep.new('testme', :params => {:one => :two}, :source => 'user2'),
|
48
|
+
]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "#meet" do
|
53
|
+
before {
|
54
|
+
subject.meet 'test1', :source => 'user1', :params => {:abc => :def}
|
55
|
+
subject.meet 'test2', :source => 'user2', :params => {:ghi => :jkl}
|
56
|
+
}
|
57
|
+
|
58
|
+
it "should store the deps correctly" do
|
59
|
+
expect(subject.deps).to eq [
|
60
|
+
VagrantPlugins::Babushka::Dep.new('test1', :params => {:abc => :def}, :source => 'user1'),
|
61
|
+
VagrantPlugins::Babushka::Dep.new('test2', :params => {:ghi => :jkl}, :source => 'user2'),
|
62
|
+
]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VagrantPlugins::Babushka::Dep do
|
4
|
+
let(:dep_name) { double "dep_name", :to_s => "the dep" }
|
5
|
+
let(:options) { Hash.new }
|
6
|
+
let(:dep) { described_class.new dep_name, options }
|
7
|
+
let(:subject) { dep }
|
8
|
+
|
9
|
+
describe "#dep_name" do
|
10
|
+
subject { dep.dep_name }
|
11
|
+
it { should eq dep_name.to_s }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#id" do
|
15
|
+
subject { dep.id }
|
16
|
+
it { should eq dep_name.to_s }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#source" do
|
20
|
+
subject { dep.source }
|
21
|
+
it { should be_nil }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#command" do
|
25
|
+
subject { dep.command }
|
26
|
+
it { should eq "the\\ dep" }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with source" do
|
30
|
+
let(:options) { {:source => source} }
|
31
|
+
let(:source) { double "source", :to_s => "the source" }
|
32
|
+
|
33
|
+
describe "#id" do
|
34
|
+
subject { dep.id }
|
35
|
+
it { should eq "#{source}:#{dep_name}" }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#source" do
|
39
|
+
subject { dep.source }
|
40
|
+
it { should eq source.to_s }
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#command" do
|
44
|
+
subject { dep.command }
|
45
|
+
it { should eq "the\\ source:the\\ dep" }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "with params" do
|
50
|
+
let(:options) { {:params => params} }
|
51
|
+
let(:params) { {:foo => :bar, :baz => :qux} }
|
52
|
+
|
53
|
+
describe "#params" do
|
54
|
+
subject { dep.params }
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#command" do
|
58
|
+
subject { dep.command }
|
59
|
+
it { should eq "the\\ dep foo=bar baz=qux" }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "with source and params" do
|
64
|
+
let(:options) { {:params => params, :source => source} }
|
65
|
+
let(:params) { {:foo => :bar, :baz => :qux} }
|
66
|
+
let(:source) { double "source", :to_s => "the source" }
|
67
|
+
|
68
|
+
describe "#command" do
|
69
|
+
subject { dep.command }
|
70
|
+
it { should eq "the\\ source:the\\ dep foo=bar baz=qux" }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/vagrant-babushka.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = "vagrant-babushka"
|
8
8
|
gem.version = VagrantPlugins::Babushka::VERSION
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.authors = ["Vladimir Valgis"]
|
10
|
+
gem.authors = ["Vladimir Valgis", "Brad Feehan"]
|
11
11
|
gem.email = ["vladimir.valgis@gmail.com"]
|
12
|
-
gem.description =
|
13
|
-
gem.summary =
|
12
|
+
gem.description = "A Vagrant plugin which allows virtual machines to be provisioned using Babushka."
|
13
|
+
gem.summary = "A Babushka provisioner for Vagrant"
|
14
14
|
gem.homepage = "https://github.com/vvalgis/vagrant-babushka"
|
15
15
|
gem.license = 'MIT'
|
16
16
|
|
@@ -18,4 +18,9 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
20
|
gem.require_paths = ["lib"]
|
21
|
+
|
22
|
+
gem.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
gem.add_development_dependency "rake"
|
24
|
+
gem.add_development_dependency "rspec"
|
25
|
+
gem.add_development_dependency "its"
|
21
26
|
end
|
metadata
CHANGED
@@ -1,17 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-babushka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Vladimir Valgis
|
8
|
+
- Brad Feehan
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.3'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.3'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: its
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
description: A Vagrant plugin which allows virtual machines to be provisioned using
|
71
|
+
Babushka.
|
15
72
|
email:
|
16
73
|
- vladimir.valgis@gmail.com
|
17
74
|
executables: []
|
@@ -23,35 +80,42 @@ files:
|
|
23
80
|
- LICENSE.txt
|
24
81
|
- README.md
|
25
82
|
- Rakefile
|
83
|
+
- Vagrantfile
|
26
84
|
- lib/vagrant-babushka.rb
|
27
85
|
- lib/vagrant-babushka/config.rb
|
86
|
+
- lib/vagrant-babushka/dep.rb
|
28
87
|
- lib/vagrant-babushka/plugin.rb
|
29
88
|
- lib/vagrant-babushka/provisioner.rb
|
30
89
|
- lib/vagrant-babushka/version.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- spec/unit/vagrant-babushka/config_spec.rb
|
92
|
+
- spec/unit/vagrant-babushka/dep_spec.rb
|
31
93
|
- vagrant-babushka.gemspec
|
32
94
|
homepage: https://github.com/vvalgis/vagrant-babushka
|
33
95
|
licenses:
|
34
96
|
- MIT
|
97
|
+
metadata: {}
|
35
98
|
post_install_message:
|
36
99
|
rdoc_options: []
|
37
100
|
require_paths:
|
38
101
|
- lib
|
39
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
103
|
requirements:
|
42
|
-
- -
|
104
|
+
- - '>='
|
43
105
|
- !ruby/object:Gem::Version
|
44
106
|
version: '0'
|
45
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
108
|
requirements:
|
48
|
-
- -
|
109
|
+
- - '>='
|
49
110
|
- !ruby/object:Gem::Version
|
50
111
|
version: '0'
|
51
112
|
requirements: []
|
52
113
|
rubyforge_project:
|
53
|
-
rubygems_version:
|
114
|
+
rubygems_version: 2.0.3
|
54
115
|
signing_key:
|
55
|
-
specification_version:
|
56
|
-
summary:
|
57
|
-
test_files:
|
116
|
+
specification_version: 4
|
117
|
+
summary: A Babushka provisioner for Vagrant
|
118
|
+
test_files:
|
119
|
+
- spec/spec_helper.rb
|
120
|
+
- spec/unit/vagrant-babushka/config_spec.rb
|
121
|
+
- spec/unit/vagrant-babushka/dep_spec.rb
|