sinatra 1.4.8 → 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 +5 -5
- data/AUTHORS.md +1 -0
- data/CHANGELOG.md +272 -54
- data/CONTRIBUTING.md +8 -8
- data/Gemfile +48 -47
- data/LICENSE +4 -1
- data/MAINTENANCE.md +42 -0
- data/README.de.md +651 -443
- data/README.es.md +738 -357
- data/README.fr.md +197 -100
- data/README.hu.md +40 -6
- data/README.ja.md +125 -67
- data/README.ko.md +15 -15
- data/README.malayalam.md +3141 -0
- data/README.md +592 -432
- data/README.pt-br.md +2362 -335
- data/README.pt-pt.md +5 -5
- data/README.ru.md +857 -608
- data/README.zh.md +91 -29
- data/Rakefile +77 -51
- data/SECURITY.md +35 -0
- data/VERSION +1 -0
- 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 +243 -265
- data/lib/sinatra/indifferent_hash.rb +200 -0
- data/lib/sinatra/main.rb +30 -10
- data/lib/sinatra/show_exceptions.rb +67 -62
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +44 -8
- metadata +43 -167
- data/lib/sinatra/ext.rb +0 -17
- data/test/asciidoctor_test.rb +0 -72
- data/test/base_test.rb +0 -167
- data/test/builder_test.rb +0 -91
- data/test/coffee_test.rb +0 -96
- data/test/compile_test.rb +0 -183
- data/test/contest.rb +0 -91
- data/test/creole_test.rb +0 -65
- data/test/delegator_test.rb +0 -160
- data/test/encoding_test.rb +0 -20
- data/test/erb_test.rb +0 -116
- data/test/extensions_test.rb +0 -98
- data/test/filter_test.rb +0 -487
- data/test/haml_test.rb +0 -109
- data/test/helper.rb +0 -132
- data/test/helpers_test.rb +0 -1917
- data/test/integration/app.rb +0 -79
- data/test/integration_helper.rb +0 -236
- data/test/integration_test.rb +0 -104
- data/test/less_test.rb +0 -69
- data/test/liquid_test.rb +0 -77
- data/test/mapped_error_test.rb +0 -285
- data/test/markaby_test.rb +0 -80
- data/test/markdown_test.rb +0 -85
- data/test/mediawiki_test.rb +0 -68
- data/test/middleware_test.rb +0 -68
- data/test/nokogiri_test.rb +0 -67
- data/test/public/favicon.ico +0 -0
- data/test/public/hello+world.txt +0 -1
- data/test/rabl_test.rb +0 -89
- data/test/rack_test.rb +0 -45
- data/test/radius_test.rb +0 -59
- data/test/rdoc_test.rb +0 -66
- data/test/readme_test.rb +0 -130
- data/test/request_test.rb +0 -100
- data/test/response_test.rb +0 -63
- data/test/result_test.rb +0 -76
- data/test/route_added_hook_test.rb +0 -59
- data/test/routing_test.rb +0 -1456
- data/test/sass_test.rb +0 -115
- data/test/scss_test.rb +0 -88
- data/test/server_test.rb +0 -56
- data/test/settings_test.rb +0 -582
- data/test/sinatra_test.rb +0 -12
- data/test/slim_test.rb +0 -102
- data/test/static_test.rb +0 -266
- data/test/streaming_test.rb +0 -149
- data/test/stylus_test.rb +0 -90
- data/test/templates_test.rb +0 -382
- data/test/textile_test.rb +0 -65
- data/test/views/a/in_a.str +0 -1
- data/test/views/ascii.erb +0 -2
- data/test/views/b/in_b.str +0 -1
- data/test/views/calc.html.erb +0 -1
- data/test/views/error.builder +0 -3
- data/test/views/error.erb +0 -3
- data/test/views/error.haml +0 -3
- data/test/views/error.sass +0 -2
- data/test/views/explicitly_nested.str +0 -1
- data/test/views/foo/hello.test +0 -1
- data/test/views/hello.asciidoc +0 -1
- data/test/views/hello.builder +0 -1
- data/test/views/hello.coffee +0 -1
- data/test/views/hello.creole +0 -1
- data/test/views/hello.erb +0 -1
- data/test/views/hello.haml +0 -1
- data/test/views/hello.less +0 -5
- data/test/views/hello.liquid +0 -1
- data/test/views/hello.mab +0 -1
- data/test/views/hello.md +0 -1
- data/test/views/hello.mediawiki +0 -1
- data/test/views/hello.nokogiri +0 -1
- data/test/views/hello.rabl +0 -2
- data/test/views/hello.radius +0 -1
- data/test/views/hello.rdoc +0 -1
- data/test/views/hello.sass +0 -2
- data/test/views/hello.scss +0 -3
- data/test/views/hello.slim +0 -1
- data/test/views/hello.str +0 -1
- data/test/views/hello.styl +0 -2
- data/test/views/hello.test +0 -1
- data/test/views/hello.textile +0 -1
- data/test/views/hello.wlang +0 -1
- data/test/views/hello.yajl +0 -1
- data/test/views/layout2.builder +0 -3
- data/test/views/layout2.erb +0 -2
- data/test/views/layout2.haml +0 -2
- data/test/views/layout2.liquid +0 -2
- data/test/views/layout2.mab +0 -2
- data/test/views/layout2.nokogiri +0 -3
- data/test/views/layout2.rabl +0 -3
- data/test/views/layout2.radius +0 -2
- data/test/views/layout2.slim +0 -3
- data/test/views/layout2.str +0 -2
- data/test/views/layout2.test +0 -1
- data/test/views/layout2.wlang +0 -2
- data/test/views/nested.str +0 -1
- data/test/views/utf8.erb +0 -2
- data/test/wlang_test.rb +0 -87
- data/test/yajl_test.rb +0 -86
@@ -0,0 +1,200 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
$stderr.puts <<EOF if !Hash.method_defined?(:slice) && !$LOAD_PATH.grep(%r{gems/activesupport}).empty? && ENV['SINATRA_ACTIVESUPPORT_WARNING'] != 'false'
|
3
|
+
WARNING: If you plan to load any of ActiveSupport's core extensions to Hash, be
|
4
|
+
sure to do so *before* loading Sinatra::Application or Sinatra::Base. If not,
|
5
|
+
you may disregard this warning.
|
6
|
+
|
7
|
+
Set SINATRA_ACTIVESUPPORT_WARNING=false in the environment to hide this warning.
|
8
|
+
EOF
|
9
|
+
|
10
|
+
module Sinatra
|
11
|
+
# A poor man's ActiveSupport::HashWithIndifferentAccess, with all the Rails-y
|
12
|
+
# stuff removed.
|
13
|
+
#
|
14
|
+
# Implements a hash where keys <tt>:foo</tt> and <tt>"foo"</tt> are
|
15
|
+
# considered to be the same.
|
16
|
+
#
|
17
|
+
# rgb = Sinatra::IndifferentHash.new
|
18
|
+
#
|
19
|
+
# rgb[:black] = '#000000' # symbol assignment
|
20
|
+
# rgb[:black] # => '#000000' # symbol retrieval
|
21
|
+
# rgb['black'] # => '#000000' # string retrieval
|
22
|
+
#
|
23
|
+
# rgb['white'] = '#FFFFFF' # string assignment
|
24
|
+
# rgb[:white] # => '#FFFFFF' # symbol retrieval
|
25
|
+
# rgb['white'] # => '#FFFFFF' # string retrieval
|
26
|
+
#
|
27
|
+
# Internally, symbols are mapped to strings when used as keys in the entire
|
28
|
+
# writing interface (calling e.g. <tt>[]=</tt>, <tt>merge</tt>). This mapping
|
29
|
+
# belongs to the public interface. For example, given:
|
30
|
+
#
|
31
|
+
# hash = Sinatra::IndifferentHash.new(:a=>1)
|
32
|
+
#
|
33
|
+
# You are guaranteed that the key is returned as a string:
|
34
|
+
#
|
35
|
+
# hash.keys # => ["a"]
|
36
|
+
#
|
37
|
+
# Technically other types of keys are accepted:
|
38
|
+
#
|
39
|
+
# hash = Sinatra::IndifferentHash.new(:a=>1)
|
40
|
+
# hash[0] = 0
|
41
|
+
# hash # => { "a"=>1, 0=>0 }
|
42
|
+
#
|
43
|
+
# But this class is intended for use cases where strings or symbols are the
|
44
|
+
# expected keys and it is convenient to understand both as the same. For
|
45
|
+
# example the +params+ hash in Sinatra.
|
46
|
+
class IndifferentHash < Hash
|
47
|
+
def self.[](*args)
|
48
|
+
new.merge!(Hash[*args])
|
49
|
+
end
|
50
|
+
|
51
|
+
def initialize(*args)
|
52
|
+
args.map!(&method(:convert_value))
|
53
|
+
|
54
|
+
super(*args)
|
55
|
+
end
|
56
|
+
|
57
|
+
def default(*args)
|
58
|
+
args.map!(&method(:convert_key))
|
59
|
+
|
60
|
+
super(*args)
|
61
|
+
end
|
62
|
+
|
63
|
+
def default=(value)
|
64
|
+
super(convert_value(value))
|
65
|
+
end
|
66
|
+
|
67
|
+
def assoc(key)
|
68
|
+
super(convert_key(key))
|
69
|
+
end
|
70
|
+
|
71
|
+
def rassoc(value)
|
72
|
+
super(convert_value(value))
|
73
|
+
end
|
74
|
+
|
75
|
+
def fetch(key, *args)
|
76
|
+
args.map!(&method(:convert_value))
|
77
|
+
|
78
|
+
super(convert_key(key), *args)
|
79
|
+
end
|
80
|
+
|
81
|
+
def [](key)
|
82
|
+
super(convert_key(key))
|
83
|
+
end
|
84
|
+
|
85
|
+
def []=(key, value)
|
86
|
+
super(convert_key(key), convert_value(value))
|
87
|
+
end
|
88
|
+
|
89
|
+
alias_method :store, :[]=
|
90
|
+
|
91
|
+
def key(value)
|
92
|
+
super(convert_value(value))
|
93
|
+
end
|
94
|
+
|
95
|
+
def key?(key)
|
96
|
+
super(convert_key(key))
|
97
|
+
end
|
98
|
+
|
99
|
+
alias_method :has_key?, :key?
|
100
|
+
alias_method :include?, :key?
|
101
|
+
alias_method :member?, :key?
|
102
|
+
|
103
|
+
def value?(value)
|
104
|
+
super(convert_value(value))
|
105
|
+
end
|
106
|
+
|
107
|
+
alias_method :has_value?, :value?
|
108
|
+
|
109
|
+
def delete(key)
|
110
|
+
super(convert_key(key))
|
111
|
+
end
|
112
|
+
|
113
|
+
def dig(key, *other_keys)
|
114
|
+
super(convert_key(key), *other_keys)
|
115
|
+
end if method_defined?(:dig) # Added in Ruby 2.3
|
116
|
+
|
117
|
+
def fetch_values(*keys)
|
118
|
+
keys.map!(&method(:convert_key))
|
119
|
+
|
120
|
+
super(*keys)
|
121
|
+
end if method_defined?(:fetch_values) # Added in Ruby 2.3
|
122
|
+
|
123
|
+
def slice(*keys)
|
124
|
+
keys.map!(&method(:convert_key))
|
125
|
+
|
126
|
+
self.class[super(*keys)]
|
127
|
+
end if method_defined?(:slice) # Added in Ruby 2.5
|
128
|
+
|
129
|
+
def values_at(*keys)
|
130
|
+
keys.map!(&method(:convert_key))
|
131
|
+
|
132
|
+
super(*keys)
|
133
|
+
end
|
134
|
+
|
135
|
+
def merge!(*other_hashes)
|
136
|
+
other_hashes.each do |other_hash|
|
137
|
+
if other_hash.is_a?(self.class)
|
138
|
+
super(other_hash)
|
139
|
+
else
|
140
|
+
other_hash.each_pair do |key, value|
|
141
|
+
key = convert_key(key)
|
142
|
+
value = yield(key, self[key], value) if block_given? && key?(key)
|
143
|
+
self[key] = convert_value(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
self
|
149
|
+
end
|
150
|
+
|
151
|
+
alias_method :update, :merge!
|
152
|
+
|
153
|
+
def merge(*other_hashes, &block)
|
154
|
+
dup.merge!(*other_hashes, &block)
|
155
|
+
end
|
156
|
+
|
157
|
+
def replace(other_hash)
|
158
|
+
super(other_hash.is_a?(self.class) ? other_hash : self.class[other_hash])
|
159
|
+
end
|
160
|
+
|
161
|
+
if method_defined?(:transform_values!) # Added in Ruby 2.4
|
162
|
+
def transform_values(&block)
|
163
|
+
dup.transform_values!(&block)
|
164
|
+
end
|
165
|
+
|
166
|
+
def transform_values!
|
167
|
+
super
|
168
|
+
super(&method(:convert_value))
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
if method_defined?(:transform_keys!) # Added in Ruby 2.5
|
173
|
+
def transform_keys(&block)
|
174
|
+
dup.transform_keys!(&block)
|
175
|
+
end
|
176
|
+
|
177
|
+
def transform_keys!
|
178
|
+
super
|
179
|
+
super(&method(:convert_key))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
private
|
184
|
+
|
185
|
+
def convert_key(key)
|
186
|
+
key.is_a?(Symbol) ? key.to_s : key
|
187
|
+
end
|
188
|
+
|
189
|
+
def convert_value(value)
|
190
|
+
case value
|
191
|
+
when Hash
|
192
|
+
value.is_a?(self.class) ? value : self.class[value]
|
193
|
+
when Array
|
194
|
+
value.map(&method(:convert_value))
|
195
|
+
else
|
196
|
+
value
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
data/lib/sinatra/main.rb
CHANGED
@@ -1,6 +1,30 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
|
3
1
|
module Sinatra
|
2
|
+
ParamsConfig = {}
|
3
|
+
|
4
|
+
if ARGV.any?
|
5
|
+
require 'optparse'
|
6
|
+
parser = OptionParser.new { |op|
|
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
|
+
ENV['RACK_ENV'] = val
|
13
|
+
ParamsConfig[:environment] = val.to_sym
|
14
|
+
end
|
15
|
+
op.on('-o addr', "set the host (default is (env == 'development' ? 'localhost' : '0.0.0.0'))") do |val|
|
16
|
+
ParamsConfig[:bind] = val
|
17
|
+
end
|
18
|
+
}
|
19
|
+
begin
|
20
|
+
parser.parse!(ARGV.dup)
|
21
|
+
rescue => evar
|
22
|
+
ParamsConfig[:optparse_error] = evar
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'sinatra/base'
|
27
|
+
|
4
28
|
class Application < Base
|
5
29
|
|
6
30
|
# we assume that the first file that requires 'sinatra' is the
|
@@ -11,17 +35,13 @@ module Sinatra
|
|
11
35
|
set :run, Proc.new { File.expand_path($0) == File.expand_path(app_file) }
|
12
36
|
|
13
37
|
if run? && ARGV.any?
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
op.on('-o addr', "set the host (default is #{bind})") { |val| set :bind, val }
|
18
|
-
op.on('-e env', 'set the environment (default is development)') { |val| set :environment, val.to_sym }
|
19
|
-
op.on('-s server', 'specify rack server/handler (default is thin)') { |val| set :server, val }
|
20
|
-
op.on('-x', 'turn on the mutex lock (default is off)') { set :lock, true }
|
21
|
-
}.parse!(ARGV.dup)
|
38
|
+
error = ParamsConfig.delete(:optparse_error)
|
39
|
+
raise error if error
|
40
|
+
ParamsConfig.each { |k, v| set k, v }
|
22
41
|
end
|
23
42
|
end
|
24
43
|
|
44
|
+
remove_const(:ParamsConfig)
|
25
45
|
at_exit { Application.run! if $!.nil? && Application.run? }
|
26
46
|
end
|
27
47
|
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
@@ -17,8 +15,7 @@ module Sinatra
|
|
17
15
|
def @@eats_errors.puts(*) end
|
18
16
|
|
19
17
|
def initialize(app)
|
20
|
-
@app
|
21
|
-
@template = ERB.new(TEMPLATE)
|
18
|
+
@app = app
|
22
19
|
end
|
23
20
|
|
24
21
|
def call(env)
|
@@ -28,47 +25,51 @@ module Sinatra
|
|
28
25
|
|
29
26
|
if prefers_plain_text?(env)
|
30
27
|
content_type = "text/plain"
|
31
|
-
|
28
|
+
body = dump_exception(e)
|
32
29
|
else
|
33
30
|
content_type = "text/html"
|
34
|
-
|
31
|
+
body = pretty(env, e)
|
35
32
|
end
|
36
33
|
|
37
34
|
env["rack.errors"] = errors
|
38
35
|
|
39
|
-
# Post 893a2c50 in rack/rack, the #pretty method above, implemented in
|
40
|
-
# Rack::ShowExceptions, returns a String instead of an array.
|
41
|
-
body = Array(exception)
|
42
|
-
|
43
36
|
[
|
44
37
|
500,
|
45
38
|
{
|
46
39
|
"Content-Type" => content_type,
|
47
|
-
"Content-Length" =>
|
40
|
+
"Content-Length" => body.bytesize.to_s
|
48
41
|
},
|
49
|
-
body
|
42
|
+
[body]
|
50
43
|
]
|
51
44
|
end
|
52
45
|
|
46
|
+
def template
|
47
|
+
TEMPLATE
|
48
|
+
end
|
49
|
+
|
53
50
|
private
|
54
51
|
|
52
|
+
def bad_request?(e)
|
53
|
+
Sinatra::BadRequest === e
|
54
|
+
end
|
55
|
+
|
55
56
|
def prefers_plain_text?(env)
|
56
57
|
!(Request.new(env).preferred_type("text/plain","text/html") == "text/html") &&
|
57
|
-
[/curl/].index{|item| item =~ env["HTTP_USER_AGENT"]}
|
58
|
+
[/curl/].index { |item| item =~ env["HTTP_USER_AGENT"] }
|
58
59
|
end
|
59
60
|
|
60
61
|
def frame_class(frame)
|
61
|
-
if frame.filename =~ /
|
62
|
+
if frame.filename =~ %r{lib/sinatra.*\.rb}
|
62
63
|
"framework"
|
63
64
|
elsif (defined?(Gem) && frame.filename.include?(Gem.dir)) ||
|
64
|
-
frame.filename =~
|
65
|
+
frame.filename =~ %r{/bin/(\w+)\z}
|
65
66
|
"system"
|
66
67
|
else
|
67
68
|
"app"
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
|
-
TEMPLATE = <<-HTML # :nodoc:
|
72
|
+
TEMPLATE = ERB.new <<-HTML # :nodoc:
|
72
73
|
<!DOCTYPE html>
|
73
74
|
<html>
|
74
75
|
<head>
|
@@ -213,8 +214,10 @@ TEMPLATE = <<-HTML # :nodoc:
|
|
213
214
|
<p><a href="#" id="expando"
|
214
215
|
onclick="toggleBacktrace(); return false">(expand)</a></p>
|
215
216
|
<p id="nav"><strong>JUMP TO:</strong>
|
216
|
-
|
217
|
-
|
217
|
+
<% unless bad_request?(exception) %>
|
218
|
+
<a href="#get-info">GET</a>
|
219
|
+
<a href="#post-info">POST</a>
|
220
|
+
<% end %>
|
218
221
|
<a href="#cookie-info">COOKIES</a>
|
219
222
|
<a href="#env-info">ENV</a>
|
220
223
|
</p>
|
@@ -267,47 +270,49 @@ TEMPLATE = <<-HTML # :nodoc:
|
|
267
270
|
</ul>
|
268
271
|
</div> <!-- /BACKTRACE -->
|
269
272
|
|
270
|
-
|
271
|
-
<
|
272
|
-
|
273
|
-
|
274
|
-
<
|
275
|
-
<
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
<
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
<
|
293
|
-
|
294
|
-
|
295
|
-
<
|
296
|
-
<
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
<
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
273
|
+
<% unless bad_request?(exception) %>
|
274
|
+
<div id="get">
|
275
|
+
<h3 id="get-info">GET</h3>
|
276
|
+
<% if req.GET and not req.GET.empty? %>
|
277
|
+
<table class="req">
|
278
|
+
<tr>
|
279
|
+
<th>Variable</th>
|
280
|
+
<th>Value</th>
|
281
|
+
</tr>
|
282
|
+
<% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
283
|
+
<tr>
|
284
|
+
<td><%=h key %></td>
|
285
|
+
<td class="code"><div><%=h val.inspect %></div></td>
|
286
|
+
</tr>
|
287
|
+
<% } %>
|
288
|
+
</table>
|
289
|
+
<% else %>
|
290
|
+
<p class="no-data">No GET data.</p>
|
291
|
+
<% end %>
|
292
|
+
<div class="clear"></div>
|
293
|
+
</div> <!-- /GET -->
|
294
|
+
|
295
|
+
<div id="post">
|
296
|
+
<h3 id="post-info">POST</h3>
|
297
|
+
<% if req.POST and not req.POST.empty? %>
|
298
|
+
<table class="req">
|
299
|
+
<tr>
|
300
|
+
<th>Variable</th>
|
301
|
+
<th>Value</th>
|
302
|
+
</tr>
|
303
|
+
<% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
304
|
+
<tr>
|
305
|
+
<td><%=h key %></td>
|
306
|
+
<td class="code"><div><%=h val.inspect %></div></td>
|
307
|
+
</tr>
|
308
|
+
<% } %>
|
309
|
+
</table>
|
310
|
+
<% else %>
|
311
|
+
<p class="no-data">No POST data.</p>
|
312
|
+
<% end %>
|
313
|
+
<div class="clear"></div>
|
314
|
+
</div> <!-- /POST -->
|
315
|
+
<% end %>
|
311
316
|
|
312
317
|
<div id="cookies">
|
313
318
|
<h3 id="cookie-info">COOKIES</h3>
|
data/lib/sinatra/version.rb
CHANGED
data/sinatra.gemspec
CHANGED
@@ -1,19 +1,55 @@
|
|
1
|
-
|
2
|
-
require 'sinatra/version'
|
1
|
+
version = File.read(File.expand_path("../VERSION", __FILE__)).strip
|
3
2
|
|
4
|
-
Gem::Specification.new 'sinatra',
|
3
|
+
Gem::Specification.new 'sinatra', version do |s|
|
5
4
|
s.description = "Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort."
|
6
5
|
s.summary = "Classy web-development dressed in a DSL"
|
7
6
|
s.authors = ["Blake Mizerany", "Ryan Tomayko", "Simon Rozet", "Konstantin Haase"]
|
8
7
|
s.email = "sinatrarb@googlegroups.com"
|
9
|
-
s.homepage = "http://
|
8
|
+
s.homepage = "http://sinatrarb.com/"
|
10
9
|
s.license = 'MIT'
|
11
|
-
s.files =
|
10
|
+
s.files = Dir['README*.md', 'lib/**/*', 'examples/*'] + [
|
11
|
+
".yardopts",
|
12
|
+
"AUTHORS.md",
|
13
|
+
"CHANGELOG.md",
|
14
|
+
"CONTRIBUTING.md",
|
15
|
+
"Gemfile",
|
16
|
+
"LICENSE",
|
17
|
+
"MAINTENANCE.md",
|
18
|
+
"Rakefile",
|
19
|
+
"SECURITY.md",
|
20
|
+
"sinatra.gemspec",
|
21
|
+
"VERSION"]
|
12
22
|
s.test_files = s.files.select { |p| p =~ /^test\/.*_test.rb/ }
|
13
23
|
s.extra_rdoc_files = s.files.select { |p| p =~ /^README/ } << 'LICENSE'
|
14
24
|
s.rdoc_options = %w[--line-numbers --inline-source --title Sinatra --main README.rdoc --encoding=UTF-8]
|
15
25
|
|
16
|
-
s.
|
17
|
-
|
18
|
-
|
26
|
+
if s.respond_to?(:metadata)
|
27
|
+
s.metadata = {
|
28
|
+
'source_code_uri' => 'https://github.com/sinatra/sinatra',
|
29
|
+
'changelog_uri' => 'https://github.com/sinatra/sinatra/blob/master/CHANGELOG.md',
|
30
|
+
'homepage_uri' => 'http://sinatrarb.com/',
|
31
|
+
'bug_tracker_uri' => 'https://github.com/sinatra/sinatra/issues',
|
32
|
+
'mailing_list_uri' => 'http://groups.google.com/group/sinatrarb',
|
33
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/sinatra'
|
34
|
+
}
|
35
|
+
else
|
36
|
+
msg = "RubyGems 2.0 or newer is required to protect against public "\
|
37
|
+
"gem pushes. You can update your rubygems version by running:\n\n"\
|
38
|
+
"gem install rubygems-update\n"\
|
39
|
+
"update_rubygems\n"\
|
40
|
+
"gem update --system"
|
41
|
+
raise <<-EOF
|
42
|
+
RubyGems 2.0 or newer is required to protect against public gem pushes. You can update your rubygems version by running:
|
43
|
+
gem install rubygems-update
|
44
|
+
update_rubygems:
|
45
|
+
gem update --system
|
46
|
+
EOF
|
47
|
+
end
|
48
|
+
|
49
|
+
s.required_ruby_version = '>= 2.3.0'
|
50
|
+
|
51
|
+
s.add_dependency 'rack', '~> 2.2'
|
52
|
+
s.add_dependency 'tilt', '~> 2.0'
|
53
|
+
s.add_dependency 'rack-protection', version
|
54
|
+
s.add_dependency 'mustermann', '~> 1.0'
|
19
55
|
end
|