lib/caboodle/kit.rb in caboodle-0.1.0 vs lib/caboodle/kit.rb in caboodle-0.1.1

- old
+ new

@@ -9,12 +9,10 @@ set :public, Proc.new { File.join(root, "public") } set :haml, {:format => :html5 } template :layout do @@template ||= File.open(File.join(File.dirname(__FILE__),"app","views","layout.haml")).read - puts @@template.inspect - @@template end class << self def is_a_caboodle_kit true @@ -27,11 +25,11 @@ Caboodle::Site[k.to_s] = v } rescue puts "Warning! Skipping #{p}" Caboodle::Site.kits.uniq! end def dump_config - p = File.expand_path(File.join(Caboodle::App.root,"site.yml")) + p = File.expand_path(File.join(Caboodle::App.root,"config","site.yml")) d = Caboodle::Site.clone e = d.to_hash e.delete("required_settings") File.open(p, 'w') {|f| f.write(YAML::dump(e))} end @@ -41,15 +39,15 @@ use_all end def load_kit name unless name.blank? - puts "Load kit #{name}" kit_name = name.to_s.split("::").last || name kit_name = kit_name.downcase + puts "Loading Kit: #{kit_name}" orig = Caboodle.constants - require "caboodle/kits/#{kit_name}/#{kit_name}" rescue puts "No such kit: #{kit_name}" + require "caboodle/kits/#{kit_name}/#{kit_name}" rescue puts "Warning! No such kit: #{kit_name}" added = Caboodle.constants - orig added.each do |d| c = Caboodle.const_get(d) if c.respond_to?(:is_a_caboodle_kit) c.register @@ -71,23 +69,18 @@ Caboodle::Kits << self end def require_all if(Caboodle::Site.kits) - Caboodle::Site.kits.each do |k| - puts "Load Kit: #{k}" - load_kit k - end + Caboodle::Site.kits.each { |k| load_kit k } else - puts "Kits not registered" + STDERR.puts "Kits not registered" end end def use_all - Caboodle::Kits.each do |p| - p.start - end + Caboodle::Kits.each { |p| p.start } end def menu display, link Caboodle::MenuItems << {:display=>display, :link=>link} end @@ -101,19 +94,15 @@ self.required_settings << keys end end def stylesheets array_of_css_files - array_of_css_files.each do |a| - Caboodle::Stylesheets << a - end + array_of_css_files.each { |a| Caboodle::Stylesheets << a } Caboodle::Stylesheets.uniq! end def javascripts array_of_js_files - array_of_js_files.each do |a| - Caboodle::Javascripts << a - end + array_of_js_files.each { |a| Caboodle::Javascripts << a } Caboodle::Javascripts.uniq! end def defaults hash if hash.class == Hash \ No newline at end of file