vagrant-properties 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6162f9a24d57a0d54dc5be0daadc900c62b984d2
4
- data.tar.gz: 8f7a5d24218933eda6f9e6650c257a134c2b5a0c
3
+ metadata.gz: 8f1efa8e9cb66f2287fdd7196c070fbfc8b301b4
4
+ data.tar.gz: 0be19e71c18e7579ee11b1e7d4fc2d8eb914307b
5
5
  SHA512:
6
- metadata.gz: 539665ea9635d2699d598d138730dd31cc485c8181f9c922f5c1783e58b064f60be5144476fc16d0bdaf89de6100fdb492505b95c5b93e4054b15f3e53b65894
7
- data.tar.gz: a36b776c5c9afcf8d60d5b528ffb2febc472f0aa5eacd33c1a21403f200ca8643722542be5800aaaae9a5c5806a7971cfdb929345b9bca2f6399bb3639bc4cf7
6
+ metadata.gz: 6aba9022d4ca61c8125d342dd876e9427707d9d5013eaca0716ae3f2d50bf7f72ee9116a45138053785c6177e81b8c3fbb17fa1738618ad0404f2e5c4af906dd
7
+ data.tar.gz: e76fa19cd4578447f9c240c7f525c0539b081b438440d5eac195ae84cee65fb60efa11cf24d3831345967314b6feda2f669de747e7838802389eb5d7e618c7d8
@@ -1,24 +1,12 @@
1
1
  require 'vagrant-properties/version'
2
2
 
3
3
  module VagrantPlugins
4
- module Properties
5
- class << self
6
- def enable
7
- @enabled = true
8
- end
9
-
10
- def enabled?
11
- @enabled
12
- end
13
- end
14
- end
15
-
16
4
  module Kernel_V2
17
5
  class Plugin < Vagrant.plugin('2')
18
6
  config('properties') do
19
7
  require File.expand_path('../vagrant-properties/config', __FILE__)
20
8
  Properties::Config
21
- end if VagrantPlugins::Properties.enabled?
9
+ end
22
10
  end
23
11
  end
24
12
  end
@@ -4,10 +4,10 @@ require 'yaml'
4
4
  module VagrantPlugins
5
5
  module Properties
6
6
  class Config < Vagrant.plugin('2', :config)
7
- attr_accessor :properties
7
+ attr_writer :properties_path
8
8
 
9
- def initialize
10
- @properties = self.class.properties
9
+ def named(key)
10
+ self.class.properties[key.to_sym]
11
11
  end
12
12
 
13
13
  class << self
@@ -16,14 +16,20 @@ module VagrantPlugins
16
16
  end
17
17
 
18
18
  def build_properties
19
- load_properties.each do |k, v|
20
- v['path'] = pull_project(v['repo'])
21
- write_to_hosts v['ip'], v['hostname']
19
+ load_properties.each_with_object({}) do |(name, property), memo|
20
+ property['path'] = pull_project(property['repo'])
21
+ write_to_hosts(property['ip'], property['hostname'])
22
+ keys = property.keys.inject([]) { |m, k| m << k.to_sym }
23
+ memo[name.to_sym] = Struct.new(*keys).new(*property.values)
22
24
  end
23
25
  end
24
26
 
27
+ def properties_path
28
+ @properties_path ||= 'vagrant_properties.yml'
29
+ end
30
+
25
31
  def load_properties
26
- YAML.load_file('vagrant_properties.yml')
32
+ YAML.load_file properties_path
27
33
  end
28
34
 
29
35
  def pull_project(repo)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Properties
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-properties
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - linyows