sinatra 1.3.0.d → 1.3.0.e
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- data/.gitignore +6 -0
- data/.yardopts +4 -0
- data/CHANGES +80 -3
- data/Gemfile +18 -12
- data/README.de.rdoc +189 -381
- data/README.es.rdoc +193 -316
- data/README.fr.rdoc +327 -475
- data/README.jp.rdoc +7 -1
- data/README.rdoc +132 -101
- data/README.ru.rdoc +3 -3
- data/README.zh.rdoc +2 -2
- data/Rakefile +19 -27
- data/lib/sinatra/base.rb +186 -262
- data/lib/sinatra/version.rb +3 -0
- data/sinatra.gemspec +12 -128
- data/test/base_test.rb +1 -1
- data/test/builder_test.rb +1 -1
- data/test/coffee_test.rb +1 -1
- data/test/creole_test.rb +1 -1
- data/test/delegator_test.rb +9 -7
- data/test/encoding_test.rb +1 -1
- data/test/erb_test.rb +1 -1
- data/test/extensions_test.rb +1 -1
- data/test/filter_test.rb +7 -4
- data/test/haml_test.rb +1 -1
- data/test/helper.rb +16 -1
- data/test/helpers_test.rb +12 -1
- data/test/less_test.rb +1 -1
- data/test/liquid_test.rb +1 -1
- data/test/mapped_error_test.rb +44 -1
- data/test/markaby_test.rb +1 -1
- data/test/markdown_test.rb +1 -1
- data/test/middleware_test.rb +1 -1
- data/test/nokogiri_test.rb +1 -1
- data/test/radius_test.rb +1 -1
- data/test/rdoc_test.rb +2 -2
- data/test/readme_test.rb +136 -0
- data/test/request_test.rb +1 -1
- data/test/response_test.rb +13 -3
- data/test/result_test.rb +3 -3
- data/test/route_added_hook_test.rb +1 -1
- data/test/routing_test.rb +9 -2
- data/test/sass_test.rb +1 -1
- data/test/scss_test.rb +1 -1
- data/test/server_test.rb +1 -1
- data/test/settings_test.rb +55 -22
- data/test/sinatra_test.rb +1 -1
- data/test/slim_test.rb +1 -1
- data/test/static_test.rb +22 -1
- data/test/templates_test.rb +1 -1
- data/test/textile_test.rb +1 -1
- metadata +47 -59
- data/lib/sinatra/rack.rb +0 -44
data/README.jp.rdoc
CHANGED
@@ -67,6 +67,12 @@ Sinatraでは、ルートはHTTPメソッドとURLマッチングパターンが
|
|
67
67
|
params[:splat] # => ["path/to/file", "xml"]
|
68
68
|
end
|
69
69
|
|
70
|
+
ブロックパラーメータを使用した場合:
|
71
|
+
|
72
|
+
get '/download/*.*' do |path, ext|
|
73
|
+
[path, ext] # => ["path/to/file", "xml"]
|
74
|
+
end
|
75
|
+
|
70
76
|
正規表現を使ったルート:
|
71
77
|
|
72
78
|
get %r{/hello/([\w]+)} do
|
@@ -1003,7 +1009,7 @@ Sinatraの開発版を使いたい場合は、ローカルに開発版を落と
|
|
1003
1009
|
git clone git://github.com/sinatra/sinatra.git
|
1004
1010
|
ruby -Isinatra/lib myapp.rb
|
1005
1011
|
|
1006
|
-
<tt>sinatra/lib</tt
|
1012
|
+
<tt>sinatra/lib</tt>ディレクトリをアプリケーションの<tt>LOAD_PATH</tt>に追加する方法もあります。
|
1007
1013
|
|
1008
1014
|
$LOAD_PATH.unshift File.dirname(__FILE__) + '/sinatra/lib'
|
1009
1015
|
require 'rubygems'
|
data/README.rdoc
CHANGED
@@ -80,6 +80,12 @@ via the <tt>params[:splat]</tt> array:
|
|
80
80
|
params[:splat] # => ["path/to/file", "xml"]
|
81
81
|
end
|
82
82
|
|
83
|
+
Or with block parameters:
|
84
|
+
|
85
|
+
get '/download/*.*' do |path, ext|
|
86
|
+
[path, ext] # => ["path/to/file", "xml"]
|
87
|
+
end
|
88
|
+
|
83
89
|
Route matching with Regular Expressions:
|
84
90
|
|
85
91
|
get %r{/hello/([\w]+)} do
|
@@ -140,9 +146,12 @@ also accepted.
|
|
140
146
|
You can return any object that would either be a valid Rack response, Rack
|
141
147
|
body object or HTTP status code:
|
142
148
|
|
143
|
-
* An Array with three elements: <tt>[status (Fixnum), headers (Hash), response
|
144
|
-
|
145
|
-
* An
|
149
|
+
* An Array with three elements: <tt>[status (Fixnum), headers (Hash), response
|
150
|
+
body (responds to #each)]</tt>
|
151
|
+
* An Array with two elements: <tt>[status (Fixnum), response body (responds to
|
152
|
+
#each)]</tt>
|
153
|
+
* An object that responds to <tt>#each</tt> and passes nothing but strings to
|
154
|
+
the given block
|
146
155
|
* A Fixnum representing the status code
|
147
156
|
|
148
157
|
That way we can, for instance, easily implement a streaming example:
|
@@ -207,6 +216,9 @@ Note that the public directory name is not included in the URL. A file
|
|
207
216
|
<tt>./public/css/style.css</tt> is made available as
|
208
217
|
<tt>http://example.com/css/style.css</tt>.
|
209
218
|
|
219
|
+
Use the <tt>:static_cache_control</tt> setting (see below) to add
|
220
|
+
<tt>Cache-Control</tt> header info.
|
221
|
+
|
210
222
|
== Views / Templates
|
211
223
|
|
212
224
|
Each template language is exposed as via its own rendering method. These
|
@@ -267,7 +279,7 @@ Available Options:
|
|
267
279
|
|
268
280
|
[layout]
|
269
281
|
Whether to use a layout (+true+ or +false+), if it's a Symbol, specifies
|
270
|
-
what template to use. Example: <tt>erb :index, :layout => request.xhr?</tt>
|
282
|
+
what template to use. Example: <tt>erb :index, :layout => !request.xhr?</tt>
|
271
283
|
|
272
284
|
[content_type]
|
273
285
|
Content-Type the template produces, default depends on template language.
|
@@ -326,7 +338,7 @@ It also takes a block for inline templates (see example).
|
|
326
338
|
|
327
339
|
Dependency:: {nokogiri}[http://nokogiri.org/]
|
328
340
|
File Extensions:: <tt>.nokogiri</tt>
|
329
|
-
Example:: <tt>
|
341
|
+
Example:: <tt>nokogiri { |xml| xml.em "hi" }</tt>
|
330
342
|
|
331
343
|
It also takes a block for inline templates (see example).
|
332
344
|
|
@@ -494,7 +506,7 @@ Or, specify an explicit Hash of local variables:
|
|
494
506
|
|
495
507
|
get '/:id' do
|
496
508
|
foo = Foo.find(params[:id])
|
497
|
-
haml '%h1=
|
509
|
+
haml '%h1= bar.name', :locals => { :bar => foo }
|
498
510
|
end
|
499
511
|
|
500
512
|
This is typically used when rendering templates as partials from within
|
@@ -540,8 +552,9 @@ Templates may also be defined using the top-level <tt>template</tt> method:
|
|
540
552
|
end
|
541
553
|
|
542
554
|
If a template named "layout" exists, it will be used each time a template
|
543
|
-
is rendered. You can individually disable layouts by passing
|
544
|
-
or disable them by default via
|
555
|
+
is rendered. You can individually disable layouts by passing
|
556
|
+
<tt>:layout => false</tt> or disable them by default via
|
557
|
+
<tt>set :haml, :layout => false</tt>:
|
545
558
|
|
546
559
|
get '/' do
|
547
560
|
haml :index, :layout => !request.xhr?
|
@@ -653,7 +666,7 @@ session hash per user session:
|
|
653
666
|
|
654
667
|
Note that <tt>enable :sessions</tt> actually stores all data in a cookie. This
|
655
668
|
might not always be what you want (storing lots of data will increase your
|
656
|
-
traffic, for instance). You can use any Rack session middleware
|
669
|
+
traffic, for instance). You can use any Rack session middleware: in order to
|
657
670
|
do so, do *not* call <tt>enable :sessions</tt>, but instead pull in your
|
658
671
|
middleware of choice how you would any other middleware:
|
659
672
|
|
@@ -760,8 +773,8 @@ access the body:
|
|
760
773
|
puts body
|
761
774
|
end
|
762
775
|
|
763
|
-
It is also possible to pass a block to +body+, which will be executed by the
|
764
|
-
handler (this can be used to implement streaming, see "Return Values").
|
776
|
+
It is also possible to pass a block to +body+, which will be executed by the
|
777
|
+
Rack handler (this can be used to implement streaming, see "Return Values").
|
765
778
|
|
766
779
|
Similar to the body, you can also set the status code and headers:
|
767
780
|
|
@@ -804,7 +817,9 @@ enable it yourself:
|
|
804
817
|
When using <tt>send_file</tt> or static files you may have mime types Sinatra
|
805
818
|
doesn't understand. Use +mime_type+ to register them by file extension:
|
806
819
|
|
807
|
-
|
820
|
+
configure do
|
821
|
+
mime_type :foo, 'text/foo'
|
822
|
+
end
|
808
823
|
|
809
824
|
You can also use it with the +content_type+ helper:
|
810
825
|
|
@@ -908,8 +923,8 @@ It is also possible to use a
|
|
908
923
|
etag @article.sha1, :weak
|
909
924
|
|
910
925
|
These helpers will not do any caching for you, but rather feed the necessary
|
911
|
-
information to your cache. If you are looking for a quick caching solutions,
|
912
|
-
{rack-cache}[http://rtomayko.github.com/rack-cache/]:
|
926
|
+
information to your cache. If you are looking for a quick caching solutions,
|
927
|
+
try {rack-cache}[http://rtomayko.github.com/rack-cache/]:
|
913
928
|
|
914
929
|
require "rack/cache"
|
915
930
|
require "sinatra"
|
@@ -922,6 +937,9 @@ information to your cache. If you are looking for a quick caching solutions, try
|
|
922
937
|
"hello"
|
923
938
|
end
|
924
939
|
|
940
|
+
Use the <tt>:static_cache_control</tt> setting (see below) to add
|
941
|
+
<tt>Cache-Control</tt> header info to static files.
|
942
|
+
|
925
943
|
=== Sending Files
|
926
944
|
|
927
945
|
For sending files, you can use the <tt>send_file</tt> helper method:
|
@@ -1116,86 +1134,92 @@ You can access those options via <tt>settings</tt>:
|
|
1116
1134
|
|
1117
1135
|
=== Available Settings
|
1118
1136
|
|
1119
|
-
[absolute_redirects]
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1137
|
+
[absolute_redirects] If disabled, Sinatra will allow relative redirects,
|
1138
|
+
however, Sinatra will no longer conform with RFC 2616
|
1139
|
+
(HTTP 1.1), which only allows absolute redirects.
|
1140
|
+
|
1141
|
+
Enable if your app is running behind a reverse proxy that
|
1142
|
+
has not been set up properly. Note that the +url+ helper
|
1143
|
+
will still produce absolute URLs, unless you pass in
|
1144
|
+
+false+ as second parameter.
|
1145
|
+
|
1146
|
+
Disabled per default.
|
1129
1147
|
|
1130
|
-
[add_charsets]
|
1131
|
-
|
1132
|
-
|
1133
|
-
You should add to it rather than overriding this option:
|
1134
|
-
|
1135
|
-
settings.add_charsets << "application/foobar"
|
1148
|
+
[add_charsets] mime types the <tt>content_type</tt> helper will
|
1149
|
+
automatically add the charset info to.
|
1136
1150
|
|
1137
|
-
|
1138
|
-
views and public folder and inline templates.
|
1151
|
+
You should add to it rather than overriding this option:
|
1139
1152
|
|
1140
|
-
|
1141
|
-
Only used for built-in server.
|
1153
|
+
settings.add_charsets << "application/foobar"
|
1142
1154
|
|
1143
|
-
[
|
1144
|
-
|
1155
|
+
[app_file] main application file, used to detect project root,
|
1156
|
+
views and public folder and inline templates.
|
1145
1157
|
|
1146
|
-
[
|
1158
|
+
[bind] IP address to bind to (default: 0.0.0.0).
|
1159
|
+
Only used for built-in server.
|
1147
1160
|
|
1148
|
-
[
|
1149
|
-
|
1161
|
+
[default_encoding] encoding to assume if unknown
|
1162
|
+
(defaults to <tt>"utf-8"</tt>).
|
1150
1163
|
|
1151
|
-
[
|
1164
|
+
[dump_errors] display errors in the log.
|
1152
1165
|
|
1153
|
-
[
|
1154
|
-
|
1155
|
-
|
1156
|
-
Enabled if your app is not thread-safe.
|
1157
|
-
Disabled per default.
|
1166
|
+
[environment] current environment, defaults to <tt>ENV['RACK_ENV']</tt>,
|
1167
|
+
or <tt>"development"</tt> if not available.
|
1158
1168
|
|
1159
|
-
[
|
1160
|
-
browsers that don't support it.
|
1169
|
+
[logging] use the logger.
|
1161
1170
|
|
1162
|
-
[
|
1171
|
+
[lock] Places a lock around every request, only running
|
1172
|
+
processing on request per Ruby process concurrently.
|
1163
1173
|
|
1164
|
-
|
1165
|
-
|
1166
|
-
<tt>redirect '/foo'</tt> would behave like
|
1167
|
-
<tt>redirect to('/foo')</tt>. Disabled per default.
|
1174
|
+
Enabled if your app is not thread-safe.
|
1175
|
+
Disabled per default.
|
1168
1176
|
|
1169
|
-
[
|
1177
|
+
[method_override] use <tt>_method</tt> magic to allow put/delete forms in
|
1178
|
+
browsers that don't support it.
|
1170
1179
|
|
1171
|
-
[
|
1172
|
-
Enabled in development mode.
|
1180
|
+
[port] Port to listen on. Only used for built-in server.
|
1173
1181
|
|
1174
|
-
[
|
1182
|
+
[prefixed_redirects] Whether or not to insert <tt>request.script_name</tt>
|
1183
|
+
into redirects if no absolute path is given. That way
|
1184
|
+
<tt>redirect '/foo'</tt> would behave like
|
1185
|
+
<tt>redirect to('/foo')</tt>. Disabled per default.
|
1175
1186
|
|
1176
|
-
[
|
1187
|
+
[public] folder public files are served from
|
1177
1188
|
|
1178
|
-
[
|
1179
|
-
|
1189
|
+
[reload_templates] whether or not to reload templates between requests.
|
1190
|
+
Enabled in development mode.
|
1180
1191
|
|
1181
|
-
[
|
1182
|
-
do not change this setting!
|
1192
|
+
[root] project root folder.
|
1183
1193
|
|
1184
|
-
[
|
1185
|
-
defaults to ['thin', 'mongrel', 'webrick'], order indicates
|
1186
|
-
priority.
|
1194
|
+
[raise_errors] raise exceptions (will stop application).
|
1187
1195
|
|
1188
|
-
[
|
1196
|
+
[run] if enabled, Sinatra will handle starting the web server,
|
1197
|
+
do not enable if using rackup or other means.
|
1189
1198
|
|
1190
|
-
[
|
1199
|
+
[running] is the built-in server running now?
|
1200
|
+
do not change this setting!
|
1191
1201
|
|
1192
|
-
[
|
1193
|
-
|
1194
|
-
|
1195
|
-
Enabled per default in classic style, disabled for
|
1196
|
-
modular apps.
|
1202
|
+
[server] server or list of servers to use for built-in server.
|
1203
|
+
defaults to ['thin', 'mongrel', 'webrick'], order
|
1204
|
+
indicates priority.
|
1197
1205
|
|
1198
|
-
[
|
1206
|
+
[sessions] enable cookie based sessions.
|
1207
|
+
|
1208
|
+
[show_exceptions] show a stack trace in the browser.
|
1209
|
+
|
1210
|
+
[static] Whether Sinatra should handle serving static files.
|
1211
|
+
Disable when using a Server able to do this on its own.
|
1212
|
+
Disabling will boost performance.
|
1213
|
+
Enabled per default in classic style, disabled for
|
1214
|
+
modular apps.
|
1215
|
+
|
1216
|
+
[static_cache_control] When Sinatra is serving static files, set this to add
|
1217
|
+
<tt>Cache-Control</tt> headers to the responses. Uses the
|
1218
|
+
+cache_control+ helper. Disabled by default.
|
1219
|
+
Use an explicit array when setting multiple values:
|
1220
|
+
<tt>set :static_cache_control, [:public, :max_age => 300]</tt>
|
1221
|
+
|
1222
|
+
[views] views folder.
|
1199
1223
|
|
1200
1224
|
== Error Handling
|
1201
1225
|
|
@@ -1292,11 +1316,17 @@ debugging, URL routing, authentication, and session handling. Sinatra uses
|
|
1292
1316
|
many of these components automatically based on configuration so you
|
1293
1317
|
typically don't have to +use+ them explicitly.
|
1294
1318
|
|
1319
|
+
You can find useful middleware in
|
1320
|
+
{rack}[https://github.com/rack/rack/tree/master/lib/rack],
|
1321
|
+
{rack-contrib}[https://github.com/rack/rack-contrib#readme],
|
1322
|
+
with {CodeRack}[http://coderack.org/] or in the
|
1323
|
+
{Rack wiki}[https://github.com/rack/rack/wiki/List-of-Middleware].
|
1324
|
+
|
1295
1325
|
== Testing
|
1296
1326
|
|
1297
1327
|
Sinatra tests can be written using any Rack-based testing library
|
1298
|
-
or framework. {Rack::Test}[http://
|
1299
|
-
recommended:
|
1328
|
+
or framework. {Rack::Test}[http://rdoc.info/github/brynary/rack-test/master/frames]
|
1329
|
+
is recommended:
|
1300
1330
|
|
1301
1331
|
require 'my_sinatra_app'
|
1302
1332
|
require 'test/unit'
|
@@ -1325,9 +1355,6 @@ recommended:
|
|
1325
1355
|
end
|
1326
1356
|
end
|
1327
1357
|
|
1328
|
-
NOTE: The built-in Sinatra::Test module and Sinatra::TestHarness class
|
1329
|
-
are deprecated as of the 0.9.2 release.
|
1330
|
-
|
1331
1358
|
== Sinatra::Base - Middleware, Libraries, and Modular Apps
|
1332
1359
|
|
1333
1360
|
Defining your app at the top-level works well for micro-apps but has
|
@@ -1335,8 +1362,8 @@ considerable drawbacks when building reusable components such as Rack
|
|
1335
1362
|
middleware, Rails metal, simple libraries with a server component, or
|
1336
1363
|
even Sinatra extensions. The top-level DSL pollutes the Object namespace
|
1337
1364
|
and assumes a micro-app style configuration (e.g., a single application
|
1338
|
-
file,
|
1339
|
-
etc.). That's where Sinatra::Base comes into play:
|
1365
|
+
file, <tt>./public</tt> and <tt>./views</tt> directories, logging, exception
|
1366
|
+
detail page, etc.). That's where <tt>Sinatra::Base</tt> comes into play:
|
1340
1367
|
|
1341
1368
|
require 'sinatra/base'
|
1342
1369
|
|
@@ -1349,15 +1376,15 @@ etc.). That's where Sinatra::Base comes into play:
|
|
1349
1376
|
end
|
1350
1377
|
end
|
1351
1378
|
|
1352
|
-
The methods available to Sinatra::Base subclasses are exactly as those
|
1379
|
+
The methods available to <tt>Sinatra::Base</tt> subclasses are exactly as those
|
1353
1380
|
available via the top-level DSL. Most top-level apps can be converted to
|
1354
|
-
Sinatra::Base components with two modifications:
|
1381
|
+
<tt>Sinatra::Base</tt> components with two modifications:
|
1355
1382
|
|
1356
1383
|
* Your file should require <tt>sinatra/base</tt> instead of +sinatra+;
|
1357
1384
|
otherwise, all of Sinatra's DSL methods are imported into the main
|
1358
1385
|
namespace.
|
1359
1386
|
* Put your app's routes, error handlers, filters, and options in a subclass
|
1360
|
-
of Sinatra::Base
|
1387
|
+
of <tt>Sinatra::Base</tt>.
|
1361
1388
|
|
1362
1389
|
<tt>Sinatra::Base</tt> is a blank slate. Most options are disabled by default,
|
1363
1390
|
including the built-in server. See {Options and Configuration}[http://sinatra.github.com/configuration.html]
|
@@ -1383,7 +1410,7 @@ different default settings:
|
|
1383
1410
|
|
1384
1411
|
Setting Classic Modular
|
1385
1412
|
|
1386
|
-
app_file file loading sinatra
|
1413
|
+
app_file file loading sinatra file subclassing Sinatra::Base
|
1387
1414
|
run $0 == app_file false
|
1388
1415
|
logging true false
|
1389
1416
|
method_override true false
|
@@ -1413,7 +1440,7 @@ Start with:
|
|
1413
1440
|
Or with a <tt>config.ru</tt>, which allows using any Rack handler:
|
1414
1441
|
|
1415
1442
|
# config.ru
|
1416
|
-
require 'my_app'
|
1443
|
+
require './my_app'
|
1417
1444
|
run MyApp
|
1418
1445
|
|
1419
1446
|
Run:
|
@@ -1433,7 +1460,7 @@ Write your app file:
|
|
1433
1460
|
|
1434
1461
|
And a corresponding <tt>config.ru</tt>:
|
1435
1462
|
|
1436
|
-
require 'app'
|
1463
|
+
require './app'
|
1437
1464
|
run Sinatra::Application
|
1438
1465
|
|
1439
1466
|
=== When to use a config.ru?
|
@@ -1464,7 +1491,7 @@ application (Rails/Ramaze/Camping/...):
|
|
1464
1491
|
get('/login') { haml :login }
|
1465
1492
|
|
1466
1493
|
post('/login') do
|
1467
|
-
if params[:name]
|
1494
|
+
if params[:name] == 'admin' && params[:password] == 'admin'
|
1468
1495
|
session['user_name'] = params[:name]
|
1469
1496
|
else
|
1470
1497
|
redirect '/login'
|
@@ -1488,7 +1515,7 @@ application (Rails/Ramaze/Camping/...):
|
|
1488
1515
|
=== Dynamic Application Creation
|
1489
1516
|
|
1490
1517
|
Sometimes you want to create new applications at runtime without having to
|
1491
|
-
assign them to a constant, you can do this with
|
1518
|
+
assign them to a constant, you can do this with <tt>Sinatra.new</tt>:
|
1492
1519
|
|
1493
1520
|
require 'sinatra/base'
|
1494
1521
|
my_app = Sinatra.new { get('/') { "hi" } }
|
@@ -1531,12 +1558,12 @@ available.
|
|
1531
1558
|
|
1532
1559
|
=== Application/Class Scope
|
1533
1560
|
|
1534
|
-
Every Sinatra application corresponds to a subclass of Sinatra::Base
|
1535
|
-
are using the top-level DSL (<tt>require 'sinatra'</tt>), then this
|
1536
|
-
Sinatra::Application
|
1537
|
-
class level you have methods like +get+ or +before+, but
|
1538
|
-
+request+ object or the +session+, as there only is a
|
1539
|
-
for all requests.
|
1561
|
+
Every Sinatra application corresponds to a subclass of <tt>Sinatra::Base</tt>.
|
1562
|
+
If you are using the top-level DSL (<tt>require 'sinatra'</tt>), then this
|
1563
|
+
class is <tt>Sinatra::Application</tt>, otherwise it is the subclass you
|
1564
|
+
created explicitly. At class level you have methods like +get+ or +before+, but
|
1565
|
+
you cannot access the +request+ object or the +session+, as there only is a
|
1566
|
+
single application class for all requests.
|
1540
1567
|
|
1541
1568
|
Options created via +set+ are methods at class level:
|
1542
1569
|
|
@@ -1637,20 +1664,22 @@ The following Ruby versions are officially supported:
|
|
1637
1664
|
[ Ruby 1.9.2 ]
|
1638
1665
|
1.9.2 is supported and recommended. Note that Radius and Markaby are
|
1639
1666
|
currently not 1.9 compatible. Do not use 1.9.2p0, it is known to cause
|
1640
|
-
segmentation faults when
|
1667
|
+
segmentation faults when running Sinatra.
|
1641
1668
|
|
1642
1669
|
[ Rubinius ]
|
1643
1670
|
Rubinius is officially supported (Rubinius >= 1.2.3), everything, including
|
1644
1671
|
all template languages, works.
|
1645
1672
|
|
1646
1673
|
[ JRuby ]
|
1647
|
-
JRuby is officially supported (JRuby >= 1.6.
|
1674
|
+
JRuby is officially supported (JRuby >= 1.6.1). No issues with third party
|
1648
1675
|
template libraries are known, however, if you choose to use JRuby, please
|
1649
1676
|
look into JRuby rack handlers, as the Thin web server is not fully supported
|
1650
1677
|
on JRuby. JRuby's support for C extensions is still experimental, which only
|
1651
|
-
affects RDiscount at the moment.
|
1678
|
+
affects RDiscount and Redcarpet at the moment.
|
1652
1679
|
|
1653
|
-
<b>Ruby 1.8.6 is no longer supported.</b>
|
1680
|
+
<b>Ruby 1.8.6 is no longer supported.</b> If you want to run with 1.8.6,
|
1681
|
+
downgrade to Sinatra 1.2, which will receive bug fixes until Sinatra 1.4.0 is
|
1682
|
+
released.
|
1654
1683
|
|
1655
1684
|
We also keep an eye on upcoming Ruby versions.
|
1656
1685
|
|
@@ -1660,7 +1689,6 @@ known to run Sinatra:
|
|
1660
1689
|
* Older versions of JRuby and Rubinius
|
1661
1690
|
* MacRuby, Maglev, IronRuby
|
1662
1691
|
* Ruby 1.9.0 and 1.9.1
|
1663
|
-
* Ruby 1.8.6 with {backports}[https://github.com/marcandre/backports/#readme]
|
1664
1692
|
|
1665
1693
|
Not being officially supported means if things only break there and not on a
|
1666
1694
|
supported platform, we assume it's not our issue but theirs.
|
@@ -1673,6 +1701,7 @@ Sinatra should work on any operating system supported by the chosen Ruby
|
|
1673
1701
|
implementation.
|
1674
1702
|
|
1675
1703
|
== The Bleeding Edge
|
1704
|
+
|
1676
1705
|
If you would like to use Sinatra's latest bleeding code, feel free to run your
|
1677
1706
|
application against the master branch, it should be rather stable.
|
1678
1707
|
|
@@ -1683,6 +1712,7 @@ We also push out prerelease gems from time to time, so you can do a
|
|
1683
1712
|
To get some of the latest features.
|
1684
1713
|
|
1685
1714
|
=== With Bundler
|
1715
|
+
|
1686
1716
|
If you want to run your application with the latest Sinatra, using
|
1687
1717
|
{Bundler}[http://gembundler.com/] is the recommended way.
|
1688
1718
|
|
@@ -1708,6 +1738,7 @@ Now you can run your app like this:
|
|
1708
1738
|
bundle exec ruby myapp.rb
|
1709
1739
|
|
1710
1740
|
=== Roll Your Own
|
1741
|
+
|
1711
1742
|
Create a local clone and run your app with the <tt>sinatra/lib</tt> directory
|
1712
1743
|
on the <tt>$LOAD_PATH</tt>:
|
1713
1744
|
|
@@ -1749,8 +1780,8 @@ SemVerTag.
|
|
1749
1780
|
* {Mailing List}[http://groups.google.com/group/sinatrarb/topics]
|
1750
1781
|
* {IRC: #sinatra}[irc://chat.freenode.net/#sinatra] on http://freenode.net
|
1751
1782
|
* {Sinatra Book}[http://sinatra-book.gittr.com] Cookbook Tutorial
|
1752
|
-
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Community
|
1783
|
+
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Community
|
1784
|
+
contributed recipes
|
1753
1785
|
* API documentation for the {latest release}[http://rubydoc.info/gems/sinatra]
|
1754
1786
|
or the {current HEAD}[http://rubydoc.info/github/sinatra/sinatra] on
|
1755
|
-
http://rubydoc.info
|
1756
|
-
|
1787
|
+
http://rubydoc.info
|