vagrant-yaybu 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Vagrantfile +38 -0
- data/install-vagrant.sh +15 -0
- data/lib/vagrant-yaybu/provisioner.rb +45 -8
- data/lib/vagrant-yaybu/version.rb +1 -1
- metadata +23 -43
data/Vagrantfile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# This is a demo Vagrantfile to prove that vagrant-yaybu is working correctly
|
2
|
+
|
3
|
+
# When you install this gem (using ``gem install vagrant-yaybu``) you do not
|
4
|
+
# need to ``require`` the provisioner. We do so here so that the development
|
5
|
+
# version is loaded.
|
6
|
+
require "lib/vagrant-yaybu/provisioner.rb"
|
7
|
+
|
8
|
+
|
9
|
+
Vagrant::Config.run do |config|
|
10
|
+
config.vm.box = "lucid64"
|
11
|
+
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
|
12
|
+
|
13
|
+
config.vm.provision :yaybu do |cfg|
|
14
|
+
|
15
|
+
# You can add directories and remote locations to the search path
|
16
|
+
# Both Yay files and assets (templates, etc) will be fetched from here.
|
17
|
+
# The default search path is the current working directory
|
18
|
+
cfg.searchpath << "../Projects/yaybu-configuration/"
|
19
|
+
cfg.searchpath << "https://raw.github.com/isotoma/yaybu-examples/master/"
|
20
|
+
|
21
|
+
# You can load any config that is on the searchpath
|
22
|
+
cfg.include << "configuration/minecraft.yay"
|
23
|
+
|
24
|
+
# The ``yay`` parameter lets you put arbritrary config inside your Vagrant file
|
25
|
+
cfg.yay = <<-EOS
|
26
|
+
resources.append:
|
27
|
+
- Execute:
|
28
|
+
name: example
|
29
|
+
command: date
|
30
|
+
EOS
|
31
|
+
|
32
|
+
# Advanced Yaybu hackers might not want to use the default python or a packaged
|
33
|
+
# version of Yaybu. You can set this to point at your development environment.
|
34
|
+
cfg.python = "/opt/virtualenvs/yaybu/bin/python"
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
data/install-vagrant.sh
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
|
3
|
+
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
|
4
|
+
|
5
|
+
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile
|
6
|
+
|
7
|
+
. "$HOME/.rvm/scripts/rvm"
|
8
|
+
|
9
|
+
rvm install 1.9.2
|
10
|
+
rvm use 1.9.2
|
11
|
+
rvm --default 1.9.2
|
12
|
+
|
13
|
+
gem update
|
14
|
+
gem install vagrant vagrant-snap vagrant-yaybu
|
15
|
+
|
@@ -22,25 +22,39 @@ from yay.config import Config
|
|
22
22
|
from yaybu.core.remote import RemoteRunner
|
23
23
|
from yaybu.core.runcontext import RunContext
|
24
24
|
|
25
|
-
raw_config = StringIO.StringIO("""
|
26
|
-
<%= yay %>
|
27
|
-
""")
|
28
|
-
|
29
|
-
config = Config()
|
30
|
-
config.load(raw_config)
|
31
|
-
|
32
25
|
class opts:
|
33
26
|
log_level = "info"
|
34
27
|
logfile = "-"
|
35
28
|
host = "<%= ssh_user %>@<%= ssh_host %>:<%= ssh_port %>"
|
36
29
|
user = "root"
|
37
|
-
ypath = [
|
30
|
+
ypath = [
|
31
|
+
<% searchpath.each do |path| %>
|
32
|
+
"<%= path %>",
|
33
|
+
<% end %>
|
34
|
+
]
|
38
35
|
simulate = False
|
39
36
|
verbose = False
|
40
37
|
resume = True
|
41
38
|
no_resume = False
|
42
39
|
env_passthrough = []
|
43
40
|
|
41
|
+
includes = StringIO.StringIO("""
|
42
|
+
<% if includes.length > 0 %>
|
43
|
+
.include:
|
44
|
+
<% includes.each do |include| %>
|
45
|
+
- <%= include %>
|
46
|
+
<% end %>
|
47
|
+
<% end %>
|
48
|
+
""")
|
49
|
+
|
50
|
+
raw_config = StringIO.StringIO("""
|
51
|
+
<%= yay %>
|
52
|
+
""")
|
53
|
+
|
54
|
+
config = Config(searchpath=opts.ypath)
|
55
|
+
config.load(includes)
|
56
|
+
config.load(raw_config)
|
57
|
+
|
44
58
|
ctx = RunContext(None, opts)
|
45
59
|
ctx.set_config(config)
|
46
60
|
|
@@ -66,10 +80,14 @@ module Vagrant
|
|
66
80
|
class Config < Vagrant::Config::Base
|
67
81
|
attr_accessor :yay
|
68
82
|
attr_accessor :python
|
83
|
+
attr_accessor :searchpath
|
84
|
+
attr_accessor :include
|
69
85
|
|
70
86
|
def initialize
|
71
87
|
@yay = ""
|
72
88
|
@python = "python"
|
89
|
+
@searchpath = []
|
90
|
+
@include = []
|
73
91
|
end
|
74
92
|
end
|
75
93
|
|
@@ -89,7 +107,24 @@ module Vagrant
|
|
89
107
|
def prepare
|
90
108
|
end
|
91
109
|
|
110
|
+
def verify_import(mod)
|
111
|
+
if not system("#{config.python}", "-c", "import #{mod}") then
|
112
|
+
raise YaybuError.new "Module #{mod} not found"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def verify_local_binary(binary)
|
117
|
+
if not system("which #{binary}") then
|
118
|
+
raise YaybuError.new "Local binary #{binary} not found"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
92
122
|
def provision!
|
123
|
+
verify_import "yaybu"
|
124
|
+
verify_import "yay"
|
125
|
+
|
126
|
+
verify_local_binary "ssh"
|
127
|
+
|
93
128
|
bootstrap
|
94
129
|
|
95
130
|
deployment_script = TemplateRenderer.render_string($deploy_script, {
|
@@ -98,6 +133,8 @@ module Vagrant
|
|
98
133
|
:ssh_port => vm.ssh.port,
|
99
134
|
:private_key_path => vm.env.config.ssh.private_key_path,
|
100
135
|
:yay => config.yay,
|
136
|
+
:searchpath => config.searchpath,
|
137
|
+
:includes => config.include,
|
101
138
|
})
|
102
139
|
|
103
140
|
IO.popen("#{config.python} -", "r+") do |io|
|
metadata
CHANGED
@@ -1,75 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-yaybu
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- John Carr
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-11-07 00:00:00 +00:00
|
19
|
-
default_executable:
|
12
|
+
date: 2011-11-10 00:00:00.000000000Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
14
|
description: This plugin adds a Yaybu 'push' provisioner to Vagrant
|
23
|
-
email:
|
15
|
+
email:
|
24
16
|
- john.carr@isotoma.com
|
25
17
|
executables: []
|
26
|
-
|
27
18
|
extensions: []
|
28
|
-
|
29
19
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
files:
|
20
|
+
files:
|
32
21
|
- .gitignore
|
33
22
|
- Gemfile
|
34
23
|
- Rakefile
|
24
|
+
- Vagrantfile
|
25
|
+
- install-vagrant.sh
|
35
26
|
- lib/vagrant-yaybu.rb
|
36
27
|
- lib/vagrant-yaybu/provisioner.rb
|
37
28
|
- lib/vagrant-yaybu/version.rb
|
38
29
|
- lib/vagrant_init.rb
|
39
30
|
- vagrant-yaybu.gemspec
|
40
|
-
|
41
|
-
homepage: ""
|
31
|
+
homepage: ''
|
42
32
|
licenses: []
|
43
|
-
|
44
33
|
post_install_message:
|
45
34
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
35
|
+
require_paths:
|
48
36
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
38
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
44
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
67
49
|
requirements: []
|
68
|
-
|
69
50
|
rubyforge_project: vagrant-yaybu
|
70
|
-
rubygems_version: 1.
|
51
|
+
rubygems_version: 1.8.10
|
71
52
|
signing_key:
|
72
53
|
specification_version: 3
|
73
54
|
summary: Teach Vagrant about Yaybu
|
74
55
|
test_files: []
|
75
|
-
|