vagrant-json-plugin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +15 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/vagrant-json/command/init.rb +93 -0
- data/lib/vagrant-json/command/root.rb +64 -0
- data/lib/vagrant-json/config/json.rb +24 -0
- data/lib/vagrant-json/plugin.rb +23 -0
- data/lib/vagrant-json/version.rb +5 -0
- data/lib/vagrant-json.rb +53 -0
- data/locales/en.yml +11 -0
- data/templates/Vagrantfile.erb +15 -0
- data/templates/default.yml.erb +39 -0
- data/templates/local.yml.erb +6 -0
- data/vagrant-json.gemspec +36 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1141edfaffcdbea895ee15582acf117704d8f3fcd54f1549a257f142ef25bc01
|
4
|
+
data.tar.gz: 1a4e3362ee46ec07a8686df02a92569fed089e1be67d0c40e0ff60ad35aef119
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 180c69dbb667e54147adf1f9dd346b103fff36a24f520e9c5d9ea3bc3b1b434e702c1acc61a8c320803e62cd3c8dfcd5bd7f6f8584db43fbe5a02e6d80bf59ba
|
7
|
+
data.tar.gz: 15089ffe71d60892a583bdec88168c482713c4bf6ff61e8c861ae48e4839ebda50c42f0923ad3285fe4dcdafb9de91532e940d6d1c70159a78d65fda776b6703
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.4.2
|
5
|
+
before_install: gem install bundler -v 1.16.1
|
6
|
+
script:
|
7
|
+
- bundle exec rake build
|
8
|
+
deploy:
|
9
|
+
provider: rubygems
|
10
|
+
api_key:
|
11
|
+
secure: Tx5oMTJEvhYh2iZM4q3Z2yRxE2oTSQVU8ZcAgrYkhDpv0cw8+qdO5B3lIxTRsRAsQUJvWqtWf+0Tc45zxf4N7h1YegRYm7ECYLnupK1Ij+A2yXH6RlZmzUc47EScxYgQXEd7oufumjPgCCC1Qbr5+F7ypj/u08hdneEuaWF5dZKcigiJmr6xTwFsbwZvrS8fDVQgurvtrmyn2Y2MbQZ53TlVy+jF5erqD76j6gbyuQwmWR0zgI0tuglgK8RvTXYrUzMKm3UI708Q+7oz/VR0xXaRsSoTZE4nLEFvGAjiov9/SAsPb6f8QDWos2Mj/BsGSDVBPAvR/MPvNgDyFM2YQYMQG3X9zUo0MeuYEHPKX34KvPXi3cOANu9j4Xz7MRJPOvnSekE06kFICqZpZXtUoDXdfVR5fiXD+8Dc8kWEYR9/7P7cN9ZrPwVY083jocvrwo4zgzdJAR4ITIpUx+QUCltHu17RYUT4AEfz41vzG3KhozLVyZvbbxJNeZkBqnGWulmFQP7dUVxN/XDghWeuki9s46KbXMbJn4mqcWzEML9FA7tDTqI7c5QvK0nBLc1so2laoXitsBLqnCENsTB7iGUB//91TGi+v9RbVaV0CKyqAQK88+ypeW9+4SEdWQSyHTXHA3n3HNU5UJjGZSRJvW6ZNYBi/ssz86TR+DHWZDU=
|
12
|
+
on:
|
13
|
+
branch: master
|
14
|
+
gem: vagrant-json-plugin
|
15
|
+
gemspec: vagrant-json.gemspec
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at thamilton@rsglab.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 thamilton
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Vagrant::Json
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vagrant/json`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
To add this plugin:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
vagrant plugin install vagrant-json-plugin
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
vagrant json init
|
19
|
+
```
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vagrant-json. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
34
|
+
|
35
|
+
## Code of Conduct
|
36
|
+
|
37
|
+
Everyone interacting in the Vagrant::Json project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/vagrant-json/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vagrant/json"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# lib/vagrant-json/command/init.rb
|
2
|
+
module VagrantPlugins
|
3
|
+
module VagrantJson
|
4
|
+
module Command
|
5
|
+
class Init < Vagrant.plugin("2", :command)
|
6
|
+
|
7
|
+
def execute
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
opts = OptionParser.new do |o|
|
11
|
+
o.separator "Usage: vagrant json init [options] <name, url, or path>"
|
12
|
+
o.separator ""
|
13
|
+
o.separator "Options:"
|
14
|
+
o.separator ""
|
15
|
+
|
16
|
+
o.on("-f", "--force", "Overwrite existing yml and Vagrantfile") do |n|
|
17
|
+
options[:force] = n
|
18
|
+
end
|
19
|
+
|
20
|
+
o.on("-r", "--remove", "Remove existing yml and Vagrantfile") do |n|
|
21
|
+
options[:remove] = n
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
argv = parse_options(opts)
|
26
|
+
return if !argv
|
27
|
+
# if argv.empty? || argv.length > 2
|
28
|
+
# raise Vagrant::Errors::CLIInvalidUsage,
|
29
|
+
# help: opts.help.chomp
|
30
|
+
# end
|
31
|
+
|
32
|
+
create_vagrantfile
|
33
|
+
create_directories
|
34
|
+
create_vm_yaml("app01")
|
35
|
+
create_vm_yaml("db01")
|
36
|
+
create_default_yaml(argv[0], argv[1])
|
37
|
+
|
38
|
+
@env.ui.info(I18n.t(
|
39
|
+
"vagrant.plugins.yml.commands.init.success",
|
40
|
+
avail_dir: 'available.d',
|
41
|
+
enabled_dir: 'enabled.d',
|
42
|
+
local_dir: 'local.d'
|
43
|
+
), :prefix => false)
|
44
|
+
# Success, exit status 0
|
45
|
+
0
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_vagrantfile
|
49
|
+
save_path = @env.cwd.join("Vagrantfile")
|
50
|
+
raise Exception if save_path.exist?
|
51
|
+
|
52
|
+
template_path = VagrantJson.source_root.join("templates/Vagrantfile")
|
53
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path)
|
54
|
+
save_path.open("w+") do |f|
|
55
|
+
f.write(contents)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_directories
|
60
|
+
Dir.mkdir(".vagrant_config")
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_default_yaml(box_name = nil, box_url = nil)
|
64
|
+
save_path = @env.cwd.join("default.yml")
|
65
|
+
raise Exception if save_path.exist?
|
66
|
+
|
67
|
+
template_path = VagrantJson.source_root.join("templates/default.yml")
|
68
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
69
|
+
:box_name => box_name,
|
70
|
+
:box_url => box_url)
|
71
|
+
save_path.open("w+") do |f|
|
72
|
+
f.write(contents)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_vm_yaml(vm_name, box_name: "ubuntu/xenial64")
|
77
|
+
save_path = @env.cwd.join(".vagrant_config/#{vm_name}.yml")
|
78
|
+
raise Exception if save_path.exist?
|
79
|
+
|
80
|
+
template_path = VagrantJson.source_root.join("templates/local.yml")
|
81
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
82
|
+
:host_name => "#{vm_name}.vagrant.local",
|
83
|
+
:box_name => box_name)
|
84
|
+
|
85
|
+
save_path.open("w+") do |f|
|
86
|
+
f.write(contents)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end # => end Init
|
91
|
+
end # => end Command
|
92
|
+
end # => end VagrantYml
|
93
|
+
end # => end VagrantPlugins
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# lib/vagrant-yml/command/root.rb
|
2
|
+
module VagrantPlugins
|
3
|
+
module VagrantJson
|
4
|
+
module Command
|
5
|
+
class Root < Vagrant.plugin("2", :command)
|
6
|
+
def self.synopsis
|
7
|
+
"manages json configurations"
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(argv, env)
|
11
|
+
super
|
12
|
+
|
13
|
+
@main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
14
|
+
|
15
|
+
@subcommands = Vagrant::Registry.new
|
16
|
+
@subcommands.register(:init) do
|
17
|
+
require File.expand_path("../init", __FILE__)
|
18
|
+
Init
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add more subcommands here
|
22
|
+
end
|
23
|
+
|
24
|
+
def execute
|
25
|
+
if @main_args.include?("-h") || @main_args.include?("--help")
|
26
|
+
# Print the help for all yml commands.
|
27
|
+
return help
|
28
|
+
end
|
29
|
+
|
30
|
+
# If we reached this far then we must have a subcommand. If not,
|
31
|
+
# then we also just print the help and exit.
|
32
|
+
command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
|
33
|
+
return help if !command_class || !@sub_command
|
34
|
+
@logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
|
35
|
+
|
36
|
+
# Initialize and execute the command class
|
37
|
+
command_class.new(@sub_args, @env).execute
|
38
|
+
end
|
39
|
+
|
40
|
+
def help
|
41
|
+
opts = OptionParser.new do |opts|
|
42
|
+
opts.banner = "Usage: vagrant json <subcommand> [<args>]"
|
43
|
+
opts.separator ""
|
44
|
+
opts.separator "Available subcommands:"
|
45
|
+
|
46
|
+
# Add the available subcommands as separators in order to print them
|
47
|
+
# out as well
|
48
|
+
keys = []
|
49
|
+
@subcommands.each {|key, value| keys << key.to_sym}
|
50
|
+
keys.sort.each do |key|
|
51
|
+
opts.separator " #{key}"
|
52
|
+
end
|
53
|
+
|
54
|
+
opts.separator ""
|
55
|
+
opts.separator "For help on any individual subcommand run `vagrant json <subcommand> -h`"
|
56
|
+
end
|
57
|
+
|
58
|
+
@env.ui.info(opts.help, prefix: false)
|
59
|
+
end
|
60
|
+
|
61
|
+
end # => end Root
|
62
|
+
end # => end Command
|
63
|
+
end # => end VagrantYml
|
64
|
+
end # => end VagrantPlugins
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module VagrantJson
|
3
|
+
module Config
|
4
|
+
class Json < Vagrant.plugin("2", :config)
|
5
|
+
attr_accessor :directory
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@directory = UNSET_VALUE
|
9
|
+
end
|
10
|
+
|
11
|
+
def finalize!
|
12
|
+
if @directory == UNSET_VALUE
|
13
|
+
@directory = ".vagrant_config"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def validate(machine)
|
18
|
+
{ "json" => _detected_errors }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# lib/vagrant-yml/plugin.rb
|
2
|
+
require "vagrant"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module VagrantJson
|
6
|
+
class Plugin < Vagrant.plugin('2')
|
7
|
+
|
8
|
+
name 'VagrantJson'
|
9
|
+
description "The `json` command gives you a starting point for json configurations"
|
10
|
+
|
11
|
+
config(:json) do
|
12
|
+
require_relative "config/json"
|
13
|
+
Config::Json
|
14
|
+
end
|
15
|
+
|
16
|
+
command("json") do
|
17
|
+
require File.expand_path("../command/root", __FILE__)
|
18
|
+
Command::Root
|
19
|
+
end
|
20
|
+
|
21
|
+
end # end Plugin
|
22
|
+
end # => end VagrantYml
|
23
|
+
end # => end
|
data/lib/vagrant-json.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'vagrant-json/version'
|
2
|
+
require 'vagrant-json/plugin'
|
3
|
+
require 'active_support/core_ext/hash'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module VagrantJson
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= Pathname.new(File.expand_path '../../', __FILE__)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.apply_settings(vm, yml)
|
13
|
+
yml.each do |key0, value0|
|
14
|
+
if !value0.is_a?(Hash) # If it's a setting,
|
15
|
+
vm.send("#{key0}=".to_sym, value0) # we set it directly.
|
16
|
+
else # Otherwise,
|
17
|
+
method_object = vm.method("#{key0}".to_sym) # we're invoking a method
|
18
|
+
value0.each do |key1, value1| # and each setting
|
19
|
+
method_object.call("#{key1}".to_sym, value1) # needs to be passed to the method.
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.up!(config)
|
26
|
+
require 'json'
|
27
|
+
require 'yaml'
|
28
|
+
|
29
|
+
vms = []
|
30
|
+
|
31
|
+
files = Dir.glob("*.{json,yaml,yml}").map {|f| JSON.parse(YAML.load_file(f).to_json, symbolize_names: true)}
|
32
|
+
|
33
|
+
files.each do |file|
|
34
|
+
if file[:boxes]
|
35
|
+
vms.concat(file[:boxes])
|
36
|
+
else
|
37
|
+
vms << file
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
vms.each do |vm|
|
42
|
+
config.vm.define "#{vm[:hostname]}" do |vm_config|
|
43
|
+
apply_settings(vm_config.vm, vm)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
I18n.load_path << File.expand_path('locales/en.yml', source_root)
|
50
|
+
I18n.reload!
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
en:
|
2
|
+
vagrant:
|
3
|
+
plugins:
|
4
|
+
yml:
|
5
|
+
commands:
|
6
|
+
init:
|
7
|
+
success:
|
8
|
+
A default `Vagrantfile` and `Yaml` VM config file has been placed in this directory. You are now ready to `vagrant up` your first
|
9
|
+
virtual environment! Please read the comments in the default Yaml VM config file to see how it works.
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,15 @@
|
|
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
|
+
|
9
|
+
# Un-comment this and specify the directory in which to look for YAML VM config files.
|
10
|
+
#config.yaml.conf_dirs = ".vagrant_config"
|
11
|
+
|
12
|
+
# Load YAML VM configs.
|
13
|
+
VagrantPlugins::VagrantJson::up!(config)
|
14
|
+
|
15
|
+
end # => end Vagrantfile
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# All Vagrant VM configuration can be done from Yaml config files such as this
|
2
|
+
# one. Only config files in the 'enabled.d' directory are interpreted. You
|
3
|
+
# can copy from, or symlink to, files in the 'available.d' directory. This
|
4
|
+
# allows you to have a library of config files that could, for example, be
|
5
|
+
# updated by an external application.
|
6
|
+
|
7
|
+
# Also, any Yaml config file in local.d/ named the same as one in enabled.d/
|
8
|
+
# will allow the selective override of individual configuration settings. See
|
9
|
+
# local.d/vm1.yaml for an example.
|
10
|
+
|
11
|
+
# To see what you can do with Yaml, check out this handy reference card:
|
12
|
+
# http://www.yaml.org/refcard.html. To see how Yaml is interpreted in Ruby, see
|
13
|
+
# this guide: http://yaml.org/YAML_for_ruby.html. For further details, refer to
|
14
|
+
# the full Yaml specification: http://www.yaml.org/spec/1.2/spec.html
|
15
|
+
|
16
|
+
# For all available Vagrant options, see the docs on Vagrantfile settings:
|
17
|
+
# http://vagrantup.com/v2/docs/vagrantfile.html. While we've provided some
|
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:
|
20
|
+
# https://github.com/PraxisLabs/vagrant-yaml. Also, feel free to post to the
|
21
|
+
# project's wiki, or submit pull requests.
|
22
|
+
boxes:
|
23
|
+
- box: "ubuntu/xenial64"
|
24
|
+
<% if box_url.nil? %># <% end %>box_url: "<%= box_url || "http://domain.com/path/to/above.box" %>"
|
25
|
+
hostname: example.vagrant.local
|
26
|
+
#network:
|
27
|
+
# forwarded_port:
|
28
|
+
# :guest: 80
|
29
|
+
# :host: 8080
|
30
|
+
#provision:
|
31
|
+
# puppet:
|
32
|
+
# :module_path: 'modules'
|
33
|
+
# :manifests_path: 'manifests'
|
34
|
+
# :manifest_file: site.pp
|
35
|
+
# :options:
|
36
|
+
# - --verbose
|
37
|
+
# - --debug
|
38
|
+
# :facter:
|
39
|
+
# fqdn: *id001
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Any Yaml config file in 'local.d/' named the same as one in 'enabled.d/' 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
|
+
box: <%= box_name %>
|
6
|
+
hostname: <%= host_name %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "vagrant-json/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-json-plugin"
|
8
|
+
spec.version = VagrantPlugins::VagrantJson::VERSION
|
9
|
+
spec.authors = ["thamilton"]
|
10
|
+
spec.email = ["thamilton@rsglab.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Write a short summary, because RubyGems requires one.}
|
13
|
+
spec.description = %q{Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/thamilton2014"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-json-plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- thamilton
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Write a longer description or delete this line.
|
56
|
+
email:
|
57
|
+
- thamilton@rsglab.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- lib/vagrant-json.rb
|
73
|
+
- lib/vagrant-json/command/init.rb
|
74
|
+
- lib/vagrant-json/command/root.rb
|
75
|
+
- lib/vagrant-json/config/json.rb
|
76
|
+
- lib/vagrant-json/plugin.rb
|
77
|
+
- lib/vagrant-json/version.rb
|
78
|
+
- locales/en.yml
|
79
|
+
- templates/Vagrantfile.erb
|
80
|
+
- templates/default.yml.erb
|
81
|
+
- templates/local.yml.erb
|
82
|
+
- vagrant-json.gemspec
|
83
|
+
homepage: https://github.com/thamilton2014
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata:
|
87
|
+
allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.7.6
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Write a short summary, because RubyGems requires one.
|
108
|
+
test_files: []
|