lib/caboodle/kit.rb in caboodle-0.2.20 vs lib/caboodle/kit.rb in caboodle-0.2.21
- old
+ new
@@ -97,30 +97,34 @@
def menu display, path=nil, &block
#todo proper slugify
slug = display.downcase.gsub(" ","-").gsub("'","")
path = "/#{slug}" unless path
- puts "set /#{slug} - menu items: #{Settings.menu_items.inspect}"
path = "/" if Site.home_kit == self.to_s.gsub("Caboodle::","") && !Settings.menu_items.include?("/")
Caboodle::MenuItems << {:display=>display, :link=>path, :kit=>self}
+
if block
self.get path, &block
else
eval "self.get '#{path}' do
@title = '#{display}'
haml :#{slug.gsub("-","_")}
end"
end
+
+ eval "before do
+ @title = '#{display}'
+ end"
+
Settings.menu_items ||= []
Settings.menu_items << path
end
def required keys
if keys.class == Array
keys.each do |k|
self.required_settings << k
- puts "self.set #{k}, #{Caboodle::Site[k]}"
self.set k.to_s.to_sym, Caboodle::Site[k].to_s
end
else
self.required_settings << keys
end
@@ -246,11 +250,10 @@
def ask_user_for_missing_settings
required_settings.each do |r|
if Caboodle::Site[r].blank?
ask_user r
end
- puts self
self.set r.to_s.to_sym, Caboodle::Site[r].to_s
end
optional_settings.each do |r|
unless defined?(Caboodle::Site[r])
ask_user r, true
@@ -265,10 +268,9 @@
end
end
def dump_config
begin
- puts "Dump config to: #{config_path}"
p = config_path
d = Caboodle::Site.clone
e = d.to_hash
e.delete("required_settings")
File.open(p, 'w') {|f| f.write(YAML::dump(e))}
\ No newline at end of file