vagrant-yarrs-and-yamls 0.7.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a691ad1f1a92c8c1fbb9ef75ea88a765c67c1c5
4
- data.tar.gz: c04ba00952460be8566cc4959f975b996c306c29
3
+ metadata.gz: 59f20cfcd72a04ccd2f1e225bd7dc364e92dd534
4
+ data.tar.gz: 168016006a52b49f109e4e680e4c5a5655b8390c
5
5
  SHA512:
6
- metadata.gz: a3db2984c7aea87065bf650b33635aa5b1e76c9baab4b95e9e47e7a5fcd307d8a0cfb0d291b7b1f6b044debfe91fb11d099a29d2ec78aeb98f20db5ddc0abd08
7
- data.tar.gz: a0ecef8b1b9f280517e1eb31a8a0745a097ffbea8d754b4225b821ace2f69c47c264240dbd59144598852304da6ca61aeb534661e1d721108f2ace8ae7a683f9
6
+ metadata.gz: b6d8188a708491ba29051ca9fe13d4e9cccae2866aba490c23948f7f23e12c30a5795e1de7bba2434bd5467428b357554c43a158b701e8b5561b47522473103a
7
+ data.tar.gz: 525d12c681ceca1dd02539ce47aad2638c487928002131bca4cf0d1a245bb91ecaffdba6509d5f5045ee916425203e7a1e958abf0100d0f6d2fae3f4e447e908
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  boxes:
3
- - hostname: coreos-34
3
+ - hostname: vagrant
4
4
  box: ubuntu/trusty64
@@ -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
- if ! self.get_config.empty?
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
- @@config = []
60
+ @@config = []
25
61
  configfile = ''
26
62
 
27
63
  # Try Vagrant.local.yml next
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module YarrsAndYamls
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-yarrs-and-yamls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pirate Dunbar