vagrant-invade 0.2.0 → 0.3.0
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 +2 -2
- data/lib/vagrant-invade/action/config.rb +6 -6
- data/lib/vagrant-invade/action/create.rb +1 -1
- data/lib/vagrant-invade/action/init.rb +62 -0
- data/lib/vagrant-invade/action.rb +8 -0
- data/lib/vagrant-invade/command/init.rb +33 -0
- data/lib/vagrant-invade/command/root.rb +6 -0
- data/lib/vagrant-invade/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bbd5aa6c473ae3aa46605dfdc897bb28f40fd960
|
|
4
|
+
data.tar.gz: ae5154aea24128941eb5a4c45d74df16116b4e79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a3253404f1678c2b8d8533c0f596940bb364fd34462d9b506e8edcb4043ee683f177f9c263e2281a23fc0f13bad295c412d2dd50a82224b862661a4a28e8efe
|
|
7
|
+
data.tar.gz: 7ff9eb2ed32121d31f2c6c955f1ea9af8585c4c90356d6eb9fcc7dee41e81a382c1f2135ecec26bedc4abf1c64858d201d8ff203d932bc5dd0c905da62ce5a62
|
data/Gemfile.lock
CHANGED
|
@@ -15,8 +15,8 @@ module VagrantPlugins
|
|
|
15
15
|
def call(env)
|
|
16
16
|
root_path = @env[:root_path]
|
|
17
17
|
config_file_path = "#{root_path}/invade.yml"
|
|
18
|
-
template_file_path = config_file_path
|
|
19
|
-
default_config_file_path =
|
|
18
|
+
template_file_path = "#{config_file_path}.dist"
|
|
19
|
+
default_config_file_path = "#{File.expand_path('../../../../', __FILE__)}/invade.yml.dist"
|
|
20
20
|
|
|
21
21
|
# Returns with invade in environment if Invade Configuration file already exists
|
|
22
22
|
if File.exist?(config_file_path)
|
|
@@ -41,9 +41,9 @@ module VagrantPlugins
|
|
|
41
41
|
@env[:ui].warn '[Invade] Restarting vagrant...'
|
|
42
42
|
sleep 3
|
|
43
43
|
if !Vagrant.in_installer? && !Vagrant.very_quiet?
|
|
44
|
-
Kernel.exec('bundle exec vagrant up')
|
|
44
|
+
Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
|
|
45
45
|
else
|
|
46
|
-
Kernel.exec('vagrant up')
|
|
46
|
+
Kernel.exec('vagrant up') if @env[:invade_command]
|
|
47
47
|
end
|
|
48
48
|
rescue
|
|
49
49
|
# If not found default invade configuration file will be copied.
|
|
@@ -57,9 +57,9 @@ module VagrantPlugins
|
|
|
57
57
|
@env[:ui].warn '[Invade] Restarting vagrant...'
|
|
58
58
|
sleep 3
|
|
59
59
|
if !Vagrant.in_installer? && !Vagrant.very_quiet?
|
|
60
|
-
Kernel.exec('bundle exec vagrant up')
|
|
60
|
+
Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
|
|
61
61
|
else
|
|
62
|
-
Kernel.exec('vagrant up')
|
|
62
|
+
Kernel.exec('vagrant up') if @env[:invade_command]
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -22,7 +22,7 @@ module VagrantPlugins
|
|
|
22
22
|
generated_vagrantfile = @env[:invade]['vagrantfile']
|
|
23
23
|
|
|
24
24
|
# Get auto_mode from env
|
|
25
|
-
auto_mode = @env[:
|
|
25
|
+
auto_mode = @env[:invade_auto]
|
|
26
26
|
|
|
27
27
|
# Write new Vagrantfile if checksum is not equal and auto mode is enabled
|
|
28
28
|
unless check_md5_checksum(@env[:ui], root_path, vagrantfile_name, generated_vagrantfile)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Action
|
|
4
|
+
|
|
5
|
+
include Vagrant::Action::Builtin
|
|
6
|
+
|
|
7
|
+
class Init
|
|
8
|
+
|
|
9
|
+
def initialize(app, env)
|
|
10
|
+
@app = app
|
|
11
|
+
@env = env
|
|
12
|
+
@logger = Log4r::Logger.new('vagrant::invade::action::init')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call(env)
|
|
16
|
+
|
|
17
|
+
if !invade_config_exists || @env[:invade_command_init_force]
|
|
18
|
+
write_invade_config
|
|
19
|
+
else
|
|
20
|
+
@env[:ui].error "[Invade] A 'invade.yml' file already exists. Use '--force' to replace file."
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
@app.call(env)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def invade_config_exists
|
|
27
|
+
invade_config_file = "#{@env[:root_path]}/invade.yml"
|
|
28
|
+
if File.exist?(invade_config_file)
|
|
29
|
+
return true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def invade_template_exists
|
|
36
|
+
template_file_path = "#{@env[:root_path]}/invade.yml.dist"
|
|
37
|
+
if File.exist?(template_file_path)
|
|
38
|
+
return true
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
false
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def write_invade_config
|
|
45
|
+
|
|
46
|
+
config_file_path = "#{@env[:root_path]}/invade.yml"
|
|
47
|
+
|
|
48
|
+
if invade_template_exists
|
|
49
|
+
template_file_path = "#{@env[:root_path]}/invade.yml.dist"
|
|
50
|
+
FileUtils.cp(template_file_path, config_file_path)
|
|
51
|
+
@env[:ui].success "[Invade] Copy of template 'invade.yml.dist' created successfully. Please make your changes."
|
|
52
|
+
else
|
|
53
|
+
default_config_file_path = "#{File.expand_path('../../../../', __FILE__)}/invade.yml.dist"
|
|
54
|
+
FileUtils.cp(default_config_file_path, config_file_path)
|
|
55
|
+
@env[:ui].success "[Invade] Copy of default 'invade.yml.dist' created successfully. Please make your changes."
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -23,8 +23,16 @@ module VagrantPlugins
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# This middleware sequence will init a InVaDE configuration file
|
|
27
|
+
def self.init
|
|
28
|
+
Vagrant::Action::Builder.new.tap do |builder|
|
|
29
|
+
builder.use Init
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
26
33
|
# The autoload farm
|
|
27
34
|
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
|
35
|
+
autoload :Init, action_root.join("init")
|
|
28
36
|
autoload :Config, action_root.join("config")
|
|
29
37
|
autoload :Validate, action_root.join("validate")
|
|
30
38
|
autoload :Generate, action_root.join("generate")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'optparse'
|
|
2
|
+
require_relative 'base'
|
|
3
|
+
|
|
4
|
+
module VagrantPlugins
|
|
5
|
+
module Invade
|
|
6
|
+
module Command
|
|
7
|
+
class Init < Base
|
|
8
|
+
def execute
|
|
9
|
+
options = {}
|
|
10
|
+
opts = OptionParser.new do |o|
|
|
11
|
+
o.banner = "Usage: vagrant invade init [-f|--force] [-h]"
|
|
12
|
+
o.separator ""
|
|
13
|
+
o.on("-f", "--force", "Force creating configuration file.") do |f|
|
|
14
|
+
options[:force] = f
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Parse the options
|
|
19
|
+
argv = parse_options(opts)
|
|
20
|
+
return if !argv
|
|
21
|
+
|
|
22
|
+
# Init InVaDE configuration file
|
|
23
|
+
action(Action.init, {
|
|
24
|
+
:invade_command_init_force => options[:force]
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
# Success, exit status 0
|
|
28
|
+
0
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -14,6 +14,12 @@ module VagrantPlugins
|
|
|
14
14
|
@main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
|
15
15
|
@subcommands = Vagrant::Registry.new
|
|
16
16
|
|
|
17
|
+
# INIT COMMAND ("vagrant invade init")
|
|
18
|
+
@subcommands.register(:init) do
|
|
19
|
+
require_relative "init"
|
|
20
|
+
Init
|
|
21
|
+
end
|
|
22
|
+
|
|
17
23
|
# VALIDATE COMMAND ("vagrant invade validate")
|
|
18
24
|
@subcommands.register(:validate) do
|
|
19
25
|
require_relative "validate"
|
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.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lennart Stein
|
|
@@ -33,6 +33,7 @@ files:
|
|
|
33
33
|
- lib/vagrant-invade/action/config.rb
|
|
34
34
|
- lib/vagrant-invade/action/create.rb
|
|
35
35
|
- lib/vagrant-invade/action/generate.rb
|
|
36
|
+
- lib/vagrant-invade/action/init.rb
|
|
36
37
|
- lib/vagrant-invade/action/validate.rb
|
|
37
38
|
- lib/vagrant-invade/builder.rb
|
|
38
39
|
- lib/vagrant-invade/builder/definition.rb
|
|
@@ -54,6 +55,7 @@ files:
|
|
|
54
55
|
- lib/vagrant-invade/builder/vm.rb
|
|
55
56
|
- lib/vagrant-invade/command/base.rb
|
|
56
57
|
- lib/vagrant-invade/command/build.rb
|
|
58
|
+
- lib/vagrant-invade/command/init.rb
|
|
57
59
|
- lib/vagrant-invade/command/root.rb
|
|
58
60
|
- lib/vagrant-invade/command/validate.rb
|
|
59
61
|
- lib/vagrant-invade/generator.rb
|