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 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 now be run in isolation and co-exist peacefully with other Rack
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
- require 'rsummer/summer'
146
- require 'rwinter/winter'
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
- This rackup file could be used to deploy to virtual host's root.
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
- Creating required by Passenger directories:
174
+ Next, create directories required by Passenger:
164
175
 
165
- mkdir /srv/www/hitch.local/{public,tmp}
176
+ mkdir /srv/www/hitch.local/{public,tmp}
166
177
 
167
- and moving `config.ru` into `/srv/www/hitch.local`.
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 the applications
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 http://hitch.local/winter
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
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 4
data/examples/rconfig.ru CHANGED
@@ -1,5 +1,8 @@
1
- require 'rsummer/summer'
2
- require 'rwinter/winter'
1
+ $LOAD_PATH.unshift('rsummer')
2
+ require 'summer'
3
+
4
+ $LOAD_PATH.unshift('rwinter')
5
+ require 'winter'
3
6
 
4
7
  map '/summer' do
5
8
  run Sinatra::Summer.new
@@ -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 Mountain in Winter</a></p>
5
+ <p><a href="/winter">Tatra Mountains in Winter</a></p>
6
6
  <p><%= link_to "Tatry Mountains Rescue Team", "/topr" %></p>
@@ -1,7 +1,4 @@
1
- # run with: thin --rackup config.ru -p 4567 start
2
-
3
- require 'app2'
1
+ require 'winter'
4
2
 
5
3
  use Rack::ShowExceptions
6
- use Rack::Static, :urls => ["/stylesheets", "/javascripts", "/images"], :root => "public"
7
4
  run Sinatra::Application
@@ -1,3 +1,5 @@
1
1
  <h2><%= @title %></h2>
2
2
 
3
3
  <p><%= image_tag "/images/tatry2.jpg", :alt => @title, :title => @title %></p>
4
+
5
+ <p><a href="/summer">Tatra Mountains in Summer</a></p>
@@ -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/app2.css" %>
6
- <%= javascript_script_tag "/javascripts/app2.js" %>
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.2
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/app2.js
100
- - examples/winter/public/stylesheets/app2.css
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/app2.rb
142
+ - examples/winter/winter.rb