sinatra-contrib 3.0.6 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/contrib/version.rb +1 -1
- data/lib/sinatra/contrib.rb +2 -0
- data/lib/sinatra/engine_tracking.rb +10 -0
- data/lib/sinatra/haml_helpers.rb +50 -0
- data/lib/sinatra/namespace.rb +2 -2
- data/lib/sinatra/respond_with.rb +1 -0
- data/lib/sinatra/runner.rb +1 -1
- data/sinatra-contrib.gemspec +2 -15
- metadata +14 -181
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03c164118c404e74ff0c1be0a36177ab2ab8b0409444fa71bc9a4297b4f08a6a
|
4
|
+
data.tar.gz: f55df9470405a33061f506b6dbc24641a85d0067d684d939bb69311e1d762c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4efe2c51cd24dfcacc0150f2d298edb7358de015fdb6ab37ca023d36df23fd6c08b1823f8d0c7b657306cc2f8a9a72ec440b9a69e87def6d7fc5ad32fa70def3
|
7
|
+
data.tar.gz: b04167f8e4d6532cc6bb118b3e18301cf008c0face2d833cfb596bd83c6080ea586867788f1d6ec2318e75d266cd11a7c892fc8a95f42b8483ba3ef29b1aa424
|
data/lib/sinatra/contrib.rb
CHANGED
@@ -27,6 +27,16 @@ module Sinatra
|
|
27
27
|
@current_engine == :haml
|
28
28
|
end
|
29
29
|
|
30
|
+
# @return [Boolean] Returns true if current engine is `:sass`.
|
31
|
+
def sass?
|
32
|
+
@current_engine == :sass
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Boolean] Returns true if current engine is `:scss`.
|
36
|
+
def scss?
|
37
|
+
@current_engine == :scss
|
38
|
+
end
|
39
|
+
|
30
40
|
# @return [Boolean] Returns true if current engine is `:builder`.
|
31
41
|
def builder?
|
32
42
|
@current_engine == :builder
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sinatra/base'
|
4
|
+
require 'sinatra/capture'
|
5
|
+
|
6
|
+
module Sinatra
|
7
|
+
# = Sinatra::HamlHelpers
|
8
|
+
#
|
9
|
+
# This extension provides some of the helper methods that existed in Haml 5
|
10
|
+
# but were removed in Haml 6. To use this in your app, just +register+ it:
|
11
|
+
#
|
12
|
+
# require 'sinatra/base'
|
13
|
+
# require 'sinatra/haml_helpers'
|
14
|
+
#
|
15
|
+
# class Application < Sinatra::Base
|
16
|
+
# register Sinatra::HamlHelpers
|
17
|
+
#
|
18
|
+
# # now you can use the helpers in your views
|
19
|
+
# get '/' do
|
20
|
+
# haml_code = <<~HAML
|
21
|
+
# %p
|
22
|
+
# != surround "(", ")" do
|
23
|
+
# %a{ href: "https://example.org/" } example.org
|
24
|
+
# HAML
|
25
|
+
# haml haml_code
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
module HamlHelpers
|
30
|
+
include Sinatra::Capture
|
31
|
+
|
32
|
+
def surround(front, back = front, &block)
|
33
|
+
"#{front}#{_capture_haml(&block).chomp}#{back}\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
def precede(str, &block)
|
37
|
+
"#{str}#{_capture_haml(&block).chomp}\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def succeed(str, &block)
|
41
|
+
"#{_capture_haml(&block).chomp}#{str}\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
def _capture_haml(*args, &block)
|
45
|
+
capture(*args, &block)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
helpers HamlHelpers
|
50
|
+
end
|
data/lib/sinatra/namespace.rb
CHANGED
@@ -210,7 +210,7 @@ module Sinatra
|
|
210
210
|
end
|
211
211
|
|
212
212
|
def template_cache
|
213
|
-
super.fetch(:nested, @namespace) {
|
213
|
+
super.fetch(:nested, @namespace) { TemplateCache.new }
|
214
214
|
end
|
215
215
|
|
216
216
|
def redirect_to(uri, *args)
|
@@ -229,7 +229,7 @@ module Sinatra
|
|
229
229
|
attr_reader :base, :templates
|
230
230
|
|
231
231
|
ALLOWED_ENGINES = %i[
|
232
|
-
erb erubi haml hamlit builder nokogiri
|
232
|
+
erb erubi haml hamlit builder nokogiri sass scss
|
233
233
|
liquid markdown rdoc asciidoc markaby
|
234
234
|
rabl slim yajl
|
235
235
|
]
|
data/lib/sinatra/respond_with.rb
CHANGED
data/lib/sinatra/runner.rb
CHANGED
data/sinatra-contrib.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.description = 'Collection of useful Sinatra extensions'
|
9
9
|
s.homepage = 'http://sinatrarb.com/contrib/'
|
10
10
|
s.license = 'MIT'
|
11
|
-
s.summary = s.description
|
11
|
+
s.summary = "#{s.description}."
|
12
12
|
s.authors = ['https://github.com/sinatra/sinatra/graphs/contributors']
|
13
13
|
s.email = 'sinatrarb@googlegroups.com'
|
14
14
|
s.files = Dir['lib/**/*.rb'] + [
|
@@ -37,22 +37,9 @@ RubyGems 2.0 or newer is required to protect against public gem pushes. You can
|
|
37
37
|
|
38
38
|
s.required_ruby_version = '>= 2.6.0'
|
39
39
|
|
40
|
-
s.add_dependency 'multi_json'
|
40
|
+
s.add_dependency 'multi_json', '>= 0.0.2'
|
41
41
|
s.add_dependency 'mustermann', '~> 3.0'
|
42
42
|
s.add_dependency 'rack-protection', version
|
43
43
|
s.add_dependency 'sinatra', version
|
44
44
|
s.add_dependency 'tilt', '~> 2.0'
|
45
|
-
|
46
|
-
s.add_development_dependency 'asciidoctor'
|
47
|
-
s.add_development_dependency 'builder'
|
48
|
-
s.add_development_dependency 'erubi'
|
49
|
-
s.add_development_dependency 'haml'
|
50
|
-
s.add_development_dependency 'liquid'
|
51
|
-
s.add_development_dependency 'markaby'
|
52
|
-
s.add_development_dependency 'nokogiri'
|
53
|
-
s.add_development_dependency 'rack-test', '~> 2'
|
54
|
-
s.add_development_dependency 'rake', '>= 12.3.3'
|
55
|
-
s.add_development_dependency 'redcarpet'
|
56
|
-
s.add_development_dependency 'rspec', '~> 3'
|
57
|
-
s.add_development_dependency 'slim'
|
58
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/sinatra/sinatra/graphs/contributors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.0.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.0.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mustermann
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.0
|
47
|
+
version: 3.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.0
|
54
|
+
version: 3.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sinatra
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.0
|
61
|
+
version: 3.2.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.0
|
68
|
+
version: 3.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tilt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,174 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: asciidoctor
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: builder
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: erubi
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: haml
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: liquid
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: markaby
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: nokogiri
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: rack-test
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - "~>"
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '2'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - "~>"
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '2'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: rake
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: 12.3.3
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: 12.3.3
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: redcarpet
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: rspec
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - "~>"
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '3'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - "~>"
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '3'
|
237
|
-
- !ruby/object:Gem::Dependency
|
238
|
-
name: slim
|
239
|
-
requirement: !ruby/object:Gem::Requirement
|
240
|
-
requirements:
|
241
|
-
- - ">="
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: '0'
|
244
|
-
type: :development
|
245
|
-
prerelease: false
|
246
|
-
version_requirements: !ruby/object:Gem::Requirement
|
247
|
-
requirements:
|
248
|
-
- - ">="
|
249
|
-
- !ruby/object:Gem::Version
|
250
|
-
version: '0'
|
251
83
|
description: Collection of useful Sinatra extensions
|
252
84
|
email: sinatrarb@googlegroups.com
|
253
85
|
executables: []
|
@@ -269,6 +101,7 @@ files:
|
|
269
101
|
- lib/sinatra/custom_logger.rb
|
270
102
|
- lib/sinatra/engine_tracking.rb
|
271
103
|
- lib/sinatra/extension.rb
|
104
|
+
- lib/sinatra/haml_helpers.rb
|
272
105
|
- lib/sinatra/json.rb
|
273
106
|
- lib/sinatra/link_header.rb
|
274
107
|
- lib/sinatra/multi_route.rb
|
@@ -290,7 +123,7 @@ metadata:
|
|
290
123
|
homepage_uri: http://sinatrarb.com/contrib/
|
291
124
|
documentation_uri: https://www.rubydoc.info/gems/sinatra-contrib
|
292
125
|
rubygems_mfa_required: 'true'
|
293
|
-
post_install_message:
|
126
|
+
post_install_message:
|
294
127
|
rdoc_options: []
|
295
128
|
require_paths:
|
296
129
|
- lib
|
@@ -305,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
138
|
- !ruby/object:Gem::Version
|
306
139
|
version: '0'
|
307
140
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
309
|
-
signing_key:
|
141
|
+
rubygems_version: 3.5.3
|
142
|
+
signing_key:
|
310
143
|
specification_version: 4
|
311
|
-
summary: Collection of useful Sinatra extensions
|
144
|
+
summary: Collection of useful Sinatra extensions.
|
312
145
|
test_files: []
|