rack-app 5.10.0 → 5.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/VERSION +1 -1
- data/lib/rack/app/router/dynamic.rb +14 -12
- data/lib/rack/app/test.rb +11 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23e30b1cd43155376103906815a81992ab9fda1b
|
4
|
+
data.tar.gz: 95ed0ee6c980d7b029b1845f6c97ee09a08d9aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8698f68df78a4bc3529f550ca4a8c1d206d93ebceeebddd6a11348a6bd96f29019017618dba991b3eb55e8b5df4d82a56eb2ff74283154de8bf4af7e635361f
|
7
|
+
data.tar.gz: ab5b5fb6425a362d1de374199e502c24a122dfe8fabc30afc5fa1a8c288330b7e3f1b50131ee75ae97978dddee64207c5a9c0af8cab2d74044d60f24fc81c694
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
[travis-link]: https://travis-ci.org/rack-app/rack-app
|
5
5
|
[travis-home]: http://travis-ci.org/
|
6
6
|
|
7
|
+
*Happy New Year!*
|
8
|
+
|
7
9
|
Your next favourite rack based micro framework that is totally addition free!
|
8
10
|
Have a cup of awesomeness with your performance designed framework!
|
9
11
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.10.
|
1
|
+
5.10.1
|
@@ -118,23 +118,19 @@ class Rack::App::Router::Dynamic < Rack::App::Router::Base
|
|
118
118
|
|
119
119
|
def get_app(env)
|
120
120
|
find_by_path_infos(env) do |path_info|
|
121
|
-
|
122
|
-
|
123
|
-
if c.is_a?(Hash)
|
124
|
-
c[:app]
|
125
|
-
else
|
126
|
-
nil
|
127
|
-
end
|
121
|
+
fetch_context(get_request_method(env), path_info)
|
128
122
|
end
|
129
123
|
end
|
130
124
|
|
131
125
|
def fetch_context(request_method, path_info)
|
126
|
+
current_cluster = main_cluster(request_method)
|
132
127
|
|
133
|
-
last_mounted_directory = nil
|
134
128
|
last_mounted_app = nil
|
135
|
-
|
136
|
-
|
137
|
-
path_info.split('/')
|
129
|
+
last_mounted_directory = nil
|
130
|
+
|
131
|
+
path_parts = path_info.split('/')
|
132
|
+
path_parts << '' if path_parts.empty?
|
133
|
+
path_parts.each do |path_part|
|
138
134
|
|
139
135
|
last_mounted_directory = current_cluster[MOUNTED_DIRECTORY] || last_mounted_directory
|
140
136
|
last_mounted_app = current_cluster[MOUNTED_APPLICATION] || last_mounted_app
|
@@ -145,6 +141,8 @@ class Rack::App::Router::Dynamic < Rack::App::Router::Base
|
|
145
141
|
last_mounted_app = (current_cluster || {})[MOUNTED_APPLICATION] || last_mounted_app
|
146
142
|
|
147
143
|
if current_cluster.nil?
|
144
|
+
|
145
|
+
|
148
146
|
if last_mounted_directory
|
149
147
|
current_cluster = last_mounted_directory
|
150
148
|
break
|
@@ -161,8 +159,12 @@ class Rack::App::Router::Dynamic < Rack::App::Router::Base
|
|
161
159
|
|
162
160
|
end
|
163
161
|
|
164
|
-
return current_cluster
|
162
|
+
return extract_app(current_cluster) || extract_app(last_mounted_app) || extract_app(last_mounted_directory)
|
163
|
+
|
164
|
+
end
|
165
165
|
|
166
|
+
def extract_app(hash)
|
167
|
+
hash.is_a?(Hash) ? hash[:app] : nil
|
166
168
|
end
|
167
169
|
|
168
170
|
end
|
data/lib/rack/app/test.rb
CHANGED
@@ -12,16 +12,17 @@ module Rack::App::Test
|
|
12
12
|
|
13
13
|
attr_reader :last_response
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
request_env = Rack::App::Test::Utils.env_by(properties)
|
23
|
-
return @last_response = mock_request.request(request_method, url, request_env)
|
15
|
+
def __send_rack_app_request__(request_method, *args)
|
16
|
+
properties = args.select { |e| e.is_a?(Hash) }.reduce({}, &:merge!)
|
17
|
+
url = args.select { |e| e.is_a?(String) }.first || properties.delete(:url)
|
18
|
+
mock_request = Rack::MockRequest.new(rack_app)
|
19
|
+
request_env = Rack::App::Test::Utils.env_by(properties)
|
20
|
+
return @last_response = mock_request.request(request_method.to_s.upcase, url, request_env)
|
21
|
+
end
|
24
22
|
|
23
|
+
Rack::App::Constants::HTTP::METHODS.each do |request_method_type|
|
24
|
+
define_method(request_method_type.to_s.downcase) do |*args|
|
25
|
+
self.__send_rack_app_request__(request_method_type, *args)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -34,7 +35,7 @@ module Rack::App::Test
|
|
34
35
|
else
|
35
36
|
raise('missing class definition')
|
36
37
|
end
|
37
|
-
end.call
|
38
|
+
end.call
|
38
39
|
block.is_a?(Proc) ? @rack_app.instance_exec(&block) : @rack_app
|
39
40
|
end
|
40
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.10.
|
4
|
+
version: 5.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|