sinatra 1.4.8 → 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sinatra might be problematic. Click here for more details.

Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -47
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile +37 -49
  5. data/MAINTENANCE.md +42 -0
  6. data/README.de.md +5 -5
  7. data/README.es.md +5 -5
  8. data/README.fr.md +9 -9
  9. data/README.hu.md +3 -3
  10. data/README.ja.md +19 -8
  11. data/README.ko.md +8 -8
  12. data/README.md +90 -61
  13. data/README.pt-br.md +3 -3
  14. data/README.pt-pt.md +2 -2
  15. data/README.ru.md +42 -26
  16. data/README.zh.md +8 -8
  17. data/Rakefile +0 -6
  18. data/SECURITY.md +35 -0
  19. data/lib/sinatra/base.rb +113 -161
  20. data/lib/sinatra/main.rb +1 -0
  21. data/lib/sinatra/show_exceptions.rb +8 -8
  22. data/lib/sinatra/version.rb +1 -1
  23. data/sinatra.gemspec +7 -4
  24. metadata +34 -168
  25. data/lib/sinatra/ext.rb +0 -17
  26. data/test/asciidoctor_test.rb +0 -72
  27. data/test/base_test.rb +0 -167
  28. data/test/builder_test.rb +0 -91
  29. data/test/coffee_test.rb +0 -96
  30. data/test/compile_test.rb +0 -183
  31. data/test/contest.rb +0 -91
  32. data/test/creole_test.rb +0 -65
  33. data/test/delegator_test.rb +0 -160
  34. data/test/encoding_test.rb +0 -20
  35. data/test/erb_test.rb +0 -116
  36. data/test/extensions_test.rb +0 -98
  37. data/test/filter_test.rb +0 -487
  38. data/test/haml_test.rb +0 -109
  39. data/test/helper.rb +0 -132
  40. data/test/helpers_test.rb +0 -1917
  41. data/test/integration/app.rb +0 -79
  42. data/test/integration_helper.rb +0 -236
  43. data/test/integration_test.rb +0 -104
  44. data/test/less_test.rb +0 -69
  45. data/test/liquid_test.rb +0 -77
  46. data/test/mapped_error_test.rb +0 -285
  47. data/test/markaby_test.rb +0 -80
  48. data/test/markdown_test.rb +0 -85
  49. data/test/mediawiki_test.rb +0 -68
  50. data/test/middleware_test.rb +0 -68
  51. data/test/nokogiri_test.rb +0 -67
  52. data/test/public/favicon.ico +0 -0
  53. data/test/public/hello+world.txt +0 -1
  54. data/test/rabl_test.rb +0 -89
  55. data/test/rack_test.rb +0 -45
  56. data/test/radius_test.rb +0 -59
  57. data/test/rdoc_test.rb +0 -66
  58. data/test/readme_test.rb +0 -130
  59. data/test/request_test.rb +0 -100
  60. data/test/response_test.rb +0 -63
  61. data/test/result_test.rb +0 -76
  62. data/test/route_added_hook_test.rb +0 -59
  63. data/test/routing_test.rb +0 -1456
  64. data/test/sass_test.rb +0 -115
  65. data/test/scss_test.rb +0 -88
  66. data/test/server_test.rb +0 -56
  67. data/test/settings_test.rb +0 -582
  68. data/test/sinatra_test.rb +0 -12
  69. data/test/slim_test.rb +0 -102
  70. data/test/static_test.rb +0 -266
  71. data/test/streaming_test.rb +0 -149
  72. data/test/stylus_test.rb +0 -90
  73. data/test/templates_test.rb +0 -382
  74. data/test/textile_test.rb +0 -65
  75. data/test/views/a/in_a.str +0 -1
  76. data/test/views/ascii.erb +0 -2
  77. data/test/views/b/in_b.str +0 -1
  78. data/test/views/calc.html.erb +0 -1
  79. data/test/views/error.builder +0 -3
  80. data/test/views/error.erb +0 -3
  81. data/test/views/error.haml +0 -3
  82. data/test/views/error.sass +0 -2
  83. data/test/views/explicitly_nested.str +0 -1
  84. data/test/views/foo/hello.test +0 -1
  85. data/test/views/hello.asciidoc +0 -1
  86. data/test/views/hello.builder +0 -1
  87. data/test/views/hello.coffee +0 -1
  88. data/test/views/hello.creole +0 -1
  89. data/test/views/hello.erb +0 -1
  90. data/test/views/hello.haml +0 -1
  91. data/test/views/hello.less +0 -5
  92. data/test/views/hello.liquid +0 -1
  93. data/test/views/hello.mab +0 -1
  94. data/test/views/hello.md +0 -1
  95. data/test/views/hello.mediawiki +0 -1
  96. data/test/views/hello.nokogiri +0 -1
  97. data/test/views/hello.rabl +0 -2
  98. data/test/views/hello.radius +0 -1
  99. data/test/views/hello.rdoc +0 -1
  100. data/test/views/hello.sass +0 -2
  101. data/test/views/hello.scss +0 -3
  102. data/test/views/hello.slim +0 -1
  103. data/test/views/hello.str +0 -1
  104. data/test/views/hello.styl +0 -2
  105. data/test/views/hello.test +0 -1
  106. data/test/views/hello.textile +0 -1
  107. data/test/views/hello.wlang +0 -1
  108. data/test/views/hello.yajl +0 -1
  109. data/test/views/layout2.builder +0 -3
  110. data/test/views/layout2.erb +0 -2
  111. data/test/views/layout2.haml +0 -2
  112. data/test/views/layout2.liquid +0 -2
  113. data/test/views/layout2.mab +0 -2
  114. data/test/views/layout2.nokogiri +0 -3
  115. data/test/views/layout2.rabl +0 -3
  116. data/test/views/layout2.radius +0 -2
  117. data/test/views/layout2.slim +0 -3
  118. data/test/views/layout2.str +0 -2
  119. data/test/views/layout2.test +0 -1
  120. data/test/views/layout2.wlang +0 -2
  121. data/test/views/nested.str +0 -1
  122. data/test/views/utf8.erb +0 -2
  123. data/test/wlang_test.rb +0 -87
  124. data/test/yajl_test.rb +0 -86
@@ -17,6 +17,7 @@ module Sinatra
17
17
  op.on('-o addr', "set the host (default is #{bind})") { |val| set :bind, val }
18
18
  op.on('-e env', 'set the environment (default is development)') { |val| set :environment, val.to_sym }
19
19
  op.on('-s server', 'specify rack server/handler (default is thin)') { |val| set :server, val }
20
+ op.on('-q', 'turn on quiet mode (default is off)') { set :quiet, true }
20
21
  op.on('-x', 'turn on the mutex lock (default is off)') { set :lock, true }
21
22
  }.parse!(ARGV.dup)
22
23
  end
@@ -1,8 +1,6 @@
1
- begin
2
- require 'rack/show_exceptions'
3
- rescue LoadError
4
- require 'rack/showexceptions'
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'rack/show_exceptions'
6
4
 
7
5
  module Sinatra
8
6
  # Sinatra::ShowExceptions catches all exceptions raised from the app it
@@ -18,7 +16,6 @@ module Sinatra
18
16
 
19
17
  def initialize(app)
20
18
  @app = app
21
- @template = ERB.new(TEMPLATE)
22
19
  end
23
20
 
24
21
  def call(env)
@@ -44,7 +41,7 @@ module Sinatra
44
41
  500,
45
42
  {
46
43
  "Content-Type" => content_type,
47
- "Content-Length" => Rack::Utils.bytesize(body.join).to_s
44
+ "Content-Length" => body.join.bytesize.to_s
48
45
  },
49
46
  body
50
47
  ]
@@ -68,7 +65,7 @@ module Sinatra
68
65
  end
69
66
  end
70
67
 
71
- TEMPLATE = <<-HTML # :nodoc:
68
+ TEMPLATE = ERB.new <<-HTML # :nodoc:
72
69
  <!DOCTYPE html>
73
70
  <html>
74
71
  <head>
@@ -355,3 +352,6 @@ enabled the <code>show_exceptions</code> setting.</p>
355
352
  HTML
356
353
  end
357
354
  end
355
+
356
+ Rack::ShowExceptions.send :remove_const, "TEMPLATE"
357
+ Rack::ShowExceptions.const_set "TEMPLATE", Sinatra::ShowExceptions::TEMPLATE
@@ -1,3 +1,3 @@
1
1
  module Sinatra
2
- VERSION = '1.4.8'
2
+ VERSION = '2.0.0.beta1'
3
3
  end
@@ -8,12 +8,15 @@ Gem::Specification.new 'sinatra', Sinatra::VERSION do |s|
8
8
  s.email = "sinatrarb@googlegroups.com"
9
9
  s.homepage = "http://www.sinatrarb.com/"
10
10
  s.license = 'MIT'
11
- s.files = `git ls-files`.split("\n") - %w[.gitignore .travis.yml]
11
+ s.files = %w(.yardopts AUTHORS.md CHANGELOG.md CONTRIBUTING.md Gemfile LICENSE MAINTENANCE.md Rakefile SECURITY.md sinatra.gemspec) + Dir['README*.md', 'lib/**/*', 'examples/*']
12
12
  s.test_files = s.files.select { |p| p =~ /^test\/.*_test.rb/ }
13
13
  s.extra_rdoc_files = s.files.select { |p| p =~ /^README/ } << 'LICENSE'
14
14
  s.rdoc_options = %w[--line-numbers --inline-source --title Sinatra --main README.rdoc --encoding=UTF-8]
15
15
 
16
- s.add_dependency 'rack', '~> 1.5'
17
- s.add_dependency 'tilt', '>= 1.3', '< 3'
18
- s.add_dependency 'rack-protection', '~> 1.4'
16
+ s.required_ruby_version = '>= 2.2.0'
17
+
18
+ s.add_dependency 'rack', '~> 2.0'
19
+ s.add_dependency 'tilt', '~> 2.0'
20
+ s.add_dependency 'rack-protection', Sinatra::VERSION
21
+ s.add_dependency 'mustermann', '1.0.0.beta2'
19
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.8
4
+ version: 2.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-01-30 00:00:00.000000000 Z
14
+ date: 2016-08-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rack
@@ -19,48 +19,56 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.5'
22
+ version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.5'
29
+ version: '2.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: tilt
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: '1.3'
37
- - - "<"
34
+ - - "~>"
38
35
  - !ruby/object:Gem::Version
39
- version: '3'
36
+ version: '2.0'
40
37
  type: :runtime
41
38
  prerelease: false
42
39
  version_requirements: !ruby/object:Gem::Requirement
43
40
  requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '1.3'
47
- - - "<"
41
+ - - "~>"
48
42
  - !ruby/object:Gem::Version
49
- version: '3'
43
+ version: '2.0'
50
44
  - !ruby/object:Gem::Dependency
51
45
  name: rack-protection
52
46
  requirement: !ruby/object:Gem::Requirement
53
47
  requirements:
54
- - - "~>"
48
+ - - '='
55
49
  - !ruby/object:Gem::Version
56
- version: '1.4'
50
+ version: 2.0.0.beta1
57
51
  type: :runtime
58
52
  prerelease: false
59
53
  version_requirements: !ruby/object:Gem::Requirement
60
54
  requirements:
61
- - - "~>"
55
+ - - '='
56
+ - !ruby/object:Gem::Version
57
+ version: 2.0.0.beta1
58
+ - !ruby/object:Gem::Dependency
59
+ name: mustermann
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - '='
63
+ - !ruby/object:Gem::Version
64
+ version: 1.0.0.beta2
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '='
62
70
  - !ruby/object:Gem::Version
63
- version: '1.4'
71
+ version: 1.0.0.beta2
64
72
  description: Sinatra is a DSL for quickly creating web applications in Ruby with minimal
65
73
  effort.
66
74
  email: sinatrarb@googlegroups.com
@@ -86,6 +94,7 @@ files:
86
94
  - CONTRIBUTING.md
87
95
  - Gemfile
88
96
  - LICENSE
97
+ - MAINTENANCE.md
89
98
  - README.de.md
90
99
  - README.es.md
91
100
  - README.fr.md
@@ -98,117 +107,18 @@ files:
98
107
  - README.ru.md
99
108
  - README.zh.md
100
109
  - Rakefile
110
+ - SECURITY.md
101
111
  - examples/chat.rb
102
112
  - examples/simple.rb
103
113
  - examples/stream.ru
104
114
  - lib/sinatra.rb
105
115
  - lib/sinatra/base.rb
106
- - lib/sinatra/ext.rb
107
116
  - lib/sinatra/images/404.png
108
117
  - lib/sinatra/images/500.png
109
118
  - lib/sinatra/main.rb
110
119
  - lib/sinatra/show_exceptions.rb
111
120
  - lib/sinatra/version.rb
112
121
  - sinatra.gemspec
113
- - test/asciidoctor_test.rb
114
- - test/base_test.rb
115
- - test/builder_test.rb
116
- - test/coffee_test.rb
117
- - test/compile_test.rb
118
- - test/contest.rb
119
- - test/creole_test.rb
120
- - test/delegator_test.rb
121
- - test/encoding_test.rb
122
- - test/erb_test.rb
123
- - test/extensions_test.rb
124
- - test/filter_test.rb
125
- - test/haml_test.rb
126
- - test/helper.rb
127
- - test/helpers_test.rb
128
- - test/integration/app.rb
129
- - test/integration_helper.rb
130
- - test/integration_test.rb
131
- - test/less_test.rb
132
- - test/liquid_test.rb
133
- - test/mapped_error_test.rb
134
- - test/markaby_test.rb
135
- - test/markdown_test.rb
136
- - test/mediawiki_test.rb
137
- - test/middleware_test.rb
138
- - test/nokogiri_test.rb
139
- - test/public/favicon.ico
140
- - test/public/hello+world.txt
141
- - test/rabl_test.rb
142
- - test/rack_test.rb
143
- - test/radius_test.rb
144
- - test/rdoc_test.rb
145
- - test/readme_test.rb
146
- - test/request_test.rb
147
- - test/response_test.rb
148
- - test/result_test.rb
149
- - test/route_added_hook_test.rb
150
- - test/routing_test.rb
151
- - test/sass_test.rb
152
- - test/scss_test.rb
153
- - test/server_test.rb
154
- - test/settings_test.rb
155
- - test/sinatra_test.rb
156
- - test/slim_test.rb
157
- - test/static_test.rb
158
- - test/streaming_test.rb
159
- - test/stylus_test.rb
160
- - test/templates_test.rb
161
- - test/textile_test.rb
162
- - test/views/a/in_a.str
163
- - test/views/ascii.erb
164
- - test/views/b/in_b.str
165
- - test/views/calc.html.erb
166
- - test/views/error.builder
167
- - test/views/error.erb
168
- - test/views/error.haml
169
- - test/views/error.sass
170
- - test/views/explicitly_nested.str
171
- - test/views/foo/hello.test
172
- - test/views/hello.asciidoc
173
- - test/views/hello.builder
174
- - test/views/hello.coffee
175
- - test/views/hello.creole
176
- - test/views/hello.erb
177
- - test/views/hello.haml
178
- - test/views/hello.less
179
- - test/views/hello.liquid
180
- - test/views/hello.mab
181
- - test/views/hello.md
182
- - test/views/hello.mediawiki
183
- - test/views/hello.nokogiri
184
- - test/views/hello.rabl
185
- - test/views/hello.radius
186
- - test/views/hello.rdoc
187
- - test/views/hello.sass
188
- - test/views/hello.scss
189
- - test/views/hello.slim
190
- - test/views/hello.str
191
- - test/views/hello.styl
192
- - test/views/hello.test
193
- - test/views/hello.textile
194
- - test/views/hello.wlang
195
- - test/views/hello.yajl
196
- - test/views/layout2.builder
197
- - test/views/layout2.erb
198
- - test/views/layout2.haml
199
- - test/views/layout2.liquid
200
- - test/views/layout2.mab
201
- - test/views/layout2.nokogiri
202
- - test/views/layout2.rabl
203
- - test/views/layout2.radius
204
- - test/views/layout2.slim
205
- - test/views/layout2.str
206
- - test/views/layout2.test
207
- - test/views/layout2.wlang
208
- - test/views/nested.str
209
- - test/views/utf8.erb
210
- - test/wlang_test.rb
211
- - test/yajl_test.rb
212
122
  homepage: http://www.sinatrarb.com/
213
123
  licenses:
214
124
  - MIT
@@ -228,61 +138,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
138
  requirements:
229
139
  - - ">="
230
140
  - !ruby/object:Gem::Version
231
- version: '0'
141
+ version: 2.2.0
232
142
  required_rubygems_version: !ruby/object:Gem::Requirement
233
143
  requirements:
234
- - - ">="
144
+ - - ">"
235
145
  - !ruby/object:Gem::Version
236
- version: '0'
146
+ version: 1.3.1
237
147
  requirements: []
238
148
  rubyforge_project:
239
- rubygems_version: 2.6.8
149
+ rubygems_version: 2.5.1
240
150
  signing_key:
241
151
  specification_version: 4
242
152
  summary: Classy web-development dressed in a DSL
243
- test_files:
244
- - test/asciidoctor_test.rb
245
- - test/base_test.rb
246
- - test/builder_test.rb
247
- - test/coffee_test.rb
248
- - test/compile_test.rb
249
- - test/creole_test.rb
250
- - test/delegator_test.rb
251
- - test/encoding_test.rb
252
- - test/erb_test.rb
253
- - test/extensions_test.rb
254
- - test/filter_test.rb
255
- - test/haml_test.rb
256
- - test/helpers_test.rb
257
- - test/integration_test.rb
258
- - test/less_test.rb
259
- - test/liquid_test.rb
260
- - test/mapped_error_test.rb
261
- - test/markaby_test.rb
262
- - test/markdown_test.rb
263
- - test/mediawiki_test.rb
264
- - test/middleware_test.rb
265
- - test/nokogiri_test.rb
266
- - test/rabl_test.rb
267
- - test/rack_test.rb
268
- - test/radius_test.rb
269
- - test/rdoc_test.rb
270
- - test/readme_test.rb
271
- - test/request_test.rb
272
- - test/response_test.rb
273
- - test/result_test.rb
274
- - test/route_added_hook_test.rb
275
- - test/routing_test.rb
276
- - test/sass_test.rb
277
- - test/scss_test.rb
278
- - test/server_test.rb
279
- - test/settings_test.rb
280
- - test/sinatra_test.rb
281
- - test/slim_test.rb
282
- - test/static_test.rb
283
- - test/streaming_test.rb
284
- - test/stylus_test.rb
285
- - test/templates_test.rb
286
- - test/textile_test.rb
287
- - test/wlang_test.rb
288
- - test/yajl_test.rb
153
+ test_files: []
154
+ has_rdoc:
@@ -1,17 +0,0 @@
1
- # This can be removed once rack/rack@2fd9df71 is released
2
- module Sinatra
3
- module Ext
4
- def self.get_handler(str)
5
- begin
6
- ::Object.const_get("Object", false)
7
- def self._const_get(str, inherit = true)
8
- Rack::Handler.const_get(str, inherit)
9
- end
10
- rescue
11
- def self._const_get(str, inherit = true)
12
- Rack::Handler.const_get(str)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,72 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- begin
4
- require 'asciidoctor'
5
-
6
- class AsciidoctorTest < Minitest::Test
7
- def asciidoc_app(&block)
8
- mock_app do
9
- set :views, File.dirname(__FILE__) + '/views'
10
- get('/', &block)
11
- end
12
- get '/'
13
- end
14
-
15
- it 'renders inline AsciiDoc strings' do
16
- asciidoc_app { asciidoc '== Hiya' }
17
- assert ok?
18
- assert_match %r{<h2.*?>Hiya</h2>}, body
19
- end
20
-
21
- it 'uses the correct engine' do
22
- engine = Tilt::AsciidoctorTemplate
23
- assert_equal engine, Tilt[:ad]
24
- assert_equal engine, Tilt[:adoc]
25
- assert_equal engine, Tilt[:asciidoc]
26
- end
27
-
28
- it 'renders .asciidoc files in views path' do
29
- asciidoc_app { asciidoc :hello }
30
- assert ok?
31
- assert_match %r{<h2.*?>Hello from AsciiDoc</h2>}, body
32
- end
33
-
34
- it 'raises error if template not found' do
35
- mock_app { get('/') { asciidoc :no_such_template } }
36
- assert_raises(Errno::ENOENT) { get('/') }
37
- end
38
-
39
- it 'renders with inline layouts' do
40
- mock_app do
41
- layout { 'THIS. IS. #{yield.upcase}!' }
42
- get('/') { asciidoc 'Sparta', :layout_engine => :str }
43
- end
44
- get '/'
45
- assert ok?
46
- assert_include body, 'THIS. IS.'
47
- assert_include body, '<P>SPARTA</P>'
48
- end
49
-
50
- it 'renders with file layouts' do
51
- asciidoc_app do
52
- asciidoc 'Hello World', :layout => :layout2, :layout_engine => :erb
53
- end
54
- assert ok?
55
- assert_include body, 'ERB Layout!'
56
- assert_include body, '<p>Hello World</p>'
57
- end
58
-
59
- it 'can be used in a nested fashion for partials and whatnot' do
60
- mock_app do
61
- template(:inner) { 'hi' }
62
- template(:outer) { '<outer><%= asciidoc :inner %></outer>' }
63
- get('/') { erb :outer }
64
- end
65
- get '/'
66
- assert ok?
67
- assert_match %r{<outer>.*<p.*?>hi</p>.*</outer>}m, body
68
- end
69
- end
70
- rescue LoadError
71
- warn "#{$!.to_s}: skipping asciidoc tests"
72
- end