sinatra 2.0.8.1 → 2.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/Gemfile +2 -1
- data/README.de.md +3 -3
- data/README.es.md +3 -3
- data/README.fr.md +182 -85
- data/README.hu.md +3 -3
- data/README.ja.md +1 -1
- data/README.ko.md +1 -1
- data/README.md +67 -34
- data/README.pt-br.md +1 -1
- data/README.pt-pt.md +3 -3
- data/README.ru.md +3 -3
- data/README.zh.md +1 -1
- data/VERSION +1 -1
- data/examples/chat.rb +2 -1
- data/examples/rainbows.conf +3 -0
- data/examples/rainbows.rb +20 -0
- data/examples/stream.ru +4 -4
- data/lib/sinatra/base.rb +73 -33
- data/lib/sinatra/main.rb +5 -5
- data/lib/sinatra/show_exceptions.rb +2 -37
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +2 -2
- metadata +10 -9
data/lib/sinatra/main.rb
CHANGED
@@ -4,11 +4,11 @@ module Sinatra
|
|
4
4
|
if ARGV.any?
|
5
5
|
require 'optparse'
|
6
6
|
parser = OptionParser.new { |op|
|
7
|
-
op.on('-p port', 'set the port (default is 4567)')
|
8
|
-
op.on('-s server', 'specify rack server/handler
|
9
|
-
op.on('-q', 'turn on quiet mode (default is off)')
|
10
|
-
op.on('-x', 'turn on the mutex lock (default is off)')
|
11
|
-
op.on('-e env', 'set the environment (default is development)')
|
7
|
+
op.on('-p port', 'set the port (default is 4567)') { |val| ParamsConfig[:port] = Integer(val) }
|
8
|
+
op.on('-s server', 'specify rack server/handler') { |val| ParamsConfig[:server] = val }
|
9
|
+
op.on('-q', 'turn on quiet mode (default is off)') { ParamsConfig[:quiet] = true }
|
10
|
+
op.on('-x', 'turn on the mutex lock (default is off)') { ParamsConfig[:lock] = true }
|
11
|
+
op.on('-e env', 'set the environment (default is development)') do |val|
|
12
12
|
ENV['RACK_ENV'] = val
|
13
13
|
ParamsConfig[:environment] = val.to_sym
|
14
14
|
end
|
@@ -43,43 +43,8 @@ module Sinatra
|
|
43
43
|
]
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
# in the future.
|
49
|
-
def pretty(env, exception)
|
50
|
-
req = Rack::Request.new(env)
|
51
|
-
|
52
|
-
# This double assignment is to prevent an "unused variable" warning on
|
53
|
-
# Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
|
54
|
-
path = path = (req.script_name + req.path_info).squeeze("/")
|
55
|
-
|
56
|
-
# This double assignment is to prevent an "unused variable" warning on
|
57
|
-
# Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
|
58
|
-
frames = frames = exception.backtrace.map { |line|
|
59
|
-
frame = OpenStruct.new
|
60
|
-
if line =~ /(.*?):(\d+)(:in `(.*)')?/
|
61
|
-
frame.filename = $1
|
62
|
-
frame.lineno = $2.to_i
|
63
|
-
frame.function = $4
|
64
|
-
|
65
|
-
begin
|
66
|
-
lineno = frame.lineno-1
|
67
|
-
lines = ::File.readlines(frame.filename)
|
68
|
-
frame.pre_context_lineno = [lineno-CONTEXT, 0].max
|
69
|
-
frame.pre_context = lines[frame.pre_context_lineno...lineno]
|
70
|
-
frame.context_line = lines[lineno].chomp
|
71
|
-
frame.post_context_lineno = [lineno+CONTEXT, lines.size].min
|
72
|
-
frame.post_context = lines[lineno+1..frame.post_context_lineno]
|
73
|
-
rescue
|
74
|
-
end
|
75
|
-
|
76
|
-
frame
|
77
|
-
else
|
78
|
-
nil
|
79
|
-
end
|
80
|
-
}.compact
|
81
|
-
|
82
|
-
TEMPLATE.result(binding)
|
46
|
+
def template
|
47
|
+
TEMPLATE
|
83
48
|
end
|
84
49
|
|
85
50
|
private
|
data/lib/sinatra/version.rb
CHANGED
data/sinatra.gemspec
CHANGED
@@ -46,9 +46,9 @@ RubyGems 2.0 or newer is required to protect against public gem pushes. You can
|
|
46
46
|
EOF
|
47
47
|
end
|
48
48
|
|
49
|
-
s.required_ruby_version = '>= 2.
|
49
|
+
s.required_ruby_version = '>= 2.3.0'
|
50
50
|
|
51
|
-
s.add_dependency 'rack', '~> 2.
|
51
|
+
s.add_dependency 'rack', '~> 2.2'
|
52
52
|
s.add_dependency 'tilt', '~> 2.0'
|
53
53
|
s.add_dependency 'rack-protection', version
|
54
54
|
s.add_dependency 'mustermann', '~> 1.0'
|
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: 2.0
|
4
|
+
version: 2.1.0
|
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: 2020-
|
14
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '2.
|
22
|
+
version: '2.2'
|
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: '2.
|
29
|
+
version: '2.2'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: tilt
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,14 +47,14 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2.0
|
50
|
+
version: 2.1.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 2.0
|
57
|
+
version: 2.1.0
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mustermann
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +112,8 @@ files:
|
|
112
112
|
- SECURITY.md
|
113
113
|
- VERSION
|
114
114
|
- examples/chat.rb
|
115
|
+
- examples/rainbows.conf
|
116
|
+
- examples/rainbows.rb
|
115
117
|
- examples/simple.rb
|
116
118
|
- examples/stream.ru
|
117
119
|
- lib/sinatra.rb
|
@@ -148,15 +150,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
150
|
requirements:
|
149
151
|
- - ">="
|
150
152
|
- !ruby/object:Gem::Version
|
151
|
-
version: 2.
|
153
|
+
version: 2.3.0
|
152
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
155
|
requirements:
|
154
156
|
- - ">="
|
155
157
|
- !ruby/object:Gem::Version
|
156
158
|
version: '0'
|
157
159
|
requirements: []
|
158
|
-
|
159
|
-
rubygems_version: 2.7.3
|
160
|
+
rubygems_version: 3.1.2
|
160
161
|
signing_key:
|
161
162
|
specification_version: 4
|
162
163
|
summary: Classy web-development dressed in a DSL
|