vagrant-templated 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/{lib/vagrant-templated/templates/defaults.yml → config/templates/attributes/rails5.yml} +2 -24
- data/config/templates/attributes/vagrant-plugin.yml +26 -0
- data/{lib/vagrant-templated/templates → config/templates/files}/Berksfile.erb +1 -1
- data/{lib/vagrant-templated/templates → config/templates/files}/Vagrantfile.erb +5 -5
- data/lib/vagrant-templated/command/init.rb +18 -13
- data/lib/vagrant-templated/version.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77e216d71b5a1c6413ffa0cf9d4bc88b7d7aa0ca
|
4
|
+
data.tar.gz: 625c7ee241d9b164738504bd588de57ddb93915b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec071972e9006ac2fb265f7d6baff96bf0d4b9080e7b54f20393904fb21b040d7aec1b74e334d2c204260568dabc329bfb66b628db411438a64cde6ffd47dcd
|
7
|
+
data.tar.gz: e413ed3c16e7a8cbd3edf3510711fea2ea61e39d8dc80bc439487317f70f5704ea15d692d90744e2938321543a03346e7e76c6957aad0da3239ceb924ba91d2d
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.1.3] - 2017-08-05
|
10
|
+
### Added
|
11
|
+
- Refactor defaults to attributes, it's more self documented now
|
12
|
+
- Move chef version to configuration files, fixing rails5 chef problem
|
13
|
+
- Templates displayed at help generated with yml information
|
14
|
+
- Refactor templates file structure: one yml per template
|
15
|
+
|
9
16
|
## [0.1.2] - 2017-08-04
|
10
17
|
### Added
|
11
18
|
- Fix locale load
|
data/{lib/vagrant-templated/templates/defaults.yml → config/templates/attributes/rails5.yml}
RENAMED
@@ -1,4 +1,6 @@
|
|
1
1
|
rails5:
|
2
|
+
omnibus:
|
3
|
+
chef_version: 12.21.1
|
2
4
|
berkself:
|
3
5
|
cookbooks:
|
4
6
|
apt: ~> 6.1.0
|
@@ -32,27 +34,3 @@ rails5:
|
|
32
34
|
vagrant-plugins:
|
33
35
|
- vagrant-omnibus
|
34
36
|
- vagrant-berkshelf
|
35
|
-
vagrant-plugin:
|
36
|
-
berkself:
|
37
|
-
cookbooks:
|
38
|
-
apt: ~> 6.1.0
|
39
|
-
ruby_rbenv: ~> 1.2.0
|
40
|
-
chef:
|
41
|
-
recipes:
|
42
|
-
- apt
|
43
|
-
- ruby_build
|
44
|
-
- ruby_rbenv::user
|
45
|
-
json:
|
46
|
-
rbenv:
|
47
|
-
user_installs:
|
48
|
-
- user: vagrant
|
49
|
-
rubies:
|
50
|
-
- 2.3.4
|
51
|
-
global: 2.3.4
|
52
|
-
gems:
|
53
|
-
2.3.4:
|
54
|
-
- name: bundler
|
55
|
-
require:
|
56
|
-
vagrant-plugins:
|
57
|
-
- vagrant-omnibus
|
58
|
-
- vagrant-berkshelf
|
@@ -0,0 +1,26 @@
|
|
1
|
+
vagrant-plugin:
|
2
|
+
omnibus:
|
3
|
+
chef_version: latest
|
4
|
+
berkself:
|
5
|
+
cookbooks:
|
6
|
+
apt: ~> 6.1.0
|
7
|
+
ruby_rbenv: ~> 1.2.0
|
8
|
+
chef:
|
9
|
+
recipes:
|
10
|
+
- apt
|
11
|
+
- ruby_build
|
12
|
+
- ruby_rbenv::user
|
13
|
+
json:
|
14
|
+
rbenv:
|
15
|
+
user_installs:
|
16
|
+
- user: vagrant
|
17
|
+
rubies:
|
18
|
+
- 2.3.4
|
19
|
+
global: 2.3.4
|
20
|
+
gems:
|
21
|
+
2.3.4:
|
22
|
+
- name: bundler
|
23
|
+
require:
|
24
|
+
vagrant-plugins:
|
25
|
+
- vagrant-omnibus
|
26
|
+
- vagrant-berkshelf
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# vi: set ft=ruby :
|
3
3
|
# Vagrantfile generated with https://github.com/afaundez/vagrant-templated
|
4
4
|
|
5
|
-
<%- if
|
6
|
-
<%=
|
5
|
+
<%- if template_attributes['require'] && template_attributes['require']['vagrant-plugins'] -%>
|
6
|
+
<%= template_attributes['require']['vagrant-plugins'].to_a %>.each do |plugin_name|
|
7
7
|
unless Vagrant.has_plugin? plugin_name
|
8
8
|
raise "#{plugin_name} plugin is required. Please run `vagrant plugin install #{plugin_name}`"
|
9
9
|
end
|
@@ -12,12 +12,12 @@ end
|
|
12
12
|
|
13
13
|
Vagrant.configure('2') do |config|
|
14
14
|
config.vm.box = 'bento/ubuntu-16.04'
|
15
|
-
config.omnibus.chef_version =
|
15
|
+
config.omnibus.chef_version = '<%= template_attributes['omnibus']['chef_version'] %>'
|
16
16
|
config.vm.provision :chef_solo do |chef|
|
17
|
-
<%-
|
17
|
+
<%- template_attributes['chef']['recipes'].each do |recipe| -%>
|
18
18
|
chef.add_recipe '<%= recipe %>'
|
19
19
|
<%- end -%>
|
20
|
-
<% lines = JSON.pretty_generate(
|
20
|
+
<% lines = JSON.pretty_generate(template_attributes['chef']['json']).lines %>
|
21
21
|
chef.json = <%= lines.shift.strip %>
|
22
22
|
<%- lines.each do |line| -%>
|
23
23
|
<%= line.rstrip %>
|
@@ -6,30 +6,34 @@ module Vagrant
|
|
6
6
|
class Init < Vagrant.plugin('2', :command)
|
7
7
|
|
8
8
|
def execute
|
9
|
-
|
10
|
-
|
9
|
+
root_path = File.expand_path '../../../', File.dirname(File.expand_path(__FILE__))
|
10
|
+
templates_attributes = Dir.glob(File.expand_path("config/templates/attributes/*.yml", root_path)).collect do |template|
|
11
|
+
YAML.load_file(template)
|
12
|
+
end.reduce Hash.new, :merge
|
11
13
|
|
14
|
+
options = {}
|
12
15
|
opts = OptionParser.new do |o|
|
13
16
|
o.banner = 'Usage: vagrant templated init [options] <template>'
|
14
17
|
|
15
18
|
o.separator ''
|
16
|
-
o.separator 'Templates availables:
|
19
|
+
o.separator 'Templates availables:'
|
17
20
|
o.separator ''
|
18
|
-
|
19
|
-
|
21
|
+
templates_attributes.keys.each do |template|
|
22
|
+
o.separator " #{template}"
|
23
|
+
end
|
20
24
|
|
21
25
|
o.separator ''
|
22
26
|
o.separator 'Options:'
|
23
27
|
o.separator ''
|
24
28
|
|
25
|
-
o.on('-f', '--force', 'Overwrite an existing box if it exists') do |f|
|
26
|
-
options[:force] = f
|
27
|
-
end
|
28
|
-
|
29
29
|
o.on('-s', '--suffix SUFFIX', String,
|
30
|
-
"Output suffix for Vagrantfile and
|
30
|
+
"Output suffix for Vagrantfile and Berksfile. '-' for stdout") do |suffix|
|
31
31
|
options[:suffix] = suffix
|
32
32
|
end
|
33
|
+
|
34
|
+
o.on('-f', '--force', 'Overwrite an existing box if it exists') do |f|
|
35
|
+
options[:force] = f
|
36
|
+
end
|
33
37
|
end
|
34
38
|
|
35
39
|
argv = parse_options(opts)
|
@@ -46,7 +50,8 @@ module Vagrant
|
|
46
50
|
end
|
47
51
|
|
48
52
|
@env.ui.info("Detected template: #{template}", prefix: false, color: :yellow)
|
49
|
-
raise Vagrant::Errors::VagrantTemplatedOptionNotFound unless
|
53
|
+
raise Vagrant::Errors::VagrantTemplatedOptionNotFound unless templates_attributes.keys.include? template
|
54
|
+
template_attributes = templates_attributes[template]
|
50
55
|
|
51
56
|
vagrantfile_save_path = nil
|
52
57
|
berksfile_save_path = nil
|
@@ -59,8 +64,8 @@ module Vagrant
|
|
59
64
|
raise Vagrant::Errors::BerksfileTemplatedExistsError if berksfile_save_path.exist?
|
60
65
|
end
|
61
66
|
|
62
|
-
vagrantfile = ERB.new File.read(File.
|
63
|
-
berksfile = ERB.new File.read(File.
|
67
|
+
vagrantfile = ERB.new File.read(File.expand_path('config/templates/files/Vagrantfile.erb', root_path)), nil, '-'
|
68
|
+
berksfile = ERB.new File.read(File.expand_path('config/templates/files/Berksfile.erb', root_path)), nil, '-'
|
64
69
|
|
65
70
|
contents = vagrantfile.result binding
|
66
71
|
if vagrantfile_save_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-templated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Álvaro Faúndez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,17 +77,20 @@ files:
|
|
77
77
|
- bin/console
|
78
78
|
- bin/setup
|
79
79
|
- config/locales/en.yml
|
80
|
+
- config/templates/attributes/rails5.yml
|
81
|
+
- config/templates/attributes/vagrant-plugin.yml
|
82
|
+
- config/templates/files/Berksfile.erb
|
83
|
+
- config/templates/files/Vagrantfile.erb
|
80
84
|
- lib/vagrant-templated.rb
|
81
85
|
- lib/vagrant-templated/command/init.rb
|
82
86
|
- lib/vagrant-templated/command/root.rb
|
83
87
|
- lib/vagrant-templated/errors.rb
|
84
88
|
- lib/vagrant-templated/plugin.rb
|
85
|
-
- lib/vagrant-templated/templates/Berksfile.erb
|
86
|
-
- lib/vagrant-templated/templates/Vagrantfile.erb
|
87
|
-
- lib/vagrant-templated/templates/defaults.yml
|
88
89
|
- lib/vagrant-templated/version.rb
|
89
90
|
- spec/spec_helper.rb
|
90
91
|
- spec/tmp/.keep
|
92
|
+
- spec/tmp/Berksfile
|
93
|
+
- spec/tmp/Vagrantfile
|
91
94
|
- spec/vagrant_templated_spec.rb
|
92
95
|
- vagrant-templated.gemspec
|
93
96
|
homepage: https://github.com/afaundez/vagrant-templated
|