I\'m working on a Sinatra app that contains about 10 different components of functionality. We\'d like to be able to mix and match these components into separate instances of t
TIMTOWTDI - There's_more_than_one_way_to_do_it :) and that is one. But in fact I use another way. I use Sinatra/Base to dev modular apps.
I have simgle routes to each app.
# config.ru file
require 'bundler/setup' Bundler.require(:default)
require File.dirname(__FILE__) + "/main.rb"
map "/" { run BONES::Main }
map "/dashboard" { run BONES::Dashboard }
map "/app1" { run BONES::App1 }
You can have variable sets for each instance. You can develop each 'component' on its Module.
require File.dirname(__FILE__) + "/lib/helpers.rb"
module BONES
class Main < Sinatra::Base
helpers XIXA::Helpers
configure :development do
enable :sessions, :clean_trace, :inline_templates
disable :logging, :dump_errors
set :static, true
set :public, 'public'
end
enable :static, :session
set :root, File.dirname(__FILE__)
set :custom_option, 'hello'
set :haml, { :format => :html5 }
#...
That a look here. http://codex.heroku.com/
have fun :)