rack-server-pages 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/lint.yml +15 -0
- data/.github/workflows/test.yml +37 -0
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +305 -29
- data/CHANGES.md +13 -3
- data/Gemfile +11 -5
- data/README.md +1 -1
- data/lib/rack/server_pages.rb +4 -6
- data/lib/rack-server-pages/version.rb +1 -1
- data/public/folder/sample.erb +14 -0
- data/public/folder/special-sub.folder-@/sample.erb +14 -0
- data/public/folder/subfolder/(sub-folder)/sample-in-sub-folder.extension.erb +14 -0
- data/public/folder/subfolder/sample.erb +14 -0
- data/public/folder//320/277/320/276-/321/200/321/203/321/201/321/201/320/272/320/270//320/277/321/200/320/270/320/274/320/265/321/200.erb +14 -0
- data/public/index.html +12 -6
- data/public/info.php +89 -1
- data/rack-server-pages.gemspec +3 -4
- metadata +14 -16
- data/.travis.yml +0 -12
- data/lib/rack/server_pages/php_helper.rb +0 -91
- data/spec/integration_spec.rb +0 -34
- data/spec/lib/rack/server_pages_spec.rb +0 -101
- data/spec/spec_helper.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: abd39cdf92e58b58b6b5fe1d8ad5a19e3f971d83877d05526c7c9c724f2a24e3
|
4
|
+
data.tar.gz: 821cd0ad12aac479c687ae02b137a174919a463635422e74e996753c39045cc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db9d93a3135dc78b280365dc0bc6a84f15db54ac5eb5dcb292235f0ee1280f4268e6372817c868559533af4ecd696a015524c4f0b7880407d7ef2404aa4ce98a
|
7
|
+
data.tar.gz: 5698f4861e5dd6927df4b980f8a1bff9f5aa428b66b8136972f1ab739b45e424de74eb6a47e76738e8310720852448612c8826e6ec42ef2abd0b36690bb85a29
|
@@ -0,0 +1,15 @@
|
|
1
|
+
name: lint
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
rubocop:
|
5
|
+
name: RuboCop
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- name: Checkout
|
9
|
+
uses: actions/checkout@v3
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: "3.2"
|
14
|
+
bundler-cache: true
|
15
|
+
- run: bundle exec rubocop
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
name: test
|
3
|
+
on: [push, pull_request]
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
name: test (ruby=${{ matrix.ruby-version }}, rack=${{ matrix.rack-version }})
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
rack-version:
|
12
|
+
- "~> 2"
|
13
|
+
- "~> 3"
|
14
|
+
ruby-version:
|
15
|
+
- "3.3"
|
16
|
+
- "3.2"
|
17
|
+
- "3.1"
|
18
|
+
- "3.0"
|
19
|
+
env:
|
20
|
+
RACK_VERSION: ${{ matrix.rack-version }}
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v4
|
23
|
+
- uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby-version }}
|
26
|
+
bundler-cache: true
|
27
|
+
- run: bundle show | grep rack
|
28
|
+
- uses: browser-actions/setup-firefox@latest
|
29
|
+
with:
|
30
|
+
firefox-version: "108.0"
|
31
|
+
- uses: browser-actions/setup-geckodriver@latest
|
32
|
+
with:
|
33
|
+
geckodriver-version: "0.34.0"
|
34
|
+
- uses: GabrielBB/xvfb-action@v1
|
35
|
+
with:
|
36
|
+
run: |
|
37
|
+
bundle exec rake spec
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,60 +1,229 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-10-19 14:31:39 UTC using RuboCop version 1.67.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 5
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
|
+
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
13
|
+
Bundler/OrderedGems:
|
14
|
+
Exclude:
|
15
|
+
- 'Gemfile'
|
16
|
+
|
17
|
+
# Offense count: 9
|
18
|
+
# Configuration parameters: EnforcedStyle.
|
19
|
+
# SupportedStyles: link_or_button, strict
|
20
|
+
Capybara/ClickLinkOrButtonStyle:
|
21
|
+
Exclude:
|
22
|
+
- 'spec/integration_spec.rb'
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# This cop supports safe autocorrection (--autocorrect).
|
26
|
+
# Configuration parameters: Severity, Include.
|
27
|
+
# Include: **/*.gemspec
|
28
|
+
Gemspec/DeprecatedAttributeAssignment:
|
29
|
+
Exclude:
|
30
|
+
- 'rack-server-pages.gemspec'
|
31
|
+
|
32
|
+
# Offense count: 1
|
33
|
+
# This cop supports safe autocorrection (--autocorrect).
|
34
|
+
# Configuration parameters: Severity, Include.
|
35
|
+
# Include: **/*.gemspec
|
36
|
+
Gemspec/RequireMFA:
|
37
|
+
Exclude:
|
38
|
+
- 'rack-server-pages.gemspec'
|
39
|
+
|
40
|
+
# Offense count: 1
|
41
|
+
# Configuration parameters: Severity, Include.
|
42
|
+
# Include: **/*.gemspec
|
43
|
+
Gemspec/RequiredRubyVersion:
|
44
|
+
Exclude:
|
45
|
+
- 'rack-server-pages.gemspec'
|
46
|
+
|
47
|
+
# Offense count: 1
|
48
|
+
# This cop supports safe autocorrection (--autocorrect).
|
49
|
+
Layout/EmptyLineAfterGuardClause:
|
50
|
+
Exclude:
|
51
|
+
- 'lib/rack/server_pages.rb'
|
52
|
+
|
53
|
+
# Offense count: 4
|
54
|
+
# This cop supports safe autocorrection (--autocorrect).
|
55
|
+
Layout/EmptyLineAfterMagicComment:
|
56
|
+
Exclude:
|
57
|
+
- 'config.ru'
|
58
|
+
- 'lib/rack/server_pages.rb'
|
59
|
+
- 'rack-server-pages.gemspec'
|
60
|
+
- 'spec/spec_helper.rb'
|
61
|
+
|
62
|
+
# Offense count: 2
|
63
|
+
# This cop supports safe autocorrection (--autocorrect).
|
64
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
65
|
+
Lint/AmbiguousBlockAssociation:
|
66
|
+
Exclude:
|
67
|
+
- 'config.ru'
|
68
|
+
- 'lib/rack/server_pages.rb'
|
69
|
+
|
9
70
|
# Offense count: 1
|
71
|
+
# This cop supports safe autocorrection (--autocorrect).
|
10
72
|
Lint/AmbiguousRegexpLiteral:
|
11
73
|
Exclude:
|
12
74
|
- 'spec/spec_helper.rb'
|
13
75
|
|
14
76
|
# Offense count: 1
|
77
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
15
78
|
# Configuration parameters: AllowSafeAssignment.
|
16
79
|
Lint/AssignmentInCondition:
|
17
80
|
Exclude:
|
18
81
|
- 'lib/rack/server_pages.rb'
|
19
82
|
|
20
83
|
# Offense count: 1
|
21
|
-
|
84
|
+
# Configuration parameters: AllowComments, AllowNil.
|
85
|
+
Lint/SuppressedException:
|
22
86
|
Exclude:
|
23
87
|
- 'spec/lib/rack/server_pages_spec.rb'
|
24
88
|
|
25
|
-
# Offense count: 1
|
26
|
-
Lint/UselessAssignment:
|
27
|
-
Exclude:
|
28
|
-
- 'lib/rack/server_pages.rb'
|
29
|
-
|
30
89
|
# Offense count: 2
|
90
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
31
91
|
Metrics/AbcSize:
|
32
|
-
Max:
|
92
|
+
Max: 21
|
33
93
|
|
34
94
|
# Offense count: 1
|
35
|
-
# Configuration parameters: CountComments.
|
95
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
96
|
+
# AllowedMethods: refine
|
36
97
|
Metrics/BlockLength:
|
37
|
-
Max:
|
38
|
-
|
39
|
-
# Offense count: 20
|
40
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
|
41
|
-
# URISchemes: http, https
|
42
|
-
Metrics/LineLength:
|
43
|
-
Max: 113
|
98
|
+
Max: 35
|
44
99
|
|
45
100
|
# Offense count: 3
|
46
|
-
# Configuration parameters: CountComments.
|
101
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
47
102
|
Metrics/MethodLength:
|
48
103
|
Max: 85
|
49
104
|
|
50
105
|
# Offense count: 1
|
51
|
-
# Configuration parameters:
|
106
|
+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
107
|
+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
108
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
109
|
+
Naming/FileName:
|
110
|
+
Exclude:
|
111
|
+
- 'Rakefile.rb'
|
112
|
+
- 'lib/rack-server-pages.rb'
|
113
|
+
|
114
|
+
# Offense count: 1
|
115
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
116
|
+
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
117
|
+
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
118
|
+
Naming/MemoizedInstanceVariableName:
|
119
|
+
Exclude:
|
120
|
+
- 'spec/spec_helper.rb'
|
121
|
+
|
122
|
+
# Offense count: 12
|
123
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
124
|
+
# Prefixes: when, with, without
|
125
|
+
RSpec/ContextWording:
|
126
|
+
Exclude:
|
127
|
+
- 'spec/integration_spec.rb'
|
128
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
129
|
+
- 'spec/spec_helper.rb'
|
130
|
+
|
131
|
+
# Offense count: 2
|
132
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
133
|
+
# Configuration parameters: AutoCorrect.
|
134
|
+
RSpec/EmptyExampleGroup:
|
135
|
+
Exclude:
|
136
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
137
|
+
|
138
|
+
# Offense count: 9
|
139
|
+
# This cop supports safe autocorrection (--autocorrect).
|
140
|
+
# Configuration parameters: AllowConsecutiveOneLiners.
|
141
|
+
RSpec/EmptyLineAfterExample:
|
142
|
+
Exclude:
|
143
|
+
- 'spec/integration_spec.rb'
|
144
|
+
|
145
|
+
# Offense count: 1
|
146
|
+
# This cop supports safe autocorrection (--autocorrect).
|
147
|
+
RSpec/EmptyLineAfterExampleGroup:
|
148
|
+
Exclude:
|
149
|
+
- 'spec/integration_spec.rb'
|
150
|
+
|
151
|
+
# Offense count: 12
|
152
|
+
# This cop supports safe autocorrection (--autocorrect).
|
153
|
+
RSpec/EmptyLineAfterFinalLet:
|
154
|
+
Exclude:
|
155
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
156
|
+
- 'spec/spec_helper.rb'
|
157
|
+
|
158
|
+
# Offense count: 2
|
159
|
+
# This cop supports safe autocorrection (--autocorrect).
|
160
|
+
# Configuration parameters: AllowConsecutiveOneLiners.
|
161
|
+
RSpec/EmptyLineAfterHook:
|
162
|
+
Exclude:
|
163
|
+
- 'spec/integration_spec.rb'
|
164
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
165
|
+
|
166
|
+
# Offense count: 1
|
167
|
+
# This cop supports safe autocorrection (--autocorrect).
|
168
|
+
RSpec/EmptyLineAfterSubject:
|
169
|
+
Exclude:
|
170
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
171
|
+
|
172
|
+
# Offense count: 1
|
173
|
+
# This cop supports safe autocorrection (--autocorrect).
|
174
|
+
# Configuration parameters: EnforcedStyle.
|
175
|
+
# SupportedStyles: is_expected, should
|
176
|
+
RSpec/ImplicitExpect:
|
177
|
+
Exclude:
|
178
|
+
- 'spec/spec_helper.rb'
|
179
|
+
|
180
|
+
# Offense count: 1
|
181
|
+
# This cop supports safe autocorrection (--autocorrect).
|
182
|
+
RSpec/LeadingSubject:
|
183
|
+
Exclude:
|
184
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
185
|
+
|
186
|
+
# Offense count: 1
|
187
|
+
# This cop supports safe autocorrection (--autocorrect).
|
188
|
+
# Configuration parameters: EnforcedStyle.
|
189
|
+
# SupportedStyles: hash, symbol
|
190
|
+
RSpec/MetadataStyle:
|
191
|
+
Exclude:
|
192
|
+
- 'spec/integration_spec.rb'
|
193
|
+
|
194
|
+
# Offense count: 1
|
195
|
+
RSpec/MultipleExpectations:
|
196
|
+
Max: 2
|
197
|
+
|
198
|
+
# Offense count: 8
|
199
|
+
# Configuration parameters: AllowedGroups.
|
200
|
+
RSpec/NestedGroups:
|
201
|
+
Max: 4
|
202
|
+
|
203
|
+
# Offense count: 2
|
204
|
+
# Configuration parameters: AllowedPatterns.
|
205
|
+
# AllowedPatterns: ^expect_, ^assert_
|
206
|
+
RSpec/NoExpectationExample:
|
207
|
+
Exclude:
|
208
|
+
- 'spec/integration_spec.rb'
|
209
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
210
|
+
|
211
|
+
# Offense count: 2
|
212
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
213
|
+
Security/IoMethods:
|
214
|
+
Exclude:
|
215
|
+
- 'lib/rack/server_pages.rb'
|
216
|
+
|
217
|
+
# Offense count: 1
|
218
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
219
|
+
# Configuration parameters: EnforcedStyle.
|
52
220
|
# SupportedStyles: nested, compact
|
53
221
|
Style/ClassAndModuleChildren:
|
54
222
|
Exclude:
|
55
223
|
- 'lib/rack/server_pages/php_helper.rb'
|
56
224
|
|
57
|
-
# Offense count:
|
225
|
+
# Offense count: 11
|
226
|
+
# Configuration parameters: AllowedConstants.
|
58
227
|
Style/Documentation:
|
59
228
|
Exclude:
|
60
229
|
- 'spec/**/*'
|
@@ -63,34 +232,141 @@ Style/Documentation:
|
|
63
232
|
- 'lib/rack/server_pages.rb'
|
64
233
|
- 'lib/rack/server_pages/php_helper.rb'
|
65
234
|
|
66
|
-
# Offense count:
|
67
|
-
|
235
|
+
# Offense count: 1
|
236
|
+
# This cop supports safe autocorrection (--autocorrect).
|
237
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
238
|
+
# SupportedStyles: compact, expanded
|
239
|
+
Style/EmptyMethod:
|
240
|
+
Exclude:
|
241
|
+
- 'config.ru'
|
242
|
+
|
243
|
+
# Offense count: 4
|
244
|
+
# This cop supports safe autocorrection (--autocorrect).
|
245
|
+
Style/Encoding:
|
68
246
|
Exclude:
|
247
|
+
- 'config.ru'
|
69
248
|
- 'lib/rack/server_pages.rb'
|
249
|
+
- 'rack-server-pages.gemspec'
|
250
|
+
- 'spec/spec_helper.rb'
|
70
251
|
|
71
|
-
# Offense count:
|
72
|
-
#
|
73
|
-
Style/
|
252
|
+
# Offense count: 2
|
253
|
+
# This cop supports safe autocorrection (--autocorrect).
|
254
|
+
Style/ExpandPathArguments:
|
74
255
|
Exclude:
|
256
|
+
- 'rack-server-pages.gemspec'
|
257
|
+
- 'spec/integration_spec.rb'
|
258
|
+
|
259
|
+
# Offense count: 14
|
260
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
261
|
+
# Configuration parameters: EnforcedStyle.
|
262
|
+
# SupportedStyles: always, always_true, never
|
263
|
+
Style/FrozenStringLiteralComment:
|
264
|
+
Exclude:
|
265
|
+
- 'Gemfile'
|
266
|
+
- 'Guardfile'
|
267
|
+
- 'Rakefile'
|
268
|
+
- 'config.ru'
|
75
269
|
- 'lib/rack-server-pages.rb'
|
270
|
+
- 'lib/rack-server-pages/version.rb'
|
271
|
+
- 'lib/rack/server_pages.rb'
|
272
|
+
- 'lib/rack/server_pages/php_helper.rb'
|
273
|
+
- 'rack-server-pages.gemspec'
|
274
|
+
- 'spec/integration_spec.rb'
|
275
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
276
|
+
- 'spec/spec_helper.rb'
|
277
|
+
- 'views/contact.xml.builder'
|
278
|
+
- 'views/examples/builder.xml.builder'
|
76
279
|
|
77
280
|
# Offense count: 2
|
78
|
-
#
|
281
|
+
# This cop supports safe autocorrection (--autocorrect).
|
282
|
+
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
79
283
|
Style/GuardClause:
|
80
284
|
Exclude:
|
81
285
|
- 'lib/rack/server_pages.rb'
|
82
286
|
|
83
287
|
# Offense count: 1
|
84
|
-
#
|
288
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
289
|
+
# Configuration parameters: AllowSplatArgument.
|
290
|
+
Style/HashConversion:
|
291
|
+
Exclude:
|
292
|
+
- 'lib/rack/server_pages.rb'
|
293
|
+
|
294
|
+
# Offense count: 1
|
295
|
+
# This cop supports safe autocorrection (--autocorrect).
|
296
|
+
Style/NegatedIfElseCondition:
|
297
|
+
Exclude:
|
298
|
+
- 'lib/rack/server_pages.rb'
|
299
|
+
|
300
|
+
# Offense count: 1
|
301
|
+
# Configuration parameters: AllowedMethods.
|
302
|
+
# AllowedMethods: respond_to_missing?
|
303
|
+
Style/OptionalBooleanParameter:
|
304
|
+
Exclude:
|
305
|
+
- 'lib/rack/server_pages.rb'
|
306
|
+
|
307
|
+
# Offense count: 4
|
308
|
+
# This cop supports safe autocorrection (--autocorrect).
|
309
|
+
# Configuration parameters: PreferredDelimiters.
|
310
|
+
Style/PercentLiteralDelimiters:
|
311
|
+
Exclude:
|
312
|
+
- 'lib/rack/server_pages.rb'
|
313
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
314
|
+
|
315
|
+
# Offense count: 1
|
316
|
+
# This cop supports safe autocorrection (--autocorrect).
|
317
|
+
Style/RedundantBegin:
|
318
|
+
Exclude:
|
319
|
+
- 'lib/rack/server_pages.rb'
|
320
|
+
|
321
|
+
# Offense count: 1
|
322
|
+
# This cop supports safe autocorrection (--autocorrect).
|
323
|
+
Style/RedundantRegexpEscape:
|
324
|
+
Exclude:
|
325
|
+
- 'Guardfile'
|
326
|
+
|
327
|
+
# Offense count: 1
|
328
|
+
# This cop supports safe autocorrection (--autocorrect).
|
329
|
+
# Configuration parameters: EnforcedStyle.
|
330
|
+
# SupportedStyles: implicit, explicit
|
331
|
+
Style/RescueStandardError:
|
332
|
+
Exclude:
|
333
|
+
- 'lib/rack/server_pages.rb'
|
334
|
+
|
335
|
+
# Offense count: 1
|
336
|
+
# This cop supports safe autocorrection (--autocorrect).
|
85
337
|
# Configuration parameters: AllowAsExpressionSeparator.
|
86
338
|
Style/Semicolon:
|
87
339
|
Exclude:
|
88
340
|
- 'spec/lib/rack/server_pages_spec.rb'
|
89
341
|
|
90
342
|
# Offense count: 1
|
91
|
-
#
|
92
|
-
# Configuration parameters:
|
93
|
-
# SupportedStyles: use_perl_names, use_english_names
|
343
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
344
|
+
# Configuration parameters: RequireEnglish, EnforcedStyle.
|
345
|
+
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
|
94
346
|
Style/SpecialGlobalVars:
|
95
347
|
Exclude:
|
96
348
|
- 'lib/rack/server_pages.rb'
|
349
|
+
|
350
|
+
# Offense count: 3
|
351
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
352
|
+
# Configuration parameters: Mode.
|
353
|
+
Style/StringConcatenation:
|
354
|
+
Exclude:
|
355
|
+
- 'config.ru'
|
356
|
+
- 'lib/rack/server_pages.rb'
|
357
|
+
- 'spec/lib/rack/server_pages_spec.rb'
|
358
|
+
|
359
|
+
# Offense count: 2
|
360
|
+
# This cop supports safe autocorrection (--autocorrect).
|
361
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
362
|
+
# SupportedStyles: single_quotes, double_quotes
|
363
|
+
Style/StringLiterals:
|
364
|
+
Exclude:
|
365
|
+
- 'views/contact.xml.builder'
|
366
|
+
|
367
|
+
# Offense count: 2
|
368
|
+
# This cop supports safe autocorrection (--autocorrect).
|
369
|
+
# Configuration parameters: MinSize.
|
370
|
+
# SupportedStyles: percent, brackets
|
371
|
+
Style/SymbolArray:
|
372
|
+
EnforcedStyle: brackets
|
data/CHANGES.md
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
CHANGES
|
2
2
|
=======
|
3
3
|
|
4
|
-
### [
|
4
|
+
### [v0.2.0](https://github.com/migrs/rack-server-pages/releases/tag/v0.2.0) / 2024-10-19
|
5
5
|
|
6
|
-
* [Changes](https://github.com/migrs/rack-server-pages/compare/v0.1.0...
|
6
|
+
* [Changes](https://github.com/migrs/rack-server-pages/compare/v0.1.0...v0.2.0)
|
7
7
|
|
8
|
-
|
8
|
+
* Feature
|
9
|
+
- Added support for Rack 3
|
10
|
+
- Added support for paths with special and unicode characters
|
11
|
+
- The built in `Rack::ServerPages::PHPHelper` has been removed
|
12
|
+
|
13
|
+
* Misc
|
14
|
+
- Replaced Travis-CI with GitHub Actions
|
15
|
+
- Upgraded RuboCop to 1.67
|
16
|
+
- Added support for Ruby 3.3
|
17
|
+
|
18
|
+
### [v0.1.0](https://github.com/migrs/rack-server-pages/releases/tag/v0.1.0)
|
9
19
|
|
10
20
|
* [Changes](https://github.com/migrs/rack-server-pages/compare/v0.0.6...v0.1.0)
|
11
21
|
|
data/Gemfile
CHANGED
@@ -2,11 +2,16 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'rack'
|
5
|
+
gem 'rack', ENV['RACK_VERSION'] || '~> 3'
|
6
6
|
|
7
7
|
group :development, :test do
|
8
|
+
gem 'builder'
|
9
|
+
gem 'markaby'
|
8
10
|
gem 'rake'
|
9
|
-
gem 'rubocop', '
|
11
|
+
gem 'rubocop', '1.67.0'
|
12
|
+
gem 'rubocop-capybara'
|
13
|
+
gem 'rubocop-rake'
|
14
|
+
gem 'rubocop-rspec'
|
10
15
|
gem 'simplecov'
|
11
16
|
gem 'rack-test', require: 'rack/test'
|
12
17
|
gem 'rspec'
|
@@ -17,7 +22,6 @@ group :development, :test do
|
|
17
22
|
gem 'tilt', '>=2.0'
|
18
23
|
gem 'RedCloth'
|
19
24
|
gem 'bluecloth'
|
20
|
-
# gem 'builder'
|
21
25
|
gem 'coffee-script'
|
22
26
|
gem 'contest'
|
23
27
|
gem 'creole'
|
@@ -26,15 +30,17 @@ group :development, :test do
|
|
26
30
|
gem 'kramdown'
|
27
31
|
# gem 'less'
|
28
32
|
gem 'liquid'
|
29
|
-
# gem 'markaby'
|
30
33
|
gem 'maruku'
|
31
34
|
gem 'nokogiri'
|
35
|
+
gem 'psych', '~> 3.0'
|
36
|
+
gem 'rackup'
|
32
37
|
gem 'radius'
|
33
38
|
gem 'rdiscount'
|
34
39
|
gem 'rdoc'
|
35
40
|
# gem 'wikicloth'
|
36
41
|
gem 'yajl-ruby'
|
37
42
|
gem 'capybara'
|
38
|
-
gem 'selenium-webdriver', '~>
|
43
|
+
gem 'selenium-webdriver', '~> 4'
|
39
44
|
# gem 'therubyracer'
|
45
|
+
gem 'webrick'
|
40
46
|
end
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ There are no controllers or models, just only views like a jsp, asp and php!
|
|
6
6
|
|
7
7
|
<http://github.com/migrs/rack-server-pages>
|
8
8
|
|
9
|
-
[![Build Status](https://
|
9
|
+
[![Build Status](https://github.com/migrs/rack-server-pages/actions/workflows/test.yml/badge.svg)](https://github.com/migrs/rack-server-pages/actions/workflows/test.yml)
|
10
10
|
[![Gem Version](https://badge.fury.io/rb/rack-server-pages.svg)](http://badge.fury.io/rb/rack-server-pages)
|
11
11
|
|
12
12
|
## Features
|
data/lib/rack/server_pages.rb
CHANGED
@@ -23,13 +23,10 @@ module Rack
|
|
23
23
|
yield @config if block_given?
|
24
24
|
@app = app || @config.failure_app || NotFound
|
25
25
|
|
26
|
-
require ::File.dirname(__FILE__) + '/server_pages/php_helper'
|
27
|
-
@config.helpers Rack::ServerPages::PHPHelper
|
28
|
-
|
29
26
|
@config.filter.merge_from_helpers(@config.helpers)
|
30
27
|
@binding = Binding.extended_class(@config.helpers)
|
31
28
|
|
32
|
-
@path_regex = %r{^#{@config.effective_path}/((?:[
|
29
|
+
@path_regex = %r{(?u)^#{@config.effective_path}/((?:[^\/]+/)+)?([\w][^\/]*?\w)?(\.\w+)?$}
|
33
30
|
end
|
34
31
|
|
35
32
|
def call(env)
|
@@ -37,12 +34,13 @@ module Rack
|
|
37
34
|
end
|
38
35
|
|
39
36
|
def serving(env)
|
40
|
-
|
37
|
+
path_info = CGI.unescape(env['PATH_INFO'])
|
38
|
+
files = find_template_files(path_info)
|
41
39
|
if files.nil? || files.empty?
|
42
40
|
@app
|
43
41
|
else
|
44
42
|
file = select_template_file(files)
|
45
|
-
(tpl = Template[file]) ? server_page(tpl) :
|
43
|
+
(tpl = Template[file]) ? server_page(tpl) : Rack::Files.new(file.split(path_info).first)
|
46
44
|
end.call(env)
|
47
45
|
end
|
48
46
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Hello <%=h(params["name"] || "Rack")%>!!</h1>
|
2
|
+
<p>Current Time: <%= Time.now %></p>
|
3
|
+
What's your name?:
|
4
|
+
<form>
|
5
|
+
<input type="text" name="name" value="<%=h params["name"]%>" />
|
6
|
+
<input type="submit" />
|
7
|
+
</form>
|
8
|
+
<%= partial 'views/examples/_time.html', :a => 'PartA', :b => 'PartB' %>
|
9
|
+
|
10
|
+
<%= @sample1 %>
|
11
|
+
<%= @sample2 %>
|
12
|
+
<%= sample3 %>
|
13
|
+
<%= sample4 %>
|
14
|
+
<%= sample5 %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Hello <%=h(params["name"] || "Rack")%>!!</h1>
|
2
|
+
<p>Current Time: <%= Time.now %></p>
|
3
|
+
What's your name?:
|
4
|
+
<form>
|
5
|
+
<input type="text" name="name" value="<%=h params["name"]%>" />
|
6
|
+
<input type="submit" />
|
7
|
+
</form>
|
8
|
+
<%= partial 'views/examples/_time.html', :a => 'PartA', :b => 'PartB' %>
|
9
|
+
|
10
|
+
<%= @sample1 %>
|
11
|
+
<%= @sample2 %>
|
12
|
+
<%= sample3 %>
|
13
|
+
<%= sample4 %>
|
14
|
+
<%= sample5 %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Hello <%=h(params["name"] || "Rack")%>!!</h1>
|
2
|
+
<p>Current Time: <%= Time.now %></p>
|
3
|
+
What's your name?:
|
4
|
+
<form>
|
5
|
+
<input type="text" name="name" value="<%=h params["name"]%>" />
|
6
|
+
<input type="submit" />
|
7
|
+
</form>
|
8
|
+
<%= partial 'views/examples/_time.html', :a => 'PartA', :b => 'PartB' %>
|
9
|
+
|
10
|
+
<%= @sample1 %>
|
11
|
+
<%= @sample2 %>
|
12
|
+
<%= sample3 %>
|
13
|
+
<%= sample4 %>
|
14
|
+
<%= sample5 %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Hello <%=h(params["name"] || "Rack")%>!!</h1>
|
2
|
+
<p>Current Time: <%= Time.now %></p>
|
3
|
+
What's your name?:
|
4
|
+
<form>
|
5
|
+
<input type="text" name="name" value="<%=h params["name"]%>" />
|
6
|
+
<input type="submit" />
|
7
|
+
</form>
|
8
|
+
<%= partial 'views/examples/_time.html', :a => 'PartA', :b => 'PartB' %>
|
9
|
+
|
10
|
+
<%= @sample1 %>
|
11
|
+
<%= @sample2 %>
|
12
|
+
<%= sample3 %>
|
13
|
+
<%= sample4 %>
|
14
|
+
<%= sample5 %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Hello <%=h(params["name"] || "Rack")%>!!</h1>
|
2
|
+
<p>Current Time: <%= Time.now %></p>
|
3
|
+
Как вас зовут?:
|
4
|
+
<form>
|
5
|
+
<input type="text" name="name" value="<%=h params["name"]%>" />
|
6
|
+
<input type="submit" />
|
7
|
+
</form>
|
8
|
+
<%= partial 'views/examples/_time.html', :a => 'PartA', :b => 'PartB' %>
|
9
|
+
|
10
|
+
<%= @sample1 %>
|
11
|
+
<%= @sample2 %>
|
12
|
+
<%= sample3 %>
|
13
|
+
<%= sample4 %>
|
14
|
+
<%= sample5 %>
|
data/public/index.html
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
3
|
<title>rack-server-pages</title>
|
4
|
-
<link href="
|
4
|
+
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
|
5
5
|
</head>
|
6
6
|
<body>
|
7
7
|
<h1>rack-server-pages</h1>
|
8
8
|
<ul>
|
9
|
-
<li><a href="
|
10
|
-
<li><a href="
|
11
|
-
<li><a href="
|
12
|
-
<li><a href="
|
13
|
-
<li><a href="
|
9
|
+
<li><a href="examples/">Tilt examples</a></li>
|
10
|
+
<li><a href="sample">sample</a></li>
|
11
|
+
<li><a href="sample.erb">sample.erb</a></li>
|
12
|
+
<li><a href="folder/sample.erb">folder/sample.erb</a></li>
|
13
|
+
<li><a href="folder/subfolder/sample.erb">folder/subfolder/sample.erb</a></li>
|
14
|
+
<li><a href="folder/special-sub.folder-@/sample.erb">folder/special-sub.folder-@/sample.erb</a></li>
|
15
|
+
<li><a href="folder/по-русски/пример.erb">folder/по-русски/пример.erb</a></li>
|
16
|
+
<li><a href="folder/subfolder/(sub-folder)/sample-in-sub-folder.extension.erb">folder/subfolder/(sub-folder)/sample-in-sub-folder.extension.erb</a></li>
|
17
|
+
<li><a href="info">info.php</a></li>
|
18
|
+
<li><a href="README">README</a></li>
|
19
|
+
<li><a href="CHANGES">CHANGES</a></li>
|
14
20
|
</ul>
|
15
21
|
<a href="http://github.com/migrs/rack-server-pages">github</a>
|
16
22
|
</body>
|
data/public/info.php
CHANGED
@@ -1 +1,89 @@
|
|
1
|
-
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<style type="text/css">
|
4
|
+
<!--
|
5
|
+
body {background-color: #ffffff; color: #000000;}
|
6
|
+
body, td, th, h1, h2 {font-family: sans-serif;}
|
7
|
+
pre {margin: 0px; font-family: monospace;}
|
8
|
+
a:hover {text-decoration: underline;}
|
9
|
+
table {border-collapse: collapse;}
|
10
|
+
.center {text-align: center;}
|
11
|
+
.center table { margin-left: auto; margin-right: auto; text-align: left;}
|
12
|
+
.center th { text-align: center !important; }
|
13
|
+
td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
|
14
|
+
h1 {font-size: 150%;}
|
15
|
+
h2 {font-size: 125%;}
|
16
|
+
.p {text-align: left;}
|
17
|
+
.e {background-color: #ccccff; font-weight: bold; color: #000000;}
|
18
|
+
.h {background-color: #9999cc; font-weight: bold; color: #000000;}
|
19
|
+
.v {background-color: #cccccc; color: #000000;}
|
20
|
+
i {color: #666666; background-color: #cccccc;}
|
21
|
+
img {float: right; border: 0px;}
|
22
|
+
hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
|
23
|
+
//-->
|
24
|
+
</style>
|
25
|
+
<title>rubyinfo()</title>
|
26
|
+
</head>
|
27
|
+
<body>
|
28
|
+
<div class="center">
|
29
|
+
<table border="0" cellpadding="3" width="600">
|
30
|
+
<tr class="h">
|
31
|
+
<td>
|
32
|
+
<h1 class="p">Rack Server Pages Version <%= Rack::ServerPages::VERSION%></h1>
|
33
|
+
</td>
|
34
|
+
</tr>
|
35
|
+
</table>
|
36
|
+
<br />
|
37
|
+
<h2>Rack Environment</h2>
|
38
|
+
<table border="0" cellpadding="3" width="600">
|
39
|
+
<tr class="h"><th>Variable</th><th>Value</th></tr>
|
40
|
+
<% for key, value in env do %>
|
41
|
+
<tr><td class="e"><%= key %></td><td class="v"><%= value %></td></tr>
|
42
|
+
<% end %>
|
43
|
+
</table>
|
44
|
+
<h2>Ruby</h2>
|
45
|
+
<table border="0" cellpadding="3" width="600">
|
46
|
+
<tr><td class="e">RUBY_VERSION</td><td class="v"><%= RUBY_VERSION %></td></tr>
|
47
|
+
<tr><td class="e">RUBY_PATCHLEVEL</td><td class="v"><%= RUBY_PATCHLEVEL %></td></tr>
|
48
|
+
<tr><td class="e">RUBY_RELEASE_DATE</td><td class="v"><%= RUBY_RELEASE_DATE %></td></tr>
|
49
|
+
<tr><td class="e">RUBY_PLATFORM</td><td class="v"><%= RUBY_PLATFORM %></td></tr>
|
50
|
+
</table>
|
51
|
+
<h2>Environment</h2>
|
52
|
+
<table border="0" cellpadding="3" width="600">
|
53
|
+
<tr class="h"><th>Variable</th><th>Value</th></tr>
|
54
|
+
<% for key, value in ENV do %>
|
55
|
+
<tr><td class="e"><%= key %></td><td class="v"><%= value %></td></tr>
|
56
|
+
<% end %>
|
57
|
+
</table>
|
58
|
+
<% if defined?(Tilt) %>
|
59
|
+
<h2>Tilt</h2>
|
60
|
+
<table border="0" cellpadding="3" width="600">
|
61
|
+
<% for key, value in (Tilt.respond_to?(:mappings) ? Tilt.mappings : Tilt.lazy_map) do %>
|
62
|
+
<tr><td class="e"><%= key %></td><td class="v"><%= value %></td></tr>
|
63
|
+
<% end %>
|
64
|
+
</table>
|
65
|
+
<% else %>
|
66
|
+
<h2>ERB Template</h2>
|
67
|
+
<table border="0" cellpadding="3" width="600">
|
68
|
+
<tr><td class="e">extensions</td><td class="v"><%=Rack::ServerPages::Template::ERBTemplate.extensions.join(', ')%></td></tr>
|
69
|
+
</table>
|
70
|
+
<% end %>
|
71
|
+
<h2>Binding</h2>
|
72
|
+
<table border="0" cellpadding="3" width="600">
|
73
|
+
<tr><td class="e">variables</td><td class="v"><%= (instance_variables).join(', ') %></td></tr>
|
74
|
+
<tr><td class="e">methods</td><td class="v"><%= (methods - Object.methods).join(', ') %></td></tr>
|
75
|
+
</table>
|
76
|
+
<h2>License</h2>
|
77
|
+
<table border="0" cellpadding="3" width="600">
|
78
|
+
<tr class="v">
|
79
|
+
<td>
|
80
|
+
<p>
|
81
|
+
<a href="http://github.com/migrs/rack-server-pages">rack-server-pages</a> is Copyright (c) 2012 <a href="http://github.com/migrs">Masato Igarashi</a>(@<a href="http://twitter.com/migrs">migrs</a>) and distributed under the <a href="http://www.opensource.org/licenses/mit-license">MIT license</a>.
|
82
|
+
</p>
|
83
|
+
</td>
|
84
|
+
</tr>
|
85
|
+
</table>
|
86
|
+
<br />
|
87
|
+
</div>
|
88
|
+
</body>
|
89
|
+
</html>
|
data/rack-server-pages.gemspec
CHANGED
@@ -13,11 +13,10 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = 'Rack middleware and appilcation for serving dynamic pages in very simple way.
|
14
14
|
There are no controllers and no models, just only views like a asp, jsp and php!'
|
15
15
|
|
16
|
-
|
16
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(spec)/})
|
18
|
+
end
|
17
19
|
|
18
|
-
s.files = `git ls-files`.split("\n")
|
19
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
20
|
s.require_paths = ['lib']
|
22
21
|
|
23
22
|
s.add_dependency 'rack'
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-server-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masato Igarashi
|
8
8
|
- Daniel Doubrovkine
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -34,11 +34,12 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
|
+
- ".github/workflows/lint.yml"
|
38
|
+
- ".github/workflows/test.yml"
|
37
39
|
- ".gitignore"
|
38
40
|
- ".rspec"
|
39
41
|
- ".rubocop.yml"
|
40
42
|
- ".rubocop_todo.yml"
|
41
|
-
- ".travis.yml"
|
42
43
|
- CHANGES.md
|
43
44
|
- Gemfile
|
44
45
|
- Guardfile
|
@@ -49,10 +50,14 @@ files:
|
|
49
50
|
- lib/rack-server-pages.rb
|
50
51
|
- lib/rack-server-pages/version.rb
|
51
52
|
- lib/rack/server_pages.rb
|
52
|
-
- lib/rack/server_pages/php_helper.rb
|
53
53
|
- public/CHANGES.erb
|
54
54
|
- public/README.erb
|
55
55
|
- public/_layout.html.erb
|
56
|
+
- public/folder/sample.erb
|
57
|
+
- public/folder/special-sub.folder-@/sample.erb
|
58
|
+
- public/folder/subfolder/(sub-folder)/sample-in-sub-folder.extension.erb
|
59
|
+
- public/folder/subfolder/sample.erb
|
60
|
+
- public/folder/по-русски/пример.erb
|
56
61
|
- public/index.html
|
57
62
|
- public/info.php
|
58
63
|
- public/rack_logo.png
|
@@ -60,9 +65,6 @@ files:
|
|
60
65
|
- public/sample.erb
|
61
66
|
- public/style.css.sass
|
62
67
|
- rack-server-pages.gemspec
|
63
|
-
- spec/integration_spec.rb
|
64
|
-
- spec/lib/rack/server_pages_spec.rb
|
65
|
-
- spec/spec_helper.rb
|
66
68
|
- views/about.html.slim
|
67
69
|
- views/article.html.md
|
68
70
|
- views/betty.css.sass
|
@@ -95,7 +97,7 @@ homepage: http://github.com/migrs/rack-server-pages
|
|
95
97
|
licenses:
|
96
98
|
- MIT
|
97
99
|
metadata: {}
|
98
|
-
post_install_message:
|
100
|
+
post_install_message:
|
99
101
|
rdoc_options: []
|
100
102
|
require_paths:
|
101
103
|
- lib
|
@@ -110,13 +112,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
112
|
- !ruby/object:Gem::Version
|
111
113
|
version: '0'
|
112
114
|
requirements: []
|
113
|
-
|
114
|
-
|
115
|
-
signing_key:
|
115
|
+
rubygems_version: 3.3.7
|
116
|
+
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: Rack middleware and appilcation for serving dynamic pages in very simple
|
118
119
|
way.
|
119
|
-
test_files:
|
120
|
-
- spec/integration_spec.rb
|
121
|
-
- spec/lib/rack/server_pages_spec.rb
|
122
|
-
- spec/spec_helper.rb
|
120
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
module Rack::ServerPages::PHPHelper
|
2
|
-
require 'erb'
|
3
|
-
def rubyinfo
|
4
|
-
ERB.new(<<-RUBYINFO).result(binding)
|
5
|
-
<html><head>
|
6
|
-
<style type="text/css"><!--
|
7
|
-
body {background-color: #ffffff; color: #000000;}
|
8
|
-
body, td, th, h1, h2 {font-family: sans-serif;}
|
9
|
-
pre {margin: 0px; font-family: monospace;}
|
10
|
-
a:hover {text-decoration: underline;}
|
11
|
-
table {border-collapse: collapse;}
|
12
|
-
.center {text-align: center;}
|
13
|
-
.center table { margin-left: auto; margin-right: auto; text-align: left;}
|
14
|
-
.center th { text-align: center !important; }
|
15
|
-
td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
|
16
|
-
h1 {font-size: 150%;}
|
17
|
-
h2 {font-size: 125%;}
|
18
|
-
.p {text-align: left;}
|
19
|
-
.e {background-color: #ccccff; font-weight: bold; color: #000000;}
|
20
|
-
.h {background-color: #9999cc; font-weight: bold; color: #000000;}
|
21
|
-
.v {background-color: #cccccc; color: #000000;}
|
22
|
-
i {color: #666666; background-color: #cccccc;}
|
23
|
-
img {float: right; border: 0px;}
|
24
|
-
hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
|
25
|
-
//--></style>
|
26
|
-
<title>rubyinfo()</title>
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<div class="center">
|
30
|
-
<table border="0" cellpadding="3" width="600">
|
31
|
-
<tr class="h">
|
32
|
-
<td>
|
33
|
-
<h1 class="p">Rack Server Pages Version <%= Rack::ServerPages::VERSION%></h1>
|
34
|
-
</td>
|
35
|
-
</tr>
|
36
|
-
</table>
|
37
|
-
<br />
|
38
|
-
<h2>Rack Environment</h2>
|
39
|
-
<table border="0" cellpadding="3" width="600">
|
40
|
-
<tr class="h"><th>Variable</th><th>Value</th></tr>
|
41
|
-
<% for key, value in env do %>
|
42
|
-
<tr><td class="e"><%= key %></td><td class="v"><%= value %></td></tr>
|
43
|
-
<% end %>
|
44
|
-
</table>
|
45
|
-
<h2>Ruby</h2>
|
46
|
-
<table border="0" cellpadding="3" width="600">
|
47
|
-
<tr><td class="e">RUBY_VERSION</td><td class="v"><%= RUBY_VERSION %></td></tr>
|
48
|
-
<tr><td class="e">RUBY_PATCHLEVEL</td><td class="v"><%= RUBY_PATCHLEVEL %></td></tr>
|
49
|
-
<tr><td class="e">RUBY_RELEASE_DATE</td><td class="v"><%= RUBY_RELEASE_DATE %></td></tr>
|
50
|
-
<tr><td class="e">RUBY_PLATFORM</td><td class="v"><%= RUBY_PLATFORM %></td></tr>
|
51
|
-
</table>
|
52
|
-
<h2>Environment</h2>
|
53
|
-
<table border="0" cellpadding="3" width="600">
|
54
|
-
<tr class="h"><th>Variable</th><th>Value</th></tr>
|
55
|
-
<% for key, value in ENV do %>
|
56
|
-
<tr><td class="e"><%= key %></td><td class="v"><%= value %></td></tr>
|
57
|
-
<% end %>
|
58
|
-
</table>
|
59
|
-
<% if defined?(Tilt) %>
|
60
|
-
<h2>Tilt</h2>
|
61
|
-
<table border="0" cellpadding="3" width="600">
|
62
|
-
<% for key, value in (Tilt.respond_to?(:mappings) ? Tilt.mappings : Tilt.lazy_map) do %>
|
63
|
-
<tr><td class="e"><%= key %></td><td class="v"><%= value %></td></tr>
|
64
|
-
<% end %>
|
65
|
-
</table>
|
66
|
-
<% else %>
|
67
|
-
<h2>ERB Template</h2>
|
68
|
-
<table border="0" cellpadding="3" width="600">
|
69
|
-
<tr><td class="e">extensions</td><td class="v"><%=Rack::ServerPages::Template::ERBTemplate.extensions.join(', ')%></td></tr>
|
70
|
-
</table>
|
71
|
-
<% end %>
|
72
|
-
<h2>Binding</h2>
|
73
|
-
<table border="0" cellpadding="3" width="600">
|
74
|
-
<tr><td class="e">variables</td><td class="v"><%= (instance_variables).join(', ') %></td></tr>
|
75
|
-
<tr><td class="e">methods</td><td class="v"><%= (methods - Object.methods).join(', ') %></td></tr>
|
76
|
-
</table>
|
77
|
-
<h2>License</h2>
|
78
|
-
<table border="0" cellpadding="3" width="600">
|
79
|
-
<tr class="v"><td>
|
80
|
-
<p>
|
81
|
-
<a href="http://github.com/migrs/rack-server-pages">rack-server-pages</a> is Copyright (c) 2012 <a href="http://github.com/migrs">Masato Igarashi</a>(@<a href="http://twitter.com/migrs">migrs</a>) and distributed under the <a href="http://www.opensource.org/licenses/mit-license">MIT license</a>.
|
82
|
-
</p>
|
83
|
-
</td></tr>
|
84
|
-
</table><br />
|
85
|
-
</div>
|
86
|
-
</body>
|
87
|
-
</html>
|
88
|
-
RUBYINFO
|
89
|
-
end
|
90
|
-
alias phpinfo rubyinfo # just a joke :)
|
91
|
-
end
|
data/spec/integration_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
Capybara.app, = Rack::Builder.parse_file(File.expand_path('../../config.ru', __FILE__))
|
4
|
-
Capybara.current_driver = :selenium
|
5
|
-
|
6
|
-
describe 'Integration', js: true do
|
7
|
-
context 'root' do
|
8
|
-
before do
|
9
|
-
visit '/'
|
10
|
-
end
|
11
|
-
it 'loads homepage' do
|
12
|
-
expect(page.find('h1')).to have_content 'rack-server-pages'
|
13
|
-
end
|
14
|
-
it 'loads markdown README' do
|
15
|
-
click_link 'README'
|
16
|
-
expect(page.first('h1')).to have_content 'Rack Server Pages'
|
17
|
-
end
|
18
|
-
it 'rendered ERB' do
|
19
|
-
click_link 'sample.erb'
|
20
|
-
expect(page).to have_content 'PartAPartB'
|
21
|
-
end
|
22
|
-
it 'rendered PHP' do
|
23
|
-
click_link 'info.php'
|
24
|
-
expect(page).to have_content 'CGI/1.1'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
it 'renders all tilt examples' do
|
28
|
-
visit '/examples/'
|
29
|
-
page.all('body ul li a').map { |a| a['href'] }.each do |href|
|
30
|
-
puts href
|
31
|
-
visit href
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
begin
|
3
|
-
require 'ruby-debug'
|
4
|
-
require 'tapp'
|
5
|
-
rescue LoadError
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'Rack::ServerPages' do
|
9
|
-
describe 'Basic requests' do
|
10
|
-
before { get path_info }
|
11
|
-
subject { last_response }
|
12
|
-
let(:content_type) { 'text/html' }
|
13
|
-
|
14
|
-
should_be_ok '/'
|
15
|
-
should_be_not_found '/hoge'
|
16
|
-
|
17
|
-
should_be_not_found '/inf'
|
18
|
-
should_be_ok '/info'
|
19
|
-
should_be_not_found '/info/'
|
20
|
-
should_be_ok '/info.php'
|
21
|
-
should_be_ok '/info.php?a=3'
|
22
|
-
should_be_not_found '/info.'
|
23
|
-
should_be_not_found '/info.p'
|
24
|
-
should_be_not_found '/info.php/'
|
25
|
-
|
26
|
-
should_be_not_found '/example'
|
27
|
-
should_be_not_found '/examples'
|
28
|
-
should_be_ok '/examples/'
|
29
|
-
should_be_ok '/examples/index'
|
30
|
-
should_be_ok '/examples/index.html'
|
31
|
-
should_be_not_found '/examples/index.htm'
|
32
|
-
should_be_not_found '/examples/.htaccess'
|
33
|
-
|
34
|
-
context 'content-type: text/css' do
|
35
|
-
let(:content_type) { 'text/css' }
|
36
|
-
should_be_ok '/betty'
|
37
|
-
should_be_ok '/betty.css'
|
38
|
-
should_be_ok '/betty.css.sass'
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'content-type: image/png' do
|
42
|
-
let(:content_type) { 'image/png' }
|
43
|
-
should_be_ok '/rack_logo.png'
|
44
|
-
should_be_ok '/rack_logo@2x.png'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'Rack::ServerPages private methods' do
|
49
|
-
describe '#evalute_path_info' do
|
50
|
-
subject { m = app.new.instance_variable_get(:@path_regex).match(path_info); m[1, 3] if m }
|
51
|
-
|
52
|
-
context '/aaa/bbb.erb' do
|
53
|
-
let(:path_info) { '/aaa/bbb.erb' }
|
54
|
-
it { is_expected.to eq %w(aaa/ bbb .erb) }
|
55
|
-
end
|
56
|
-
|
57
|
-
context '/aaa/bbb/ccc.erb' do
|
58
|
-
let(:path_info) { '/aaa/bbb/ccc.erb' }
|
59
|
-
it { is_expected.to eq %w(aaa/bbb/ ccc .erb) }
|
60
|
-
end
|
61
|
-
|
62
|
-
context '/aaa/bbb/ccc.' do
|
63
|
-
let(:path_info) { '/aaa/bbb/ccc.' }
|
64
|
-
it { is_expected.to be_nil }
|
65
|
-
end
|
66
|
-
|
67
|
-
context '/aaa/bbb/ccc' do
|
68
|
-
let(:path_info) { '/aaa/bbb/ccc' }
|
69
|
-
it { is_expected.to eq ['aaa/bbb/', 'ccc', nil] }
|
70
|
-
end
|
71
|
-
|
72
|
-
context '/aaa-bbb/ccc' do
|
73
|
-
let(:path_info) { '/aaa-bbb/ccc' }
|
74
|
-
it { is_expected.to eq ['aaa-bbb/', 'ccc', nil] }
|
75
|
-
end
|
76
|
-
|
77
|
-
context '/aaa/bbb/' do
|
78
|
-
let(:path_info) { '/aaa/bbb/' }
|
79
|
-
it { is_expected.to eq ['aaa/bbb/', nil, nil] }
|
80
|
-
end
|
81
|
-
|
82
|
-
context '/' do
|
83
|
-
let(:path_info) { '/' }
|
84
|
-
it { is_expected.to eq [nil, nil, nil] }
|
85
|
-
end
|
86
|
-
|
87
|
-
context path = '/aaa/bbb/AB-c.182-d.min.js' do
|
88
|
-
let(:path_info) { path }
|
89
|
-
it { is_expected.to eq ['aaa/bbb/', 'AB-c.182-d.min', '.js'] }
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe 'Configuration' do
|
95
|
-
it 'test' do
|
96
|
-
mock_app do
|
97
|
-
run Rack::ServerPages
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require 'rack/test'
|
3
|
-
require 'rspec/its'
|
4
|
-
require 'tapp'
|
5
|
-
require 'simplecov'
|
6
|
-
require 'rack-server-pages'
|
7
|
-
require 'capybara/rspec'
|
8
|
-
|
9
|
-
# SimpleCov.start
|
10
|
-
|
11
|
-
RSpec.configure do |conf|
|
12
|
-
conf.include Rack::Test::Methods
|
13
|
-
conf.include Capybara::DSL
|
14
|
-
conf.raise_errors_for_deprecations!
|
15
|
-
end
|
16
|
-
|
17
|
-
require 'tilt'
|
18
|
-
require 'slim'
|
19
|
-
Tilt.register Tilt::ERBTemplate, 'php'
|
20
|
-
|
21
|
-
require 'sass'
|
22
|
-
require 'rdiscount'
|
23
|
-
require 'rdoc'
|
24
|
-
require 'liquid'
|
25
|
-
require 'radius'
|
26
|
-
# require 'less'
|
27
|
-
require 'haml'
|
28
|
-
# require 'markaby'
|
29
|
-
# require 'builder'
|
30
|
-
require 'coffee_script'
|
31
|
-
require 'redcloth'
|
32
|
-
# require 'wikicloth'
|
33
|
-
require 'yajl'
|
34
|
-
|
35
|
-
def app
|
36
|
-
@app ||= Rack::Builder.app do
|
37
|
-
run Rack::ServerPages
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def mock_app(&block)
|
42
|
-
@app ||= Rack::Builder.app(&block)
|
43
|
-
end
|
44
|
-
|
45
|
-
def should_be_ok(path)
|
46
|
-
context "GET #{path}" do
|
47
|
-
let(:path_info) { path }
|
48
|
-
it { is_expected.to be_ok }
|
49
|
-
its(:content_type) { should match /\b#{content_type}\b/ }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def should_be_not_found(path)
|
54
|
-
context "GET #{path}" do
|
55
|
-
let(:path_info) { path }
|
56
|
-
it { is_expected.to be_not_found }
|
57
|
-
# its(:content_type) { should eq 'text/plain' }
|
58
|
-
end
|
59
|
-
end
|