Yeah, Monk has some good stuff including the general patterns and
loving the reloader and dependencies, although I've had to do some
hackery to implement it without having to take haml and sass along for
the ride. Fyi, your referenced files that add routes to classes do
not have to also inherit via Sinatra::Base via < Sinatra::Base as this
is already done in your main file. Here is the current state of my
init.rb:
RACK_ENV = ENV["RACK_ENV"] ||= "development" unless defined? RACK_ENV
ROOT_DIR = File.expand_path(File.dirname(__FILE__)) unless defined?
ROOT_DIR
def root_path(*args)
File.join(ROOT_DIR, *args)
end
begin
require "vendor/dependencies/lib/dependencies"
rescue LoadError
require "dependencies"
end
require 'sinatra/base'
require 'erubis'
module Monk; module Glue; end; end
class Main < Sinatra::Base
set :dump_errors, true
set :logging, true
set :raise_errors, false
set :root, root_path
set :app_file, __FILE__
set :run, Proc.new { $0 == app_file }
set :show_exceptions, true
set :static, true
set :views, root_path("app", "views")
get '/' do
response_helper
# eruby :index
end
configure :development do
require "monk/glue/reloader"
use Monk::Glue::Reloader
end
end
#Load all application files.
Dir[root_path("app/**/*.rb")].each { |file| require file }
Main.run! if Main.run?
> To unsubscribe from this group, send email to
sinatrarb+...@googlegroups.com