Skip to content

Commit

Permalink
use a non-singleton inheritable configatron store
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewland committed Mar 10, 2009
1 parent 9d52769 commit 09e1ea1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/shadow_puppet/core_ext.rb
Expand Up @@ -2,4 +2,9 @@
require 'active_support/core_ext/array'
require 'active_support/inflector'
require 'active_support/core_ext/class/inheritable_attributes'
require 'active_support/core_ext/duplicable'
require 'active_support/core_ext/duplicable'
class Configatron::Store
def to_s
''
end
end
12 changes: 11 additions & 1 deletion lib/shadow_puppet/manifest.rb
Expand Up @@ -76,6 +76,8 @@ class Manifest
class_inheritable_accessor :recipes
write_inheritable_attribute(:recipes, [])
attr_reader :puppet_resources
class_inheritable_accessor :__configatron__
write_inheritable_attribute(:__configatron__, Configatron::Store.new)

# Initialize a new instance of this manifest. This can take a
# config hash, which is immediately passed on to the configure
Expand Down Expand Up @@ -117,6 +119,14 @@ def self.recipe(*methods)
end
end

def self.configatron
__configatron__
end

def configatron
self.class.__configatron__
end

# A hash describing any configuration that has been
# performed on the class. Modify this hash by calling configure:
#
Expand Down Expand Up @@ -153,7 +163,7 @@ def configuration
# Subsequent calls to configure perform a deep_merge of the
# provided <tt>hash</tt> into the pre-existing configuration
def self.configure(hash)
configatron.configure_from_hash(hash)
__configatron__.configure_from_hash(hash)
end

# Define configuration on this manifest's creating class. This is useful
Expand Down

0 comments on commit 09e1ea1

Please sign in to comment.