sinatra 2.0.0 → 2.0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/AUTHORS.md +1 -0
- data/CHANGELOG.md +157 -37
- data/CONTRIBUTING.md +7 -7
- data/Gemfile +10 -2
- data/README.de.md +6 -6
- data/README.es.md +733 -352
- data/README.fr.md +6 -6
- data/README.ja.md +22 -22
- data/README.ko.md +6 -6
- data/README.malayalam.md +3141 -0
- data/README.md +75 -56
- data/README.pt-br.md +2359 -332
- data/README.ru.md +834 -563
- data/README.zh.md +82 -20
- data/Rakefile +10 -7
- data/VERSION +1 -0
- data/lib/sinatra/base.rb +51 -55
- data/lib/sinatra/indifferent_hash.rb +65 -15
- data/lib/sinatra/main.rb +30 -11
- data/lib/sinatra/show_exceptions.rb +43 -11
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +26 -2
- metadata +16 -7
data/README.fr.md
CHANGED
@@ -324,13 +324,13 @@ acceptées.
|
|
324
324
|
Vous pouvez renvoyer n'importe quel objet qu'il s'agisse d'une réponse Rack
|
325
325
|
valide, d'un corps de réponse Rack ou d'un code statut HTTP :
|
326
326
|
|
327
|
-
* Un tableau de 3 éléments : `[code statut (
|
327
|
+
* Un tableau de 3 éléments : `[code statut (Integer), en-têtes (Hash), corps
|
328
328
|
de la réponse (répondant à #each)]`
|
329
|
-
* Un tableau de 2 élements : `[code statut (
|
329
|
+
* Un tableau de 2 élements : `[code statut (Integer), corps de la réponse
|
330
330
|
(répondant à #each)]`
|
331
331
|
* Un objet qui répond à `#each` et qui ne transmet que des chaînes de
|
332
332
|
caractères au bloc fourni
|
333
|
-
* Un
|
333
|
+
* Un Integer représentant le code statut
|
334
334
|
|
335
335
|
Ainsi, on peut facilement implémenter un exemple de streaming :
|
336
336
|
|
@@ -691,7 +691,7 @@ exemple).
|
|
691
691
|
<table>
|
692
692
|
<tr>
|
693
693
|
<td>Dépendances</td>
|
694
|
-
<td><a href="
|
694
|
+
<td><a href="https://shopify.github.io/liquid/" title="liquid">liquid</a></td>
|
695
695
|
</tr>
|
696
696
|
<tr>
|
697
697
|
<td>Extensions de fichier</td>
|
@@ -716,7 +716,7 @@ locales.
|
|
716
716
|
Au choix :
|
717
717
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
718
718
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
719
|
-
<a href="
|
719
|
+
<a href="https://github.com/ged/bluecloth" title="bluecloth">BlueCloth</a>,
|
720
720
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
721
721
|
<a href="https://github.com/bhollis/maruku" title="maruku">maruku</a>
|
722
722
|
</td>
|
@@ -2048,7 +2048,7 @@ end
|
|
2048
2048
|
|
2049
2049
|
### Se protéger des attaques
|
2050
2050
|
|
2051
|
-
Sinatra utilise [Rack::Protection](https://github.com/sinatra/rack-protection#readme)
|
2051
|
+
Sinatra utilise [Rack::Protection](https://github.com/sinatra/sinatra/tree/master/rack-protection#readme)
|
2052
2052
|
pour protéger votre application contre les principales attaques opportunistes.
|
2053
2053
|
Vous pouvez très simplement désactiver cette fonctionnalité (ce qui exposera
|
2054
2054
|
votre application à beaucoup de vulnerabilités courantes) :
|
data/README.ja.md
CHANGED
@@ -315,12 +315,12 @@ end
|
|
315
315
|
Rackレスポンス、Rackボディオブジェクト、HTTPステータスコードのいずれかとして妥当なオブジェクトであればどのようなオブジェクトでも返すことができます。
|
316
316
|
|
317
317
|
* 3つの要素を含む配列:
|
318
|
-
`[ステータス(
|
318
|
+
`[ステータス(Integer), ヘッダ(Hash), レスポンスボディ(#eachに応答する)]`
|
319
319
|
* 2つの要素を含む配列:
|
320
|
-
`[ステータス(
|
320
|
+
`[ステータス(Integer), レスポンスボディ(#eachに応答する)]`
|
321
321
|
* `#each`に応答するオブジェクト。通常はそのまま何も返さないが、
|
322
322
|
与えられたブロックに文字列を渡す。
|
323
|
-
* ステータスコードを表現する整数(
|
323
|
+
* ステータスコードを表現する整数(Integer)
|
324
324
|
|
325
325
|
これにより、例えばストリーミングを簡単に実装することができます。
|
326
326
|
|
@@ -551,13 +551,14 @@ get('/') { markdown :index }
|
|
551
551
|
<tr>
|
552
552
|
<td>依存</td>
|
553
553
|
<td>
|
554
|
-
<a href="
|
554
|
+
<a href="https://github.com/jeremyevans/erubi" title="erubi">erubi</a>
|
555
|
+
または <a href="http://www.kuwata-lab.com/erubis/" title="erubis">erubis</a>
|
555
556
|
または erb (Rubyに同梱)
|
556
557
|
</td>
|
557
558
|
</tr>
|
558
559
|
<tr>
|
559
560
|
<td>ファイル拡張子</td>
|
560
|
-
<td><tt>.erb</tt>, <tt>.rhtml</tt>
|
561
|
+
<td><tt>.erb</tt>, <tt>.rhtml</tt> または <tt>.erubi</tt> (Erubiだけ) または<tt>.erubis</tt> (Erubisだけ)</td>
|
561
562
|
</tr>
|
562
563
|
<tr>
|
563
564
|
<td>例</td>
|
@@ -610,7 +611,7 @@ get('/') { markdown :index }
|
|
610
611
|
<table>
|
611
612
|
<tr>
|
612
613
|
<td>依存</td>
|
613
|
-
<td><a href="
|
614
|
+
<td><a href="https://sass-lang.com/" title="sass">sass</a></td>
|
614
615
|
</tr>
|
615
616
|
<tr>
|
616
617
|
<td>ファイル拡張子</td>
|
@@ -627,7 +628,7 @@ get('/') { markdown :index }
|
|
627
628
|
<table>
|
628
629
|
<tr>
|
629
630
|
<td>依存</td>
|
630
|
-
<td><a href="
|
631
|
+
<td><a href="https://sass-lang.com/" title="sass">sass</a></td>
|
631
632
|
</tr>
|
632
633
|
<tr>
|
633
634
|
<td>ファイル拡張子</td>
|
@@ -661,7 +662,7 @@ get('/') { markdown :index }
|
|
661
662
|
<table>
|
662
663
|
<tr>
|
663
664
|
<td>依存</td>
|
664
|
-
<td><a href="
|
665
|
+
<td><a href="https://shopify.github.io/liquid/" title="liquid">liquid</a></td>
|
665
666
|
</tr>
|
666
667
|
<tr>
|
667
668
|
<td>ファイル拡張子</td>
|
@@ -684,8 +685,8 @@ LiquidテンプレートからRubyのメソッド(`yield`を除く)を呼び出
|
|
684
685
|
次の何れか:
|
685
686
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
686
687
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
687
|
-
<a href="
|
688
|
-
<a href="
|
688
|
+
<a href="https://github.com/ged/bluecloth" title="bluecloth">BlueCloth</a>,
|
689
|
+
<a href="https://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
689
690
|
<a href="https://github.com/bhollis/maruku" title="maruku">maruku</a>
|
690
691
|
</td>
|
691
692
|
</tr>
|
@@ -786,7 +787,7 @@ RDocからはRubyを呼ぶことができないので、RDocで書かれたレ
|
|
786
787
|
<table>
|
787
788
|
<tr>
|
788
789
|
<td>依存</td>
|
789
|
-
<td><a href="
|
790
|
+
<td><a href="https://asciidoctor.org/" title="Asciidoctor">Asciidoctor</a></td>
|
790
791
|
</tr>
|
791
792
|
<tr>
|
792
793
|
<td>ファイル拡張子</td>
|
@@ -824,7 +825,7 @@ RadiusテンプレートからRubyのメソッドを直接呼び出すことが
|
|
824
825
|
<table>
|
825
826
|
<tr>
|
826
827
|
<td>依存</td>
|
827
|
-
<td><a href="
|
828
|
+
<td><a href="https://markaby.github.io/" title="Markaby">Markaby</a></td>
|
828
829
|
</tr>
|
829
830
|
<tr>
|
830
831
|
<td>ファイル拡張子</td>
|
@@ -1456,7 +1457,7 @@ get '/foo' do
|
|
1456
1457
|
status 418
|
1457
1458
|
headers \
|
1458
1459
|
"Allow" => "BREW, POST, GET, PROPFIND, WHEN",
|
1459
|
-
"Refresh" => "Refresh: 20;
|
1460
|
+
"Refresh" => "Refresh: 20; https://www.ietf.org/rfc/rfc2324.txt"
|
1460
1461
|
body "I'm a tea pot!"
|
1461
1462
|
end
|
1462
1463
|
```
|
@@ -1586,7 +1587,7 @@ end
|
|
1586
1587
|
|
1587
1588
|
```ruby
|
1588
1589
|
redirect to('/bar'), 303
|
1589
|
-
redirect '
|
1590
|
+
redirect 'https://www.google.com/', 'wrong place, buddy'
|
1590
1591
|
```
|
1591
1592
|
|
1592
1593
|
また、`redirect back`を使えば、簡単にユーザが来たページへ戻るリダイレクトを作れます。
|
@@ -1951,7 +1952,7 @@ end
|
|
1951
1952
|
|
1952
1953
|
### 攻撃防御に対する設定
|
1953
1954
|
|
1954
|
-
Sinatraは[Rack::Protection](https://github.com/sinatra/rack-protection#readme)を使用することで、アプリケーションを一般的な日和見的攻撃から守っています。これは簡単に無効化できます(が、アプリケーションに大量の一般的な脆弱性を埋め込むことになってしまいます)。
|
1955
|
+
Sinatraは[Rack::Protection](https://github.com/sinatra/sinatra/tree/master/rack-protection#readme)を使用することで、アプリケーションを一般的な日和見的攻撃から守っています。これは簡単に無効化できます(が、アプリケーションに大量の一般的な脆弱性を埋め込むことになってしまいます)。
|
1955
1956
|
|
1956
1957
|
```ruby
|
1957
1958
|
disable :protection
|
@@ -2219,7 +2220,7 @@ Sinatraを開発環境の下で実行している場合は、特別な`not_found
|
|
2219
2220
|
|
2220
2221
|
## Rackミドルウェア(Rack Middleware)
|
2221
2222
|
|
2222
|
-
SinatraはRuby製Webフレームワークのミニマルな標準的インタフェースである[Rack](
|
2223
|
+
SinatraはRuby製Webフレームワークのミニマルな標準的インタフェースである[Rack](https://rack.github.io/)上に構築されています。アプリケーションデベロッパーにとってRackにおける最も興味深い機能は、「ミドルウェア(middleware)」をサポートしていることであり、これは、サーバとアプリケーションとの間に置かれ、HTTPリクエスト/レスポンスを監視および/または操作することで、各種の汎用的機能を提供するコンポーネントです。
|
2223
2224
|
|
2224
2225
|
Sinatraはトップレベルの`use`メソッドを通して、Rackミドルウェアパイプラインの構築を楽にします。
|
2225
2226
|
|
@@ -2636,7 +2637,8 @@ ruby myapp.rb [-h] [-x] [-e ENVIRONMENT] [-p PORT] [-o HOST] [-s HANDLER]
|
|
2636
2637
|
|
2637
2638
|
### マルチスレッド
|
2638
2639
|
|
2639
|
-
_この[StackOverflow]
|
2640
|
+
_この[StackOverflow](https://stackoverflow.com/a/6282999/5245129)
|
2641
|
+
のKonstantinによる回答を言い換えています。_
|
2640
2642
|
|
2641
2643
|
Sinatraでは同時実行モデルを負わせることはできませんが、根本的な部分であるThinやPuma、WebrickのようなRackハンドラ(サーバー)部分に委ねることができます。
|
2642
2644
|
Sinatra自身はスレッドセーフであり、もしRackハンドラが同時実行モデルのスレッドを使用していても問題はありません。
|
@@ -2663,8 +2665,6 @@ App.run!
|
|
2663
2665
|
thin --threaded start
|
2664
2666
|
```
|
2665
2667
|
|
2666
|
-
[so-answer]: http://stackoverflow.com/questions/6278817/is-sinatra-multi-threaded/6282999#6282999)
|
2667
|
-
|
2668
2668
|
## 必要環境
|
2669
2669
|
|
2670
2670
|
次のRubyバージョンが公式にサポートされています。
|
@@ -2734,7 +2734,7 @@ gem install sinatra --pre
|
|
2734
2734
|
|
2735
2735
|
### Bundlerを使う場合
|
2736
2736
|
|
2737
|
-
最新のSinatraでアプリケーションを動作させたい場合には、[Bundler](
|
2737
|
+
最新のSinatraでアプリケーションを動作させたい場合には、[Bundler](https://bundler.io)を使うのがお薦めのやり方です。
|
2738
2738
|
|
2739
2739
|
まず、Bundlerがなければそれをインストールします。
|
2740
2740
|
|
@@ -2797,7 +2797,7 @@ sudo rake install
|
|
2797
2797
|
|
2798
2798
|
## バージョニング(Versioning)
|
2799
2799
|
|
2800
|
-
Sinatraは、[Semantic Versioning](
|
2800
|
+
Sinatraは、[Semantic Versioning](https://semver.org/)におけるSemVerおよびSemVerTagの両方に準拠しています。
|
2801
2801
|
|
2802
2802
|
## 参考文献
|
2803
2803
|
|
@@ -2805,7 +2805,7 @@ Sinatraは、[Semantic Versioning](http://semver.org/)におけるSemVerおよ
|
|
2805
2805
|
* [プロジェクトに参加(貢献)する](http://www.sinatrarb.com/contributing.html) - バグレポート パッチの送信、サポートなど
|
2806
2806
|
* [Issue tracker](https://github.com/sinatra/sinatra/issues)
|
2807
2807
|
* [Twitter](https://twitter.com/sinatra)
|
2808
|
-
* [メーリングリスト](
|
2808
|
+
* [メーリングリスト](https://groups.google.com/group/sinatrarb/topics)
|
2809
2809
|
* http://freenode.net上のIRC: [#sinatra](irc://chat.freenode.net/#sinatra)
|
2810
2810
|
* [Sinatra Book](https://github.com/sinatra/sinatra-book/) クックブック、チュートリアル
|
2811
2811
|
* [Sinatra Recipes](http://recipes.sinatrarb.com/) コミュニティによるレシピ集
|
data/README.ko.md
CHANGED
@@ -315,10 +315,10 @@ end
|
|
315
315
|
|
316
316
|
유효한 Rack 응답, Rack 본문 객체 또는 HTTP 상태 코드가 되는 어떠한 객체라도 반환할 수 있습니다.
|
317
317
|
|
318
|
-
* 세 요소를 가진 배열: `[상태 (
|
319
|
-
* 두 요소를 가진 배열: `[상태 (
|
318
|
+
* 세 요소를 가진 배열: `[상태 (Integer), 헤더 (Hash), 응답 본문 (#each에 반응)]`
|
319
|
+
* 두 요소를 가진 배열: `[상태 (Integer), 응답 본문 (#each에 반응)]`
|
320
320
|
* `#each`에 반응하고 주어진 블록으로 문자열만을 전달하는 객체
|
321
|
-
* 상태 코드를 의미하는
|
321
|
+
* 상태 코드를 의미하는 Integer
|
322
322
|
|
323
323
|
이것을 이용한 예를 들자면, 스트리밍(streaming) 예제를 쉽게 구현할 수 있습니다.
|
324
324
|
|
@@ -653,7 +653,7 @@ get('/') { markdown :index }
|
|
653
653
|
<table>
|
654
654
|
<tr>
|
655
655
|
<td>의존성</td>
|
656
|
-
<td><a href="
|
656
|
+
<td><a href="https://shopify.github.io/liquid/">liquid</a></td>
|
657
657
|
</tr>
|
658
658
|
<tr>
|
659
659
|
<td>파일 확장자</td>
|
@@ -676,7 +676,7 @@ Liquid 템플릿에서는 루비 메서드(`yield` 제외)를 호출할 수 없
|
|
676
676
|
<td>
|
677
677
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
678
678
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
679
|
-
<a href="
|
679
|
+
<a href="https://github.com/ged/bluecloth" title="bluecloth">BlueCloth</a>,
|
680
680
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
681
681
|
<a href="https://github.com/bhollis/maruku" title="maruku">maruku</a>
|
682
682
|
중 아무거나
|
@@ -2023,7 +2023,7 @@ end
|
|
2023
2023
|
|
2024
2024
|
### 공격 방어 설정하기(Configuring attack protection)
|
2025
2025
|
|
2026
|
-
Sinatra는 [Rack::Protection](https://github.com/sinatra/rack-protection#readme)을 사용하여
|
2026
|
+
Sinatra는 [Rack::Protection](https://github.com/sinatra/sinatra/tree/master/rack-protection#readme)을 사용하여
|
2027
2027
|
일반적이고 일어날 수 있는 공격에 대비합니다. 이 모듈은 간단하게 비활성시킬 수 있습니다.
|
2028
2028
|
(하지만 애플리케이션에 엄청나게 많은 취약성을 야기합니다.)
|
2029
2029
|
|