vagrant-yaml 0.0.5 → 0.0.6
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 +1 -0
- data/lib/vagrant-yaml/commands/yaml_init.rb +34 -15
- data/lib/vagrant-yaml/version.rb +1 -1
- data/locales/en.yml +7 -6
- data/templates/Vagrantfile.erb +8 -0
- data/templates/default.yaml.erb +8 -4
- data/templates/local.default.yaml.erb +6 -0
- data/vagrant-yaml.gemspec +2 -0
- metadata +21 -3
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
@@ -17,43 +17,62 @@ module VagrantYaml
|
|
17
17
|
argv = parse_options(opts)
|
18
18
|
return if !argv
|
19
19
|
|
20
|
-
|
20
|
+
create_vagrantfile
|
21
|
+
create_directories
|
22
|
+
create_default_yaml(argv[0], argv[1])
|
23
|
+
create_local_default_yaml
|
24
|
+
create_symlinks
|
25
|
+
|
26
|
+
@env.ui.info(I18n.t("vagrant.plugins.yaml.commands.init.success"),
|
27
|
+
:prefix => false)
|
28
|
+
# Success, exit status 0
|
29
|
+
0
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_vagrantfile
|
21
33
|
save_path = @env.cwd.join("Vagrantfile")
|
22
34
|
raise Errors::VagrantfileExistsError if save_path.exist?
|
23
35
|
|
24
36
|
template_path = ::VagrantYaml.source_root.join("templates/Vagrantfile")
|
25
|
-
contents = Vagrant::Util::TemplateRenderer.render(template_path
|
26
|
-
:box_name => argv[0] || "base",
|
27
|
-
:box_url => argv[1])
|
37
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path)
|
28
38
|
save_path.open("w+") do |f|
|
29
39
|
f.write(contents)
|
30
40
|
end
|
41
|
+
end
|
31
42
|
|
32
|
-
|
43
|
+
def create_directories
|
33
44
|
Dir.mkdir('vms-available')
|
34
45
|
Dir.mkdir('vms-enabled')
|
46
|
+
Dir.mkdir('local.d')
|
47
|
+
end
|
35
48
|
|
36
|
-
|
49
|
+
def create_default_yaml(box_name=nil, box_url=nil)
|
37
50
|
save_path = @env.cwd.join("vms-available/default.yaml")
|
38
51
|
raise Errors::VagrantfileExistsError if save_path.exist?
|
39
52
|
|
40
53
|
template_path = ::VagrantYaml.source_root.join("templates/default.yaml")
|
41
54
|
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
42
|
-
:box_name =>
|
43
|
-
:box_url =>
|
55
|
+
:box_name => box_name,
|
56
|
+
:box_url => box_url)
|
44
57
|
save_path.open("w+") do |f|
|
45
58
|
f.write(contents)
|
46
59
|
end
|
60
|
+
end
|
47
61
|
|
48
|
-
|
49
|
-
|
62
|
+
def create_local_default_yaml
|
63
|
+
save_path = @env.cwd.join("local.d/default.yaml")
|
64
|
+
raise Errors::VagrantfileExistsError if save_path.exist?
|
65
|
+
template_path = ::VagrantYaml.source_root.join("templates/local.default.yaml")
|
66
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path)
|
67
|
+
save_path.open("w+") do |f|
|
68
|
+
f.write(contents)
|
69
|
+
end
|
70
|
+
end
|
50
71
|
|
51
|
-
|
52
|
-
|
72
|
+
def create_symlinks
|
73
|
+
File.symlink("../vms-available/default.yaml", "vms-enabled/default.yaml")
|
74
|
+
end
|
53
75
|
|
54
|
-
# Success, exit status 0
|
55
|
-
0
|
56
|
-
end
|
57
76
|
end
|
58
77
|
end
|
59
78
|
end
|
data/lib/vagrant-yaml/version.rb
CHANGED
data/locales/en.yml
CHANGED
@@ -6,14 +6,15 @@ en:
|
|
6
6
|
init:
|
7
7
|
success: |-
|
8
8
|
A `Vagrantfile` has been placed in this directory, a default Yaml VM config file
|
9
|
-
has been placed in
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
has been placed in vms-available/, and a symlink to it, placed in vms-enabled/.
|
10
|
+
Finally, a file to contain local overrides was placed in local.d/. Unlike a
|
11
|
+
regular Vagrantfile, this one parses and applies the configuration in the Yaml
|
12
|
+
files it finds in vms-enabled/. You are now ready to `vagrant up` your first
|
13
|
+
virtual environment! Please read the comments in the default Yaml VM config
|
14
|
+
file to see how it works.
|
14
15
|
update:
|
15
16
|
success: |-
|
16
|
-
Vagrantfile updated using the
|
17
|
+
Vagrantfile updated using the latest one from vagrant-yaml.
|
17
18
|
confirmation: |-
|
18
19
|
This operation will overwrite the Vagrantfile in this project with the one in the
|
19
20
|
vagrant-yaml gem. Do you want to proceed?
|
data/templates/Vagrantfile.erb
CHANGED
@@ -24,6 +24,14 @@ Vagrant::Config.run do |config|
|
|
24
24
|
|
25
25
|
yml = YAML.load_file "#{current_dir}/vms-enabled/#{config_file}"
|
26
26
|
|
27
|
+
# Allow local overrides
|
28
|
+
if File.exists?("#{current_dir}/local.d/#{config_file}")
|
29
|
+
local = YAML.load_file "#{current_dir}/local.d/#{config_file}"
|
30
|
+
if local.is_a?(Hash)
|
31
|
+
yml.merge!(local)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
27
35
|
def apply_settings(vm,yml)
|
28
36
|
yml.each do |key0,value0|
|
29
37
|
if !value0.is_a?(Hash) # If it's a setting,
|
data/templates/default.yaml.erb
CHANGED
@@ -4,19 +4,23 @@
|
|
4
4
|
# allows you to have a library of config files that could, for example, be
|
5
5
|
# updated by an external application.
|
6
6
|
|
7
|
-
#
|
7
|
+
# Also, any Yaml config file in local.d/ named the same as one in vms-enabled/
|
8
|
+
# will allow the selective override of individual configuration settings. See
|
9
|
+
# local.d/default.yaml for an example.
|
10
|
+
|
11
|
+
# To see what you can do with Yaml, check out this handy reference card:
|
8
12
|
# http://www.yaml.org/refcard.html. To see how Yaml is interpreted in Ruby, see
|
9
13
|
# this guide: http://yaml.org/YAML_for_ruby.html. For further details, refer to
|
10
14
|
# the full Yaml specification: http://www.yaml.org/spec/1.2/spec.html
|
11
15
|
|
12
16
|
# For all available Vagrant options, see the docs on Vagrantfile settings:
|
13
17
|
# http://vagrantup.com/v1/docs/vagrantfile.html. While we've provided some
|
14
|
-
#
|
15
|
-
# a particular setting, please file a support request at:
|
18
|
+
# examples below, it's far from exhaustive. If you can't figure out how to
|
19
|
+
# apply a particular setting, please file a support request at:
|
16
20
|
# https://github.com/ergonlogic/vagrant-yaml. Also, feel free to post to the
|
17
21
|
# project's wiki, or submit pull requests.
|
18
22
|
|
19
|
-
box: "<%= box_name %>"
|
23
|
+
box: "<%= box_name || "base" %>"
|
20
24
|
<% if box_url.nil? %># <% end %>box_url: "<%= box_url || "http://domain.com/path/to/above.box" %>"
|
21
25
|
# host_name: &id001 vagrant.local
|
22
26
|
# network:
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Any Yaml config file in local.d/ named the same as one in vms-enabled/ will
|
2
|
+
# allow the selective override of individual configuration settings. Uncommen-
|
3
|
+
# ting the setting below would override the 'host_name' set by Vagrant in the
|
4
|
+
# VM.
|
5
|
+
|
6
|
+
# host_name: something.else
|
data/vagrant-yaml.gemspec
CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
16
|
|
17
|
+
s.add_dependency "i18n", "~> 0.6.0"
|
18
|
+
|
17
19
|
s.files = `git ls-files`.split("\n")
|
18
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
13
|
-
dependencies:
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: i18n
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.6.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.6.0
|
14
30
|
description: A Vagrant plugin that provides a Vagrantfile that looks in YAML files
|
15
31
|
for project and VM settings
|
16
32
|
email:
|
@@ -19,6 +35,7 @@ executables: []
|
|
19
35
|
extensions: []
|
20
36
|
extra_rdoc_files: []
|
21
37
|
files:
|
38
|
+
- .gitignore
|
22
39
|
- CHANGELOG.md
|
23
40
|
- Gemfile
|
24
41
|
- LICENSE
|
@@ -33,6 +50,7 @@ files:
|
|
33
50
|
- locales/en.yml
|
34
51
|
- templates/Vagrantfile.erb
|
35
52
|
- templates/default.yaml.erb
|
53
|
+
- templates/local.default.yaml.erb
|
36
54
|
- vagrant-yaml.gemspec
|
37
55
|
homepage: https://github.com/ergonlogic/vagrant-yaml
|
38
56
|
licenses:
|