wbzyl-sinatra-static-assets 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +27 -11
- data/VERSION.yml +1 -1
- data/examples/rconfig.ru +5 -2
- data/examples/summer/views/index.erb +1 -1
- data/examples/winter/config.ru +1 -4
- data/examples/winter/public/javascripts/{app2.js → app.js} +0 -0
- data/examples/winter/public/stylesheets/{app2.css → app.css} +0 -0
- data/examples/winter/views/index.erb +2 -0
- data/examples/winter/views/layout.erb +2 -2
- data/examples/winter/{app2.rb → winter.rb} +0 -0
- metadata +5 -5
data/README.markdown
CHANGED
@@ -134,16 +134,19 @@ Or, if subclassing `Sinatra::Base`, include helpers manually:
|
|
134
134
|
|
135
135
|
With the latest version of Sinatra it is possible to build
|
136
136
|
reusable Sinatra applications. This means that multiple Sinatra applications
|
137
|
-
can
|
137
|
+
can be run in isolation and co-exist peacefully with other Rack
|
138
138
|
based applications. Subclassing `Sinatra::Base` creates such a
|
139
139
|
reusable application.
|
140
140
|
|
141
141
|
The `example` directory contains two reusable Sinatra applications:
|
142
142
|
*rsummer*, *rwinter* and a rackup file `rconfig.ru` which
|
143
|
-
dispatches these applications to `/summer` and `/rsummer` sub URI
|
143
|
+
dispatches these applications to `/summer` and `/rsummer` sub URI:
|
144
144
|
|
145
|
-
|
146
|
-
require '
|
145
|
+
$LOAD_PATH.unshift('rsummer')
|
146
|
+
require 'summer'
|
147
|
+
|
148
|
+
$LOAD_PATH.unshift('rwinter')
|
149
|
+
require 'winter'
|
147
150
|
|
148
151
|
map '/summer' do
|
149
152
|
run Sinatra::Summer.new
|
@@ -153,23 +156,36 @@ dispatches these applications to `/summer` and `/rsummer` sub URI.
|
|
153
156
|
run Sinatra::Winter.new
|
154
157
|
end
|
155
158
|
|
156
|
-
|
159
|
+
Run `rconfig.ru` file with:
|
160
|
+
|
161
|
+
rackup -p 3000 rconfig.ru
|
162
|
+
|
163
|
+
This file could **also** be used to deploy to virtual host's root with
|
164
|
+
Passenger.
|
165
|
+
|
166
|
+
To this end, create an Apache2 configuration file with the following
|
167
|
+
content:
|
157
168
|
|
158
169
|
<VirtualHost *:80>
|
159
170
|
ServerName hitch.local
|
160
171
|
DocumentRoot /srv/www/hitch.local
|
161
172
|
</VirtualHost>
|
162
173
|
|
163
|
-
|
174
|
+
Next, create directories required by Passenger:
|
164
175
|
|
165
|
-
mkdir
|
176
|
+
mkdir /srv/www/hitch.local/{public,tmp}
|
166
177
|
|
167
|
-
and
|
178
|
+
and copy `config.ru` into `/srv/www/hitch.local` and
|
179
|
+
update `LOAD_PATH` in the copied file.
|
168
180
|
|
169
|
-
With everything in place, after restarting Apache2
|
170
|
-
are accessible from the
|
181
|
+
With everything in place, after restarting Apache2,
|
182
|
+
the applications are accessible from the
|
171
183
|
|
172
|
-
http://hitch.local/summer
|
184
|
+
http://hitch.local/summer
|
185
|
+
|
186
|
+
and
|
187
|
+
|
188
|
+
http://hitch.local/winter
|
173
189
|
|
174
190
|
respectively.
|
175
191
|
|
data/VERSION.yml
CHANGED
data/examples/rconfig.ru
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
|
3
3
|
<p><%= image_tag "/images/tatry1.jpg", :closed => true, :alt => @title, :title => @title %></p>
|
4
4
|
|
5
|
-
<p><a href="/winter">Tatra
|
5
|
+
<p><a href="/winter">Tatra Mountains in Winter</a></p>
|
6
6
|
<p><%= link_to "Tatry Mountains Rescue Team", "/topr" %></p>
|
data/examples/winter/config.ru
CHANGED
File without changes
|
File without changes
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
5
|
-
<%= stylesheet_link_tag "/stylesheets/
|
6
|
-
<%= javascript_script_tag "/javascripts/
|
5
|
+
<%= stylesheet_link_tag "/stylesheets/app.css" %>
|
6
|
+
<%= javascript_script_tag "/javascripts/app.js" %>
|
7
7
|
|
8
8
|
<title><%= @title %></title>
|
9
9
|
</head>
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wbzyl-sinatra-static-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wlodek Bzyl
|
@@ -93,15 +93,15 @@ files:
|
|
93
93
|
- examples/summer/views/index.erb
|
94
94
|
- examples/summer/views/layout.erb
|
95
95
|
- examples/summer/views/topr.erb
|
96
|
-
- examples/winter/app2.rb
|
97
96
|
- examples/winter/config.ru
|
98
97
|
- examples/winter/public/images/tatry2.jpg
|
99
|
-
- examples/winter/public/javascripts/
|
100
|
-
- examples/winter/public/stylesheets/
|
98
|
+
- examples/winter/public/javascripts/app.js
|
99
|
+
- examples/winter/public/stylesheets/app.css
|
101
100
|
- examples/winter/public/stylesheets/src/skating.png
|
102
101
|
- examples/winter/tmp/always_restart.txt
|
103
102
|
- examples/winter/views/index.erb
|
104
103
|
- examples/winter/views/layout.erb
|
104
|
+
- examples/winter/winter.rb
|
105
105
|
- lib/sinatra/static_assets.rb
|
106
106
|
- test/sinatra_static_assets_test.rb
|
107
107
|
- test/test_helper.rb
|
@@ -139,4 +139,4 @@ test_files:
|
|
139
139
|
- examples/summer/summer.rb
|
140
140
|
- examples/rsummer/summer.rb
|
141
141
|
- examples/rwinter/winter.rb
|
142
|
-
- examples/winter/
|
142
|
+
- examples/winter/winter.rb
|