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)
|
||||
* **Zachary Scott**
|
||||
* **Katrina Owen**
|
||||
* **Kashyap Kondamudi**
|
||||
* **Ashley Williams**
|
||||
* **Trevor Bramble**
|
||||
|
||||
### Alumni
|
||||
|
||||
* **Blake Mizerany** (creator)
|
||||
* **Ryan Tomayko**
|
||||
* **Simon Rozet**
|
||||
* **Katrina Owen**
|
||||
|
||||
### 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).*
|
||||
|
||||
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
|
||||
ermöglicht:
|
||||
|
||||
|
@ -220,9 +220,9 @@ end
|
|||
Routen-Muster können auch mit optionalen Parametern ausgestattet werden:
|
||||
|
||||
```ruby
|
||||
get '/posts.?:format?' do
|
||||
# passt auf "GET /posts" sowie jegliche Erweiterung
|
||||
# wie "GET /posts.json", "GET /posts.xml" etc.
|
||||
get '/posts/:format?' do
|
||||
# passt auf "GET /posts/" sowie jegliche Erweiterung
|
||||
# wie "GET /posts/json", "GET /posts/xml" etc.
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -608,7 +608,7 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Dateierweiterung</td>
|
||||
|
@ -663,7 +663,7 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Dateierweiterung</td>
|
||||
|
@ -681,7 +681,7 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Dateierweiterung</td>
|
||||
|
@ -703,7 +703,7 @@ denen man Variablen weitergibt.
|
|||
<tr>
|
||||
<td>Abhängigkeit</td>
|
||||
<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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||
<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>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Dateierweiterung</td>
|
||||
|
@ -1011,7 +1011,7 @@ Templates zu verwenden und einen anderen für das Layout, indem die
|
|||
<tr>
|
||||
<td>Abhängigkeit</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
|
||||
</a> und eine Möglichkeit
|
||||
<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.
|
||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/), die als Basis für
|
||||
[WebSockets](http://en.wikipedia.org/wiki/WebSocket) dienen. Ebenso können sie
|
||||
[Server Sent Events](https://w3c.github.io/eventsource/), die als Basis für
|
||||
[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
|
||||
langsamen Ressourcen abhängig ist.
|
||||
|
||||
|
@ -1672,7 +1672,7 @@ Weitere Parameter werden wie Argumente der `halt`-Methode behandelt:
|
|||
|
||||
```ruby
|
||||
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`
|
||||
|
@ -1757,7 +1757,7 @@ end
|
|||
```
|
||||
|
||||
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
|
||||
etag @article.sha1, :weak
|
||||
|
@ -2073,7 +2073,7 @@ end
|
|||
#### Einstellung des Angriffsschutzes
|
||||
|
||||
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
|
||||
lässt sich selbstverständlich deaktivieren, der damit verbundene
|
||||
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
|
||||
[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
|
||||
`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
|
||||
|
||||
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:
|
||||
|
||||
```ruby
|
||||
|
@ -2464,7 +2464,7 @@ Veränderungen zu `Sinatra::Base` konvertiert werden:
|
|||
|
||||
`Sinatra::Base` ist ein unbeschriebenes Blatt. Die meisten Optionen sind per
|
||||
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.
|
||||
|
||||
Damit eine App sich ähnlich wie eine klassische App verhält, kann man
|
||||
|
@ -2541,7 +2541,7 @@ werden:
|
|||
<tr>
|
||||
<td>static</td>
|
||||
<td>true</td>
|
||||
<td>false</td>
|
||||
<td>File.exist?(public_folder)</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2926,7 +2926,7 @@ gem install sinatra --pre
|
|||
### Mit Bundler
|
||||
|
||||
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.
|
||||
|
||||
Soweit Bundler noch nicht installiert ist:
|
||||
|
@ -3013,12 +3013,12 @@ SemVer und SemVerTag.
|
|||
|
||||
## 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.
|
||||
* [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?
|
||||
* [Issue-Tracker](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [Issue-Tracker](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [Mailing-Liste](http://groups.google.com/group/sinatrarb)
|
||||
* [#sinatra](irc://chat.freenode.net/#sinatra) auf http://freenode.net Es
|
||||
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
|
||||
Community
|
||||
* API Dokumentation für die [aktuelle
|
||||
Version](http://rubydoc.info/gems/sinatra) oder für
|
||||
[HEAD](http://rubydoc.info/github/sinatra/sinatra) auf http://rubydoc.info
|
||||
* [CI Server](http://travis-ci.org/sinatra/sinatra)
|
||||
Version](http://www.rubydoc.info//gems/sinatra) oder für
|
||||
[HEAD](http://www.rubydoc.info/github/sinatra/sinatra) auf http://rubydoc.info
|
||||
* [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.*
|
||||
|
||||
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:
|
||||
|
||||
```ruby
|
||||
|
@ -22,7 +22,7 @@ gem install sinatra
|
|||
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.
|
||||
|
||||
|
@ -133,9 +133,9 @@ end
|
|||
Los patrones de ruta pueden contener parámetros opcionales:
|
||||
|
||||
```ruby
|
||||
get '/posts.?:formato?' do
|
||||
# coincide con "GET /posts" y además admite cualquier extensión, por
|
||||
# ejemplo, "GET /posts.json", "GET /posts.xml", etc.
|
||||
get '/posts/:formato?' do
|
||||
# coincide con "GET /posts/" y además admite cualquier extensión, por
|
||||
# ejemplo, "GET /posts/json", "GET /posts/xml", etc.
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -503,7 +503,7 @@ Además, acepta un bloque con la definición de la plantilla (ver ejemplo).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensiones de Archivo</td>
|
||||
|
@ -556,7 +556,7 @@ Además, acepta un bloque con la definición de la plantilla (ver ejemplo).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensiones de Archivo</td>
|
||||
|
@ -573,7 +573,7 @@ Además, acepta un bloque con la definición de la plantilla (ver ejemplo).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensiones de Archivo</td>
|
||||
|
@ -594,7 +594,7 @@ plantilla Liquid, casi siempre va a querer pasarle locales.
|
|||
<tr>
|
||||
<td>Dependencias</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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a> o
|
||||
|
@ -727,7 +727,7 @@ plantilla Radius, casi siempre se necesita pasar locales.
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensiones de Archivo</td>
|
||||
|
@ -841,7 +841,7 @@ distinto al de la plantilla pasando la opción `:layout_engine`.
|
|||
<tr>
|
||||
<td>Dependencias</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
|
||||
</a> y un
|
||||
<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,
|
||||
[Server-Sent Events](http://dev.w3.org/html5/eventsource/) y puede ser usado
|
||||
como base para [WebSockets](http://es.wikipedia.org/wiki/WebSockets). También
|
||||
[Server-Sent Events](https://w3c.github.io/eventsource/) y puede ser usado
|
||||
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
|
||||
depende de un recurso lento.
|
||||
|
||||
|
@ -1441,7 +1441,7 @@ pasados a `halt`:
|
|||
|
||||
```ruby
|
||||
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
|
||||
|
@ -1526,7 +1526,7 @@ end
|
|||
```
|
||||
|
||||
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
|
||||
etag @articulo.sha1, :weak
|
||||
|
@ -1841,7 +1841,7 @@ end
|
|||
|
||||
### 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,
|
||||
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
|
||||
|
@ -2187,7 +2187,7 @@ end
|
|||
```
|
||||
|
||||
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`
|
||||
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
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
### Estilo Modular vs. Clásico
|
||||
|
@ -2336,7 +2336,7 @@ de ambos estilos:
|
|||
<tr>
|
||||
<td>static</td>
|
||||
<td>true</td>
|
||||
<td>false</td>
|
||||
<td>File.exist?(public_folder)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -2732,7 +2732,7 @@ Para obtener algunas de las últimas características.
|
|||
### Con Bundler
|
||||
|
||||
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:
|
||||
|
||||
|
@ -2807,15 +2807,15 @@ siguiendo las especificaciones SemVer y SemVerTag.
|
|||
adicional, noticias, y enlaces a otros recursos.
|
||||
* [Contribuyendo](http://www.sinatrarb.com/contributing) - ¿Encontraste un
|
||||
error?. ¿Necesitás ayuda?. ¿Tenés un parche?.
|
||||
* [Seguimiento de problemas](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [Seguimiento de problemas](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [Lista de Correo](http://groups.google.com/group/sinatrarb/topics)
|
||||
* [IRC: #sinatra](irc://chat.freenode.net/#sinatra) en http://freenode.net
|
||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Tutorial (en inglés).
|
||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) Recetas contribuidas
|
||||
por la comunidad (en inglés).
|
||||
* Documentación de la API para la
|
||||
[última versión liberada](http://rubydoc.info/gems/sinatra) o para la
|
||||
[rama de desarrollo actual](http://rubydoc.info/github/sinatra/sinatra)
|
||||
en http://rubydoc.info/
|
||||
* [Servidor de CI](http://travis-ci.org/sinatra/sinatra)
|
||||
[última versión liberada](http://www.rubydoc.info/gems/sinatra) o para la
|
||||
[rama de desarrollo actual](http://www.rubydoc.info/github/sinatra/sinatra)
|
||||
en http://www.rubydoc.info/
|
||||
* [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
|
||||
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 :
|
||||
|
||||
```ruby
|
||||
|
@ -26,7 +26,8 @@ Puis lancez votre programme :
|
|||
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
|
||||
Sinatra utilise le server Thin quand il est disponible.
|
||||
|
@ -225,8 +226,8 @@ end
|
|||
Les routes peuvent aussi comporter des paramètres optionnels :
|
||||
|
||||
```ruby
|
||||
get '/articles.?:format?' do
|
||||
# répond à "GET /articles" ou avec une extension "GET /articles.json", "GET /articles.xml" etc...
|
||||
get '/articles/:format?' do
|
||||
# répond à "GET /articles/" ou avec une extension "GET /articles/json", "GET /articles/xml" etc...
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -616,7 +617,7 @@ exemple).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensions de fichier</td>
|
||||
|
@ -672,7 +673,7 @@ exemple).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensions de fichier</td>
|
||||
|
@ -690,7 +691,7 @@ exemple).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensions de fichier</td>
|
||||
|
@ -713,7 +714,7 @@ locales.
|
|||
<td><p>Dépendances</p></td>
|
||||
<td>
|
||||
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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</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>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extensions de fichier</td>
|
||||
|
@ -966,7 +967,7 @@ en utilisant l'option `:layout_engine`.
|
|||
<tr>
|
||||
<td>Dépendances</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
|
||||
</a>
|
||||
et un
|
||||
|
@ -1503,8 +1504,8 @@ end
|
|||
```
|
||||
|
||||
Cela permet d'implémenter des API de streaming ou de
|
||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/) et peut servir de
|
||||
base pour des [WebSockets](http://en.wikipedia.org/wiki/WebSocket). Vous
|
||||
[Server Sent Events](https://w3c.github.io/eventsource/) et peut servir de
|
||||
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
|
||||
provient d'une ressource lente.
|
||||
|
||||
|
@ -1635,7 +1636,7 @@ Tout paramètre additionnel sera utilisé comme argument pour la méthode
|
|||
|
||||
```ruby
|
||||
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
|
||||
|
@ -1718,7 +1719,7 @@ end
|
|||
```
|
||||
|
||||
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
|
||||
etag @article.sha1, :weak
|
||||
|
@ -2047,7 +2048,7 @@ end
|
|||
|
||||
### 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.
|
||||
Vous pouvez très simplement désactiver cette fonctionnalité (ce qui exposera
|
||||
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
|
||||
[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
|
||||
`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
|
||||
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
|
||||
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
|
||||
|
@ -2523,7 +2524,7 @@ mineures en ce qui concerne les paramètres par défaut :
|
|||
<tr>
|
||||
<td>static</td>
|
||||
<td>true</td>
|
||||
<td>false</td>
|
||||
<td>File.exist?(public_folder)</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2922,7 +2923,7 @@ Ce qui permet de bénéficier des toutes dernières fonctionnalités.
|
|||
|
||||
### 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.
|
||||
|
||||
Pour commencer, installez bundler si nécessaire :
|
||||
|
@ -3000,14 +3001,14 @@ SemVer que SemVerTag.
|
|||
de news, et des liens vers d'autres ressources.
|
||||
* [Contribuer](http://www.sinatrarb.com/contributing) - Vous avez trouvé un
|
||||
bug ? Besoin d'aide ? Vous avez un patch ?
|
||||
* [Suivi des problèmes](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [Suivi des problèmes](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [Mailing List](http://groups.google.com/group/sinatrarb/topics)
|
||||
* IRC : [#sinatra](irc://chat.freenode.net/#sinatra) sur http://freenode.net
|
||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Tutoriels et recettes
|
||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) trucs et astuces rédigés par
|
||||
la communauté
|
||||
* Documentation API de la [dernière version](http://rubydoc.info/gems/sinatra)
|
||||
ou du [HEAD courant](http://rubydoc.info/github/sinatra/sinatra) sur
|
||||
http://rubydoc.info
|
||||
* [CI server](http://travis-ci.org/sinatra/sinatra)
|
||||
* Documentation API de la [dernière version](http://www.rubydoc.info/gems/sinatra)
|
||||
ou du [HEAD courant](http://www.rubydoc.info/github/sinatra/sinatra) sur
|
||||
http://www.rubydoc.info/
|
||||
* [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ű
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
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)
|
||||
|
||||
|
@ -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
|
||||
[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á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:
|
||||
|
@ -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ó
|
||||
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
|
||||
[Options and Configuration](http://sinatra.github.com/configuration.html) lap
|
||||
[Options and Configuration](http://www.sinatrarb.com/configuration.html) lap
|
||||
foglalkozik.
|
||||
|
||||
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
|
||||
|
||||
* [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
|
||||
* [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?
|
||||
* [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)
|
||||
* [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
|
||||
# myapp.rb
|
||||
|
@ -26,7 +26,7 @@ gem install sinatra
|
|||
ruby myapp.rb
|
||||
```
|
||||
|
||||
[localhost:4567](http://localhost:4567) を開きます。
|
||||
[http://localhost:4567](http://localhost:4567) を開きます。
|
||||
|
||||
ThinがあればSinatraはこれを利用するので、`gem install thin`することをお薦めします。
|
||||
|
||||
|
@ -224,8 +224,8 @@ end
|
|||
ルーティングパターンは、オプショナルパラメータを取ることもできます。
|
||||
|
||||
```ruby
|
||||
get '/posts.?:format?' do
|
||||
# "GET /posts" と "GET /posts.json", "GET /posts.xml" の拡張子などにマッチ
|
||||
get '/posts/:format?' do
|
||||
# "GET /posts/" と "GET /posts/json", "GET /posts/xml" の拡張子などにマッチ
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -578,7 +578,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>ファイル拡張子</td>
|
||||
|
@ -633,7 +633,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>ファイル拡張子</td>
|
||||
|
@ -650,7 +650,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>ファイル拡張子</td>
|
||||
|
@ -671,7 +671,7 @@ LiquidテンプレートからRubyのメソッド(`yield`を除く)を呼び出
|
|||
<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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||
|
@ -816,7 +816,7 @@ RadiusテンプレートからRubyのメソッドを直接呼び出すことが
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>ファイル拡張子</td>
|
||||
|
@ -952,7 +952,7 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
|||
<tr>
|
||||
<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
|
||||
</a> および
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
|
@ -1426,7 +1426,7 @@ get '/' do
|
|||
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を使った場合は全く動作しません。
|
||||
|
||||
|
@ -1532,7 +1532,7 @@ end
|
|||
|
||||
```ruby
|
||||
redirect to('/bar'), 303
|
||||
redirect 'http://google.com', 'wrong place, buddy'
|
||||
redirect 'http://www.google.com/', 'wrong place, buddy'
|
||||
```
|
||||
|
||||
また、`redirect back`を使えば、簡単にユーザが来たページへ戻るリダイレクトを作れます。
|
||||
|
@ -1610,7 +1610,7 @@ get '/article/:id' do
|
|||
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
|
||||
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
|
||||
disable :protection
|
||||
|
@ -2177,7 +2177,7 @@ get '/hello' do
|
|||
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
|
||||
use Rack::Auth::Basic do |username, password|
|
||||
|
@ -2195,7 +2195,7 @@ Rackは、ロギング、デバッギング、URLルーティング、認証、
|
|||
|
||||
## テスト(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
|
||||
require 'my_sinatra_app'
|
||||
|
@ -2251,7 +2251,7 @@ end
|
|||
(そうしない場合、SinatraのDSLメソッドの全てがmainの名前空間にインポートされます)
|
||||
* ルーティング、エラーハンドラ、フィルタ、オプションを`Sinatra::Base`のサブクラスに書く
|
||||
|
||||
`Sinatra::Base`はまっさらです。ビルトインサーバを含む、ほとんどのオプションがデフォルトで無効になっています。利用可能なオプションとその挙動の詳細については[Configuring Settings](http://sinatra.github.com/configuration.html)(英語)をご覧下さい。
|
||||
`Sinatra::Base`はまっさらです。ビルトインサーバを含む、ほとんどのオプションがデフォルトで無効になっています。利用可能なオプションとその挙動の詳細については[Configuring Settings](http://www.sinatrarb.com/configuration.html)(英語)をご覧下さい。
|
||||
|
||||
もしもクラシックスタイルと同じような挙動のアプリケーションをトップレベルで定義させる必要があれば、`Sinatra::Application`をサブクラス化させてください。
|
||||
|
||||
|
@ -2319,7 +2319,7 @@ end
|
|||
<tr>
|
||||
<td>static</td>
|
||||
<td>true</td>
|
||||
<td>false</td>
|
||||
<td>File.exist?(public_folder)</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2676,7 +2676,7 @@ gem install sinatra --pre
|
|||
|
||||
### Bundlerを使う場合
|
||||
|
||||
最新のSinatraでアプリケーションを動作させたい場合には、[Bundler](http://gembundler.com/)を使うのがお薦めのやり方です。
|
||||
最新のSinatraでアプリケーションを動作させたい場合には、[Bundler](http://bundler.io)を使うのがお薦めのやり方です。
|
||||
|
||||
まず、Bundlerがなければそれをインストールします。
|
||||
|
||||
|
@ -2743,14 +2743,14 @@ Sinatraは、[Semantic Versioning](http://semver.org/)におけるSemVerおよ
|
|||
|
||||
## 参考文献
|
||||
|
||||
* [プロジェクトサイト](http://sinatra.github.com/) - ドキュメント、ニュース、他のリソースへのリンクがあります。
|
||||
* [プロジェクトに参加(貢献)する](http://sinatra.github.com/contributing.html) - バグレポート パッチの送信、サポートなど
|
||||
* [Issue tracker](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [プロジェクトサイト](http://www.sinatrarb.com/) - ドキュメント、ニュース、他のリソースへのリンクがあります。
|
||||
* [プロジェクトに参加(貢献)する](http://www.sinatrarb.com/contributing.html) - バグレポート パッチの送信、サポートなど
|
||||
* [Issue tracker](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [メーリングリスト](http://groups.google.com/group/sinatrarb/topics)
|
||||
* http://freenode.net上のIRC: [#sinatra](irc://chat.freenode.net/#sinatra)
|
||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) クックブック、チュートリアル
|
||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) コミュニティによるレシピ集
|
||||
* http://rubydoc.info上のAPIドキュメント: [最新版(latest release)用](http://rubydoc.info/gems/sinatra)または[現在のHEAD用](http://rubydoc.info/github/sinatra/sinatra)
|
||||
* [CIサーバ](http://travis-ci.org/sinatra/sinatra)
|
||||
* http://www.rubydoc.info/上のAPIドキュメント: [最新版(latest release)用](http://www.rubydoc.info/gems/sinatra)または[現在のHEAD用](http://www.rubydoc.info/github/sinatra/sinatra)
|
||||
* [CIサーバ](https://travis-ci.org/sinatra/sinatra)
|
||||
* [Greenbear Laboratory Rack日本語マニュアル](http://route477.net/w/RackReferenceJa.html)
|
||||
|
|
60
README.ko.md
60
README.ko.md
|
@ -3,7 +3,7 @@
|
|||
*주의: 이 문서는 영문판의 번역본이며 최신판 문서와 다를 수 있습니다.*
|
||||
|
||||
Sinatra는 최소한의 노력으로 루비 기반 웹 애플리케이션을 신속하게 만들 수 있게
|
||||
해 주는 [DSL](http://en.wikipedia.org/wiki/Domain-specific_language)입니다.
|
||||
해 주는 [DSL](https://en.wikipedia.org/wiki/Domain-specific_language)입니다.
|
||||
|
||||
```ruby
|
||||
# myapp.rb
|
||||
|
@ -14,19 +14,19 @@ get '/' do
|
|||
end
|
||||
```
|
||||
|
||||
젬을 설치합니다.
|
||||
아래의 명령어로 젬을 설치합니다.
|
||||
|
||||
```shell
|
||||
gem install sinatra
|
||||
```
|
||||
|
||||
실행합니다.
|
||||
아래의 명령어로 실행합니다.
|
||||
|
||||
```shell
|
||||
ruby myapp.rb
|
||||
```
|
||||
|
||||
`http://localhost:4567`를 확인해 보세요.
|
||||
[http://localhost:4567](http://localhost:4567) 를 확인해 보세요.
|
||||
|
||||
`gem install thin`도 함께 실행하기를 권장합니다.
|
||||
thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
||||
|
@ -224,8 +224,8 @@ end
|
|||
라우터 패턴에는 선택적인(optional) 매개변수도 올 수 있습니다.
|
||||
|
||||
```ruby
|
||||
get '/posts.?:format?' do
|
||||
# "GET /posts" 는 물론 "GET /posts.json", "GET /posts.xml" 와 같은 어떤 확장자와도 매칭
|
||||
get '/posts/:format?' do
|
||||
# "GET /posts/" 는 물론 "GET /posts/json", "GET /posts/xml" 와 같은 어떤 확장자와도 매칭
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -583,7 +583,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="http://nokogiri.org/">nokogiri</a></td>
|
||||
<td><a href="http://www.nokogiri.org/">nokogiri</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
|
@ -636,7 +636,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="http://www.lesscss.org/">less</a></td>
|
||||
<td><a href="http://lesscss.org/">less</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
|
@ -653,7 +653,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="http://www.liquidmarkup.org/">liquid</a></td>
|
||||
<td><a href="http://liquidmarkup.org/">liquid</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
|
@ -674,7 +674,7 @@ Liquid 템플릿에서는 루비 메서드(`yield` 제외)를 호출할 수 없
|
|||
<tr>
|
||||
<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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||
|
@ -825,7 +825,7 @@ Radius 템플릿에서는 루비 메서드를 호출할 수 없기
|
|||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="http://markaby.github.com/">markaby</a></td>
|
||||
<td><a href="http://markaby.github.io/">markaby</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일확장</td>
|
||||
|
@ -973,7 +973,7 @@ MediaWiki에서 루비를 호출할 수 없기 때문에, MediaWiki으로 작성
|
|||
<tr>
|
||||
<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
|
||||
</a> 와
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
|
@ -1506,8 +1506,8 @@ end
|
|||
```
|
||||
|
||||
이렇게 스트리밍 API나 [서버 발송 이벤트Server Sent
|
||||
Events](http://dev.w3.org/html5/eventsource/)를 구현할 수 있고, 이 방법은
|
||||
[WebSockets](http://en.wikipedia.org/wiki/WebSocket)을 위한 기반으로 사용됩니다.
|
||||
Events](https://w3c.github.io/eventsource/)를 구현할 수 있고, 이 방법은
|
||||
[WebSockets](https://en.wikipedia.org/wiki/WebSocket)을 위한 기반으로 사용됩니다.
|
||||
이 방법은 일부 콘텐츠가 느린 자원에 의존하는 경우에 스로풋(throughtput)을
|
||||
높이기 위해 사용되기도 합니다.
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ end
|
|||
|
||||
```ruby
|
||||
redirect to('/bar'), 303
|
||||
redirect 'http://google.com', 'wrong place, buddy'
|
||||
redirect 'http://www.google.com/', 'wrong place, buddy'
|
||||
```
|
||||
|
||||
`redirect back`을 사용하면 쉽게 사용자가 왔던 페이지로 다시 돌아가게
|
||||
|
@ -1713,7 +1713,7 @@ get "/article/:id" do
|
|||
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
|
||||
|
@ -2023,7 +2023,7 @@ end
|
|||
|
||||
### 공격 방어 설정하기(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
|
||||
```
|
||||
|
||||
`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` 메서드는
|
||||
블록이나 여러 개의/가변적인 인자도 받을 수 있습니다.
|
||||
|
||||
|
@ -2376,7 +2376,7 @@ Rack은 로깅, 디버깅, URL 라우팅, 인증, 그리고 세센 핸들링을
|
|||
## 테스팅(Testing)
|
||||
|
||||
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
|
||||
require 'my_sinatra_app'
|
||||
|
@ -2444,7 +2444,7 @@ end
|
|||
|
||||
`Sinatra::Base`는 백지상태(blank slate)입니다. 빌트인 서버를 비롯한 대부분의 옵션들이
|
||||
기본값으로 꺼져 있습니다. 가능한 옵션들과 그 작동에 대한 상세는 [옵션과
|
||||
설정](http://sinatra.github.com/configuration.html)을 참조하세요.
|
||||
설정](http://www.sinatrarb.com/configuration.html)을 참조하세요.
|
||||
|
||||
### 모듈(Modular) vs. 전통적 방식(Classic Style)
|
||||
|
||||
|
@ -2492,7 +2492,7 @@ end
|
|||
<tr>
|
||||
<td>static</td>
|
||||
<td>true</td>
|
||||
<td>false</td>
|
||||
<td>File.exist?(public_folder)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -2847,8 +2847,8 @@ thin --threaded start
|
|||
* MacRuby, Maglev, IronRuby
|
||||
* Ruby 1.9.0 및 1.9.1 (이 버전들은 사용하지 말 것을 권합니다)
|
||||
|
||||
공식적으로 지원하지 않는다는 것의 의미는 무언가가 그 플랫폼에서만 잘못되고
|
||||
지원되는 플랫폼에서는 그러지 않을 경우, 우리의 문제가 아니라 그 플랫폼의 문제로
|
||||
공식적으로 지원하지 않는다는 것의 의미는 무언가가 그 플랫폼에서만 잘못 동작하고,
|
||||
지원되는 플랫폼에서는 정상적으로 동작할 경우, 우리의 문제가 아니라 그 플랫폼의 문제로
|
||||
간주한다는 뜻입니다.
|
||||
|
||||
또한 우리는 CI를 ruby-head (MRI의 이후 릴리즈) 브랜치에 맞춰 실행하지만,
|
||||
|
@ -2858,6 +2858,8 @@ thin --threaded start
|
|||
Sinatra는 선택한 루비 구현체가 지원하는 어떠한 운영체제에서도 작동해야
|
||||
합니다.
|
||||
|
||||
MacRuby를 사용한다면, gem install control_tower 를 실행해 주세요.
|
||||
|
||||
현재 Cardinal, SmallRuby, BlueRuby 또는 1.8.7 이전의 루비 버전에서는
|
||||
Sinatra를 실행할 수 없을 것입니다.
|
||||
|
||||
|
@ -2876,7 +2878,7 @@ gem install sinatra --pre
|
|||
### Bundler를 사용하여
|
||||
|
||||
여러분 애플리케이션을 최신 Sinatra로 실행하고자 한다면,
|
||||
[Bundler](http://gembundler.com/)를 사용할 것을 권장합니다.
|
||||
[Bundler](http://bundler.io)를 사용할 것을 권장합니다.
|
||||
|
||||
우선, 아직 설치하지 않았다면 bundler를 설치합니다.
|
||||
|
||||
|
@ -2952,14 +2954,14 @@ SemVerTag를 준수합니다.
|
|||
그리고 다른 리소스들에 대한 링크.
|
||||
* [기여하기](http://www.sinatrarb.com/contributing) - 버그를 찾았나요?
|
||||
도움이 필요한가요? 패치를 하셨나요?
|
||||
* [이슈 트래커](http://github.com/sinatra/sinatra/issues)
|
||||
* [트위터](http://twitter.com/sinatra)
|
||||
* [이슈 트래커](https://github.com/sinatra/sinatra/issues)
|
||||
* [트위터](https://twitter.com/sinatra)
|
||||
* [메일링 리스트](http://groups.google.com/group/sinatrarb/topics)
|
||||
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) http://freenode.net
|
||||
* 슬랙의 [Sinatra & Friends](https://sinatrarb.slack.com)입니다.
|
||||
[여기](https://sinatra-slack.herokuapp.com/)에서 가입가능합니다.
|
||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) Cookbook 튜토리얼
|
||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) 커뮤니티가 만드는 레시피
|
||||
* http://rubydoc.info에 있는 [최종 릴리스](http://rubydoc.info/gems/sinatra)
|
||||
또는 [current HEAD](http://rubydoc.info/github/sinatra/sinatra)에 대한 API 문서
|
||||
* [CI server](http://travis-ci.org/sinatra/sinatra)
|
||||
* http://www.rubydoc.info/에 있는 [최종 릴리스](http://www.rubydoc.info/gems/sinatra)
|
||||
또는 [current HEAD](http://www.rubydoc.info/github/sinatra/sinatra)에 대한 API 문서
|
||||
* [CI server](https://travis-ci.org/sinatra/sinatra)
|
||||
|
|
60
README.md
60
README.md
|
@ -1,6 +1,6 @@
|
|||
# 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:
|
||||
|
||||
```ruby
|
||||
|
@ -24,7 +24,7 @@ And run with:
|
|||
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
|
||||
pick up if available.
|
||||
|
@ -225,8 +225,8 @@ end
|
|||
Route patterns may have optional parameters:
|
||||
|
||||
```ruby
|
||||
get '/posts.?:format?' do
|
||||
# matches "GET /posts" and any extension "GET /posts.json", "GET /posts.xml" etc.
|
||||
get '/posts/:format?' do
|
||||
# matches "GET /posts/" and any extension "GET /posts/json", "GET /posts/xml" etc
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -609,7 +609,7 @@ It also takes a block for inline templates (see example).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>File Extension</td>
|
||||
|
@ -662,7 +662,7 @@ It also takes a block for inline templates (see example).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>File Extension</td>
|
||||
|
@ -679,7 +679,7 @@ It also takes a block for inline templates (see example).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>File Extension</td>
|
||||
|
@ -701,7 +701,7 @@ template, you almost always want to pass locals to it.
|
|||
<td>Dependency</td>
|
||||
<td>
|
||||
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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||
|
@ -852,7 +852,7 @@ always want to pass locals to it.
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>File Extension</td>
|
||||
|
@ -1001,7 +1001,7 @@ template than for the layout by passing the `:layout_engine` option.
|
|||
<tr>
|
||||
<td>Dependency</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
|
||||
</a> and a
|
||||
<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,
|
||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/), and can be used as
|
||||
the basis for [WebSockets](http://en.wikipedia.org/wiki/WebSocket). It can also be
|
||||
[Server Sent Events](https://w3c.github.io/eventsource/), and can be used as
|
||||
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
|
||||
resource.
|
||||
|
||||
|
@ -1659,7 +1659,7 @@ Any additional parameters are handled like arguments passed to `halt`:
|
|||
|
||||
```ruby
|
||||
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
|
||||
|
@ -1742,7 +1742,7 @@ end
|
|||
```
|
||||
|
||||
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
|
||||
etag @article.sha1, :weak
|
||||
|
@ -2055,7 +2055,7 @@ end
|
|||
### Configuring attack protection
|
||||
|
||||
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
|
||||
this behavior (which will open up your application to tons of common
|
||||
vulnerabilities):
|
||||
|
@ -2138,7 +2138,7 @@ set :protection, :session => true
|
|||
Places a lock around every request, only running processing on request
|
||||
per Ruby process concurrently.
|
||||
</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>
|
||||
<dd>
|
||||
|
@ -2153,7 +2153,7 @@ set :protection, :session => true
|
|||
<dd>
|
||||
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
|
||||
<tt>redirect to('/foo')</tt>. Disabled per default.
|
||||
<tt>redirect to('/foo')</tt>. Disabled by default.
|
||||
</dd>
|
||||
|
||||
<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>Disabling will boost performance.</dd>
|
||||
<dd>
|
||||
Enabled per default in classic style, disabled for modular apps.
|
||||
Enabled by default in classic style, disabled for modular apps.
|
||||
</dd>
|
||||
|
||||
<dt>static_cache_control</dt>
|
||||
|
@ -2394,7 +2394,7 @@ end
|
|||
```
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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:
|
||||
|
||||
```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,
|
||||
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
|
||||
behavior more similar to when you define your app at the top level (also
|
||||
known as Classic style), you
|
||||
|
@ -2562,7 +2562,7 @@ different default settings:
|
|||
<tr>
|
||||
<td>static</td>
|
||||
<td>true</td>
|
||||
<td>false</td>
|
||||
<td>File.exist?(public_folder)</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2789,7 +2789,7 @@ end
|
|||
|
||||
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
|
||||
* helper methods
|
||||
* templates/views
|
||||
|
@ -2934,7 +2934,7 @@ to get some of the latest features.
|
|||
### With Bundler
|
||||
|
||||
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:
|
||||
|
||||
|
@ -3009,8 +3009,8 @@ SemVerTag.
|
|||
news, and links to other resources.
|
||||
* [Contributing](http://www.sinatrarb.com/contributing) - Find a bug? Need
|
||||
help? Have a patch?
|
||||
* [Issue tracker](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [Issue tracker](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [Mailing List](http://groups.google.com/group/sinatrarb/topics)
|
||||
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) on http://freenode.net
|
||||
* [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 Recipes](http://recipes.sinatrarb.com/) Community
|
||||
contributed recipes
|
||||
* API documentation for the [latest release](http://rubydoc.info/gems/sinatra)
|
||||
or the [current HEAD](http://rubydoc.info/github/sinatra/sinatra) on
|
||||
http://rubydoc.info
|
||||
* [CI server](http://travis-ci.org/sinatra/sinatra)
|
||||
* API documentation for the [latest release](http://www.rubydoc.info/gems/sinatra)
|
||||
or the [current HEAD](http://www.rubydoc.info/github/sinatra/sinatra) on
|
||||
http://www.rubydoc.info/
|
||||
* [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
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```ruby
|
||||
|
@ -33,7 +33,7 @@ Em seguida execute:
|
|||
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
|
||||
Sinatra irá utilizá-la.
|
||||
|
@ -197,8 +197,8 @@ end
|
|||
Padrões de rota podem contar com parâmetros opcionais:
|
||||
|
||||
```ruby
|
||||
get '/posts.?:formato?' do
|
||||
# corresponde a "GET /posts" e qualquer extensão "GET /posts.json", "GET /posts.xml", etc.
|
||||
get '/posts/:formato?' do
|
||||
# corresponde a "GET /posts/" e qualquer extensão "GET /posts/json", "GET /posts/xml", etc.
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -585,7 +585,7 @@ It also takes a block for inline templates (see exemplo).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extencao do Arquivo</td>
|
||||
|
@ -638,7 +638,7 @@ It also takes a block for inline templates (see exemplo).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extencao do Arquivo</td>
|
||||
|
@ -655,7 +655,7 @@ It also takes a block for inline templates (see exemplo).
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extencao do Arquivo</td>
|
||||
|
@ -677,7 +677,7 @@ você quase sempre precisará passar o `locals` para ele.
|
|||
<td>Dependencia</td>
|
||||
<td>
|
||||
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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</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>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Extencao do Arquivo</td>
|
||||
|
@ -975,7 +975,7 @@ deve-se passar a `:layout_engine` como opção.
|
|||
<tr>
|
||||
<td>Dependencia</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
|
||||
</a> and a
|
||||
<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
|
||||
[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
|
||||
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
|
||||
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.
|
||||
|
||||
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.
|
||||
* [Contribuir](http://www.sinatrarb.com/contributing) - Encontrar um
|
||||
bug? Precisa de ajuda? Tem um patch?
|
||||
* [Acompanhar Questões](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [Acompanhar Questões](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [Lista de Email](http://groups.google.com/group/sinatrarb/topics)
|
||||
* [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
|
||||
[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.*
|
||||
|
||||
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:
|
||||
|
||||
```ruby
|
||||
|
@ -23,7 +23,7 @@ sudo gem install sinatra
|
|||
ruby minhaapp.rb
|
||||
```
|
||||
|
||||
Aceda em: [localhost:4567](http://localhost:4567)
|
||||
Aceda em: [http://localhost:4567](http://localhost:4567)
|
||||
|
||||
## Rotas
|
||||
|
||||
|
@ -158,7 +158,7 @@ end
|
|||
Renderiza `./views/index.haml`.
|
||||
|
||||
[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,
|
||||
veja [Opções e
|
||||
Configurações](http://www.sinatrarb.com/configuration.html), e substitua
|
||||
|
@ -233,7 +233,7 @@ end
|
|||
Renderiza `./views/stylesheet.sass`.
|
||||
|
||||
[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,
|
||||
veja [Opções e
|
||||
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
|
||||
[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
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
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)
|
||||
|
||||
|
|
50
README.ru.md
50
README.ru.md
|
@ -91,7 +91,7 @@
|
|||
устаревшим*
|
||||
|
||||
Sinatra — это предметно-ориентированный каркас
|
||||
([DSL](http://ru.wikipedia.org/wiki/Предметно-ориентированный_язык_программирования))
|
||||
([DSL](https://ru.wikipedia.org/wiki/Предметно-ориентированный_язык))
|
||||
для быстрого создания функциональных веб-приложений на Ruby с минимумом усилий:
|
||||
|
||||
```ruby
|
||||
|
@ -115,7 +115,7 @@ gem install sinatra
|
|||
ruby myapp.rb
|
||||
```
|
||||
|
||||
Оцените результат: http://localhost:4567
|
||||
Оцените результат: [http://localhost:4567](http://localhost:4567)
|
||||
|
||||
Рекомендуется также установить Thin, сделать это можно командой: `gem install
|
||||
thin`. Thin — это более производительный и функциональный сервер для
|
||||
|
@ -225,8 +225,8 @@ end
|
|||
Шаблоны маршрутов могут иметь необязательные параметры:
|
||||
|
||||
```ruby
|
||||
get '/posts.?:format?' do
|
||||
# соответствует "GET /posts", "GET /posts.json", "GET /posts.xml" и т.д.
|
||||
get '/posts/:format?' do
|
||||
# соответствует "GET /posts/", "GET /posts/json", "GET /posts/xml" и т.д.
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -595,7 +595,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Расширения файлов</td>
|
||||
|
@ -648,7 +648,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Расширения файлов</td>
|
||||
|
@ -665,7 +665,7 @@ get('/') { markdown :index }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Расширения файлов</td>
|
||||
|
@ -687,7 +687,7 @@ get('/') { markdown :index }
|
|||
<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="http://deveiate.org/projects/BlueCloth" title="BlueCloth">BlueCloth</a>,
|
||||
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
||||
|
@ -843,7 +843,7 @@ erb :overview, :locals => { :text => rdoc(:introduction) }
|
|||
<table>
|
||||
<tr>
|
||||
<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>
|
||||
<td>Расширения файлов</td>
|
||||
|
@ -995,7 +995,7 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
|||
<tr>
|
||||
<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
|
||||
</a> и
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
|
@ -1526,8 +1526,8 @@ end
|
|||
```
|
||||
|
||||
Что позволяет вам реализовать стриминговые API,
|
||||
[Server Sent Events](http://dev.w3.org/html5/eventsource/),
|
||||
и может служить основой для [WebSockets](http://en.wikipedia.org/wiki/WebSocket).
|
||||
[Server Sent Events](https://w3c.github.io/eventsource/),
|
||||
и может служить основой для [WebSockets](https://en.wikipedia.org/wiki/WebSocket).
|
||||
Также такой подход можно использовать для увеличения производительности в случае,
|
||||
когда какая-то часть контента зависит от медленного ресурса.
|
||||
|
||||
|
@ -1654,7 +1654,7 @@ end
|
|||
|
||||
```ruby
|
||||
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
|
||||
etag @article.sha1, :weak
|
||||
|
@ -2055,7 +2055,7 @@ end
|
|||
### Настройка защиты от атак
|
||||
|
||||
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` идентична той, что определена для
|
||||
[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` принимает как
|
||||
множественные переменные, так и блоки:
|
||||
|
||||
|
@ -2387,7 +2387,7 @@ 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
|
||||
|
@ -2479,7 +2479,7 @@ end
|
|||
logging true false
|
||||
method_override true false
|
||||
inline_templates true false
|
||||
static true false
|
||||
static true File.exist?(public_folder)
|
||||
|
||||
### Запуск модульных приложений
|
||||
|
||||
|
@ -2868,7 +2868,7 @@ gem install sinatra --pre
|
|||
### С помощью Bundler
|
||||
|
||||
Если вы хотите запускать свое приложение с последней версией Sinatra, то
|
||||
рекомендуем использовать [Bundler](http://gembundler.com/).
|
||||
рекомендуем использовать [Bundler](http://bundler.io).
|
||||
|
||||
Сначала установите Bundler, если у вас его еще нет:
|
||||
|
||||
|
@ -2944,15 +2944,15 @@ SemVerTag.
|
|||
документация, новости и ссылки на другие ресурсы.
|
||||
* [Участие в проекте](http://www.sinatrarb.com/contributing) — Обнаружили
|
||||
баг? Нужна помощь? Написали патч?
|
||||
* [Отслеживание проблем/ошибок](http://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](http://twitter.com/sinatra)
|
||||
* [Отслеживание проблем/ошибок](https://github.com/sinatra/sinatra/issues)
|
||||
* [Twitter](https://twitter.com/sinatra)
|
||||
* [Группы рассылки](http://groups.google.com/group/sinatrarb/topics)
|
||||
* IRC: [#sinatra](irc://chat.freenode.net/#sinatra) на http://freenode.net
|
||||
* [Sinatra и Друзья](https://sinatrarb.slack.com) на Slack, а так же
|
||||
[ссылка](https://sinatra-slack.herokuapp.com/) для инвайта.
|
||||
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) учебник и сборник рецептов
|
||||
* [Sinatra Recipes](http://recipes.sinatrarb.com/) сборник рецептов
|
||||
* API документация к [последнему релизу](http://rubydoc.info/gems/sinatra)
|
||||
или [текущему HEAD](http://rubydoc.info/github/sinatra/sinatra) на
|
||||
http://rubydoc.info
|
||||
* [Сервер непрерывной интеграции](http://travis-ci.org/sinatra/sinatra)
|
||||
* API документация к [последнему релизу](http://www.rubydoc.info/gems/sinatra)
|
||||
или [текущему HEAD](http://www.rubydoc.info/github/sinatra/sinatra) на
|
||||
http://www.rubydoc.info/
|
||||
* [Сервер непрерывной интеграции](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 'tilt'
|
||||
require 'rack/protection'
|
||||
require 'forwardable'
|
||||
|
||||
# stdlib dependencies
|
||||
require 'thread'
|
||||
|
@ -304,10 +303,15 @@ module Sinatra
|
|||
response.headers
|
||||
end
|
||||
|
||||
extend Forwardable
|
||||
def_delegators :request,
|
||||
:session, # Access the underlying Rack session.
|
||||
:logger # Access shared logger object.
|
||||
# Access the underlying Rack session.
|
||||
def session
|
||||
request.session
|
||||
end
|
||||
|
||||
# Access shared logger object.
|
||||
def logger
|
||||
request.logger
|
||||
end
|
||||
|
||||
# Look up a media type by file extension in Rack's mime registry.
|
||||
def mime_type(type)
|
||||
|
|
Loading…
Reference in New Issue