rack-app 6.7.1 → 6.8.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918146f8853c3deef7b9f56e1b01c5200e47f938
|
4
|
+
data.tar.gz: aafdf76c3b3f8346d3479dd97baeda137a50b112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe4cd8db4e9b6753b402676f3a0f04f7a0377803b60d6bb1b08187e26754d397766766606704a19c492075f748a1fb573be521f92e64134a147ca808b9416de
|
7
|
+
data.tar.gz: 23d411aaed8a51cd0b0f34673f06718828c10b50929b3c05ac790d367c5fc258ec51c348b3739bd6372a9492b692c9f2f46ce9c1b241aa02d73ac668bf2658f0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
1
|
+
6.8.0
|
@@ -24,7 +24,7 @@ class Rack::App::Endpoint::Builder
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def apply_middleware_build_blocks(builder)
|
27
|
-
|
27
|
+
@config.middlewares.each do |builder_block|
|
28
28
|
builder_block.call(builder)
|
29
29
|
end
|
30
30
|
builder.use(Rack::App::Middlewares::Configuration, @config)
|
@@ -43,8 +43,4 @@ class Rack::App::Endpoint::Builder
|
|
43
43
|
builder.use(Rack::App::Middlewares::Hooks::After, after_block)
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
47
|
-
def builder_blocks
|
48
|
-
[@config.app_class.middlewares, @config.endpoint_specific_middlewares].flatten
|
49
|
-
end
|
50
46
|
end
|
@@ -27,8 +27,21 @@ class Rack::App::Endpoint::Config
|
|
27
27
|
@raw[:payload].parser_builder
|
28
28
|
end
|
29
29
|
|
30
|
+
def ancestor_apps
|
31
|
+
[@raw[:ancestors]].flatten.compact
|
32
|
+
end
|
33
|
+
|
30
34
|
def app_class
|
31
|
-
|
35
|
+
ancestor_apps.first || raise('missing app class')
|
36
|
+
end
|
37
|
+
|
38
|
+
def middlewares
|
39
|
+
mws = []
|
40
|
+
ancestor_apps.reverse_each do |ancestors_app|
|
41
|
+
mws.push(*ancestors_app.middlewares)
|
42
|
+
end
|
43
|
+
mws.push(*endpoint_specific_middlewares)
|
44
|
+
return mws
|
32
45
|
end
|
33
46
|
|
34
47
|
def serializer
|
@@ -79,12 +92,6 @@ class Rack::App::Endpoint::Config
|
|
79
92
|
@raw = raw
|
80
93
|
end
|
81
94
|
|
82
|
-
def register_method_to_app_class
|
83
|
-
method_name = '__' + ::Rack::App::Utils.uuid
|
84
|
-
app_class.__send__(:define_method, method_name, &logic_block)
|
85
|
-
method_name
|
86
|
-
end
|
87
|
-
|
88
95
|
def logic_block
|
89
96
|
@raw[:user_defined_logic]
|
90
97
|
end
|
data/lib/rack/app/router.rb
CHANGED
@@ -38,7 +38,8 @@ class Rack::App::Router
|
|
38
38
|
raise(ArgumentError, 'invalid router object, must implement :endpoints interface') unless router.respond_to?(:endpoints)
|
39
39
|
router.endpoints.each do |endpoint|
|
40
40
|
new_request_path = ::Rack::App::Utils.join(prop[:namespaces], endpoint.request_path)
|
41
|
-
|
41
|
+
new_ancestors = endpoint.config.ancestor_apps + [prop[:new_ancestor]]
|
42
|
+
new_endpoint = endpoint.fork(:request_path => new_request_path, :ancestors => new_ancestors)
|
42
43
|
register_endpoint!(new_endpoint)
|
43
44
|
end
|
44
45
|
nil
|
@@ -20,7 +20,12 @@ module Rack::App::SingletonMethods::Mounting
|
|
20
20
|
end
|
21
21
|
|
22
22
|
cli.merge!(app.cli)
|
23
|
-
|
23
|
+
|
24
|
+
merge_prop = {
|
25
|
+
:namespaces => [@namespaces, options[:to]].flatten,
|
26
|
+
:new_ancestor => self
|
27
|
+
}
|
28
|
+
|
24
29
|
router.merge_router!(app.router, merge_prop)
|
25
30
|
|
26
31
|
nil
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module Rack::App::SingletonMethods::RouteHandling
|
2
|
-
|
3
2
|
def router
|
4
3
|
@router ||= Rack::App::Router.new
|
5
4
|
end
|
@@ -15,30 +14,26 @@ module Rack::App::SingletonMethods::RouteHandling
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def description(*description_texts)
|
18
|
-
route_registration_properties[:description]= description_texts.join("\n")
|
17
|
+
route_registration_properties[:description] = description_texts.join("\n")
|
19
18
|
end
|
20
19
|
|
21
20
|
alias desc description
|
22
21
|
|
23
22
|
def add_route(request_method, request_path, callable)
|
24
|
-
|
25
23
|
router.register_endpoint!(
|
26
|
-
Rack::App::Endpoint.new(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:request_path => ::Rack::App::Utils.join(namespace, request_path)
|
35
|
-
})
|
24
|
+
Rack::App::Endpoint.new(:ancestors => [self],
|
25
|
+
:callable => callable,
|
26
|
+
:payload => payload,
|
27
|
+
:error_handler => error,
|
28
|
+
:request_method => request_method,
|
29
|
+
:route => route_registration_properties.dup,
|
30
|
+
:endpoint_specific_middlewares => next_endpoint_middlewares.dup,
|
31
|
+
:request_path => ::Rack::App::Utils.join(namespace, request_path))
|
36
32
|
)
|
37
33
|
|
38
34
|
next_endpoint_middlewares.clear
|
39
35
|
route_registration_properties.clear
|
40
|
-
|
41
|
-
|
36
|
+
nil
|
42
37
|
end
|
43
38
|
|
44
39
|
def namespace(*namespace_paths)
|
@@ -48,5 +43,4 @@ module Rack::App::SingletonMethods::RouteHandling
|
|
48
43
|
@namespaces.pop
|
49
44
|
::Rack::App::Utils.join(@namespaces.flatten)
|
50
45
|
end
|
51
|
-
|
52
46
|
end
|
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: 6.
|
4
|
+
version: 6.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|