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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f9e1adde462fe63f752d02b74395426c74022f9e8fb920ecf089a4b3bb20624
4
- data.tar.gz: 2c4fea5a52568b9bd153c95f67c02a722634ad32177733be4c7941686eb9bfed
3
+ metadata.gz: 9e3fc2a04dd1e7b37c37958f0b25b2d6191832cc366709d041e1300ef1af439f
4
+ data.tar.gz: 1d8b6a8eba52d898fe154e66953185bf54df5cf0b8de447ae1d6642b7c01a0e6
5
5
  SHA512:
6
- metadata.gz: 428fb54496fb53eb2efc363f37d0ad2b7b889edb23c3a40a22cd1acc52f20348015b8193a8d92967a9f8da1716903b68ff672ff581e4e68411d8b017b6a6a3ca
7
- data.tar.gz: 20db48c00b68b9cb4bb3499e3a0bf8bee223f71f0f48312c16a1eeb21481cb5cb2865a2ec2331412ffcf4e88e9bfa4da4a5bc81e6a2ca206b6df4d8b211b61be
6
+ metadata.gz: 78344e08eb017faf0215752156b32049ff28f400c7056da95b2956258c3fa4f6295042c8063dab78e3ca67b6948f5eccbf69905b24deb72bd09c96d25fa8c542
7
+ data.tar.gz: e1d4b4abd422e3b77d23e60b4a8ddf3484bcfc394b90530101f046676f63eb83b0629f2a21323c27a563a97d2ab77c057456939194c68916eca7bfae52b3169d
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGES
2
2
 
3
+ ## Jellyfish 1.3.1 -- 2018-11-11
4
+
5
+ ### Bugs fixed
6
+
7
+ * Fixed `Jellyfish::Rewrite` for SCRIPT_NAME when host is also used.
8
+
3
9
  ## Jellyfish 1.3.0 -- 2018-11-11
4
10
 
5
11
  ### Incompatible changes
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: jellyfish 1.3.0 ruby lib
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.0"
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]
@@ -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, path, to, &block)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jellyfish
4
- VERSION = '1.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jellyfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)