railsmachine-shadow_puppet 0.1.14 → 0.1.15

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.
data/lib/shadow_puppet.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'puppet'
2
+ require 'configatron'
3
+ require 'erb'
1
4
  require File.join(File.dirname(__FILE__) + '/shadow_puppet', 'core_ext.rb')
2
5
  require File.join(File.dirname(__FILE__) + '/shadow_puppet', 'manifest.rb')
3
6
 
@@ -1,24 +1,3 @@
1
1
  require 'active_support/core_ext/class/attribute_accessors'
2
2
  require 'active_support/core_ext/array'
3
- require 'active_support/inflector'
4
- require 'active_support/core_ext/hash/indifferent_access'
5
- require 'active_support/core_ext/class/inheritable_attributes'
6
- require 'active_support/core_ext/duplicable'
7
- class Hash #:nodoc:
8
- include ActiveSupport::CoreExtensions::Hash::IndifferentAccess
9
-
10
- # Returns a new hash with +self+ and +other_hash+ merged recursively.
11
- def deep_merge(other_hash)
12
- self.merge(other_hash) do |key, oldval, newval|
13
- oldval = oldval.to_hash if oldval.respond_to?(:to_hash)
14
- newval = newval.to_hash if newval.respond_to?(:to_hash)
15
- oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval
16
- end
17
- end
18
-
19
- # Returns a new hash with +self+ and +other_hash+ merged recursively.
20
- # Modifies the receiver in place.
21
- def deep_merge!(other_hash)
22
- replace(deep_merge(other_hash))
23
- end
24
- end
3
+ require 'active_support/inflector'
@@ -1,6 +1,3 @@
1
- require 'puppet'
2
- require 'erb'
3
-
4
1
  module ShadowPuppet
5
2
  # A Manifest is an executable collection of Puppet Resources[http://reductivelabs.com/trac/puppet/wiki/TypeReference].
6
3
  #
@@ -114,13 +111,13 @@ module ShadowPuppet
114
111
  return nil if methods.nil? || methods == []
115
112
  options = methods.extract_options!
116
113
  methods.each do |meth|
117
- options = self.configuration[meth.to_sym] if options == {}
114
+ options = configatron.send(meth.to_sym) if options == {}
118
115
  options ||= {}
119
116
  recipes << [meth.to_sym, options]
120
117
  end
121
118
  end
122
119
 
123
- # A HashWithIndifferentAccess describing any configuration that has been
120
+ # A hash describing any configuration that has been
124
121
  # performed on the class. Modify this hash by calling configure:
125
122
  #
126
123
  # class SampleManifest < ShadowPuppet::Manifest
@@ -133,7 +130,7 @@ module ShadowPuppet
133
130
  # Subclasses of the Manifest class properly inherit the parent classes'
134
131
  # configuration.
135
132
  def self.configuration
136
- read_inheritable_attribute(:configuration) || write_inheritable_attribute(:configuration, HashWithIndifferentAccess.new)
133
+ configatron
137
134
  end
138
135
 
139
136
  # Access to the configuration of the creating class.
@@ -156,11 +153,7 @@ module ShadowPuppet
156
153
  # Subsequent calls to configure perform a deep_merge of the
157
154
  # provided <tt>hash</tt> into the pre-existing configuration
158
155
  def self.configure(hash)
159
- hash ||= HashWithIndifferentAccess.new
160
- write_inheritable_attribute(:configuration, hash.deep_merge(configuration))
161
- end
162
- class << self
163
- alias_method :configuration=, :configure
156
+ configatron.configure_from_hash(hash)
164
157
  end
165
158
 
166
159
  # Define configuration on this manifest's creating class. This is useful
@@ -338,4 +331,4 @@ end
338
331
 
339
332
  Dir.glob(File.join(File.dirname(__FILE__), '..', 'facts', '*.rb')).each do |fact|
340
333
  require fact
341
- end
334
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsmachine-shadow_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Newland
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-04 00:00:00 -08:00
12
+ date: 2009-03-06 00:00:00 -08:00
13
13
  default_executable: shadow_puppet
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -62,6 +62,16 @@ dependencies:
62
62
  - !ruby/object:Gem::Version
63
63
  version: 2.0.0
64
64
  version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: configatron
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.2.2
74
+ version:
65
75
  description: A Ruby Puppet DSL
66
76
  email:
67
77
  - jesse@railsmachine.com