syro 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +5 -5
  2. data/lib/syro.rb +1 -1
  3. data/syro.gemspec +1 -1
  4. data/test/all.rb +28 -0
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 585d2fe3559bfaa4cc09f2a6b25efac445ca739b
4
- data.tar.gz: 99a97c194e80a465474f2439a7f80e938f6e69c8
2
+ SHA256:
3
+ metadata.gz: d7b8d0d24032087e88045df823a3b61adb898e85af19d22cd17b7bf05ed50449
4
+ data.tar.gz: 426037f8eb05e2f24f490d81c2f423c22e7d6ea4036e6de7bedcff3ff4ab8007
5
5
  SHA512:
6
- metadata.gz: 23adfa66e18f592c65688248b8f9c4f625c988c8a6392e84ea578cc2263396ef5170b1cde6a27132aa43b3139679f1e523ddfd38d07cf4ddb7fa09fd0f3a7804
7
- data.tar.gz: e1ae691f6c4d9fee2aaaec0c814519bc0bb4cd6a765dea46b63e978564426bd9763b946e8e203e2ad8b0f64f55a766c2ad4be667a171180d85bacb08db9e6c3d
6
+ metadata.gz: 974c67998f9d13ea7999065ce3099c9980cb5014ec1baba55de43eb59eabac80f2b2f1357f799116350d2466245d9a664d63ef3e6751f749d9c0acff242f9b18
7
+ data.tar.gz: a610effd762f148f833ba5de540c40015e1f583c95d3354057d9d36facdebccdca4ccf0b84f0f11382893235fff699a0dc93df4d032fa732ecc59cb38790a340
@@ -277,7 +277,7 @@ class Syro
277
277
  path, script = env[Rack::PATH_INFO], env[Rack::SCRIPT_NAME]
278
278
 
279
279
  env[Rack::PATH_INFO] = @syro_path.curr
280
- env[Rack::SCRIPT_NAME] = @syro_path.prev
280
+ env[Rack::SCRIPT_NAME] = script + @syro_path.prev
281
281
  env[Syro::INBOX] = inbox
282
282
 
283
283
  halt(app.call(env))
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "syro"
3
- s.version = "3.1.0"
3
+ s.version = "3.1.1"
4
4
  s.summary = "Simple router"
5
5
  s.description = "Simple router for web applications"
6
6
  s.authors = ["Michel Martens"]
@@ -99,6 +99,24 @@ handlers = Syro.new do
99
99
  end
100
100
  end
101
101
 
102
+ path_info = Syro.new do
103
+ on "foo" do
104
+ get do
105
+ res.text req.path
106
+ end
107
+ end
108
+
109
+ get do
110
+ res.text req.path
111
+ end
112
+ end
113
+
114
+ script_name = Syro.new do
115
+ on "path" do
116
+ run(path_info)
117
+ end
118
+ end
119
+
102
120
  app = Syro.new do
103
121
  get do
104
122
  res.write "GET /"
@@ -238,6 +256,10 @@ app = Syro.new do
238
256
  on "json" do
239
257
  res.json "json!"
240
258
  end
259
+
260
+ on "script" do
261
+ run(script_name)
262
+ end
241
263
  end
242
264
 
243
265
  setup do
@@ -415,3 +437,9 @@ test "status code handling" do |f|
415
437
  assert_equal "text/plain", f.last_response.headers["Content-Type"]
416
438
  assert_equal "Also not found!", f.last_response.body
417
439
  end
440
+
441
+ test "script name and path info" do |f|
442
+ f.get("/script/path")
443
+ assert_equal 200, f.last_response.status
444
+ assert_equal "/script/path", f.last_response.body
445
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syro
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-01 00:00:00.000000000 Z
11
+ date: 2018-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: seg
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.6.11
106
+ rubygems_version: 2.7.6
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Simple router