jellyfish 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/jellyfish.gemspec +2 -2
- data/lib/jellyfish/builder.rb +3 -3
- data/lib/jellyfish/version.rb +1 -1
- data/test/test_rewrite.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e3fc2a04dd1e7b37c37958f0b25b2d6191832cc366709d041e1300ef1af439f
|
4
|
+
data.tar.gz: 1d8b6a8eba52d898fe154e66953185bf54df5cf0b8de447ae1d6642b7c01a0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78344e08eb017faf0215752156b32049ff28f400c7056da95b2956258c3fa4f6295042c8063dab78e3ca67b6948f5eccbf69905b24deb72bd09c96d25fa8c542
|
7
|
+
data.tar.gz: e1d4b4abd422e3b77d23e60b4a8ddf3484bcfc394b90530101f046676f63eb83b0629f2a21323c27a563a97d2ab77c057456939194c68916eca7bfae52b3169d
|
data/CHANGES.md
CHANGED
data/jellyfish.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: jellyfish 1.3.
|
2
|
+
# stub: jellyfish 1.3.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "jellyfish".freeze
|
6
|
-
s.version = "1.3.
|
6
|
+
s.version = "1.3.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
data/lib/jellyfish/builder.rb
CHANGED
@@ -31,7 +31,7 @@ module Jellyfish
|
|
31
31
|
|
32
32
|
def map path, to: nil, host: nil, &block
|
33
33
|
key = if host then "http://#{File.join(host, path)}" else path end
|
34
|
-
(@map ||= {})[key] = [block, to]
|
34
|
+
(@map ||= {})[key] = [block, path, to]
|
35
35
|
end
|
36
36
|
|
37
37
|
def listen host, &block
|
@@ -56,8 +56,8 @@ module Jellyfish
|
|
56
56
|
private
|
57
57
|
def generate_map current_map, app
|
58
58
|
mapped = if app then {'' => app} else {} end
|
59
|
-
current_map.each do |path, (block, to)|
|
60
|
-
mapped[path] = self.class.app(app,
|
59
|
+
current_map.each do |path, (block, from, to)|
|
60
|
+
mapped[path] = self.class.app(app, from, to, &block)
|
61
61
|
end
|
62
62
|
URLMap.new(mapped)
|
63
63
|
end
|
data/lib/jellyfish/version.rb
CHANGED
data/test/test_rewrite.rb
CHANGED
@@ -41,4 +41,18 @@ describe Jellyfish::Rewrite do
|
|
41
41
|
expect(call(app, '/top/from/inner')).eq '/top!/to/inner'
|
42
42
|
expect(call(app, '/top/from/outer')).eq '/top!/to/outer'
|
43
43
|
end
|
44
|
+
|
45
|
+
would 'map to with host and handle SCRIPT_NAME properly' do
|
46
|
+
app = Jellyfish::Builder.app do
|
47
|
+
map '/path', to: '/path', host: 'host' do
|
48
|
+
run lambda{ |env|
|
49
|
+
[200, {},
|
50
|
+
["#{env['HTTP_HOST']} #{env['SCRIPT_NAME']} #{env['PATH_INFO']}"]]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(get('/path', app, 'HTTP_HOST' => 'host').dig(-1, -1)).
|
56
|
+
eq 'host /path'
|
57
|
+
end
|
44
58
|
end
|