lib/tweaks.rb in tweaks-0.1.0 vs lib/tweaks.rb in tweaks-0.2.0
- old
+ new
@@ -1,11 +1,11 @@
require File.join(File.dirname(__FILE__),'tweak_config')
class Tweaks
def self.reset
- @@configs = {}
+ @@configs = {} # may contain defaults or config
@@procs = {}
@@installed = []
end
reset()
@@ -64,17 +64,17 @@
# pass a hash to set
# returns config hash for modification
def self.configure(aName,aConfig=nil)
aName = aName.to_sym
- if have_defaults = have_config?(aName) # will be defaults from define, so merge in app config
+ if have_config?(aName) # will be defaults from define, so merge in app config
config = @@configs[aName]
config.read(aConfig) if aConfig
@@configs[aName] = config
else # store app config for merge later
@@configs[aName] = TweakConfig.new(aConfig)
end
- do_it(aName) if have_defaults && !installed?(aName)
+ do_it(aName) if @@procs[aName] && !installed?(aName) # we have configured here, so install if we have define proc and not already installed
@@configs[aName]
end
def self.define_and_install(aName,aConfig=nil,&block)
define(aName,aConfig,&block)