Ready first version of reusable apps dispatching.
This commit is contained in:
parent
aeb39757c7
commit
3291a5d8ce
@ -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.
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName hitch.local
|
||||
DocumentRoot /srv/www/hitch.local
|
||||
</VirtualHost>
|
||||
|
||||
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
|
||||
|
||||
|
@ -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"
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user