Object
Syckle configuration. Configuration comes from a main Syckfile and/or .syckle task files, and configuration options defined in a path store in the project's config directory (eg. .config/syckle/).
Service defaults. This is a mapping of service names to default settings. Very useful for autorun mode.
Service configurations from Syckfile or task/*.syckle files. This is a hash of parameters.
# File lib/syckle/config.rb, line 47 def initialize(project) #, *files) @project = project if file = project.config.glob('syckle/config.{yml,yaml}').first conf = YAML.load(File.new(file)) else conf = {} end #if conf['automatic'].nil? # self.automatic = true #else # self.automatic = conf['automatic'] #end #self.standard = conf['standard'] || [] if file = project.config.glob('syckle/defaults.{yml,yaml}').first self.defaults = YAML.load(File.new(file)) else self.defaults = {} end @services = {} syckle_files.each do |file| load_syckle_file(file) end end
# File lib/syckle/config.rb, line 101 def defaults=(hash) @defaults = hash.to_h #OpenStruct.new(hash) # need two layer OpenStruct.. OpenCascade? end
# File lib/syckle/config.rb, line 122 def load_syckle_file(file) text = File.read(file) begin edit = ERB.new(text).result(binding).strip rescue => err raise err if $DEBUG abort "#{File.basename(file)}: #{err}" end data = YAML.load(edit) || {} # automatics can be defined in the syckle files (TODO: Is this prudent?) #self.automatic = data.delete('automatic') if data.key?('automatic') self.standard = data.delete('standard') if data.key?('standard') # We import other files. This is most useful when using a Syckfile. if import = data.delete('import') [import].flatten.each do |glob| Dir[glob].each do |f| load_syckle_file(f) end end end @services.update(data) end
# File lib/syckle/config.rb, line 151 def method_missing(sym, *args) super unless args.empty? project.metadata.__send__(sym) #if project.metadata.respond_to?(sym) end
# File lib/syckle/config.rb, line 107 def syckle_files @confg_files ||= ( files = [] if project.root.glob('{Syckfile,.syckle}').first files += project.root.glob('{Syckfile,.syckle}') else files += project.task.glob('*.syckle') #files += project.script.glob('*.syckle') end files = files.select{ |f| File.file?(f) } ) end
Generated with the Darkfish Rdoc Generator 2.