vagrant-invade 0.3.0 → 0.3.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/config.rb +46 -40
- data/lib/vagrant-invade/action/create.rb +18 -16
- data/lib/vagrant-invade/action/init.rb +9 -6
- data/lib/vagrant-invade/action/validate.rb +21 -22
- data/lib/vagrant-invade/command/build.rb +3 -2
- data/lib/vagrant-invade/command/validate.rb +3 -3
- data/lib/vagrant-invade/validator.rb +9 -14
- data/lib/vagrant-invade/version.rb +1 -1
- data/lib/vagrant-invade.rb +5 -7
- data/vagrant-invade.gemspec +2 -1
- metadata +3 -4
- data/pkg/vagrant-invade-0.0.1.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c48fad8a557a97252354adb8561eb863446883b
|
|
4
|
+
data.tar.gz: 083271a0bef5b9ebb93bf475cd5858d7d58f7a26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e36091d4d4b3837da8a6678a27cfe6b18dc0c260ecb5ec875919be495afcbc69c30e3db26d46f95cb3c5398b4d908999c05aac616bd7aa2f3a0c8242356d1221
|
|
7
|
+
data.tar.gz: 0a55515c00a8252d16f235050c84324faee1ecd5abb9f4952cf0835bb7599a2f613d342417ec485246e0990c6b3d1845f3b0ef57b243ddb8d185d75739df452c
|
data/Gemfile.lock
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'vagrant-invade/version'
|
|
2
|
+
|
|
1
3
|
module VagrantPlugins
|
|
2
4
|
module Invade
|
|
3
5
|
module Action
|
|
@@ -10,58 +12,62 @@ module VagrantPlugins
|
|
|
10
12
|
@app = app
|
|
11
13
|
@env = env
|
|
12
14
|
@logger = Log4r::Logger.new('vagrant::invade::action::config')
|
|
15
|
+
@dir = Dir.pwd
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
def call(env)
|
|
16
|
-
|
|
17
|
-
config_file_path = "#{
|
|
19
|
+
|
|
20
|
+
config_file_path = "#{@dir}/invade.yml"
|
|
18
21
|
template_file_path = "#{config_file_path}.dist"
|
|
19
22
|
default_config_file_path = "#{File.expand_path('../../../../', __FILE__)}/invade.yml.dist"
|
|
20
23
|
|
|
21
24
|
# Returns with invade in environment if Invade Configuration file already exists
|
|
22
25
|
if File.exist?(config_file_path)
|
|
23
26
|
@logger.debug 'Config file found. Proceed.'
|
|
24
|
-
@env[:ui].info "[Invade] Using Plugin vagrant-invade-#{
|
|
27
|
+
@env[:ui].info "[Invade] Using Plugin vagrant-invade-#{VERSION} to setup Vagrant!"
|
|
25
28
|
|
|
26
29
|
# Add invade configuration as global environment variable since we know configuration file exists
|
|
27
|
-
env[:invade] =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@app.call(env)
|
|
31
|
-
else
|
|
32
|
-
# Try to copy template path from vagrant repository of project.
|
|
33
|
-
begin
|
|
34
|
-
FileUtils.cp(template_file_path, config_file_path)
|
|
35
|
-
@logger.debug 'Config file could not be found. Copied template file.'
|
|
36
|
-
@env[:ui].debug '[Invade] Configuration file could not be found.'
|
|
37
|
-
@env[:ui].warn '[Invade] Copying template configuration...'
|
|
38
|
-
@env[:ui].warn "\tFrom: \"#{template_file_path}\""
|
|
39
|
-
@env[:ui].warn "\tTo: \"#{config_file_path}\""
|
|
40
|
-
sleep 2
|
|
41
|
-
@env[:ui].warn '[Invade] Restarting vagrant...'
|
|
42
|
-
sleep 3
|
|
43
|
-
if !Vagrant.in_installer? && !Vagrant.very_quiet?
|
|
44
|
-
Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
|
|
45
|
-
else
|
|
46
|
-
Kernel.exec('vagrant up') if @env[:invade_command]
|
|
47
|
-
end
|
|
48
|
-
rescue
|
|
49
|
-
# If not found default invade configuration file will be copied.
|
|
50
|
-
FileUtils.cp(default_config_file_path, config_file_path)
|
|
51
|
-
@logger.info 'Template file could not be found. Copied default invade configuration file.'
|
|
52
|
-
@env[:ui].warn '[Invade] Template file could not be found.'
|
|
53
|
-
@env[:ui].warn '[Invade] Copying default configuration...'
|
|
54
|
-
@env[:ui].warn "\tFrom: \"#{template_file_path}\""
|
|
55
|
-
@env[:ui].warn "\tTo: \"#{config_file_path}\""
|
|
56
|
-
sleep 2
|
|
57
|
-
@env[:ui].warn '[Invade] Restarting vagrant...'
|
|
58
|
-
sleep 3
|
|
59
|
-
if !Vagrant.in_installer? && !Vagrant.very_quiet?
|
|
60
|
-
Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
|
|
61
|
-
else
|
|
62
|
-
Kernel.exec('vagrant up') if @env[:invade_command]
|
|
63
|
-
end
|
|
30
|
+
env[:invade] = Invade.get_invade_config
|
|
31
|
+
unless env[:invade]
|
|
32
|
+
raise "Something went wront. Configuration file could not be loaded."
|
|
64
33
|
end
|
|
34
|
+
else
|
|
35
|
+
@env[:ui].info "[Invade] 'invade.yml' not exists. You forgot a 'vagrant invade init'?"
|
|
36
|
+
exit
|
|
37
|
+
|
|
38
|
+
# # Try to copy template path from vagrant repository of project.
|
|
39
|
+
# begin
|
|
40
|
+
# FileUtils.cp(template_file_path, config_file_path)
|
|
41
|
+
# @logger.debug 'Config file could not be found. Copied template file.'
|
|
42
|
+
# @env[:ui].debug '[Invade] Configuration file could not be found.'
|
|
43
|
+
# @env[:ui].warn '[Invade] Copying template configuration...'
|
|
44
|
+
# @env[:ui].warn "\tFrom: \"#{template_file_path}\""
|
|
45
|
+
# @env[:ui].warn "\tTo: \"#{config_file_path}\""
|
|
46
|
+
# sleep 2
|
|
47
|
+
# @env[:ui].warn '[Invade] Restarting vagrant...'
|
|
48
|
+
# sleep 3
|
|
49
|
+
# if !Vagrant.in_installer? && !Vagrant.very_quiet?
|
|
50
|
+
# Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
|
|
51
|
+
# else
|
|
52
|
+
# Kernel.exec('vagrant up') if @env[:invade_command]
|
|
53
|
+
# end
|
|
54
|
+
# rescue
|
|
55
|
+
# # If not found default invade configuration file will be copied.
|
|
56
|
+
# FileUtils.cp(default_config_file_path, config_file_path)
|
|
57
|
+
# @logger.info 'Template file could not be found. Copied default invade configuration file.'
|
|
58
|
+
# @env[:ui].warn '[Invade] Template file could not be found.'
|
|
59
|
+
# @env[:ui].warn '[Invade] Copying default configuration...'
|
|
60
|
+
# @env[:ui].warn "\tFrom: \"#{template_file_path}\""
|
|
61
|
+
# @env[:ui].warn "\tTo: \"#{config_file_path}\""
|
|
62
|
+
# sleep 2
|
|
63
|
+
# @env[:ui].warn '[Invade] Restarting vagrant...'
|
|
64
|
+
# sleep 3
|
|
65
|
+
# if !Vagrant.in_installer? && !Vagrant.very_quiet?
|
|
66
|
+
# Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
|
|
67
|
+
# else
|
|
68
|
+
# Kernel.exec('vagrant up') if @env[:invade_command]
|
|
69
|
+
# end
|
|
70
|
+
# end
|
|
65
71
|
end
|
|
66
72
|
|
|
67
73
|
@app.call(env)
|
|
@@ -15,25 +15,21 @@ module VagrantPlugins
|
|
|
15
15
|
def call(env)
|
|
16
16
|
|
|
17
17
|
# Get project root and default vagrantfile filename
|
|
18
|
+
root_path = Dir.pwd
|
|
18
19
|
ENV['VAGRANT_VAGRANTFILE'] ? vagrantfile_name = ENV['VAGRANT_VAGRANTFILE'] : vagrantfile_name = "Vagrantfile"
|
|
19
|
-
root_path = @env[:root_path]
|
|
20
20
|
|
|
21
21
|
# Get generated Vagrantfile from environment
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if @env[:invade]['vagrantfile']
|
|
23
|
+
generated_vagrantfile = @env[:invade]['vagrantfile']
|
|
24
|
+
else
|
|
25
|
+
raise "[Invade]: No generated data found. Can't build Vagrantfile."
|
|
26
|
+
end
|
|
26
27
|
|
|
27
28
|
# Write new Vagrantfile if checksum is not equal and auto mode is enabled
|
|
28
29
|
unless check_md5_checksum(@env[:ui], root_path, vagrantfile_name, generated_vagrantfile)
|
|
29
|
-
|
|
30
|
-
# Write Vagrantfile
|
|
31
|
-
auto_mode ?
|
|
30
|
+
@env[:invade_build_force] ?
|
|
32
31
|
write_vagrantfile(@env[:ui], root_path, generated_vagrantfile, vagrantfile_name, true) :
|
|
33
32
|
write_vagrantfile(@env[:ui], root_path, generated_vagrantfile, vagrantfile_name, false)
|
|
34
|
-
|
|
35
|
-
# Reload
|
|
36
|
-
reload(@env[:ui]) if auto_mode
|
|
37
33
|
end
|
|
38
34
|
end
|
|
39
35
|
|
|
@@ -45,17 +41,23 @@ module VagrantPlugins
|
|
|
45
41
|
require 'digest'
|
|
46
42
|
|
|
47
43
|
md5_new = Digest::MD5.hexdigest(generated_vagrantfile)
|
|
48
|
-
md5_current = Digest::MD5.file("#{root_path}/#{vagrantfile_name}").hexdigest
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
if File.exists?("#{root_path}/#{vagrantfile_name}")
|
|
46
|
+
md5_current = Digest::MD5.file("#{root_path}/#{vagrantfile_name}").hexdigest
|
|
47
|
+
else
|
|
48
|
+
md5_current = 0
|
|
49
|
+
end
|
|
50
|
+
|
|
51
51
|
(md5_new.eql? md5_current) ? md5_check = true : md5_check = false
|
|
52
52
|
|
|
53
53
|
unless md5_check
|
|
54
|
-
ui.warn "[Invade]
|
|
54
|
+
ui.warn "[Invade] Checksum not equal!"
|
|
55
|
+
ui.warn "[Invade] Current : '#{md5_current}'"
|
|
56
|
+
ui.warn "[Invade] Generated : '#{md5_new}'"
|
|
55
57
|
return false
|
|
56
58
|
end
|
|
57
59
|
|
|
58
|
-
ui.success "[Invade] Vagrantfile is valid."
|
|
60
|
+
ui.success "[Invade] Vagrantfile is still valid. No need to rebuild. Or use --force."
|
|
59
61
|
|
|
60
62
|
true
|
|
61
63
|
end
|
|
@@ -88,7 +90,7 @@ module VagrantPlugins
|
|
|
88
90
|
|
|
89
91
|
overwrite ?
|
|
90
92
|
ui.warn('[Invade] Replaced old Vagrantfile.') :
|
|
91
|
-
ui.warn("[Invade] Saved new Vagrantfile
|
|
93
|
+
ui.warn("[Invade] Saved new Vagrantfile at '#{root_path}/#{vagrantfile_name}.new'")
|
|
92
94
|
end
|
|
93
95
|
end
|
|
94
96
|
|
|
@@ -10,6 +10,7 @@ module VagrantPlugins
|
|
|
10
10
|
@app = app
|
|
11
11
|
@env = env
|
|
12
12
|
@logger = Log4r::Logger.new('vagrant::invade::action::init')
|
|
13
|
+
@dir = Dir.pwd
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def call(env)
|
|
@@ -24,7 +25,8 @@ module VagrantPlugins
|
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
def invade_config_exists
|
|
27
|
-
|
|
28
|
+
current_root_path = Dir.pwd
|
|
29
|
+
invade_config_file = "#{@dir}/invade.yml"
|
|
28
30
|
if File.exist?(invade_config_file)
|
|
29
31
|
return true
|
|
30
32
|
end
|
|
@@ -33,7 +35,7 @@ module VagrantPlugins
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def invade_template_exists
|
|
36
|
-
template_file_path = "#{@
|
|
38
|
+
template_file_path = "#{@dir}/invade.yml.dist"
|
|
37
39
|
if File.exist?(template_file_path)
|
|
38
40
|
return true
|
|
39
41
|
end
|
|
@@ -42,15 +44,16 @@ module VagrantPlugins
|
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
def write_invade_config
|
|
45
|
-
|
|
46
|
-
config_file_path = "#{@
|
|
47
|
+
current_root_path = Dir.pwd
|
|
48
|
+
config_file_path = "#{@dir}/invade.yml"
|
|
47
49
|
|
|
48
50
|
if invade_template_exists
|
|
49
|
-
template_file_path = "#{@
|
|
51
|
+
template_file_path = "#{@dir}/invade.yml.dist"
|
|
50
52
|
FileUtils.cp(template_file_path, config_file_path)
|
|
51
53
|
@env[:ui].success "[Invade] Copy of template 'invade.yml.dist' created successfully. Please make your changes."
|
|
52
54
|
else
|
|
53
|
-
|
|
55
|
+
plugin_root_path = File.expand_path('../../../../', __FILE__)
|
|
56
|
+
default_config_file_path = plugin_root_path + '/invade.yml.dist'
|
|
54
57
|
FileUtils.cp(default_config_file_path, config_file_path)
|
|
55
58
|
@env[:ui].success "[Invade] Copy of default 'invade.yml.dist' created successfully. Please make your changes."
|
|
56
59
|
end
|
|
@@ -13,11 +13,10 @@ module VagrantPlugins
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def call(env)
|
|
16
|
-
|
|
17
16
|
config = env[:invade]
|
|
17
|
+
quiet = @env[:invade_validate_quiet]
|
|
18
18
|
|
|
19
19
|
Validator.set_env(@env)
|
|
20
|
-
Validator.set_invade(@env)
|
|
21
20
|
|
|
22
21
|
###############################################################
|
|
23
22
|
# Validate the settings and set default variables if needed
|
|
@@ -33,19 +32,19 @@ module VagrantPlugins
|
|
|
33
32
|
|
|
34
33
|
# VM
|
|
35
34
|
unless sections['vm'] == nil
|
|
36
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating VM configuration...")
|
|
37
|
-
sleep 1 unless
|
|
35
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating VM configuration...") unless quiet
|
|
36
|
+
sleep 1 unless quiet
|
|
38
37
|
|
|
39
38
|
sections['vm'] = Validator::VM.new(env, sections['vm']).validate
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
# NETWORK
|
|
43
42
|
unless sections['network'] == nil
|
|
44
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating network configuration...")
|
|
45
|
-
sleep 1 unless
|
|
43
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating network configuration...") unless quiet
|
|
44
|
+
sleep 1 unless quiet
|
|
46
45
|
|
|
47
46
|
sections['network'].each do |type, network|
|
|
48
|
-
@env[:ui].info("\tNetwork: #{type}")
|
|
47
|
+
@env[:ui].info("\tNetwork: #{type}") unless quiet
|
|
49
48
|
case type
|
|
50
49
|
when 'private', 'private_network', 'privatenetwork', 'private-network'
|
|
51
50
|
network = Validator::Network::PrivateNetwork.new(env, network).validate
|
|
@@ -61,11 +60,11 @@ module VagrantPlugins
|
|
|
61
60
|
|
|
62
61
|
# PROVIDER
|
|
63
62
|
unless sections['provider'] == nil
|
|
64
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating provider configuration...")
|
|
65
|
-
sleep 1 unless
|
|
63
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating provider configuration...") unless quiet
|
|
64
|
+
sleep 1 unless quiet
|
|
66
65
|
|
|
67
66
|
sections['provider'].each do |type, provider|
|
|
68
|
-
@env[:ui].info("\tProvider: #{type}")
|
|
67
|
+
@env[:ui].info("\tProvider: #{type}") unless quiet
|
|
69
68
|
case type
|
|
70
69
|
when 'virtualbox'
|
|
71
70
|
provider = Validator::Provider::VirtualBox.new(env, provider).validate
|
|
@@ -79,11 +78,11 @@ module VagrantPlugins
|
|
|
79
78
|
|
|
80
79
|
# SYNCED FOLDER
|
|
81
80
|
unless sections['synced_folder'] == nil
|
|
82
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating synced folder configuration...")
|
|
83
|
-
sleep 1 unless
|
|
81
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating synced folder configuration...") unless quiet
|
|
82
|
+
sleep 1 unless quiet
|
|
84
83
|
|
|
85
84
|
sections['synced_folder'].each do |type, sf|
|
|
86
|
-
@env[:ui].info("\tSynced Folder: #{type}")
|
|
85
|
+
@env[:ui].info("\tSynced Folder: #{type}") unless quiet
|
|
87
86
|
case type
|
|
88
87
|
when 'nfs'
|
|
89
88
|
sf = Validator::SyncedFolder::NFS.new(env, sf).validate
|
|
@@ -97,11 +96,11 @@ module VagrantPlugins
|
|
|
97
96
|
|
|
98
97
|
# PROVISION
|
|
99
98
|
unless sections['provision'] == nil
|
|
100
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating provision configuration...")
|
|
101
|
-
sleep 1 unless
|
|
99
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating provision configuration...") unless quiet
|
|
100
|
+
sleep 1 unless quiet
|
|
102
101
|
|
|
103
102
|
sections['provision'].each do |type, provision|
|
|
104
|
-
@env[:ui].info("\tProvision: #{type}")
|
|
103
|
+
@env[:ui].info("\tProvision: #{type}") unless quiet
|
|
105
104
|
case type
|
|
106
105
|
when 'shell'
|
|
107
106
|
provision = Validator::Provision::Shell.new(env, provision).validate
|
|
@@ -115,18 +114,18 @@ module VagrantPlugins
|
|
|
115
114
|
|
|
116
115
|
# SSH
|
|
117
116
|
unless sections['ssh'] == nil
|
|
118
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating SSH configuration...")
|
|
119
|
-
sleep 1 unless
|
|
117
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating SSH configuration...") unless quiet
|
|
118
|
+
sleep 1 unless quiet
|
|
120
119
|
|
|
121
120
|
sections['ssh'] = Validator::SSH.new(env, sections['ssh']).validate
|
|
122
121
|
end
|
|
123
122
|
|
|
124
123
|
unless sections['plugin'] == nil
|
|
125
|
-
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating plugin configuration...")
|
|
126
|
-
sleep 1 unless
|
|
124
|
+
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating plugin configuration...") unless quiet
|
|
125
|
+
sleep 1 unless quiet
|
|
127
126
|
|
|
128
127
|
sections['plugin'].each do |type, plugin|
|
|
129
|
-
@env[:ui].info("\tPlugin: #{type}")
|
|
128
|
+
@env[:ui].info("\tPlugin: #{type}") unless quiet
|
|
130
129
|
case type
|
|
131
130
|
when 'hostmanager'
|
|
132
131
|
plugin = Validator::Plugin::HostManager.new(env, plugin).validate
|
|
@@ -142,7 +141,7 @@ module VagrantPlugins
|
|
|
142
141
|
end
|
|
143
142
|
|
|
144
143
|
if Validator::VALIDATION_ERRORS > 0
|
|
145
|
-
@env[:ui].warn('[Invade] Configuration has validation warnings. Use debug mode to see details.')
|
|
144
|
+
@env[:ui].warn('[Invade] Configuration has validation warnings. Use debug mode to see details.') unless quiet
|
|
146
145
|
else
|
|
147
146
|
@env[:ui].success('[Invade] Configuration validated successfully.')
|
|
148
147
|
end
|
|
@@ -24,8 +24,9 @@ module VagrantPlugins
|
|
|
24
24
|
|
|
25
25
|
# Validates InVaDE configuration
|
|
26
26
|
action(Action.build, {
|
|
27
|
-
:
|
|
28
|
-
:
|
|
27
|
+
:invade_build_force => options[:force],
|
|
28
|
+
:invade_build_quiet => options[:quiet],
|
|
29
|
+
:invade_validate_quiet => true # set this to true. Just build without validate output
|
|
29
30
|
})
|
|
30
31
|
|
|
31
32
|
# Success, exit status 0
|
|
@@ -13,7 +13,7 @@ module VagrantPlugins
|
|
|
13
13
|
o.on("-f", "--force", "Overwrite existing Vagrantfile") do |f|
|
|
14
14
|
options[:force] = f
|
|
15
15
|
end
|
|
16
|
-
o.on("-q", "--quiet", "
|
|
16
|
+
o.on("-q", "--quiet", "Just make it whisper.") do |q|
|
|
17
17
|
options[:quiet] = q
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -24,8 +24,8 @@ module VagrantPlugins
|
|
|
24
24
|
|
|
25
25
|
# Validates InVaDE configuration
|
|
26
26
|
action(Action.validate, {
|
|
27
|
-
:
|
|
28
|
-
:
|
|
27
|
+
:invade_validate_force => options[:force],
|
|
28
|
+
:invade_validate_quiet => options[:quiet]
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
# Success, exit status 0
|
|
@@ -17,25 +17,20 @@ module VagrantPlugins
|
|
|
17
17
|
attr_accessor :invade
|
|
18
18
|
|
|
19
19
|
@env = nil
|
|
20
|
-
@invade = nil
|
|
21
20
|
|
|
22
21
|
def self.set_env(env)
|
|
23
22
|
@env = env
|
|
24
23
|
end
|
|
25
24
|
|
|
26
|
-
def self.set_invade(env)
|
|
27
|
-
@invade = env[:invade]['invade']
|
|
28
|
-
end
|
|
29
|
-
|
|
30
25
|
# Validates to BOOLEAN and returns the value at success or a default if not
|
|
31
26
|
def self.validate_boolean(value, name, default)
|
|
32
27
|
|
|
33
28
|
invade = @env[:invade]['invade']
|
|
34
29
|
|
|
35
30
|
if [true, false].include? value
|
|
36
|
-
@env[:ui].success("\t#{name} => #{value}") unless @env[:
|
|
31
|
+
@env[:ui].success("\t#{name} => #{value}") unless @env[:invade_validate_quiet]
|
|
37
32
|
elsif value === nil
|
|
38
|
-
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:
|
|
33
|
+
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:invade_validate_quiet]
|
|
39
34
|
return default
|
|
40
35
|
else
|
|
41
36
|
@env[:ui].warn("\tWarning: #{name} => #{value} is not a boolean. Set '#{name}' to default value #{default.to_s.upcase}.")
|
|
@@ -52,12 +47,12 @@ module VagrantPlugins
|
|
|
52
47
|
invade = @env[:invade]['invade']
|
|
53
48
|
|
|
54
49
|
if value.is_a? String
|
|
55
|
-
@env[:ui].success("\t#{name} => '#{value}'") unless @env[:
|
|
50
|
+
@env[:ui].success("\t#{name} => '#{value}'") unless @env[:invade_validate_quiet]
|
|
56
51
|
elsif value === nil
|
|
57
|
-
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:
|
|
52
|
+
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:invade_validate_quiet]
|
|
58
53
|
return default
|
|
59
54
|
elsif value === ''
|
|
60
|
-
@env[:ui].warn("\tEmpty string is not valid. Set '#{name}' => '#{default}'.") unless @env[:
|
|
55
|
+
@env[:ui].warn("\tEmpty string is not valid. Set '#{name}' => '#{default}'.") unless @env[:invade_validate_quiet]
|
|
61
56
|
return default
|
|
62
57
|
else
|
|
63
58
|
@env[:ui].warn("\tWarning: '#{value}' is not a string. Set to '#{name}' to default value '#{default}'.")
|
|
@@ -74,9 +69,9 @@ module VagrantPlugins
|
|
|
74
69
|
invade = @env[:invade]['invade']
|
|
75
70
|
|
|
76
71
|
if value.is_a? Integer or is_number(value)
|
|
77
|
-
@env[:ui].success("\t#{name} => #{value}") unless @env[:
|
|
72
|
+
@env[:ui].success("\t#{name} => #{value}") unless @env[:invade_validate_quiet]
|
|
78
73
|
elsif value === nil
|
|
79
|
-
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:
|
|
74
|
+
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:invade_validate_quiet]
|
|
80
75
|
return default
|
|
81
76
|
else
|
|
82
77
|
@env[:ui].warn("\tWarning: '#{value}' is not an integer. Set '#{name}' to default value #{default}.")
|
|
@@ -91,9 +86,9 @@ module VagrantPlugins
|
|
|
91
86
|
def self.validate_array(value, name, default)
|
|
92
87
|
|
|
93
88
|
if value.is_a? Array
|
|
94
|
-
@env[:ui].success("\t#{name} => #{value}") unless @env[:
|
|
89
|
+
@env[:ui].success("\t#{name} => #{value}") unless @env[:invade_validate_quiet]
|
|
95
90
|
elsif value === nil
|
|
96
|
-
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:
|
|
91
|
+
@env[:ui].warn("\t#{name} not set. Use Vagrant default.") unless @env[:invade_validate_quiet]
|
|
97
92
|
return default
|
|
98
93
|
else
|
|
99
94
|
@env[:ui].warn("\tWarning: '#{value}' is not an array. Set '#{name}' to default value #{default}.")
|
data/lib/vagrant-invade.rb
CHANGED
|
@@ -11,16 +11,18 @@ require 'vagrant-invade/plugin'
|
|
|
11
11
|
module VagrantPlugins
|
|
12
12
|
module Invade
|
|
13
13
|
|
|
14
|
+
require 'vagrant-invade/version'
|
|
15
|
+
|
|
14
16
|
autoload :Validator, 'vagrant-invade/validator'
|
|
15
17
|
autoload :Builder, 'vagrant-invade/builder'
|
|
16
18
|
autoload :Generator, 'vagrant-invade/generator'
|
|
17
19
|
|
|
18
20
|
def self.get_invade_config
|
|
21
|
+
|
|
19
22
|
#Loading Invade configuration settings from file
|
|
20
|
-
|
|
21
|
-
invade_config_file = "#{@source_root}/invade.yml"
|
|
23
|
+
invade_config_file = Dir.pwd + '/invade.yml'
|
|
22
24
|
|
|
23
|
-
if File.
|
|
25
|
+
if File.exists?(invade_config_file)
|
|
24
26
|
begin
|
|
25
27
|
return YAML.load_file(invade_config_file)
|
|
26
28
|
rescue SyntaxError => e
|
|
@@ -33,9 +35,5 @@ module VagrantPlugins
|
|
|
33
35
|
|
|
34
36
|
@config_values
|
|
35
37
|
end
|
|
36
|
-
|
|
37
|
-
def self.source_root
|
|
38
|
-
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
|
39
|
-
end
|
|
40
38
|
end
|
|
41
39
|
end
|
data/vagrant-invade.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ require File.expand_path('../lib/vagrant-invade/version', __FILE__)
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = 'vagrant-invade'
|
|
6
6
|
s.version = VagrantPlugins::Invade::VERSION
|
|
7
|
-
s.date =
|
|
7
|
+
s.date = Date.today.to_s
|
|
8
8
|
s.summary = "Create a Vagrantfile with a single YAML configuration file"
|
|
9
9
|
s.description = "InVaDE is a plugin that uses a YAML configuration file to build a Vagrantfile from it."
|
|
10
10
|
s.authors = ["Lennart Stein"]
|
|
@@ -14,4 +14,5 @@ Gem::Specification.new do |s|
|
|
|
14
14
|
s.require_paths = ['lib']
|
|
15
15
|
s.homepage = 'https://github.com/frgmt/vagrant-invade'
|
|
16
16
|
s.license = 'GNU'
|
|
17
|
+
s.required_ruby_version = '>= 2.0.0'
|
|
17
18
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-invade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lennart Stein
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-08
|
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: InVaDE is a plugin that uses a YAML configuration file to build a Vagrantfile
|
|
14
14
|
from it.
|
|
@@ -104,7 +104,6 @@ files:
|
|
|
104
104
|
- lib/vagrant-invade/validator/synced_folder/vb.rb
|
|
105
105
|
- lib/vagrant-invade/validator/vm.rb
|
|
106
106
|
- lib/vagrant-invade/version.rb
|
|
107
|
-
- pkg/vagrant-invade-0.0.1.gem
|
|
108
107
|
- vagrant-invade.gemspec
|
|
109
108
|
homepage: https://github.com/frgmt/vagrant-invade
|
|
110
109
|
licenses:
|
|
@@ -118,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
118
117
|
requirements:
|
|
119
118
|
- - ">="
|
|
120
119
|
- !ruby/object:Gem::Version
|
|
121
|
-
version:
|
|
120
|
+
version: 2.0.0
|
|
122
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
122
|
requirements:
|
|
124
123
|
- - ">="
|
|
Binary file
|