vagrant-babushka 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/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/lib/vagrant-babushka/config.rb +26 -0
- data/lib/vagrant-babushka/plugin.rb +17 -0
- data/lib/vagrant-babushka/provisioner.rb +47 -0
- data/lib/vagrant-babushka/version.rb +5 -0
- data/lib/vagrant-babushka.rb +5 -0
- data/vagrant-babushka.gemspec +20 -0
- metadata +56 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Vladimir Valgis
|
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,34 @@
|
|
1
|
+
# Vagrant Provisioner Babushka
|
2
|
+
|
3
|
+
Based on plugin created by @tcurdt
|
4
|
+
https://github.com/tcurdt/vagrant-boxes/blob/master/plugins/babushka_provisioner.rb
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ vagrant plugin install vagrant-babushka
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
In Vagrant file set provisioner to `:babushka`
|
13
|
+
|
14
|
+
config.vm.provision :babushka do |b|
|
15
|
+
# Path for local deps, relative to Vagrantfile.
|
16
|
+
# Syncronized to '/home/vagrant/babushka-deps' on guest machine
|
17
|
+
b.local_deps_path = '.deps'
|
18
|
+
# add local dep which is defined in '.deps/htop.rb' with name 'htop'
|
19
|
+
b.local_dep 'htop'
|
20
|
+
# add remote dep in source 'tcurdt' with name 'rbenv system'
|
21
|
+
b.remote_dep 'tcurdt', 'rbenv system'
|
22
|
+
end
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create new Pull Request
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
MIT
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Babushka
|
3
|
+
class Config < Vagrant.plugin("2", :config)
|
4
|
+
attr_accessor :args, :deps, :local_deps_path
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super
|
8
|
+
@deps = []
|
9
|
+
@local_deps_path = UNSET_VALUE
|
10
|
+
end
|
11
|
+
|
12
|
+
def finalize!
|
13
|
+
@deps = [] if @deps == UNSET_VALUE
|
14
|
+
@local_deps_path = nil if @local_deps_path == UNSET_VALUE
|
15
|
+
end
|
16
|
+
|
17
|
+
def local_dep(dep_name, args = {})
|
18
|
+
@deps << ['', dep_name, args]
|
19
|
+
end
|
20
|
+
|
21
|
+
def remote_dep(source, dep_name, args = {})
|
22
|
+
@deps << ["#{source}:", dep_name, args]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Babushka
|
3
|
+
class Plugin < Vagrant.plugin("2")
|
4
|
+
name "Babushka"
|
5
|
+
|
6
|
+
config :babushka, :provisioner do
|
7
|
+
require_relative "config"
|
8
|
+
Config
|
9
|
+
end
|
10
|
+
|
11
|
+
provisioner :babushka do
|
12
|
+
require_relative "provisioner"
|
13
|
+
Provisioner
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Babushka
|
3
|
+
class Provisioner < Vagrant.plugin("2", :provisioner)
|
4
|
+
|
5
|
+
def initialize(machine, config)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def configure(root_config)
|
10
|
+
@hostname = root_config.vm.hostname
|
11
|
+
if @config.local_deps_path
|
12
|
+
local_path = @config.local_deps_path
|
13
|
+
remote_path = '/home/vagrant/babushka-deps'
|
14
|
+
opts = {id: 'babushka_deps', nfs: false}
|
15
|
+
root_config.vm.synced_folder local_path, remote_path, opts
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def provision
|
20
|
+
bootstrap_babushka! unless @machine.communicate.test('babushka --version')
|
21
|
+
@config.deps.map do |(dep_source, dep_name, dep_args)|
|
22
|
+
args = dep_args.to_a.map { |k, v| "#{k}='#{v}'" }.join(' ')
|
23
|
+
run_remote "babushka --update --defaults --colour #{dep_source}'#{dep_name}' #{args}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def bootstrap_babushka!
|
30
|
+
require 'net/http'
|
31
|
+
@machine.env.ui.info("Installing babushka on #{@hostname}.")
|
32
|
+
local_tmpfile = remote_tmpfile = "/tmp/babushka_me_up"
|
33
|
+
File.open(local_tmpfile, 'w') {|f| f.write `curl https://babushka.me/up` }
|
34
|
+
@machine.communicate.upload(local_tmpfile, remote_tmpfile)
|
35
|
+
run_remote "bash #{remote_tmpfile}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_remote(command)
|
39
|
+
@machine.communicate.sudo(command) do |type, data|
|
40
|
+
color = type == :stdout ? :green : :red
|
41
|
+
@machine.env.ui.info(data.chomp, :color => color, :prefix => false)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-babushka/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "vagrant-babushka"
|
8
|
+
gem.version = VagrantPlugins::Babushka::VERSION
|
9
|
+
gem.platform = Gem::Platform::RUBY
|
10
|
+
gem.authors = ["Vladimir Valgis"]
|
11
|
+
gem.email = ["vladimir.valgis@gmail.com"]
|
12
|
+
gem.description = %q{Vagrant provisioner plugin for using Babushka}
|
13
|
+
gem.summary = %q{Vagrant provisioner plugin for using Babushka}
|
14
|
+
gem.homepage = ""
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-babushka
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Vladimir Valgis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Vagrant provisioner plugin for using Babushka
|
15
|
+
email:
|
16
|
+
- vladimir.valgis@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/vagrant-babushka.rb
|
27
|
+
- lib/vagrant-babushka/config.rb
|
28
|
+
- lib/vagrant-babushka/plugin.rb
|
29
|
+
- lib/vagrant-babushka/provisioner.rb
|
30
|
+
- lib/vagrant-babushka/version.rb
|
31
|
+
- vagrant-babushka.gemspec
|
32
|
+
homepage: ''
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.24
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: Vagrant provisioner plugin for using Babushka
|
56
|
+
test_files: []
|