lib/qed/config.rb in qed-1.3 vs lib/qed/config.rb in qed-2.0.0

- old
+ new

@@ -1,25 +1,60 @@ module QED - class Config +=begin + # Setup global configuration. + # + # QED.config do + # + # Before(:session) do + # # ... + # end + # + # After(:session) do + # # ... + # end + # + # end + # + def self.configure(&block) + @config ||= Profile.new #(nil) + @config.instance_eval(&block) if block + @config + end +=end + # + class Profile + + # def initialize - @local = ['qed', 'demos', 'test/demos'] + #@local = ['test/demos', 'demos', 'qed'] + + @before = { :session=>[], :demo=>[], :step=>[] } + @after = { :session=>[], :demo=>[], :step=>[] } - if file = File.glob('{.,}config/qed.{yml,yaml}') - YAML.load(File.new(file)).each do |k,v| - __send__("#{k}=", v) - end - end + #if file = Dir.glob('{.,}config/qed.{yml,yaml}').first + # YAML.load(File.new(file)).each do |k,v| + # __send__("#{k}=", v) + # end + #end end - attr_accessor :local + # + #attr_accessor :local - # How ot identify a header? - #attr_accessor :header + # + def Before(type=:session, &procedure) + @before[type] << procedure if procedure + @before[type] + end - # How ot identify a footer? - #attr_accessor :footer + # + def After(type=:session, &procedure) + @after[type] << procedure if procedure + @after[type] + end end end +