vagrant-invade 0.6.1 → 0.6.2
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/Gemfile.lock +1 -1
- data/lib/vagrant-invade/action/process.rb +92 -79
- data/lib/vagrant-invade/action.rb +0 -9
- data/lib/vagrant-invade/command/root.rb +0 -6
- data/lib/vagrant-invade/validator/type/type_string_array.rb +13 -14
- data/lib/vagrant-invade/version.rb +1 -1
- metadata +1 -3
- data/lib/vagrant-invade/action/check.rb +0 -44
- data/lib/vagrant-invade/command/check.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dbd3d96412ec32d5a5b356a5aafba507ea052ad3
|
|
4
|
+
data.tar.gz: 14445f3fd7ed2148da40e6ab91c477a2ae35d49f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd3ec435c6b5c1a3dc9328ad6165f808c9e2b2ea0b2596b9be1f31f1f5b83a047e565626c567a571357d1db7124459dfd46387815d196800a583f1c5c068c8fe
|
|
7
|
+
data.tar.gz: 356f5e4443d13e1e8033cee651cf208c9e74c3a252d4b3d3d7ce060c468463b4995632230db76f7f613b35e94db7486ae34f2d493744ea62d117946d193673b4
|
data/Gemfile.lock
CHANGED
|
@@ -13,109 +13,122 @@ module VagrantPlugins
|
|
|
13
13
|
@validator = VagrantPlugins::Invade::Validator::Validator.new(env)
|
|
14
14
|
@generator = VagrantPlugins::Invade::Generator::Generator.new(env)
|
|
15
15
|
|
|
16
|
+
@invade_machine = Hash.new
|
|
17
|
+
@invade_machine_part = Hash.new
|
|
18
|
+
@invade_vagrantfile = Hash.new
|
|
19
|
+
|
|
20
|
+
@generate = @env[:invade_generate]
|
|
21
|
+
@quiet = @env[:invade_validate_quiet]
|
|
22
|
+
|
|
16
23
|
@logger = Log4r::Logger.new('vagrant::invade::action::validate')
|
|
17
24
|
end
|
|
18
25
|
|
|
19
26
|
def call(env)
|
|
20
|
-
config = env[:invade]
|
|
21
|
-
quiet = @env[:invade_validate_quiet]
|
|
22
|
-
generate = @env[:invade_generate]
|
|
23
|
-
|
|
24
|
-
invade_machine = Hash.new
|
|
25
|
-
invade_machine_part = Hash.new
|
|
26
|
-
invade_vagrantfile = Hash.new
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
# Validate the settings and set default variables if needed
|
|
30
|
-
###############################################################
|
|
28
|
+
config = env[:invade]
|
|
31
29
|
|
|
32
30
|
# Remove empty Hashes
|
|
33
31
|
config.delete_blank
|
|
34
32
|
|
|
35
33
|
config.each do |config_key, config_data|
|
|
36
|
-
|
|
37
34
|
if config_key == 'machines'
|
|
35
|
+
process_machines(config_data)
|
|
36
|
+
else
|
|
37
|
+
process_vagrant_part(config_key, config_data)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
invade_machine_part[machine_part_name] = ''
|
|
50
|
-
machine_part_data.each do |value_name, value_data|
|
|
51
|
-
|
|
52
|
-
# Output info message
|
|
53
|
-
info_message = "\t#{machine_part_name.split('_').collect(&:capitalize).join}: #{value_name}"
|
|
54
|
-
@env[:ui].info(info_message) unless @env[:invade_validate_quiet]
|
|
55
|
-
|
|
56
|
-
# Exception handling for synced_folder and provision types
|
|
57
|
-
if machine_part_name == 'synced_folder' or machine_part_name == 'provision'
|
|
58
|
-
value_name = value_data['type']
|
|
59
|
-
value_data.delete('type')
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
validated_data = validate(machine_part_name, value_name, value_data, machine_part_data.depth)
|
|
63
|
-
invade_machine_part[machine_part_name].concat(
|
|
64
|
-
generate(
|
|
65
|
-
machine_name: machine,
|
|
66
|
-
part: machine_part_name,
|
|
67
|
-
part_type: value_name,
|
|
68
|
-
data: validated_data,
|
|
69
|
-
generator_type: Invade::Generator::Type::MACHINE_NESTED_PART
|
|
70
|
-
)
|
|
71
|
-
) if generate
|
|
72
|
-
end
|
|
73
|
-
else # Is VM, or SSH part
|
|
74
|
-
validated_data = validate('Machine', machine_part_name, machine_part_data, machine_part_data.depth)
|
|
75
|
-
invade_machine_part[machine_part_name] = generate(
|
|
76
|
-
machine_name: machine,
|
|
77
|
-
part_type: machine_part_name,
|
|
78
|
-
data: validated_data,
|
|
79
|
-
generator_type: Invade::Generator::Type::MACHINE_PART
|
|
80
|
-
) if generate
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
invade_machine[machine] = generate(
|
|
85
|
-
machine_name: machine,
|
|
86
|
-
data: invade_machine_part,
|
|
87
|
-
generator_type: Invade::Generator::Type::MACHINE
|
|
88
|
-
)
|
|
41
|
+
@env[:invade]['vagrantfile'] = generate(
|
|
42
|
+
data: @invade_vagrantfile,
|
|
43
|
+
generator_type: Invade::Generator::Type::VAGRANTFILE
|
|
44
|
+
) if @generate
|
|
45
|
+
|
|
46
|
+
@env[:invade].delete('machines')
|
|
47
|
+
|
|
48
|
+
@app.call(env)
|
|
49
|
+
end
|
|
89
50
|
|
|
90
|
-
|
|
51
|
+
private
|
|
91
52
|
|
|
92
|
-
|
|
93
|
-
|
|
53
|
+
def process_machines(machines)
|
|
54
|
+
|
|
55
|
+
# Iterate over machine configurations
|
|
56
|
+
machines.each_with_index do |(machine, machine_data), _|
|
|
57
|
+
process_machine(machine, machine_data)
|
|
58
|
+
end
|
|
94
59
|
|
|
95
|
-
|
|
60
|
+
@invade_vagrantfile['machines'] = @invade_machine
|
|
61
|
+
@env[:ui].success "\n[Invade]: Processed #{machines.count} machine(s)."
|
|
96
62
|
|
|
97
|
-
|
|
98
|
-
@env[:ui].info("\n[Invade]: Validating #{config_key.upcase} part...") unless quiet
|
|
63
|
+
end
|
|
99
64
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
generator_type: Invade::Generator::Type::VAGRANT_PART
|
|
105
|
-
) if generate
|
|
65
|
+
def process_machine(machine_name, machine_data)
|
|
66
|
+
# Iterate over each machine part configuration
|
|
67
|
+
machine_data.each do |machine_part_name, machine_part_data|
|
|
68
|
+
@env[:ui].info("\n[Invade][Machine: #{machine_name.upcase}]: Validating #{machine_part_name.upcase} part...") unless @quiet
|
|
106
69
|
|
|
70
|
+
if machine_part_data.depth > 1
|
|
71
|
+
process_machine_nested_part(machine_name, machine_part_name, machine_part_data)
|
|
72
|
+
else
|
|
73
|
+
process_machine_part(machine_name, machine_part_name, machine_part_data)
|
|
107
74
|
end
|
|
108
75
|
|
|
76
|
+
@invade_machine[machine_name] = generate(
|
|
77
|
+
machine_name: machine_name,
|
|
78
|
+
data: @invade_machine_part,
|
|
79
|
+
generator_type: Invade::Generator::Type::MACHINE
|
|
80
|
+
)
|
|
109
81
|
end
|
|
82
|
+
end
|
|
110
83
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
84
|
+
def process_machine_part(machine, machine_part_name, machine_part_data)
|
|
85
|
+
validated_data = validate('Machine', machine_part_name, machine_part_data, machine_part_data.depth)
|
|
86
|
+
@invade_machine_part[machine_part_name] = generate(
|
|
87
|
+
machine_name: machine,
|
|
88
|
+
part_type: machine_part_name,
|
|
89
|
+
data: validated_data,
|
|
90
|
+
generator_type: Invade::Generator::Type::MACHINE_PART
|
|
91
|
+
) if @generate
|
|
92
|
+
end
|
|
115
93
|
|
|
116
|
-
|
|
94
|
+
def process_machine_nested_part(machine, machine_part_name, machine_part_data)
|
|
117
95
|
|
|
118
|
-
@
|
|
96
|
+
@invade_machine_part[machine_part_name] = ''
|
|
97
|
+
machine_part_data.each do |value_name, value_data|
|
|
98
|
+
|
|
99
|
+
# Output info message
|
|
100
|
+
info_message = "\t#{machine_part_name.split('_').collect(&:capitalize).join}: #{value_name}"
|
|
101
|
+
@env[:ui].info(info_message) unless @env[:invade_validate_quiet]
|
|
102
|
+
|
|
103
|
+
# Exception handling for synced_folder and provision types
|
|
104
|
+
if machine_part_name == 'synced_folder' or machine_part_name == 'provision'
|
|
105
|
+
value_name = value_data['type']
|
|
106
|
+
value_data.delete('type')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
validated_data = validate(machine_part_name, value_name, value_data, machine_part_data.depth)
|
|
110
|
+
@invade_machine_part[machine_part_name].concat(
|
|
111
|
+
generate(
|
|
112
|
+
machine_name: machine,
|
|
113
|
+
part: machine_part_name,
|
|
114
|
+
part_type: value_name,
|
|
115
|
+
data: validated_data,
|
|
116
|
+
generator_type: Invade::Generator::Type::MACHINE_NESTED_PART
|
|
117
|
+
)
|
|
118
|
+
) if @generate
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def process_vagrant_part(config_key, config_data)
|
|
124
|
+
@env[:ui].info("\n[Invade]: Validating #{config_key.upcase} part...") unless @quiet
|
|
125
|
+
|
|
126
|
+
validated_data = validate(config_key, config_key, config_data, config_data.depth)
|
|
127
|
+
@invade_vagrantfile[config_key] = generate(
|
|
128
|
+
part_type: config_key,
|
|
129
|
+
data: validated_data,
|
|
130
|
+
generator_type: Invade::Generator::Type::VAGRANT_PART
|
|
131
|
+
) if @generate
|
|
119
132
|
end
|
|
120
133
|
|
|
121
134
|
def validate(part_name, value_name, value_data, depth)
|
|
@@ -28,21 +28,12 @@ module VagrantPlugins
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def self.check
|
|
32
|
-
Vagrant::Action::Builder.new.tap do |builder|
|
|
33
|
-
builder.use Config
|
|
34
|
-
builder.use Process
|
|
35
|
-
builder.use Check
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
31
|
# The autoload farm
|
|
40
32
|
action_root = Pathname.new(File.expand_path('../action', __FILE__))
|
|
41
33
|
autoload :Init, action_root.join('init')
|
|
42
34
|
autoload :Config, action_root.join('config')
|
|
43
35
|
autoload :Process, action_root.join('process')
|
|
44
36
|
autoload :Create, action_root.join('create')
|
|
45
|
-
autoload :Check, action_root.join('check')
|
|
46
37
|
|
|
47
38
|
end
|
|
48
39
|
end
|
|
@@ -20,12 +20,6 @@ module VagrantPlugins
|
|
|
20
20
|
Init
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
# CHECK COMMAND ("vagrant invade check")
|
|
24
|
-
@subcommands.register(:check) do
|
|
25
|
-
require_relative 'check'
|
|
26
|
-
Check
|
|
27
|
-
end
|
|
28
|
-
|
|
29
23
|
# VALIDATE COMMAND ("vagrant invade validate")
|
|
30
24
|
@subcommands.register(:validate) do
|
|
31
25
|
require_relative 'validate'
|
|
@@ -16,20 +16,19 @@ module VagrantPlugins
|
|
|
16
16
|
|
|
17
17
|
def validate
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return default
|
|
19
|
+
case @value
|
|
20
|
+
when String, Array
|
|
21
|
+
@env[:ui].success("\t#{name} => '#{@value}'") unless @env[:invade_validate_quiet]
|
|
22
|
+
|
|
23
|
+
when nil?
|
|
24
|
+
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:invade_validate_quiet]
|
|
25
|
+
return default
|
|
26
|
+
when ''
|
|
27
|
+
@env[:ui].warn("\tError: Empty string is not valid. Set '#{name}' => '#{default}'.") unless @env[:invade_validate_quiet]
|
|
28
|
+
return default
|
|
29
|
+
else
|
|
30
|
+
@env[:ui].error("\tError: '#{@value}' is not a string or array. Set to '#{name}' to default value '#{default}'.") unless @env[:invade_validate_quiet]
|
|
31
|
+
return default
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
@value
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-invade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lennart Stein
|
|
@@ -65,14 +65,12 @@ files:
|
|
|
65
65
|
- invade.yml.dist
|
|
66
66
|
- lib/vagrant-invade.rb
|
|
67
67
|
- lib/vagrant-invade/action.rb
|
|
68
|
-
- lib/vagrant-invade/action/check.rb
|
|
69
68
|
- lib/vagrant-invade/action/config.rb
|
|
70
69
|
- lib/vagrant-invade/action/create.rb
|
|
71
70
|
- lib/vagrant-invade/action/init.rb
|
|
72
71
|
- lib/vagrant-invade/action/process.rb
|
|
73
72
|
- lib/vagrant-invade/command/base.rb
|
|
74
73
|
- lib/vagrant-invade/command/build.rb
|
|
75
|
-
- lib/vagrant-invade/command/check.rb
|
|
76
74
|
- lib/vagrant-invade/command/init.rb
|
|
77
75
|
- lib/vagrant-invade/command/root.rb
|
|
78
76
|
- lib/vagrant-invade/command/validate.rb
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module VagrantPlugins
|
|
2
|
-
module Invade
|
|
3
|
-
module Action
|
|
4
|
-
|
|
5
|
-
include Vagrant::Action::Builtin
|
|
6
|
-
|
|
7
|
-
class Check
|
|
8
|
-
|
|
9
|
-
def initialize(app, env)
|
|
10
|
-
@app = app
|
|
11
|
-
@env = env
|
|
12
|
-
@logger = Log4r::Logger.new('vagrant::invade::action::init')
|
|
13
|
-
@dir = Dir.pwd
|
|
14
|
-
|
|
15
|
-
ENV['VAGRANT_VAGRANTFILE'] ? @vagrantfile_name = ENV['VAGRANT_VAGRANTFILE'] : @vagrantfile_name = "Vagrantfile"
|
|
16
|
-
@root_path = Dir.pwd
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def call(env)
|
|
20
|
-
|
|
21
|
-
data = @env[:invade]['vagrantfile']
|
|
22
|
-
|
|
23
|
-
checksum_helper = Helper::Checksum.new @env
|
|
24
|
-
vagrantfile_path = "#{@root_path}/#{@vagrantfile_name}"
|
|
25
|
-
md5_current = checksum_helper.get_checksum_of_file(vagrantfile_path)
|
|
26
|
-
md5_generated = checksum_helper.get_checksum_of_data(data)
|
|
27
|
-
|
|
28
|
-
if checksum_helper.check
|
|
29
|
-
@env[:ui].success "[Invade][CHECK] #{md5_current}"
|
|
30
|
-
@env[:ui].success "[Invade][CHECK] Checksum is valid!"
|
|
31
|
-
else
|
|
32
|
-
@env[:ui].warn "[Invade][CHECK] Changes found. Checksum is not equal!"
|
|
33
|
-
@env[:ui].warn "[Invade][CHECK] #{@vagrantfile_name} \tMD5:#{md5_current}"
|
|
34
|
-
@env[:ui].warn "[Invade][CHECK] invade.yml\tMD5:#{md5_generated}"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
@app.call(env)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require 'optparse'
|
|
2
|
-
require_relative 'base'
|
|
3
|
-
|
|
4
|
-
module VagrantPlugins
|
|
5
|
-
module Invade
|
|
6
|
-
module Command
|
|
7
|
-
class Check < Base
|
|
8
|
-
def execute
|
|
9
|
-
options = {}
|
|
10
|
-
opts = OptionParser.new do |o|
|
|
11
|
-
o.banner = 'Usage: vagrant invade check [-f|--force] [-q|--quiet] [-h|--help]'
|
|
12
|
-
o.separator ''
|
|
13
|
-
o.on('-q', '--quiet', 'No verbose output.') do |q|
|
|
14
|
-
options[:quiet] = q
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Parse the options
|
|
19
|
-
argv = parse_options(opts)
|
|
20
|
-
return unless argv
|
|
21
|
-
|
|
22
|
-
# Validates InVaDE configuration
|
|
23
|
-
action(Action.check, {
|
|
24
|
-
:invade_validate_quiet => true # set this to true. Just build without validate output
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
# Success, exit status 0
|
|
28
|
-
0
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|