From 3291a5d8cec666304753d7a00140b96c691775d1 Mon Sep 17 00:00:00 2001 From: Wlodek Bzyl Date: Tue, 2 Jun 2009 00:01:53 +0200 Subject: [PATCH] Ready first version of reusable apps dispatching. --- README.markdown | 42 +++++++++++++++++++++++++++++++++++ sinatra-static-assets.gemspec | 10 ++++----- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 8ddeef5..cc3417b 100644 --- a/README.markdown +++ b/README.markdown @@ -130,6 +130,48 @@ Or, if subclassing `Sinatra::Base`, include helpers manually: # ... end +## Dispatching reusable Sinatra applications + +With the latest version of Sinatra it is possible to build +reusable Sinatra applications. This means that multiple Sinatra applications +can now be run in isolation and co-exist peacefully with other Rack +based applications. Subclassing `Sinatra::Base` creates such a +reusable application. + +The `example` directory contains two reusable Sinatra applications: +*rsummer*, *rwinter* and a rackup file `rconfig.ru` which +dispatches these applications to `/summer` and `/rsummer` sub URI. + + require 'rsummer/summer' + require 'rwinter/winter' + + map '/summer' do + run Sinatra::Summer.new + end + + map '/winter' do + run Sinatra::Winter.new + end + +This rackup file could be used to deploy to virtual host's root. + + + ServerName hitch.local + DocumentRoot /srv/www/hitch.local + + +Creating required by Passenger directories: + + mkdir /srv/www/hitch.local/{public,tmp} + +and moving `config.ru` into `/srv/www/hitch.local`. + +With everything in place, after restarting Apache2 the applications +are accessible from the + + http://hitch.local/summer http://hitch.local/winter + +respectively. ## Miscellaneous stuff diff --git a/sinatra-static-assets.gemspec b/sinatra-static-assets.gemspec index 508a29f..a266398 100644 --- a/sinatra-static-assets.gemspec +++ b/sinatra-static-assets.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Wlodek Bzyl"] - s.date = %q{2009-06-01} + s.date = %q{2009-06-02} s.description = %q{This Sinatra extensions provides following helper methods: - image_tag - stylesheet_link_tag @@ -28,17 +28,17 @@ Gem::Specification.new do |s| "examples/rsummer/public/stylesheets/src/background.png", "examples/rsummer/summer.rb", "examples/rsummer/tmp/always_restart.txt", - "examples/rsummer/views/app.erb", + "examples/rsummer/views/index.erb", "examples/rsummer/views/layout.erb", "examples/rwinter/config.ru", - "examples/rwinter/mapp.rb", "examples/rwinter/public/images/tatry2.jpg", "examples/rwinter/public/javascripts/mapp.js", "examples/rwinter/public/stylesheets/mapp.css", "examples/rwinter/public/stylesheets/src/background.png", "examples/rwinter/tmp/always_restart.txt", + "examples/rwinter/views/index.erb", "examples/rwinter/views/layout.erb", - "examples/rwinter/views/mapp.erb", + "examples/rwinter/winter.rb", "examples/summer/config.ru", "examples/summer/public/images/tatry1.jpg", "examples/summer/public/javascripts/app.js", @@ -73,7 +73,7 @@ Gem::Specification.new do |s| "test/sinatra_static_assets_test.rb", "examples/summer/summer.rb", "examples/rsummer/summer.rb", - "examples/rwinter/mapp.rb", + "examples/rwinter/winter.rb", "examples/winter/app2.rb" ]