vagrant-yarrs-and-yamls 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example.Vagrantfile.yml +1 -1
- data/lib/vagrant-yarrs-and-yamls/plugin.rb +38 -2
- data/lib/vagrant-yarrs-and-yamls/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59f20cfcd72a04ccd2f1e225bd7dc364e92dd534
|
4
|
+
data.tar.gz: 168016006a52b49f109e4e680e4c5a5655b8390c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d8188a708491ba29051ca9fe13d4e9cccae2866aba490c23948f7f23e12c30a5795e1de7bba2434bd5467428b357554c43a158b701e8b5561b47522473103a
|
7
|
+
data.tar.gz: 525d12c681ceca1dd02539ce47aad2638c487928002131bca4cf0d1a245bb91ecaffdba6509d5f5045ee916425203e7a1e958abf0100d0f6d2fae3f4e447e908
|
data/example.Vagrantfile.yml
CHANGED
@@ -9,19 +9,55 @@ module VagrantPlugins
|
|
9
9
|
|
10
10
|
@@config = false
|
11
11
|
|
12
|
+
action_hook(:init, :environment_unload) { maybe_create_yaml_file }
|
12
13
|
action_hook(:load_config, Plugin::ALL_ACTIONS) { load_config }
|
13
14
|
|
14
15
|
action_hook(:require_vagrant_plugins, :environment_load) {
|
15
|
-
|
16
|
+
if ! self.get_config.empty?
|
16
17
|
self.require_vagrant_plugins(self.get_config["required_plugins"]) if self.get_config["required_plugins"]
|
17
18
|
end
|
18
19
|
}
|
19
20
|
|
21
|
+
def self.maybe_create_yaml_file
|
22
|
+
ARGV.each do |arg|
|
23
|
+
if arg.include?('init') || arg.include?('--yaml') || arg.include?('--yamls') || arg.include?('--yarrs')
|
24
|
+
self.create_vagrant_file
|
25
|
+
self.create_yaml_file
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.create_vagrant_file
|
31
|
+
source = __FILE__ + '/../../../example.Vagrantfile'
|
32
|
+
dest = Dir.pwd + '/Vagrantfile'
|
33
|
+
self.copy_file source, dest
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.create_yaml_file
|
37
|
+
source = __FILE__ + '/../../../example.Vagrantfile.yml'
|
38
|
+
dest = Dir.pwd + '/Vagrantfile.yml'
|
39
|
+
self.copy_file source, dest
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.copy_file(source, dest)
|
43
|
+
source = File.realpath(source)
|
44
|
+
self.backup_file(dest)
|
45
|
+
FileUtils.copy_file source, dest
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.timestamp_filename(file)
|
49
|
+
dir = File.dirname(file)
|
50
|
+
base = File.basename(file, ".*")
|
51
|
+
time = Time.now.to_i
|
52
|
+
ext = File.extname(file)
|
53
|
+
File.join(dir, "#{base}.bak.#{time}#{ext}")
|
54
|
+
end
|
55
|
+
|
20
56
|
def self.load_config
|
21
57
|
|
22
58
|
return @@config if @@config
|
23
59
|
|
24
|
-
|
60
|
+
@@config = []
|
25
61
|
configfile = ''
|
26
62
|
|
27
63
|
# Try Vagrant.local.yml next
|