lib/goatmail/app.rb in goatmail-1.1.0 vs lib/goatmail/app.rb in goatmail-1.1.1
- old
+ new
@@ -3,33 +3,39 @@
require 'erb'
require 'goatmail/message'
module Goatmail
class App < Sinatra::Base
- set :root, File.expand_path(File.dirname(__FILE__))
- set :public_folder, Proc.new { "#{root}/assets" }
- set :views, Proc.new { "#{root}/views" }
-
- enable :method_override
-
if defined?(Padrino) && Padrino.version < '0.13.0'
def self.setup_application!; end
def self.dependencies; []; end
def self.reload!; end
set :app_name, :letter_opener
if Padrino.version < '0.12.0'
set :erb, engine_class: Padrino::Erubis::SafeBufferTemplate
end
end
+ configure do
+ set :root, File.expand_path(File.dirname(__FILE__))
+ set :public_folder, Proc.new { "#{root}/assets" }
+ set :views, Proc.new { "#{root}/views" }
+
+ enable :method_override
+ end
+
helpers do
+ def root_path
+ "#{env['SCRIPT_NAME']}/"
+ end
+
def h(text)
Rack::Utils.escape_html(text)
end
- end
- def root_path
- "#{env['SCRIPT_NAME']}/"
+ def title
+ [ settings.environment, Goatmail.name ].join("::")
+ end
end
get '/' do
@messages = Goatmail::Message.load_all
erb :index