Merge branch 'master' into 2.2.0-alpha
This commit is contained in:
commit
a0acf42ded
|
@ -4,14 +4,16 @@ Sinatra was designed and developed by Blake Mizerany in California.
|
||||||
|
|
||||||
* **Konstantin Haase** (maintainer)
|
* **Konstantin Haase** (maintainer)
|
||||||
* **Zachary Scott**
|
* **Zachary Scott**
|
||||||
* **Katrina Owen**
|
* **Kashyap Kondamudi**
|
||||||
* **Ashley Williams**
|
* **Ashley Williams**
|
||||||
|
* **Trevor Bramble**
|
||||||
|
|
||||||
### Alumni
|
### Alumni
|
||||||
|
|
||||||
* **Blake Mizerany** (creator)
|
* **Blake Mizerany** (creator)
|
||||||
* **Ryan Tomayko**
|
* **Ryan Tomayko**
|
||||||
* **Simon Rozet**
|
* **Simon Rozet**
|
||||||
|
* **Katrina Owen**
|
||||||
|
|
||||||
### Thanks
|
### Thanks
|
||||||
|
|
||||||
|
|
54
README.de.md
54
README.de.md
|
@ -4,7 +4,7 @@
|
||||||
Umständen nicht auf dem aktuellen Stand (aktuell Sinatra 1.4.5).*
|
Umständen nicht auf dem aktuellen Stand (aktuell Sinatra 1.4.5).*
|
||||||
|
|
||||||
Sinatra ist eine
|
Sinatra ist eine
|
||||||
[DSL](http://de.wikipedia.org/wiki/Domänenspezifische_Sprache), die das
|
[DSL](https://de.wikipedia.org/wiki/Domänenspezifische_Sprache), die das
|
||||||
schnelle Erstellen von Webanwendungen in Ruby mit minimalem Aufwand
|
schnelle Erstellen von Webanwendungen in Ruby mit minimalem Aufwand
|
||||||
ermöglicht:
|
ermöglicht:
|
||||||
|
|
||||||
|
@ -220,9 +220,9 @@ end
|
||||||
Routen-Muster können auch mit optionalen Parametern ausgestattet werden:
|
Routen-Muster können auch mit optionalen Parametern ausgestattet werden:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:format?' do
|
get '/posts/:format?' do
|
||||||
# passt auf "GET /posts" sowie jegliche Erweiterung
|
# passt auf "GET /posts/" sowie jegliche Erweiterung
|
||||||
# wie "GET /posts.json", "GET /posts.xml" etc.
|
# wie "GET /posts/json", "GET /posts/xml" etc.
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abhängigkeit</td>
|
<td>Abhängigkeit</td>
|
||||||
<td><a href="http://nokogiri.org/">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dateierweiterung</td>
|
<td>Dateierweiterung</td>
|
||||||
|
@ -663,7 +663,7 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abhängigkeit</td>
|
<td>Abhängigkeit</td>
|
||||||
<td><a href="http://www.lesscss.org/">less</a></td>
|
<td><a href="http://lesscss.org/">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dateierweiterung</td>
|
<td>Dateierweiterung</td>
|
||||||
|
@ -681,7 +681,7 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abhängigkeit</td>
|
<td>Abhängigkeit</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dateierweiterung</td>
|
<td>Dateierweiterung</td>
|
||||||
|
@ -703,7 +703,7 @@ denen man Variablen weitergibt.
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abhängigkeit</td>
|
<td>Abhängigkeit</td>
|
||||||
<td>Eine der folgenden Bibliotheken:
|
<td>Eine der folgenden Bibliotheken:
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a> oder
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a> oder
|
||||||
|
@ -863,7 +863,7 @@ man üblicherweise locals verwenden wollen, mit denen man Variablen weitergibt.
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abhängigkeit</td>
|
<td>Abhängigkeit</td>
|
||||||
<td><a href="http://markaby.github.com/">markaby</a></td>
|
<td><a href="http://markaby.github.io/">markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dateierweiterung</td>
|
<td>Dateierweiterung</td>
|
||||||
|
@ -1011,7 +1011,7 @@ Templates zu verwenden und einen anderen für das Layout, indem die
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abhängigkeit</td>
|
<td>Abhängigkeit</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> und eine Möglichkeit
|
</a> und eine Möglichkeit
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1540,8 +1540,8 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Damit lassen sich Streaming-APIs realisieren, sog.
|
Damit lassen sich Streaming-APIs realisieren, sog.
|
||||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/), die als Basis für
|
[Server Sent Events](https://w3c.github.io/eventsource/), die als Basis für
|
||||||
[WebSockets](http://en.wikipedia.org/wiki/WebSocket) dienen. Ebenso können sie
|
[WebSockets](https://en.wikipedia.org/wiki/WebSocket) dienen. Ebenso können sie
|
||||||
verwendet werden, um den Durchsatz zu erhöhen, wenn ein Teil der Daten von
|
verwendet werden, um den Durchsatz zu erhöhen, wenn ein Teil der Daten von
|
||||||
langsamen Ressourcen abhängig ist.
|
langsamen Ressourcen abhängig ist.
|
||||||
|
|
||||||
|
@ -1672,7 +1672,7 @@ Weitere Parameter werden wie Argumente der `halt`-Methode behandelt:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'Hier bist du falsch'
|
redirect 'http://www.google.com/', 'Hier bist du falsch'
|
||||||
```
|
```
|
||||||
|
|
||||||
Ebenso leicht lässt sich ein Schritt zurück mit dem Alias `redirect back`
|
Ebenso leicht lässt sich ein Schritt zurück mit dem Alias `redirect back`
|
||||||
|
@ -1757,7 +1757,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
ebenso ist es möglich einen
|
ebenso ist es möglich einen
|
||||||
[schwachen ETag](http://de.wikipedia.org/wiki/HTTP_ETag) zu verwenden:
|
[schwachen ETag](https://de.wikipedia.org/wiki/HTTP_ETag) zu verwenden:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
etag @article.sha1, :weak
|
etag @article.sha1, :weak
|
||||||
|
@ -2073,7 +2073,7 @@ end
|
||||||
#### Einstellung des Angriffsschutzes
|
#### Einstellung des Angriffsschutzes
|
||||||
|
|
||||||
Sinatra verwendet
|
Sinatra verwendet
|
||||||
[Rack::Protection](https://github.com/rkh/rack-protection#readme), um die
|
[Rack::Protection](https://github.com/sinatra/rack-protection#readme), um die
|
||||||
Anwendung vor häufig vorkommenden Angriffen zu schützen. Diese Voreinstellung
|
Anwendung vor häufig vorkommenden Angriffen zu schützen. Diese Voreinstellung
|
||||||
lässt sich selbstverständlich deaktivieren, der damit verbundene
|
lässt sich selbstverständlich deaktivieren, der damit verbundene
|
||||||
Geschwindigkeitszuwachs steht aber in keinem Verhätnis zu den möglichen
|
Geschwindigkeitszuwachs steht aber in keinem Verhätnis zu den möglichen
|
||||||
|
@ -2360,7 +2360,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Die Semantik von `use` entspricht der gleichnamigen Methode der
|
Die Semantik von `use` entspricht der gleichnamigen Methode der
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder)-DSL
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder)-DSL
|
||||||
(meist verwendet in Rackup-Dateien). Ein Beispiel dafür ist, dass die
|
(meist verwendet in Rackup-Dateien). Ein Beispiel dafür ist, dass die
|
||||||
`use`-Methode mehrere/verschiedene Argumente und auch Blöcke entgegennimmt:
|
`use`-Methode mehrere/verschiedene Argumente und auch Blöcke entgegennimmt:
|
||||||
|
|
||||||
|
@ -2383,7 +2383,7 @@ oder im [Rack wiki](https://github.com/rack/rack/wiki/List-of-Middleware).
|
||||||
## Testen
|
## Testen
|
||||||
|
|
||||||
Sinatra-Tests können mit jedem auf Rack aufbauendem Test-Framework geschrieben
|
Sinatra-Tests können mit jedem auf Rack aufbauendem Test-Framework geschrieben
|
||||||
werden. [Rack::Test](http://rdoc.info/github/brynary/rack-test/master/frames)
|
werden. [Rack::Test](http://www.rubydoc.info/github/brynary/rack-test/master/frames)
|
||||||
wird empfohlen:
|
wird empfohlen:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -2464,7 +2464,7 @@ Veränderungen zu `Sinatra::Base` konvertiert werden:
|
||||||
|
|
||||||
`Sinatra::Base` ist ein unbeschriebenes Blatt. Die meisten Optionen sind per
|
`Sinatra::Base` ist ein unbeschriebenes Blatt. Die meisten Optionen sind per
|
||||||
Standard deaktiviert. Das betrifft auch den eingebauten Server. Siehe
|
Standard deaktiviert. Das betrifft auch den eingebauten Server. Siehe
|
||||||
[Optionen und Konfiguration](http://sinatra.github.com/configuration.html) für
|
[Optionen und Konfiguration](http://www.sinatrarb.com/configuration.html) für
|
||||||
Details über mögliche Optionen.
|
Details über mögliche Optionen.
|
||||||
|
|
||||||
Damit eine App sich ähnlich wie eine klassische App verhält, kann man
|
Damit eine App sich ähnlich wie eine klassische App verhält, kann man
|
||||||
|
@ -2541,7 +2541,7 @@ werden:
|
||||||
<tr>
|
<tr>
|
||||||
<td>static</td>
|
<td>static</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
<td>false</td>
|
<td>File.exist?(public_folder)</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -2926,7 +2926,7 @@ gem install sinatra --pre
|
||||||
### Mit Bundler
|
### Mit Bundler
|
||||||
|
|
||||||
Wenn die Applikation mit der neuesten Version von Sinatra und
|
Wenn die Applikation mit der neuesten Version von Sinatra und
|
||||||
[Bundler](http://gembundler.com/) genutzt werden soll, empfehlen wir den
|
[Bundler](http://bundler.io) genutzt werden soll, empfehlen wir den
|
||||||
nachfolgenden Weg.
|
nachfolgenden Weg.
|
||||||
|
|
||||||
Soweit Bundler noch nicht installiert ist:
|
Soweit Bundler noch nicht installiert ist:
|
||||||
|
@ -3013,12 +3013,12 @@ SemVer und SemVerTag.
|
||||||
|
|
||||||
## Mehr
|
## Mehr
|
||||||
|
|
||||||
* [Projekt-Website](http://sinatra.github.com/) - Ergänzende Dokumentation,
|
* [Projekt-Website](http://www.sinatrarb.com/) - Ergänzende Dokumentation,
|
||||||
News und Links zu anderen Ressourcen.
|
News und Links zu anderen Ressourcen.
|
||||||
* [Mitmachen](http://sinatra.github.com/contributing.html) - Einen Fehler
|
* [Mitmachen](http://www.sinatrarb.com/contributing.html) - Einen Fehler
|
||||||
gefunden? Brauchst du Hilfe? Hast du einen Patch?
|
gefunden? Brauchst du Hilfe? Hast du einen Patch?
|
||||||
* [Issue-Tracker](http://github.com/sinatra/sinatra/issues)
|
* [Issue-Tracker](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Mailing-Liste](http://groups.google.com/group/sinatrarb)
|
* [Mailing-Liste](http://groups.google.com/group/sinatrarb)
|
||||||
* [#sinatra](irc://chat.freenode.net/#sinatra) auf http://freenode.net Es
|
* [#sinatra](irc://chat.freenode.net/#sinatra) auf http://freenode.net Es
|
||||||
gibt dort auch immer wieder deutschsprachige Entwickler, die gerne weiterhelfen.
|
gibt dort auch immer wieder deutschsprachige Entwickler, die gerne weiterhelfen.
|
||||||
|
@ -3026,6 +3026,6 @@ SemVer und SemVerTag.
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Sinatra-Rezepte aus der
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Sinatra-Rezepte aus der
|
||||||
Community
|
Community
|
||||||
* API Dokumentation für die [aktuelle
|
* API Dokumentation für die [aktuelle
|
||||||
Version](http://rubydoc.info/gems/sinatra) oder für
|
Version](http://www.rubydoc.info//gems/sinatra) oder für
|
||||||
[HEAD](http://rubydoc.info/github/sinatra/sinatra) auf http://rubydoc.info
|
[HEAD](http://www.rubydoc.info/github/sinatra/sinatra) auf http://rubydoc.info
|
||||||
* [CI Server](http://travis-ci.org/sinatra/sinatra)
|
* [CI Server](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
54
README.es.md
54
README.es.md
|
@ -3,7 +3,7 @@
|
||||||
*Atención: Este documento es una traducción de la versión en inglés y puede estar desactualizado.*
|
*Atención: Este documento es una traducción de la versión en inglés y puede estar desactualizado.*
|
||||||
|
|
||||||
Sinatra es un
|
Sinatra es un
|
||||||
[DSL](http://es.wikipedia.org/wiki/Lenguaje_específico_del_dominio) para
|
[DSL](https://es.wikipedia.org/wiki/Lenguaje_específico_del_dominio) para
|
||||||
crear aplicaciones web rápidamente en Ruby con un mínimo esfuerzo:
|
crear aplicaciones web rápidamente en Ruby con un mínimo esfuerzo:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -22,7 +22,7 @@ gem install sinatra
|
||||||
ruby miapp.rb
|
ruby miapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
Ver en <http://localhost:4567>.
|
Ver en [http://localhost:4567](http://localhost:4567).
|
||||||
|
|
||||||
Se recomienda ejecutar `gem install thin`, porque Sinatra lo utilizará si está disponible.
|
Se recomienda ejecutar `gem install thin`, porque Sinatra lo utilizará si está disponible.
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ end
|
||||||
Los patrones de ruta pueden contener parámetros opcionales:
|
Los patrones de ruta pueden contener parámetros opcionales:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:formato?' do
|
get '/posts/:formato?' do
|
||||||
# coincide con "GET /posts" y además admite cualquier extensión, por
|
# coincide con "GET /posts/" y además admite cualquier extensión, por
|
||||||
# ejemplo, "GET /posts.json", "GET /posts.xml", etc.
|
# ejemplo, "GET /posts/json", "GET /posts/xml", etc.
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ Además, acepta un bloque con la definición de la plantilla (ver ejemplo).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencias</td>
|
<td>Dependencias</td>
|
||||||
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensiones de Archivo</td>
|
<td>Extensiones de Archivo</td>
|
||||||
|
@ -556,7 +556,7 @@ Además, acepta un bloque con la definición de la plantilla (ver ejemplo).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencias</td>
|
<td>Dependencias</td>
|
||||||
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
|
<td><a href="http://lesscss.org/" title="less">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensiones de Archivo</td>
|
<td>Extensiones de Archivo</td>
|
||||||
|
@ -573,7 +573,7 @@ Además, acepta un bloque con la definición de la plantilla (ver ejemplo).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencias</td>
|
<td>Dependencias</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/" title="liquid">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensiones de Archivo</td>
|
<td>Extensiones de Archivo</td>
|
||||||
|
@ -594,7 +594,7 @@ plantilla Liquid, casi siempre va a querer pasarle locales.
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencias</td>
|
<td>Dependencias</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a> o
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a> o
|
||||||
|
@ -727,7 +727,7 @@ plantilla Radius, casi siempre se necesita pasar locales.
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencias</td>
|
<td>Dependencias</td>
|
||||||
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
|
<td><a href="http://markaby.github.io/" title="Markaby">Markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensiones de Archivo</td>
|
<td>Extensiones de Archivo</td>
|
||||||
|
@ -841,7 +841,7 @@ distinto al de la plantilla pasando la opción `:layout_engine`.
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencias</td>
|
<td>Dependencias</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> y un
|
</a> y un
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1324,8 +1324,8 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Podés implementar APIs de streaming,
|
Podés implementar APIs de streaming,
|
||||||
[Server-Sent Events](http://dev.w3.org/html5/eventsource/) y puede ser usado
|
[Server-Sent Events](https://w3c.github.io/eventsource/) y puede ser usado
|
||||||
como base para [WebSockets](http://es.wikipedia.org/wiki/WebSockets). También
|
como base para [WebSockets](https://es.wikipedia.org/wiki/WebSockets). También
|
||||||
puede ser usado para incrementar el throughput si solo una parte del contenido
|
puede ser usado para incrementar el throughput si solo una parte del contenido
|
||||||
depende de un recurso lento.
|
depende de un recurso lento.
|
||||||
|
|
||||||
|
@ -1441,7 +1441,7 @@ pasados a `halt`:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'te confundiste de lugar, compañero'
|
redirect 'http://www.google.com/', 'te confundiste de lugar, compañero'
|
||||||
```
|
```
|
||||||
|
|
||||||
También podés redireccionar fácilmente de vuelta hacia la página desde donde
|
También podés redireccionar fácilmente de vuelta hacia la página desde donde
|
||||||
|
@ -1526,7 +1526,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
También es posible usar una
|
También es posible usar una
|
||||||
[weak ETag](http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation):
|
[weak ETag](https://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation):
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
etag @articulo.sha1, :weak
|
etag @articulo.sha1, :weak
|
||||||
|
@ -1841,7 +1841,7 @@ end
|
||||||
|
|
||||||
### Configurando la Protección de Ataques
|
### Configurando la Protección de Ataques
|
||||||
|
|
||||||
Sinatra usa [Rack::Protection](https://github.com/rkh/rack-protection#readme)
|
Sinatra usa [Rack::Protection](https://github.com/sinatra/rack-protection#readme)
|
||||||
para defender a tu aplicación de los ataques más comunes. Si por algún motivo,
|
para defender a tu aplicación de los ataques más comunes. Si por algún motivo,
|
||||||
querés desactivar esta funcionalidad, podés hacerlo como se indica a
|
querés desactivar esta funcionalidad, podés hacerlo como se indica a
|
||||||
continuación (ten en cuenta que tu aplicación va a quedar expuesta a un
|
continuación (ten en cuenta que tu aplicación va a quedar expuesta a un
|
||||||
|
@ -2187,7 +2187,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
La semántica de `use` es idéntica a la definida para el DSL
|
La semántica de `use` es idéntica a la definida para el DSL
|
||||||
Rack::Builder[http://rubydoc.info/github/rack/rack/master/Rack/Builder] (más
|
Rack::Builder[http://www.rubydoc.info/github/rack/rack/master/Rack/Builder] (más
|
||||||
frecuentemente usado en archivos rackup). Por ejemplo, el método `use`
|
frecuentemente usado en archivos rackup). Por ejemplo, el método `use`
|
||||||
acepta argumentos múltiples/variables así como bloques:
|
acepta argumentos múltiples/variables así como bloques:
|
||||||
|
|
||||||
|
@ -2211,7 +2211,7 @@ o en la [Rack wiki](https://github.com/rack/rack/wiki/List-of-Middleware).
|
||||||
|
|
||||||
Las pruebas para las aplicaciones Sinatra pueden ser escritas utilizando
|
Las pruebas para las aplicaciones Sinatra pueden ser escritas utilizando
|
||||||
cualquier framework o librería de pruebas basada en Rack. Se recomienda usar
|
cualquier framework o librería de pruebas basada en Rack. Se recomienda usar
|
||||||
[Rack::Test](http://rdoc.info/github/brynary/rack-test/master/frames):
|
[Rack::Test](http://www.rubydoc.info/github/brynary/rack-test/master/frames):
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
require 'mi_app_sinatra'
|
require 'mi_app_sinatra'
|
||||||
|
@ -2279,7 +2279,7 @@ aplicaciones top-level se pueden convertir en componentes
|
||||||
|
|
||||||
`Sinatra::Base` es una pizarra en blanco. La mayoría de las opciones están
|
`Sinatra::Base` es una pizarra en blanco. La mayoría de las opciones están
|
||||||
desactivadas por defecto, incluyendo el servidor incorporado. Mirá
|
desactivadas por defecto, incluyendo el servidor incorporado. Mirá
|
||||||
[Opciones y Configuraciones](http://sinatra.github.com/configuration.html)
|
[Opciones y Configuraciones](http://www.sinatrarb.com/configuration.html)
|
||||||
para detalles sobre las opciones disponibles y su comportamiento.
|
para detalles sobre las opciones disponibles y su comportamiento.
|
||||||
|
|
||||||
### Estilo Modular vs. Clásico
|
### Estilo Modular vs. Clásico
|
||||||
|
@ -2336,7 +2336,7 @@ de ambos estilos:
|
||||||
<tr>
|
<tr>
|
||||||
<td>static</td>
|
<td>static</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
<td>false</td>
|
<td>File.exist?(public_folder)</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -2732,7 +2732,7 @@ Para obtener algunas de las últimas características.
|
||||||
### Con Bundler
|
### Con Bundler
|
||||||
|
|
||||||
Esta es la manera recomendada para ejecutar tu aplicación sobre la última
|
Esta es la manera recomendada para ejecutar tu aplicación sobre la última
|
||||||
versión de Sinatra usando [Bundler](http://gembundler.com/).
|
versión de Sinatra usando [Bundler](http://bundler.io).
|
||||||
|
|
||||||
Primero, instalá Bundler si no lo hiciste todavía:
|
Primero, instalá Bundler si no lo hiciste todavía:
|
||||||
|
|
||||||
|
@ -2807,15 +2807,15 @@ siguiendo las especificaciones SemVer y SemVerTag.
|
||||||
adicional, noticias, y enlaces a otros recursos.
|
adicional, noticias, y enlaces a otros recursos.
|
||||||
* [Contribuyendo](http://www.sinatrarb.com/contributing) - ¿Encontraste un
|
* [Contribuyendo](http://www.sinatrarb.com/contributing) - ¿Encontraste un
|
||||||
error?. ¿Necesitás ayuda?. ¿Tenés un parche?.
|
error?. ¿Necesitás ayuda?. ¿Tenés un parche?.
|
||||||
* [Seguimiento de problemas](http://github.com/sinatra/sinatra/issues)
|
* [Seguimiento de problemas](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Lista de Correo](http://groups.google.com/group/sinatrarb/topics)
|
* [Lista de Correo](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* [IRC: #sinatra](irc://chat.freenode.net/#sinatra) en http://freenode.net
|
* [IRC: #sinatra](irc://chat.freenode.net/#sinatra) en http://freenode.net
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Tutorial (en inglés).
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Tutorial (en inglés).
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Recetas contribuidas
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Recetas contribuidas
|
||||||
por la comunidad (en inglés).
|
por la comunidad (en inglés).
|
||||||
* Documentación de la API para la
|
* Documentación de la API para la
|
||||||
[última versión liberada](http://rubydoc.info/gems/sinatra) o para la
|
[última versión liberada](http://www.rubydoc.info/gems/sinatra) o para la
|
||||||
[rama de desarrollo actual](http://rubydoc.info/github/sinatra/sinatra)
|
[rama de desarrollo actual](http://www.rubydoc.info/github/sinatra/sinatra)
|
||||||
en http://rubydoc.info/
|
en http://www.rubydoc.info/
|
||||||
* [Servidor de CI](http://travis-ci.org/sinatra/sinatra)
|
* [Servidor de CI](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
51
README.fr.md
51
README.fr.md
|
@ -2,7 +2,7 @@
|
||||||
*Attention : Ce document correspond à la traduction de la version anglaise et
|
*Attention : Ce document correspond à la traduction de la version anglaise et
|
||||||
il n'est peut-être plus à jour.*
|
il n'est peut-être plus à jour.*
|
||||||
|
|
||||||
Sinatra est un [DSL](http://fr.wikipedia.org/wiki/Langage_dédié) pour
|
Sinatra est un [DSL](https://fr.wikipedia.org/wiki/Langage_dédié) pour
|
||||||
créer rapidement et facilement des applications web en Ruby :
|
créer rapidement et facilement des applications web en Ruby :
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -26,7 +26,8 @@ Puis lancez votre programme :
|
||||||
ruby mon_application.rb
|
ruby mon_application.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
Le résultat est visible sur : http://localhost:4567
|
Le résultat est visible sur :
|
||||||
|
[http://localhost:4567](http://localhost:4567)
|
||||||
|
|
||||||
Il est recommandé d'exécuter également `gem install thin`, pour que
|
Il est recommandé d'exécuter également `gem install thin`, pour que
|
||||||
Sinatra utilise le server Thin quand il est disponible.
|
Sinatra utilise le server Thin quand il est disponible.
|
||||||
|
@ -225,8 +226,8 @@ end
|
||||||
Les routes peuvent aussi comporter des paramètres optionnels :
|
Les routes peuvent aussi comporter des paramètres optionnels :
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/articles.?:format?' do
|
get '/articles/:format?' do
|
||||||
# répond à "GET /articles" ou avec une extension "GET /articles.json", "GET /articles.xml" etc...
|
# répond à "GET /articles/" ou avec une extension "GET /articles/json", "GET /articles/xml" etc...
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -616,7 +617,7 @@ exemple).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dépendances</td>
|
<td>Dépendances</td>
|
||||||
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensions de fichier</td>
|
<td>Extensions de fichier</td>
|
||||||
|
@ -672,7 +673,7 @@ exemple).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dépendances</td>
|
<td>Dépendances</td>
|
||||||
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
|
<td><a href="http://lesscss.org/" title="less">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensions de fichier</td>
|
<td>Extensions de fichier</td>
|
||||||
|
@ -690,7 +691,7 @@ exemple).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dépendances</td>
|
<td>Dépendances</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/" title="liquid">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensions de fichier</td>
|
<td>Extensions de fichier</td>
|
||||||
|
@ -713,7 +714,7 @@ locales.
|
||||||
<td><p>Dépendances</p></td>
|
<td><p>Dépendances</p></td>
|
||||||
<td>
|
<td>
|
||||||
Au choix :
|
Au choix :
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||||
|
@ -849,7 +850,7 @@ Radius, vous aurez sûrement à lui passer des variables locales.
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dépendances</td>
|
<td>Dépendances</td>
|
||||||
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
|
<td><a href="http://markaby.github.io/" title="Markaby">Markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extensions de fichier</td>
|
<td>Extensions de fichier</td>
|
||||||
|
@ -966,7 +967,7 @@ en utilisant l'option `:layout_engine`.
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dépendances</td>
|
<td>Dépendances</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a>
|
</a>
|
||||||
et un
|
et un
|
||||||
|
@ -1503,8 +1504,8 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Cela permet d'implémenter des API de streaming ou de
|
Cela permet d'implémenter des API de streaming ou de
|
||||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/) et peut servir de
|
[Server Sent Events](https://w3c.github.io/eventsource/) et peut servir de
|
||||||
base pour des [WebSockets](http://en.wikipedia.org/wiki/WebSocket). Vous
|
base pour des [WebSockets](https://en.wikipedia.org/wiki/WebSocket). Vous
|
||||||
pouvez aussi l'employer pour augmenter le débit quand une partie du contenu
|
pouvez aussi l'employer pour augmenter le débit quand une partie du contenu
|
||||||
provient d'une ressource lente.
|
provient d'une ressource lente.
|
||||||
|
|
||||||
|
@ -1635,7 +1636,7 @@ Tout paramètre additionnel sera utilisé comme argument pour la méthode
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'mauvais endroit mon pote'
|
redirect 'http://www.google.com/', 'mauvais endroit mon pote'
|
||||||
```
|
```
|
||||||
|
|
||||||
Vous pouvez aussi rediriger vers la page dont l'utilisateur venait au moyen de
|
Vous pouvez aussi rediriger vers la page dont l'utilisateur venait au moyen de
|
||||||
|
@ -1718,7 +1719,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Il est également possible d'utiliser un
|
Il est également possible d'utiliser un
|
||||||
[weak ETag](http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation) :
|
[weak ETag](https://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation) :
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
etag @article.sha1, :weak
|
etag @article.sha1, :weak
|
||||||
|
@ -2047,7 +2048,7 @@ end
|
||||||
|
|
||||||
### Se protéger des attaques
|
### Se protéger des attaques
|
||||||
|
|
||||||
Sinatra utilise [Rack::Protection](https://github.com/rkh/rack-protection#readme)
|
Sinatra utilise [Rack::Protection](https://github.com/sinatra/rack-protection#readme)
|
||||||
pour protéger votre application contre les principales attaques opportunistes.
|
pour protéger votre application contre les principales attaques opportunistes.
|
||||||
Vous pouvez très simplement désactiver cette fonctionnalité (ce qui exposera
|
Vous pouvez très simplement désactiver cette fonctionnalité (ce qui exposera
|
||||||
votre application à beaucoup de vulnerabilités courantes) :
|
votre application à beaucoup de vulnerabilités courantes) :
|
||||||
|
@ -2356,7 +2357,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
La sémantique de `use` est identique à celle définie dans le DSL de
|
La sémantique de `use` est identique à celle définie dans le DSL de
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder)
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder)
|
||||||
(le plus souvent utilisé dans un fichier `rackup`). Par exemple, la méthode
|
(le plus souvent utilisé dans un fichier `rackup`). Par exemple, la méthode
|
||||||
`use` accepte divers arguments ainsi que des blocs :
|
`use` accepte divers arguments ainsi que des blocs :
|
||||||
|
|
||||||
|
@ -2447,7 +2448,7 @@ pour transformer la plupart des applications de haut niveau en un composant
|
||||||
|
|
||||||
`Sinatra::Base` est une page blanche. La plupart des options sont
|
`Sinatra::Base` est une page blanche. La plupart des options sont
|
||||||
désactivées par défaut, y compris le serveur intégré. Reportez-vous à
|
désactivées par défaut, y compris le serveur intégré. Reportez-vous à
|
||||||
[Options et Configuration](http://sinatra.github.com/configuration.html)
|
[Options et Configuration](http://www.sinatrarb.com/configuration.html)
|
||||||
pour plus d'informations sur les options et leur fonctionnement. Si vous
|
pour plus d'informations sur les options et leur fonctionnement. Si vous
|
||||||
souhaitez un comportement plus proche de celui obtenu lorsque vous définissez
|
souhaitez un comportement plus proche de celui obtenu lorsque vous définissez
|
||||||
votre application au niveau supérieur (aussi connu sous le nom de style
|
votre application au niveau supérieur (aussi connu sous le nom de style
|
||||||
|
@ -2523,7 +2524,7 @@ mineures en ce qui concerne les paramètres par défaut :
|
||||||
<tr>
|
<tr>
|
||||||
<td>static</td>
|
<td>static</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
<td>false</td>
|
<td>File.exist?(public_folder)</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -2922,7 +2923,7 @@ Ce qui permet de bénéficier des toutes dernières fonctionnalités.
|
||||||
|
|
||||||
### Installer avec Bundler
|
### Installer avec Bundler
|
||||||
|
|
||||||
Il est cependant conseillé de passer par [Bundler](http://gembundler.com/) pour
|
Il est cependant conseillé de passer par [Bundler](http://bundler.io) pour
|
||||||
faire tourner votre application avec la dernière version de Sinatra.
|
faire tourner votre application avec la dernière version de Sinatra.
|
||||||
|
|
||||||
Pour commencer, installez bundler si nécessaire :
|
Pour commencer, installez bundler si nécessaire :
|
||||||
|
@ -3000,14 +3001,14 @@ SemVer que SemVerTag.
|
||||||
de news, et des liens vers d'autres ressources.
|
de news, et des liens vers d'autres ressources.
|
||||||
* [Contribuer](http://www.sinatrarb.com/contributing) - Vous avez trouvé un
|
* [Contribuer](http://www.sinatrarb.com/contributing) - Vous avez trouvé un
|
||||||
bug ? Besoin d'aide ? Vous avez un patch ?
|
bug ? Besoin d'aide ? Vous avez un patch ?
|
||||||
* [Suivi des problèmes](http://github.com/sinatra/sinatra/issues)
|
* [Suivi des problèmes](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Mailing List](http://groups.google.com/group/sinatrarb/topics)
|
* [Mailing List](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* IRC : [#sinatra](irc://chat.freenode.net/#sinatra) sur http://freenode.net
|
* IRC : [#sinatra](irc://chat.freenode.net/#sinatra) sur http://freenode.net
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Tutoriels et recettes
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Tutoriels et recettes
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) trucs et astuces rédigés par
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) trucs et astuces rédigés par
|
||||||
la communauté
|
la communauté
|
||||||
* Documentation API de la [dernière version](http://rubydoc.info/gems/sinatra)
|
* Documentation API de la [dernière version](http://www.rubydoc.info/gems/sinatra)
|
||||||
ou du [HEAD courant](http://rubydoc.info/github/sinatra/sinatra) sur
|
ou du [HEAD courant](http://www.rubydoc.info/github/sinatra/sinatra) sur
|
||||||
http://rubydoc.info
|
http://www.rubydoc.info/
|
||||||
* [CI server](http://travis-ci.org/sinatra/sinatra)
|
* [CI server](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
14
README.hu.md
14
README.hu.md
|
@ -2,7 +2,7 @@
|
||||||
*Fontos megjegyzés: Ez a dokumentum csak egy fordítása az angol nyelvű
|
*Fontos megjegyzés: Ez a dokumentum csak egy fordítása az angol nyelvű
|
||||||
változatnak, és lehet, hogy nem naprakész.*
|
változatnak, és lehet, hogy nem naprakész.*
|
||||||
|
|
||||||
A Sinatra egy [DSL](http://en.wikipedia.org/wiki/Domain-specific_language)
|
A Sinatra egy [DSL](https://en.wikipedia.org/wiki/Domain-specific_language)
|
||||||
webalkalmazások Ruby nyelven történő fejlesztéséhez, minimális
|
webalkalmazások Ruby nyelven történő fejlesztéséhez, minimális
|
||||||
energiabefektetéssel:
|
energiabefektetéssel:
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Telepítsd a gem-et és indítsd el az alkalmazást a következőképpen:
|
||||||
ruby myapp.rb
|
ruby myapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
Az alkalmazás elérhető lesz itt: `http://localhost:4567`
|
Az alkalmazás elérhető lesz itt: [http://localhost:4567](http://localhost:4567)
|
||||||
|
|
||||||
## Útvonalak (routes)
|
## Útvonalak (routes)
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ A Sinatra keretrendszerben gyerekjáték a Rack middleware-ek behúzása a
|
||||||
```
|
```
|
||||||
|
|
||||||
A `use` metódus szemantikája megegyezik a
|
A `use` metódus szemantikája megegyezik a
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder) DSL-ben
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder) DSL-ben
|
||||||
használt +use+ metóduséval (az említett DSL-t leginkább rackup állományokban
|
használt +use+ metóduséval (az említett DSL-t leginkább rackup állományokban
|
||||||
használják). Hogy egy példát említsünk, a `use` metódus elfogad
|
használják). Hogy egy példát említsünk, a `use` metódus elfogad
|
||||||
változókat és blokkokat egyaránt, akár kombinálva is ezeket:
|
változókat és blokkokat egyaránt, akár kombinálva is ezeket:
|
||||||
|
@ -621,7 +621,7 @@ alkalmazás átalakítható Sinatra::Base alapú komponensekké két lépésben:
|
||||||
A `Sinatra::Base` osztály igazából egy üres lap: a legtöbb funkció
|
A `Sinatra::Base` osztály igazából egy üres lap: a legtöbb funkció
|
||||||
alapból ki van kapcsolva, beleértve a beépített szervert is. A
|
alapból ki van kapcsolva, beleértve a beépített szervert is. A
|
||||||
beállításokkal és az egyes kapcsolók hatásával az
|
beállításokkal és az egyes kapcsolók hatásával az
|
||||||
[Options and Configuration](http://sinatra.github.com/configuration.html) lap
|
[Options and Configuration](http://www.sinatrarb.com/configuration.html) lap
|
||||||
foglalkozik.
|
foglalkozik.
|
||||||
|
|
||||||
Széljegyzet: A Sinatra felső szintű DSL-je egy egyszerű delegációs
|
Széljegyzet: A Sinatra felső szintű DSL-je egy egyszerű delegációs
|
||||||
|
@ -684,11 +684,11 @@ A Sinatra frissítését később így végezheted el:
|
||||||
|
|
||||||
## További információk
|
## További információk
|
||||||
|
|
||||||
* [A projekt weboldala](http://sinatra.github.com/) - Kiegészítő dokumentáció,
|
* [A projekt weboldala](http://www.sinatrarb.com/) - Kiegészítő dokumentáció,
|
||||||
hírek, hasznos linkek
|
hírek, hasznos linkek
|
||||||
* [Közreműködés](http://sinatra.github.com/contributing.html) - Hibát találtál?
|
* [Közreműködés](http://www.sinatrarb.com/contributing.html) - Hibát találtál?
|
||||||
Segítségre van szükséged? Foltot küldenél be?
|
Segítségre van szükséged? Foltot küldenél be?
|
||||||
* [Lighthouse](http://sinatra.lighthouseapp.com) - Hibakövetés és kiadások
|
* [Lighthouse](http://sinatra.lighthouseapp.com) - Hibakövetés és kiadások
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Levelezőlista](http://groups.google.com/group/sinatrarb)
|
* [Levelezőlista](http://groups.google.com/group/sinatrarb)
|
||||||
* [IRC: #sinatra](irc://chat.freenode.net/#sinatra) a http://freenode.net címen
|
* [IRC: #sinatra](irc://chat.freenode.net/#sinatra) a http://freenode.net címen
|
||||||
|
|
50
README.ja.md
50
README.ja.md
|
@ -3,7 +3,7 @@
|
||||||
*注)
|
*注)
|
||||||
本文書は英語から翻訳したものであり、その内容が最新でない場合もあります。最新の情報はオリジナルの英語版を参照して下さい。*
|
本文書は英語から翻訳したものであり、その内容が最新でない場合もあります。最新の情報はオリジナルの英語版を参照して下さい。*
|
||||||
|
|
||||||
Sinatraは最小の労力でRubyによるWebアプリケーションを手早く作るための[DSL](http://ja.wikipedia.org/wiki/ドメイン固有言語)です。
|
Sinatraは最小の労力でRubyによるWebアプリケーションを手早く作るための[DSL](https://ja.wikipedia.org/wiki/メインページドメイン固有言語)です。
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# myapp.rb
|
# myapp.rb
|
||||||
|
@ -26,7 +26,7 @@ gem install sinatra
|
||||||
ruby myapp.rb
|
ruby myapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
[localhost:4567](http://localhost:4567) を開きます。
|
[http://localhost:4567](http://localhost:4567) を開きます。
|
||||||
|
|
||||||
ThinがあればSinatraはこれを利用するので、`gem install thin`することをお薦めします。
|
ThinがあればSinatraはこれを利用するので、`gem install thin`することをお薦めします。
|
||||||
|
|
||||||
|
@ -224,8 +224,8 @@ end
|
||||||
ルーティングパターンは、オプショナルパラメータを取ることもできます。
|
ルーティングパターンは、オプショナルパラメータを取ることもできます。
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:format?' do
|
get '/posts/:format?' do
|
||||||
# "GET /posts" と "GET /posts.json", "GET /posts.xml" の拡張子などにマッチ
|
# "GET /posts/" と "GET /posts/json", "GET /posts/xml" の拡張子などにマッチ
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>依存</td>
|
<td>依存</td>
|
||||||
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ファイル拡張子</td>
|
<td>ファイル拡張子</td>
|
||||||
|
@ -633,7 +633,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>依存</td>
|
<td>依存</td>
|
||||||
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
|
<td><a href="http://lesscss.org/" title="less">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ファイル拡張子</td>
|
<td>ファイル拡張子</td>
|
||||||
|
@ -650,7 +650,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>依存</td>
|
<td>依存</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/" title="liquid">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ファイル拡張子</td>
|
<td>ファイル拡張子</td>
|
||||||
|
@ -671,7 +671,7 @@ LiquidテンプレートからRubyのメソッド(`yield`を除く)を呼び出
|
||||||
<td>依存</td>
|
<td>依存</td>
|
||||||
<td>
|
<td>
|
||||||
次の何れか:
|
次の何れか:
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||||
|
@ -816,7 +816,7 @@ RadiusテンプレートからRubyのメソッドを直接呼び出すことが
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>依存</td>
|
<td>依存</td>
|
||||||
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
|
<td><a href="http://markaby.github.io/" title="Markaby">Markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ファイル拡張子</td>
|
<td>ファイル拡張子</td>
|
||||||
|
@ -952,7 +952,7 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||||
<tr>
|
<tr>
|
||||||
<td>依存</td>
|
<td>依存</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> および
|
</a> および
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1426,7 +1426,7 @@ get '/' do
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
これはストリーミングAPI、[Server Sent Events](http://dev.w3.org/html5/eventsource/)の実装を可能にし、[WebSockets](http://en.wikipedia.org/wiki/WebSocket)の土台に使うことができます。また、一部のコンテンツが遅いリソースに依存しているときに、スループットを上げるために使うこともできます。
|
これはストリーミングAPI、[Server Sent Events](https://w3c.github.io/eventsource/)の実装を可能にし、[WebSockets](https://en.wikipedia.org/wiki/WebSocket)の土台に使うことができます。また、一部のコンテンツが遅いリソースに依存しているときに、スループットを上げるために使うこともできます。
|
||||||
|
|
||||||
ノート: ストリーミングの挙動、特に並行リクエスト(cuncurrent requests)の数は、アプリケーションを提供するのに使われるWebサーバに強く依存します。いくつかのサーバは、ストリーミングを全くサポートしません。サーバがストリーミングをサポートしない場合、ボディは`stream`に渡されたブロックの実行が終了した後、一度に全部送られることになります。ストリーミングは、Shotgunを使った場合は全く動作しません。
|
ノート: ストリーミングの挙動、特に並行リクエスト(cuncurrent requests)の数は、アプリケーションを提供するのに使われるWebサーバに強く依存します。いくつかのサーバは、ストリーミングを全くサポートしません。サーバがストリーミングをサポートしない場合、ボディは`stream`に渡されたブロックの実行が終了した後、一度に全部送られることになります。ストリーミングは、Shotgunを使った場合は全く動作しません。
|
||||||
|
|
||||||
|
@ -1532,7 +1532,7 @@ end
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'wrong place, buddy'
|
redirect 'http://www.google.com/', 'wrong place, buddy'
|
||||||
```
|
```
|
||||||
|
|
||||||
また、`redirect back`を使えば、簡単にユーザが来たページへ戻るリダイレクトを作れます。
|
また、`redirect back`を使えば、簡単にユーザが来たページへ戻るリダイレクトを作れます。
|
||||||
|
@ -1610,7 +1610,7 @@ get '/article/:id' do
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
また、[weak ETag](http://ja.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation)を使うこともできます。
|
また、[weak ETag](https://ja.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation)を使うこともできます。
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
etag @article.sha1, :weak
|
etag @article.sha1, :weak
|
||||||
|
@ -1900,7 +1900,7 @@ end
|
||||||
|
|
||||||
### 攻撃防御に対する設定
|
### 攻撃防御に対する設定
|
||||||
|
|
||||||
Sinatraは、[Rack::Protection](https://github.com/rkh/rack-protection#readme)を使って、アプリケーションを多発する日和見的攻撃から守っています。この挙動は簡単に無効化できます(これはアプリケーションを大量の脆弱性攻撃に晒すことになります)。
|
Sinatraは、[Rack::Protection](https://github.com/sinatra/rack-protection#readme)を使って、アプリケーションを多発する日和見的攻撃から守っています。この挙動は簡単に無効化できます(これはアプリケーションを大量の脆弱性攻撃に晒すことになります)。
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
disable :protection
|
disable :protection
|
||||||
|
@ -2177,7 +2177,7 @@ get '/hello' do
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
`use`の文法は、[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder)DSLで定義されているそれ(rackupファイルで最もよく使われる)と同じです。例えば `use`メソッドは複数の引数、そしてブロックも取ることができます。
|
`use`の文法は、[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder)DSLで定義されているそれ(rackupファイルで最もよく使われる)と同じです。例えば `use`メソッドは複数の引数、そしてブロックも取ることができます。
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
use Rack::Auth::Basic do |username, password|
|
use Rack::Auth::Basic do |username, password|
|
||||||
|
@ -2195,7 +2195,7 @@ Rackは、ロギング、デバッギング、URLルーティング、認証、
|
||||||
|
|
||||||
## テスト(Testing)
|
## テスト(Testing)
|
||||||
|
|
||||||
SinatraでのテストはRackベースのテストライブラリまたはフレームワークを使って書くことができます。[Rack::Test](http://rdoc.info/github/brynary/rack-test/master/frames)をお薦めします。
|
SinatraでのテストはRackベースのテストライブラリまたはフレームワークを使って書くことができます。[Rack::Test](http://www.rubydoc.info/github/brynary/rack-test/master/frames)をお薦めします。
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
require 'my_sinatra_app'
|
require 'my_sinatra_app'
|
||||||
|
@ -2251,7 +2251,7 @@ end
|
||||||
(そうしない場合、SinatraのDSLメソッドの全てがmainの名前空間にインポートされます)
|
(そうしない場合、SinatraのDSLメソッドの全てがmainの名前空間にインポートされます)
|
||||||
* ルーティング、エラーハンドラ、フィルタ、オプションを`Sinatra::Base`のサブクラスに書く
|
* ルーティング、エラーハンドラ、フィルタ、オプションを`Sinatra::Base`のサブクラスに書く
|
||||||
|
|
||||||
`Sinatra::Base`はまっさらです。ビルトインサーバを含む、ほとんどのオプションがデフォルトで無効になっています。利用可能なオプションとその挙動の詳細については[Configuring Settings](http://sinatra.github.com/configuration.html)(英語)をご覧下さい。
|
`Sinatra::Base`はまっさらです。ビルトインサーバを含む、ほとんどのオプションがデフォルトで無効になっています。利用可能なオプションとその挙動の詳細については[Configuring Settings](http://www.sinatrarb.com/configuration.html)(英語)をご覧下さい。
|
||||||
|
|
||||||
もしもクラシックスタイルと同じような挙動のアプリケーションをトップレベルで定義させる必要があれば、`Sinatra::Application`をサブクラス化させてください。
|
もしもクラシックスタイルと同じような挙動のアプリケーションをトップレベルで定義させる必要があれば、`Sinatra::Application`をサブクラス化させてください。
|
||||||
|
|
||||||
|
@ -2319,7 +2319,7 @@ end
|
||||||
<tr>
|
<tr>
|
||||||
<td>static</td>
|
<td>static</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
<td>false</td>
|
<td>File.exist?(public_folder)</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -2676,7 +2676,7 @@ gem install sinatra --pre
|
||||||
|
|
||||||
### Bundlerを使う場合
|
### Bundlerを使う場合
|
||||||
|
|
||||||
最新のSinatraでアプリケーションを動作させたい場合には、[Bundler](http://gembundler.com/)を使うのがお薦めのやり方です。
|
最新のSinatraでアプリケーションを動作させたい場合には、[Bundler](http://bundler.io)を使うのがお薦めのやり方です。
|
||||||
|
|
||||||
まず、Bundlerがなければそれをインストールします。
|
まず、Bundlerがなければそれをインストールします。
|
||||||
|
|
||||||
|
@ -2743,14 +2743,14 @@ Sinatraは、[Semantic Versioning](http://semver.org/)におけるSemVerおよ
|
||||||
|
|
||||||
## 参考文献
|
## 参考文献
|
||||||
|
|
||||||
* [プロジェクトサイト](http://sinatra.github.com/) - ドキュメント、ニュース、他のリソースへのリンクがあります。
|
* [プロジェクトサイト](http://www.sinatrarb.com/) - ドキュメント、ニュース、他のリソースへのリンクがあります。
|
||||||
* [プロジェクトに参加(貢献)する](http://sinatra.github.com/contributing.html) - バグレポート パッチの送信、サポートなど
|
* [プロジェクトに参加(貢献)する](http://www.sinatrarb.com/contributing.html) - バグレポート パッチの送信、サポートなど
|
||||||
* [Issue tracker](http://github.com/sinatra/sinatra/issues)
|
* [Issue tracker](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [メーリングリスト](http://groups.google.com/group/sinatrarb/topics)
|
* [メーリングリスト](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* http://freenode.net上のIRC: [#sinatra](irc://chat.freenode.net/#sinatra)
|
* http://freenode.net上のIRC: [#sinatra](irc://chat.freenode.net/#sinatra)
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) クックブック、チュートリアル
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) クックブック、チュートリアル
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) コミュニティによるレシピ集
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) コミュニティによるレシピ集
|
||||||
* http://rubydoc.info上のAPIドキュメント: [最新版(latest release)用](http://rubydoc.info/gems/sinatra)または[現在のHEAD用](http://rubydoc.info/github/sinatra/sinatra)
|
* http://www.rubydoc.info/上のAPIドキュメント: [最新版(latest release)用](http://www.rubydoc.info/gems/sinatra)または[現在のHEAD用](http://www.rubydoc.info/github/sinatra/sinatra)
|
||||||
* [CIサーバ](http://travis-ci.org/sinatra/sinatra)
|
* [CIサーバ](https://travis-ci.org/sinatra/sinatra)
|
||||||
* [Greenbear Laboratory Rack日本語マニュアル](http://route477.net/w/RackReferenceJa.html)
|
* [Greenbear Laboratory Rack日本語マニュアル](http://route477.net/w/RackReferenceJa.html)
|
||||||
|
|
60
README.ko.md
60
README.ko.md
|
@ -3,7 +3,7 @@
|
||||||
*주의: 이 문서는 영문판의 번역본이며 최신판 문서와 다를 수 있습니다.*
|
*주의: 이 문서는 영문판의 번역본이며 최신판 문서와 다를 수 있습니다.*
|
||||||
|
|
||||||
Sinatra는 최소한의 노력으로 루비 기반 웹 애플리케이션을 신속하게 만들 수 있게
|
Sinatra는 최소한의 노력으로 루비 기반 웹 애플리케이션을 신속하게 만들 수 있게
|
||||||
해 주는 [DSL](http://en.wikipedia.org/wiki/Domain-specific_language)입니다.
|
해 주는 [DSL](https://en.wikipedia.org/wiki/Domain-specific_language)입니다.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# myapp.rb
|
# myapp.rb
|
||||||
|
@ -14,19 +14,19 @@ get '/' do
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
젬을 설치합니다.
|
아래의 명령어로 젬을 설치합니다.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gem install sinatra
|
gem install sinatra
|
||||||
```
|
```
|
||||||
|
|
||||||
실행합니다.
|
아래의 명령어로 실행합니다.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ruby myapp.rb
|
ruby myapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
`http://localhost:4567`를 확인해 보세요.
|
[http://localhost:4567](http://localhost:4567) 를 확인해 보세요.
|
||||||
|
|
||||||
`gem install thin`도 함께 실행하기를 권장합니다.
|
`gem install thin`도 함께 실행하기를 권장합니다.
|
||||||
thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
||||||
|
@ -224,8 +224,8 @@ end
|
||||||
라우터 패턴에는 선택적인(optional) 매개변수도 올 수 있습니다.
|
라우터 패턴에는 선택적인(optional) 매개변수도 올 수 있습니다.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:format?' do
|
get '/posts/:format?' do
|
||||||
# "GET /posts" 는 물론 "GET /posts.json", "GET /posts.xml" 와 같은 어떤 확장자와도 매칭
|
# "GET /posts/" 는 물론 "GET /posts/json", "GET /posts/xml" 와 같은 어떤 확장자와도 매칭
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>의존성</td>
|
<td>의존성</td>
|
||||||
<td><a href="http://nokogiri.org/">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>파일 확장자</td>
|
<td>파일 확장자</td>
|
||||||
|
@ -636,7 +636,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>의존성</td>
|
<td>의존성</td>
|
||||||
<td><a href="http://www.lesscss.org/">less</a></td>
|
<td><a href="http://lesscss.org/">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>파일 확장자</td>
|
<td>파일 확장자</td>
|
||||||
|
@ -653,7 +653,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>의존성</td>
|
<td>의존성</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>파일 확장자</td>
|
<td>파일 확장자</td>
|
||||||
|
@ -674,7 +674,7 @@ Liquid 템플릿에서는 루비 메서드(`yield` 제외)를 호출할 수 없
|
||||||
<tr>
|
<tr>
|
||||||
<td>의존성</td>
|
<td>의존성</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||||
|
@ -825,7 +825,7 @@ Radius 템플릿에서는 루비 메서드를 호출할 수 없기
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>의존성</td>
|
<td>의존성</td>
|
||||||
<td><a href="http://markaby.github.com/">markaby</a></td>
|
<td><a href="http://markaby.github.io/">markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>파일확장</td>
|
<td>파일확장</td>
|
||||||
|
@ -973,7 +973,7 @@ MediaWiki에서 루비를 호출할 수 없기 때문에, MediaWiki으로 작성
|
||||||
<tr>
|
<tr>
|
||||||
<td>의존성</td>
|
<td>의존성</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> 와
|
</a> 와
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1506,8 +1506,8 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
이렇게 스트리밍 API나 [서버 발송 이벤트Server Sent
|
이렇게 스트리밍 API나 [서버 발송 이벤트Server Sent
|
||||||
Events](http://dev.w3.org/html5/eventsource/)를 구현할 수 있고, 이 방법은
|
Events](https://w3c.github.io/eventsource/)를 구현할 수 있고, 이 방법은
|
||||||
[WebSockets](http://en.wikipedia.org/wiki/WebSocket)을 위한 기반으로 사용됩니다.
|
[WebSockets](https://en.wikipedia.org/wiki/WebSocket)을 위한 기반으로 사용됩니다.
|
||||||
이 방법은 일부 콘텐츠가 느린 자원에 의존하는 경우에 스로풋(throughtput)을
|
이 방법은 일부 콘텐츠가 느린 자원에 의존하는 경우에 스로풋(throughtput)을
|
||||||
높이기 위해 사용되기도 합니다.
|
높이기 위해 사용되기도 합니다.
|
||||||
|
|
||||||
|
@ -1631,7 +1631,7 @@ end
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'wrong place, buddy'
|
redirect 'http://www.google.com/', 'wrong place, buddy'
|
||||||
```
|
```
|
||||||
|
|
||||||
`redirect back`을 사용하면 쉽게 사용자가 왔던 페이지로 다시 돌아가게
|
`redirect back`을 사용하면 쉽게 사용자가 왔던 페이지로 다시 돌아가게
|
||||||
|
@ -1713,7 +1713,7 @@ get "/article/:id" do
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
[약한 ETag](http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation)를
|
[약한 ETag](https://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation)를
|
||||||
사용할 수 도 있습니다.
|
사용할 수 도 있습니다.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -2023,7 +2023,7 @@ end
|
||||||
|
|
||||||
### 공격 방어 설정하기(Configuring attack protection)
|
### 공격 방어 설정하기(Configuring attack protection)
|
||||||
|
|
||||||
Sinatra는 [Rack::Protection](https://github.com/rkh/rack-protection#readme)을 사용하여
|
Sinatra는 [Rack::Protection](https://github.com/sinatra/rack-protection#readme)을 사용하여
|
||||||
일반적이고 일어날 수 있는 공격에 대비합니다. 이 모듈은 간단하게 비활성시킬 수 있습니다.
|
일반적이고 일어날 수 있는 공격에 대비합니다. 이 모듈은 간단하게 비활성시킬 수 있습니다.
|
||||||
(하지만 애플리케이션에 엄청나게 많은 취약성을 야기합니다.)
|
(하지만 애플리케이션에 엄청나게 많은 취약성을 야기합니다.)
|
||||||
|
|
||||||
|
@ -2353,7 +2353,7 @@ get '/hello' do
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
`use`문법은 [Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder) DSL
|
`use`문법은 [Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder) DSL
|
||||||
(rackup 파일에서 가장 많이 사용)에서 정의한 것과 동일합니다. 예를 들어, `use` 메서드는
|
(rackup 파일에서 가장 많이 사용)에서 정의한 것과 동일합니다. 예를 들어, `use` 메서드는
|
||||||
블록이나 여러 개의/가변적인 인자도 받을 수 있습니다.
|
블록이나 여러 개의/가변적인 인자도 받을 수 있습니다.
|
||||||
|
|
||||||
|
@ -2376,7 +2376,7 @@ Rack은 로깅, 디버깅, URL 라우팅, 인증, 그리고 세센 핸들링을
|
||||||
## 테스팅(Testing)
|
## 테스팅(Testing)
|
||||||
|
|
||||||
Sinatra 테스트는 많은 Rack 기반 테스팅 라이브러리, 프레임워크를 사용하여 작성가능합니다.
|
Sinatra 테스트는 많은 Rack 기반 테스팅 라이브러리, 프레임워크를 사용하여 작성가능합니다.
|
||||||
그 중 [Rack::Test](http://rdoc.info/github/brynary/rack-test/master/frames)를 권장합니다.
|
그 중 [Rack::Test](http://www.rubydoc.info/github/brynary/rack-test/master/frames)를 권장합니다.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
require 'my_sinatra_app'
|
require 'my_sinatra_app'
|
||||||
|
@ -2444,7 +2444,7 @@ end
|
||||||
|
|
||||||
`Sinatra::Base`는 백지상태(blank slate)입니다. 빌트인 서버를 비롯한 대부분의 옵션들이
|
`Sinatra::Base`는 백지상태(blank slate)입니다. 빌트인 서버를 비롯한 대부분의 옵션들이
|
||||||
기본값으로 꺼져 있습니다. 가능한 옵션들과 그 작동에 대한 상세는 [옵션과
|
기본값으로 꺼져 있습니다. 가능한 옵션들과 그 작동에 대한 상세는 [옵션과
|
||||||
설정](http://sinatra.github.com/configuration.html)을 참조하세요.
|
설정](http://www.sinatrarb.com/configuration.html)을 참조하세요.
|
||||||
|
|
||||||
### 모듈(Modular) vs. 전통적 방식(Classic Style)
|
### 모듈(Modular) vs. 전통적 방식(Classic Style)
|
||||||
|
|
||||||
|
@ -2492,7 +2492,7 @@ end
|
||||||
<tr>
|
<tr>
|
||||||
<td>static</td>
|
<td>static</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
<td>false</td>
|
<td>File.exist?(public_folder)</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -2847,8 +2847,8 @@ thin --threaded start
|
||||||
* MacRuby, Maglev, IronRuby
|
* MacRuby, Maglev, IronRuby
|
||||||
* Ruby 1.9.0 및 1.9.1 (이 버전들은 사용하지 말 것을 권합니다)
|
* Ruby 1.9.0 및 1.9.1 (이 버전들은 사용하지 말 것을 권합니다)
|
||||||
|
|
||||||
공식적으로 지원하지 않는다는 것의 의미는 무언가가 그 플랫폼에서만 잘못되고
|
공식적으로 지원하지 않는다는 것의 의미는 무언가가 그 플랫폼에서만 잘못 동작하고,
|
||||||
지원되는 플랫폼에서는 그러지 않을 경우, 우리의 문제가 아니라 그 플랫폼의 문제로
|
지원되는 플랫폼에서는 정상적으로 동작할 경우, 우리의 문제가 아니라 그 플랫폼의 문제로
|
||||||
간주한다는 뜻입니다.
|
간주한다는 뜻입니다.
|
||||||
|
|
||||||
또한 우리는 CI를 ruby-head (MRI의 이후 릴리즈) 브랜치에 맞춰 실행하지만,
|
또한 우리는 CI를 ruby-head (MRI의 이후 릴리즈) 브랜치에 맞춰 실행하지만,
|
||||||
|
@ -2858,6 +2858,8 @@ thin --threaded start
|
||||||
Sinatra는 선택한 루비 구현체가 지원하는 어떠한 운영체제에서도 작동해야
|
Sinatra는 선택한 루비 구현체가 지원하는 어떠한 운영체제에서도 작동해야
|
||||||
합니다.
|
합니다.
|
||||||
|
|
||||||
|
MacRuby를 사용한다면, gem install control_tower 를 실행해 주세요.
|
||||||
|
|
||||||
현재 Cardinal, SmallRuby, BlueRuby 또는 1.8.7 이전의 루비 버전에서는
|
현재 Cardinal, SmallRuby, BlueRuby 또는 1.8.7 이전의 루비 버전에서는
|
||||||
Sinatra를 실행할 수 없을 것입니다.
|
Sinatra를 실행할 수 없을 것입니다.
|
||||||
|
|
||||||
|
@ -2876,7 +2878,7 @@ gem install sinatra --pre
|
||||||
### Bundler를 사용하여
|
### Bundler를 사용하여
|
||||||
|
|
||||||
여러분 애플리케이션을 최신 Sinatra로 실행하고자 한다면,
|
여러분 애플리케이션을 최신 Sinatra로 실행하고자 한다면,
|
||||||
[Bundler](http://gembundler.com/)를 사용할 것을 권장합니다.
|
[Bundler](http://bundler.io)를 사용할 것을 권장합니다.
|
||||||
|
|
||||||
우선, 아직 설치하지 않았다면 bundler를 설치합니다.
|
우선, 아직 설치하지 않았다면 bundler를 설치합니다.
|
||||||
|
|
||||||
|
@ -2952,14 +2954,14 @@ SemVerTag를 준수합니다.
|
||||||
그리고 다른 리소스들에 대한 링크.
|
그리고 다른 리소스들에 대한 링크.
|
||||||
* [기여하기](http://www.sinatrarb.com/contributing) - 버그를 찾았나요?
|
* [기여하기](http://www.sinatrarb.com/contributing) - 버그를 찾았나요?
|
||||||
도움이 필요한가요? 패치를 하셨나요?
|
도움이 필요한가요? 패치를 하셨나요?
|
||||||
* [이슈 트래커](http://github.com/sinatra/sinatra/issues)
|
* [이슈 트래커](https://github.com/sinatra/sinatra/issues)
|
||||||
* [트위터](http://twitter.com/sinatra)
|
* [트위터](https://twitter.com/sinatra)
|
||||||
* [메일링 리스트](http://groups.google.com/group/sinatrarb/topics)
|
* [메일링 리스트](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) http://freenode.net
|
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) http://freenode.net
|
||||||
* 슬랙의 [Sinatra & Friends](https://sinatrarb.slack.com)입니다.
|
* 슬랙의 [Sinatra & Friends](https://sinatrarb.slack.com)입니다.
|
||||||
[여기](https://sinatra-slack.herokuapp.com/)에서 가입가능합니다.
|
[여기](https://sinatra-slack.herokuapp.com/)에서 가입가능합니다.
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Cookbook 튜토리얼
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Cookbook 튜토리얼
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) 커뮤니티가 만드는 레시피
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) 커뮤니티가 만드는 레시피
|
||||||
* http://rubydoc.info에 있는 [최종 릴리스](http://rubydoc.info/gems/sinatra)
|
* http://www.rubydoc.info/에 있는 [최종 릴리스](http://www.rubydoc.info/gems/sinatra)
|
||||||
또는 [current HEAD](http://rubydoc.info/github/sinatra/sinatra)에 대한 API 문서
|
또는 [current HEAD](http://www.rubydoc.info/github/sinatra/sinatra)에 대한 API 문서
|
||||||
* [CI server](http://travis-ci.org/sinatra/sinatra)
|
* [CI server](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
60
README.md
60
README.md
|
@ -1,6 +1,6 @@
|
||||||
# Sinatra
|
# Sinatra
|
||||||
|
|
||||||
Sinatra is a [DSL](http://en.wikipedia.org/wiki/Domain-specific_language) for
|
Sinatra is a [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) for
|
||||||
quickly creating web applications in Ruby with minimal effort:
|
quickly creating web applications in Ruby with minimal effort:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -24,7 +24,7 @@ And run with:
|
||||||
ruby myapp.rb
|
ruby myapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
View at: http://localhost:4567
|
View at: [http://localhost:4567](http://localhost:4567)
|
||||||
|
|
||||||
It is recommended to also run `gem install thin`, which Sinatra will
|
It is recommended to also run `gem install thin`, which Sinatra will
|
||||||
pick up if available.
|
pick up if available.
|
||||||
|
@ -225,8 +225,8 @@ end
|
||||||
Route patterns may have optional parameters:
|
Route patterns may have optional parameters:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:format?' do
|
get '/posts/:format?' do
|
||||||
# matches "GET /posts" and any extension "GET /posts.json", "GET /posts.xml" etc.
|
# matches "GET /posts/" and any extension "GET /posts/json", "GET /posts/xml" etc
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ It also takes a block for inline templates (see example).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependency</td>
|
<td>Dependency</td>
|
||||||
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>File Extension</td>
|
<td>File Extension</td>
|
||||||
|
@ -662,7 +662,7 @@ It also takes a block for inline templates (see example).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependency</td>
|
<td>Dependency</td>
|
||||||
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
|
<td><a href="http://lesscss.org/" title="less">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>File Extension</td>
|
<td>File Extension</td>
|
||||||
|
@ -679,7 +679,7 @@ It also takes a block for inline templates (see example).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependency</td>
|
<td>Dependency</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/" title="liquid">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>File Extension</td>
|
<td>File Extension</td>
|
||||||
|
@ -701,7 +701,7 @@ template, you almost always want to pass locals to it.
|
||||||
<td>Dependency</td>
|
<td>Dependency</td>
|
||||||
<td>
|
<td>
|
||||||
Anyone of:
|
Anyone of:
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||||
|
@ -852,7 +852,7 @@ always want to pass locals to it.
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependency</td>
|
<td>Dependency</td>
|
||||||
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
|
<td><a href="http://markaby.github.io/" title="Markaby">Markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>File Extension</td>
|
<td>File Extension</td>
|
||||||
|
@ -1001,7 +1001,7 @@ template than for the layout by passing the `:layout_engine` option.
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependency</td>
|
<td>Dependency</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> and a
|
</a> and a
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1536,8 +1536,8 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
This allows you to implement streaming APIs,
|
This allows you to implement streaming APIs,
|
||||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/), and can be used as
|
[Server Sent Events](https://w3c.github.io/eventsource/), and can be used as
|
||||||
the basis for [WebSockets](http://en.wikipedia.org/wiki/WebSocket). It can also be
|
the basis for [WebSockets](https://en.wikipedia.org/wiki/WebSocket). It can also be
|
||||||
used to increase throughput if some but not all content depends on a slow
|
used to increase throughput if some but not all content depends on a slow
|
||||||
resource.
|
resource.
|
||||||
|
|
||||||
|
@ -1659,7 +1659,7 @@ Any additional parameters are handled like arguments passed to `halt`:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'wrong place, buddy'
|
redirect 'http://www.google.com/', 'wrong place, buddy'
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also easily redirect back to the page the user came from with
|
You can also easily redirect back to the page the user came from with
|
||||||
|
@ -1742,7 +1742,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
It is also possible to use a
|
It is also possible to use a
|
||||||
[weak ETag](http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation):
|
[weak ETag](https://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation):
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
etag @article.sha1, :weak
|
etag @article.sha1, :weak
|
||||||
|
@ -2055,7 +2055,7 @@ end
|
||||||
### Configuring attack protection
|
### Configuring attack protection
|
||||||
|
|
||||||
Sinatra is using
|
Sinatra is using
|
||||||
[Rack::Protection](https://github.com/rkh/rack-protection#readme) to defend
|
[Rack::Protection](https://github.com/sinatra/rack-protection#readme) to defend
|
||||||
your application against common, opportunistic attacks. You can easily disable
|
your application against common, opportunistic attacks. You can easily disable
|
||||||
this behavior (which will open up your application to tons of common
|
this behavior (which will open up your application to tons of common
|
||||||
vulnerabilities):
|
vulnerabilities):
|
||||||
|
@ -2138,7 +2138,7 @@ set :protection, :session => true
|
||||||
Places a lock around every request, only running processing on request
|
Places a lock around every request, only running processing on request
|
||||||
per Ruby process concurrently.
|
per Ruby process concurrently.
|
||||||
</dd>
|
</dd>
|
||||||
<dd>Enabled if your app is not thread-safe. Disabled per default.</dd>
|
<dd>Enabled if your app is not thread-safe. Disabled by default.</dd>
|
||||||
|
|
||||||
<dt>method_override</dt>
|
<dt>method_override</dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
@ -2153,7 +2153,7 @@ set :protection, :session => true
|
||||||
<dd>
|
<dd>
|
||||||
Whether or not to insert <tt>request.script_name</tt> into redirects if no
|
Whether or not to insert <tt>request.script_name</tt> into redirects if no
|
||||||
absolute path is given. That way <tt>redirect '/foo'</tt> would behave like
|
absolute path is given. That way <tt>redirect '/foo'</tt> would behave like
|
||||||
<tt>redirect to('/foo')</tt>. Disabled per default.
|
<tt>redirect to('/foo')</tt>. Disabled by default.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt>protection</dt>
|
<dt>protection</dt>
|
||||||
|
@ -2225,7 +2225,7 @@ set :protection, :session => true
|
||||||
<dd>Disable when using a server able to do this on its own.</dd>
|
<dd>Disable when using a server able to do this on its own.</dd>
|
||||||
<dd>Disabling will boost performance.</dd>
|
<dd>Disabling will boost performance.</dd>
|
||||||
<dd>
|
<dd>
|
||||||
Enabled per default in classic style, disabled for modular apps.
|
Enabled by default in classic style, disabled for modular apps.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt>static_cache_control</dt>
|
<dt>static_cache_control</dt>
|
||||||
|
@ -2394,7 +2394,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
The semantics of `use` are identical to those defined for the
|
The semantics of `use` are identical to those defined for the
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder) DSL
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder) DSL
|
||||||
(most frequently used from rackup files). For example, the `use` method
|
(most frequently used from rackup files). For example, the `use` method
|
||||||
accepts multiple/variable args as well as blocks:
|
accepts multiple/variable args as well as blocks:
|
||||||
|
|
||||||
|
@ -2417,7 +2417,7 @@ or in the [Rack wiki](https://github.com/rack/rack/wiki/List-of-Middleware).
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Sinatra tests can be written using any Rack-based testing library or framework.
|
Sinatra tests can be written using any Rack-based testing library or framework.
|
||||||
[Rack::Test](http://rdoc.info/github/brynary/rack-test/master/frames)
|
[Rack::Test](http://www.rubydoc.info/github/brynary/rack-test/master/frames)
|
||||||
is recommended:
|
is recommended:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -2487,7 +2487,7 @@ those available via the top-level DSL. Most top-level apps can be converted to
|
||||||
|
|
||||||
`Sinatra::Base` is a blank slate. Most options are disabled by default,
|
`Sinatra::Base` is a blank slate. Most options are disabled by default,
|
||||||
including the built-in server. See
|
including the built-in server. See
|
||||||
[Configuring Settings](http://sinatra.github.com/configuration.html)
|
[Configuring Settings](http://www.sinatrarb.com/configuration.html)
|
||||||
for details on available options and their behavior. If you want
|
for details on available options and their behavior. If you want
|
||||||
behavior more similar to when you define your app at the top level (also
|
behavior more similar to when you define your app at the top level (also
|
||||||
known as Classic style), you
|
known as Classic style), you
|
||||||
|
@ -2562,7 +2562,7 @@ different default settings:
|
||||||
<tr>
|
<tr>
|
||||||
<td>static</td>
|
<td>static</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
<td>false</td>
|
<td>File.exist?(public_folder)</td>
|
||||||
<td>true</td>
|
<td>true</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -2789,7 +2789,7 @@ end
|
||||||
|
|
||||||
You have the request scope binding inside:
|
You have the request scope binding inside:
|
||||||
|
|
||||||
* get, head, post, put, delete, options, patch, link, and unlink blocks
|
* get, head, post, put, delete, options, patch, link and unlink blocks
|
||||||
* before and after filters
|
* before and after filters
|
||||||
* helper methods
|
* helper methods
|
||||||
* templates/views
|
* templates/views
|
||||||
|
@ -2934,7 +2934,7 @@ to get some of the latest features.
|
||||||
### With Bundler
|
### With Bundler
|
||||||
|
|
||||||
If you want to run your application with the latest Sinatra, using
|
If you want to run your application with the latest Sinatra, using
|
||||||
[Bundler](http://gembundler.com/) is the recommended way.
|
[Bundler](http://bundler.io) is the recommended way.
|
||||||
|
|
||||||
First, install bundler, if you haven't:
|
First, install bundler, if you haven't:
|
||||||
|
|
||||||
|
@ -3009,8 +3009,8 @@ SemVerTag.
|
||||||
news, and links to other resources.
|
news, and links to other resources.
|
||||||
* [Contributing](http://www.sinatrarb.com/contributing) - Find a bug? Need
|
* [Contributing](http://www.sinatrarb.com/contributing) - Find a bug? Need
|
||||||
help? Have a patch?
|
help? Have a patch?
|
||||||
* [Issue tracker](http://github.com/sinatra/sinatra/issues)
|
* [Issue tracker](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Mailing List](http://groups.google.com/group/sinatrarb/topics)
|
* [Mailing List](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) on http://freenode.net
|
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) on http://freenode.net
|
||||||
* [Sinatra & Friends](https://sinatrarb.slack.com) on Slack and see
|
* [Sinatra & Friends](https://sinatrarb.slack.com) on Slack and see
|
||||||
|
@ -3018,7 +3018,7 @@ SemVerTag.
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Cookbook Tutorial
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Cookbook Tutorial
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Community
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Community
|
||||||
contributed recipes
|
contributed recipes
|
||||||
* API documentation for the [latest release](http://rubydoc.info/gems/sinatra)
|
* API documentation for the [latest release](http://www.rubydoc.info/gems/sinatra)
|
||||||
or the [current HEAD](http://rubydoc.info/github/sinatra/sinatra) on
|
or the [current HEAD](http://www.rubydoc.info/github/sinatra/sinatra) on
|
||||||
http://rubydoc.info
|
http://www.rubydoc.info/
|
||||||
* [CI server](http://travis-ci.org/sinatra/sinatra)
|
* [CI server](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
|
@ -9,7 +9,7 @@ Alguns dos trechos de código a seguir utilizam caracteres UTF-8. Então, caso e
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
```
|
```
|
||||||
|
|
||||||
Sinatra é uma [DSL](http://pt.wikipedia.org/wiki/Linguagem_de_domínio_específico) para
|
Sinatra é uma [DSL](https://pt.wikipedia.org/wiki/Linguagem_de_domínio_específico) para
|
||||||
criar aplicações web em Ruby com o mínimo de esforço e rapidez:
|
criar aplicações web em Ruby com o mínimo de esforço e rapidez:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -33,7 +33,7 @@ Em seguida execute:
|
||||||
ruby minha_app.rb
|
ruby minha_app.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
Acesse: [localhost:4567](http://localhost:4567)
|
Acesse: [http://localhost:4567](http://localhost:4567)
|
||||||
|
|
||||||
É recomendado também executar `gem install thin`. Caso esta gem esteja disponível, o
|
É recomendado também executar `gem install thin`. Caso esta gem esteja disponível, o
|
||||||
Sinatra irá utilizá-la.
|
Sinatra irá utilizá-la.
|
||||||
|
@ -197,8 +197,8 @@ end
|
||||||
Padrões de rota podem contar com parâmetros opcionais:
|
Padrões de rota podem contar com parâmetros opcionais:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:formato?' do
|
get '/posts/:formato?' do
|
||||||
# corresponde a "GET /posts" e qualquer extensão "GET /posts.json", "GET /posts.xml", etc.
|
# corresponde a "GET /posts/" e qualquer extensão "GET /posts/json", "GET /posts/xml", etc.
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ It also takes a block for inline templates (see exemplo).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencia</td>
|
<td>Dependencia</td>
|
||||||
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extencao do Arquivo</td>
|
<td>Extencao do Arquivo</td>
|
||||||
|
@ -638,7 +638,7 @@ It also takes a block for inline templates (see exemplo).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencia</td>
|
<td>Dependencia</td>
|
||||||
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
|
<td><a href="http://lesscss.org/" title="less">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extencao do Arquivo</td>
|
<td>Extencao do Arquivo</td>
|
||||||
|
@ -655,7 +655,7 @@ It also takes a block for inline templates (see exemplo).
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencia</td>
|
<td>Dependencia</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/" title="liquid">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extencao do Arquivo</td>
|
<td>Extencao do Arquivo</td>
|
||||||
|
@ -677,7 +677,7 @@ você quase sempre precisará passar o `locals` para ele.
|
||||||
<td>Dependencia</td>
|
<td>Dependencia</td>
|
||||||
<td>
|
<td>
|
||||||
Anyone of:
|
Anyone of:
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||||
|
@ -825,7 +825,7 @@ você quase sempre precisará passar o `locals` para ele.
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencia</td>
|
<td>Dependencia</td>
|
||||||
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
|
<td><a href="http://markaby.github.io/" title="Markaby">Markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Extencao do Arquivo</td>
|
<td>Extencao do Arquivo</td>
|
||||||
|
@ -975,7 +975,7 @@ deve-se passar a `:layout_engine` como opção.
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dependencia</td>
|
<td>Dependencia</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> and a
|
</a> and a
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1548,7 +1548,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
A semântica de `use` é idêntica aquela definida para a DSL
|
A semântica de `use` é idêntica aquela definida para a DSL
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder)
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder)
|
||||||
(mais frequentemente utilizada para arquivos rackup). Por exemplo, o
|
(mais frequentemente utilizada para arquivos rackup). Por exemplo, o
|
||||||
método `use` aceita múltiplos argumentos/variáveis bem como blocos:
|
método `use` aceita múltiplos argumentos/variáveis bem como blocos:
|
||||||
|
|
||||||
|
@ -1647,7 +1647,7 @@ modificações:
|
||||||
|
|
||||||
`Sinatra::Base` é um quadro branco. Muitas opções são desabilitadas por
|
`Sinatra::Base` é um quadro branco. Muitas opções são desabilitadas por
|
||||||
padrão, incluindo o servidor embutido. Veja [Opções e
|
padrão, incluindo o servidor embutido. Veja [Opções e
|
||||||
Configurações](http://sinatra.github.com/configuration.html) para
|
Configurações](http://www.sinatrarb.com/configuration.html) para
|
||||||
detalhes de opções disponíveis e seus comportamentos.
|
detalhes de opções disponíveis e seus comportamentos.
|
||||||
|
|
||||||
SIDEBAR: A DSL de alto nível do Sinatra é implementada utilizando um simples
|
SIDEBAR: A DSL de alto nível do Sinatra é implementada utilizando um simples
|
||||||
|
@ -1750,11 +1750,11 @@ git pull
|
||||||
adicional, novidades e links para outros recursos.
|
adicional, novidades e links para outros recursos.
|
||||||
* [Contribuir](http://www.sinatrarb.com/contributing) - Encontrar um
|
* [Contribuir](http://www.sinatrarb.com/contributing) - Encontrar um
|
||||||
bug? Precisa de ajuda? Tem um patch?
|
bug? Precisa de ajuda? Tem um patch?
|
||||||
* [Acompanhar Questões](http://github.com/sinatra/sinatra/issues)
|
* [Acompanhar Questões](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Lista de Email](http://groups.google.com/group/sinatrarb/topics)
|
* [Lista de Email](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Livro de Receitas
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Livro de Receitas
|
||||||
* Documentação da API para a [última release](http://rubydoc.info/gems/sinatra)
|
* Documentação da API para a [última release](http://www.rubydoc.info/gems/sinatra)
|
||||||
* [IRC: \#sinatra](irc://chat.freenode.net/#sinatra) em
|
* [IRC: \#sinatra](irc://chat.freenode.net/#sinatra) em
|
||||||
[freenode.net](http://freenode.net)
|
[freenode.net](http://freenode.net)
|
||||||
* [Servidor de CI](http://travis-ci.org/sinatra/sinatra)
|
* [Servidor de CI](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
pode estar desatualizado.*
|
pode estar desatualizado.*
|
||||||
|
|
||||||
Sinatra é uma
|
Sinatra é uma
|
||||||
[DSL](http://pt.wikipedia.org/wiki/Linguagem_de_domínio_específico) para
|
[DSL](https://pt.wikipedia.org/wiki/Linguagem_de_domínio_específico) para
|
||||||
criar rapidamente aplicações web em Ruby com o mínimo de esforço:
|
criar rapidamente aplicações web em Ruby com o mínimo de esforço:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -23,7 +23,7 @@ sudo gem install sinatra
|
||||||
ruby minhaapp.rb
|
ruby minhaapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
Aceda em: [localhost:4567](http://localhost:4567)
|
Aceda em: [http://localhost:4567](http://localhost:4567)
|
||||||
|
|
||||||
## Rotas
|
## Rotas
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ end
|
||||||
Renderiza `./views/index.haml`.
|
Renderiza `./views/index.haml`.
|
||||||
|
|
||||||
[Opções
|
[Opções
|
||||||
Haml](http://haml.info/docs/yardoc/file.HAML_REFERENCE.html#options)
|
Haml](http://haml.info/docs/yardoc/file.REFERENCE.html#options)
|
||||||
podem ser definidas globalmente através das configurações do sinatra,
|
podem ser definidas globalmente através das configurações do sinatra,
|
||||||
veja [Opções e
|
veja [Opções e
|
||||||
Configurações](http://www.sinatrarb.com/configuration.html), e substitua
|
Configurações](http://www.sinatrarb.com/configuration.html), e substitua
|
||||||
|
@ -233,7 +233,7 @@ end
|
||||||
Renderiza `./views/stylesheet.sass`.
|
Renderiza `./views/stylesheet.sass`.
|
||||||
|
|
||||||
[Opções
|
[Opções
|
||||||
Sass](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#options)
|
Sass](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#options)
|
||||||
podem ser definidas globalmente através das configurações do sinatra,
|
podem ser definidas globalmente através das configurações do sinatra,
|
||||||
veja [Opções e
|
veja [Opções e
|
||||||
Configurações](http://www.sinatrarb.com/configuration.html), e substitua
|
Configurações](http://www.sinatrarb.com/configuration.html), e substitua
|
||||||
|
@ -609,7 +609,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
A semântica de `use` é idêntica aquela definida para a DSL
|
A semântica de `use` é idêntica aquela definida para a DSL
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder)
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder)
|
||||||
(mais frequentemente utilizada para arquivos rackup). Por exemplo, o
|
(mais frequentemente utilizada para arquivos rackup). Por exemplo, o
|
||||||
método `use` aceita múltiplos argumentos/variáveis, bem como blocos:
|
método `use` aceita múltiplos argumentos/variáveis, bem como blocos:
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ modificações:
|
||||||
|
|
||||||
`Sinatra::Base` é um quadro branco. Muitas opções são desactivadas por
|
`Sinatra::Base` é um quadro branco. Muitas opções são desactivadas por
|
||||||
padrão, incluindo o servidor embutido. Veja [Opções e
|
padrão, incluindo o servidor embutido. Veja [Opções e
|
||||||
Configurações](http://sinatra.github.com/configuration.html) para
|
Configurações](http://www.sinatrarb.com/configuration.html) para
|
||||||
detalhes de opções disponíveis e seus comportamentos.
|
detalhes de opções disponíveis e seus comportamentos.
|
||||||
|
|
||||||
SIDEBAR: A DSL de alto nível do Sinatra é implementada utilizando um simples
|
SIDEBAR: A DSL de alto nível do Sinatra é implementada utilizando um simples
|
||||||
|
@ -781,9 +781,9 @@ git pull
|
||||||
- [Contribuir](http://www.sinatrarb.com/contributing) - Encontrou um
|
- [Contribuir](http://www.sinatrarb.com/contributing) - Encontrou um
|
||||||
bug? Precisa de ajuda? Tem um patch?
|
bug? Precisa de ajuda? Tem um patch?
|
||||||
|
|
||||||
- [Acompanhar Questões](http://github.com/sinatra/sinatra/issues)
|
- [Acompanhar Questões](https://github.com/sinatra/sinatra/issues)
|
||||||
|
|
||||||
- [Twitter](http://twitter.com/sinatra)
|
- [Twitter](https://twitter.com/sinatra)
|
||||||
|
|
||||||
- [Lista de Email](http://groups.google.com/group/sinatrarb/topics)
|
- [Lista de Email](http://groups.google.com/group/sinatrarb/topics)
|
||||||
|
|
||||||
|
|
50
README.ru.md
50
README.ru.md
|
@ -91,7 +91,7 @@
|
||||||
устаревшим*
|
устаревшим*
|
||||||
|
|
||||||
Sinatra — это предметно-ориентированный каркас
|
Sinatra — это предметно-ориентированный каркас
|
||||||
([DSL](http://ru.wikipedia.org/wiki/Предметно-ориентированный_язык_программирования))
|
([DSL](https://ru.wikipedia.org/wiki/Предметно-ориентированный_язык))
|
||||||
для быстрого создания функциональных веб-приложений на Ruby с минимумом усилий:
|
для быстрого создания функциональных веб-приложений на Ruby с минимумом усилий:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -115,7 +115,7 @@ gem install sinatra
|
||||||
ruby myapp.rb
|
ruby myapp.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
Оцените результат: http://localhost:4567
|
Оцените результат: [http://localhost:4567](http://localhost:4567)
|
||||||
|
|
||||||
Рекомендуется также установить Thin, сделать это можно командой: `gem install
|
Рекомендуется также установить Thin, сделать это можно командой: `gem install
|
||||||
thin`. Thin — это более производительный и функциональный сервер для
|
thin`. Thin — это более производительный и функциональный сервер для
|
||||||
|
@ -225,8 +225,8 @@ end
|
||||||
Шаблоны маршрутов могут иметь необязательные параметры:
|
Шаблоны маршрутов могут иметь необязательные параметры:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/posts.?:format?' do
|
get '/posts/:format?' do
|
||||||
# соответствует "GET /posts", "GET /posts.json", "GET /posts.xml" и т.д.
|
# соответствует "GET /posts/", "GET /posts/json", "GET /posts/xml" и т.д.
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Зависимости</td>
|
<td>Зависимости</td>
|
||||||
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
<td><a href="http://www.nokogiri.org/" title="nokogiri">nokogiri</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Расширения файлов</td>
|
<td>Расширения файлов</td>
|
||||||
|
@ -648,7 +648,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Зависимости</td>
|
<td>Зависимости</td>
|
||||||
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
|
<td><a href="http://lesscss.org/" title="less">less</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Расширения файлов</td>
|
<td>Расширения файлов</td>
|
||||||
|
@ -665,7 +665,7 @@ get('/') { markdown :index }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Зависимости</td>
|
<td>Зависимости</td>
|
||||||
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
|
<td><a href="http://liquidmarkup.org/" title="liquid">liquid</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Расширения файлов</td>
|
<td>Расширения файлов</td>
|
||||||
|
@ -687,7 +687,7 @@ get('/') { markdown :index }
|
||||||
<td>Зависимости</td>
|
<td>Зависимости</td>
|
||||||
<td>
|
<td>
|
||||||
Любая из библиотек:
|
Любая из библиотек:
|
||||||
<a href="https://github.com/rtomayko/rdiscount" title="RDiscount">RDiscount</a>,
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
||||||
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
||||||
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
<a href="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||||
|
@ -843,7 +843,7 @@ erb :overview, :locals => { :text => rdoc(:introduction) }
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Зависимости</td>
|
<td>Зависимости</td>
|
||||||
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
|
<td><a href="http://markaby.github.io/" title="Markaby">Markaby</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Расширения файлов</td>
|
<td>Расширения файлов</td>
|
||||||
|
@ -995,7 +995,7 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||||
<tr>
|
<tr>
|
||||||
<td>Зависимости</td>
|
<td>Зависимости</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://github.com/lucasmazza/ruby-stylus" title="Ruby Stylus">
|
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||||
Stylus
|
Stylus
|
||||||
</a> и
|
</a> и
|
||||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||||
|
@ -1526,8 +1526,8 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Что позволяет вам реализовать стриминговые API,
|
Что позволяет вам реализовать стриминговые API,
|
||||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/),
|
[Server Sent Events](https://w3c.github.io/eventsource/),
|
||||||
и может служить основой для [WebSockets](http://en.wikipedia.org/wiki/WebSocket).
|
и может служить основой для [WebSockets](https://en.wikipedia.org/wiki/WebSocket).
|
||||||
Также такой подход можно использовать для увеличения производительности в случае,
|
Также такой подход можно использовать для увеличения производительности в случае,
|
||||||
когда какая-то часть контента зависит от медленного ресурса.
|
когда какая-то часть контента зависит от медленного ресурса.
|
||||||
|
|
||||||
|
@ -1654,7 +1654,7 @@ end
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
redirect to('/bar'), 303
|
redirect to('/bar'), 303
|
||||||
redirect 'http://google.com', 'wrong place, buddy'
|
redirect 'http://www.google.com/', 'wrong place, buddy'
|
||||||
```
|
```
|
||||||
|
|
||||||
Вы также можете перенаправить пользователя обратно, на страницу, с которой он
|
Вы также можете перенаправить пользователя обратно, на страницу, с которой он
|
||||||
|
@ -1738,7 +1738,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Также вы можете использовать
|
Также вы можете использовать
|
||||||
[weak ETag](http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation):
|
[weak ETag](https://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation):
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
etag @article.sha1, :weak
|
etag @article.sha1, :weak
|
||||||
|
@ -2055,7 +2055,7 @@ end
|
||||||
### Настройка защиты от атак
|
### Настройка защиты от атак
|
||||||
|
|
||||||
Sinatra использует
|
Sinatra использует
|
||||||
[Rack::Protection](https://github.com/rkh/rack-protection#readme) для защиты
|
[Rack::Protection](https://github.com/sinatra/rack-protection#readme) для защиты
|
||||||
приложения от простых атак. Вы можете легко выключить эту защиту (что сделает
|
приложения от простых атак. Вы можете легко выключить эту защиту (что сделает
|
||||||
ваше приложение чрезвычайно уязвимым):
|
ваше приложение чрезвычайно уязвимым):
|
||||||
|
|
||||||
|
@ -2362,7 +2362,7 @@ end
|
||||||
```
|
```
|
||||||
|
|
||||||
Семантика `use` идентична той, что определена для
|
Семантика `use` идентична той, что определена для
|
||||||
[Rack::Builder](http://rubydoc.info/github/rack/rack/master/Rack/Builder) DSL
|
[Rack::Builder](http://www.rubydoc.info/github/rack/rack/master/Rack/Builder) DSL
|
||||||
(чаще всего используется в rackup файлах). Например, метод `use` принимает как
|
(чаще всего используется в rackup файлах). Например, метод `use` принимает как
|
||||||
множественные переменные, так и блоки:
|
множественные переменные, так и блоки:
|
||||||
|
|
||||||
|
@ -2387,7 +2387,7 @@ Rack распространяется с различными стандартн
|
||||||
|
|
||||||
Тесты для Sinatra приложений могут быть написаны с помощью библиотек,
|
Тесты для Sinatra приложений могут быть написаны с помощью библиотек,
|
||||||
фреймворков, поддерживающих тестирование Rack.
|
фреймворков, поддерживающих тестирование Rack.
|
||||||
[Rack::Test](http://rdoc.info/github/brynary/rack-test/master/frames)
|
[Rack::Test](http://www.rubydoc.info/github/brynary/rack-test/master/frames)
|
||||||
рекомендован:
|
рекомендован:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -2479,7 +2479,7 @@ end
|
||||||
logging true false
|
logging true false
|
||||||
method_override true false
|
method_override true false
|
||||||
inline_templates true false
|
inline_templates true false
|
||||||
static true false
|
static true File.exist?(public_folder)
|
||||||
|
|
||||||
### Запуск модульных приложений
|
### Запуск модульных приложений
|
||||||
|
|
||||||
|
@ -2868,7 +2868,7 @@ gem install sinatra --pre
|
||||||
### С помощью Bundler
|
### С помощью Bundler
|
||||||
|
|
||||||
Если вы хотите запускать свое приложение с последней версией Sinatra, то
|
Если вы хотите запускать свое приложение с последней версией Sinatra, то
|
||||||
рекомендуем использовать [Bundler](http://gembundler.com/).
|
рекомендуем использовать [Bundler](http://bundler.io).
|
||||||
|
|
||||||
Сначала установите Bundler, если у вас его еще нет:
|
Сначала установите Bundler, если у вас его еще нет:
|
||||||
|
|
||||||
|
@ -2944,15 +2944,15 @@ SemVerTag.
|
||||||
документация, новости и ссылки на другие ресурсы.
|
документация, новости и ссылки на другие ресурсы.
|
||||||
* [Участие в проекте](http://www.sinatrarb.com/contributing) — Обнаружили
|
* [Участие в проекте](http://www.sinatrarb.com/contributing) — Обнаружили
|
||||||
баг? Нужна помощь? Написали патч?
|
баг? Нужна помощь? Написали патч?
|
||||||
* [Отслеживание проблем/ошибок](http://github.com/sinatra/sinatra/issues)
|
* [Отслеживание проблем/ошибок](https://github.com/sinatra/sinatra/issues)
|
||||||
* [Twitter](http://twitter.com/sinatra)
|
* [Twitter](https://twitter.com/sinatra)
|
||||||
* [Группы рассылки](http://groups.google.com/group/sinatrarb/topics)
|
* [Группы рассылки](http://groups.google.com/group/sinatrarb/topics)
|
||||||
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) на http://freenode.net
|
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) на http://freenode.net
|
||||||
* [Sinatra и Друзья](https://sinatrarb.slack.com) на Slack, а так же
|
* [Sinatra и Друзья](https://sinatrarb.slack.com) на Slack, а так же
|
||||||
[ссылка](https://sinatra-slack.herokuapp.com/) для инвайта.
|
[ссылка](https://sinatra-slack.herokuapp.com/) для инвайта.
|
||||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) учебник и сборник рецептов
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) учебник и сборник рецептов
|
||||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) сборник рецептов
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) сборник рецептов
|
||||||
* API документация к [последнему релизу](http://rubydoc.info/gems/sinatra)
|
* API документация к [последнему релизу](http://www.rubydoc.info/gems/sinatra)
|
||||||
или [текущему HEAD](http://rubydoc.info/github/sinatra/sinatra) на
|
или [текущему HEAD](http://www.rubydoc.info/github/sinatra/sinatra) на
|
||||||
http://rubydoc.info
|
http://www.rubydoc.info/
|
||||||
* [Сервер непрерывной интеграции](http://travis-ci.org/sinatra/sinatra)
|
* [Сервер непрерывной интеграции](https://travis-ci.org/sinatra/sinatra)
|
||||||
|
|
3158
README.zh.md
3158
README.zh.md
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,6 @@
|
||||||
require 'rack'
|
require 'rack'
|
||||||
require 'tilt'
|
require 'tilt'
|
||||||
require 'rack/protection'
|
require 'rack/protection'
|
||||||
require 'forwardable'
|
|
||||||
|
|
||||||
# stdlib dependencies
|
# stdlib dependencies
|
||||||
require 'thread'
|
require 'thread'
|
||||||
|
@ -304,10 +303,15 @@ module Sinatra
|
||||||
response.headers
|
response.headers
|
||||||
end
|
end
|
||||||
|
|
||||||
extend Forwardable
|
# Access the underlying Rack session.
|
||||||
def_delegators :request,
|
def session
|
||||||
:session, # Access the underlying Rack session.
|
request.session
|
||||||
:logger # Access shared logger object.
|
end
|
||||||
|
|
||||||
|
# Access shared logger object.
|
||||||
|
def logger
|
||||||
|
request.logger
|
||||||
|
end
|
||||||
|
|
||||||
# Look up a media type by file extension in Rack's mime registry.
|
# Look up a media type by file extension in Rack's mime registry.
|
||||||
def mime_type(type)
|
def mime_type(type)
|
||||||
|
|
Loading…
Reference in New Issue