routing-filter 0.5.1 → 0.6.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.markdown +1 -1
- data/lib/routing_filter/adapters/rails.rb +9 -8
- data/lib/routing_filter/adapters/routers/journey.rb +5 -10
- data/lib/routing_filter/version.rb +1 -1
- metadata +28 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d3095bce449432d012c141626f8138f80ffa03
|
4
|
+
data.tar.gz: 028e2cf381be48361c999ce9cd04ccdbbf16e8b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e3a3a7038fbccd2913b2d585d81874b6b672a2e6dad839d47e3efa76f85391f0c9701e02543ff032986fbc89f1acac94e6d38258869db64c4cd08755065fe98
|
7
|
+
data.tar.gz: 3ed295112a78c5d5d59d833b56480c2b6a9ea1fdc565d5f9ce5540ebe369ffdacc3408f021baaefa2f3891436c31489673dd269ad69d24ea8c8dd6c3da0f32ab
|
data/CHANGELOG.md
CHANGED
data/README.markdown
CHANGED
@@ -22,7 +22,7 @@ implement custom ones. Maybe the most popular one is the Locale routing filter:
|
|
22
22
|
|
23
23
|
## Requirements
|
24
24
|
|
25
|
-
Latest routing-filter (~> 0.5.0) currently only works with Rails 4.2. It should not be all too hard
|
25
|
+
Latest routing-filter (~> 0.5.0) currently only works with Rails 5.0 and 4.2. It should not be all too hard
|
26
26
|
to get it working with plain Rack::Mount but I haven't had that usecase, yet.
|
27
27
|
|
28
28
|
For older Rails use `0-4-stable` branch.
|
@@ -12,7 +12,7 @@ mappers.each do |mapper|
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
module ActionDispatchRoutingRouteSetWithFiltering
|
16
16
|
def filters
|
17
17
|
@set.filters if @set
|
18
18
|
end
|
@@ -22,26 +22,27 @@ ActionDispatch::Routing::RouteSet.class_eval do
|
|
22
22
|
names.each { |name| filters.unshift(RoutingFilter.build(name, options)) }
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def generate(route_key, options, recall = {})
|
26
26
|
options = options.symbolize_keys
|
27
27
|
|
28
28
|
# `around_generate` is destructive method and it breaks url. To avoid this, `dup` is required.
|
29
29
|
filters.run(:around_generate, options, &lambda{
|
30
|
-
|
30
|
+
super(route_key, options, recall).map(&:dup)
|
31
31
|
})
|
32
32
|
end
|
33
|
-
alias_method_chain :generate, :filtering
|
34
33
|
|
35
|
-
def
|
34
|
+
def clear!
|
36
35
|
filters.clear if filters
|
37
|
-
|
36
|
+
super
|
38
37
|
end
|
39
|
-
alias_method_chain :clear!, :filtering
|
40
38
|
end
|
41
39
|
|
40
|
+
ActionDispatch::Routing::RouteSet.send(:prepend, ActionDispatchRoutingRouteSetWithFiltering)
|
41
|
+
|
42
|
+
|
42
43
|
ActionDispatch::Journey::Routes.class_eval do
|
43
44
|
def filters
|
44
|
-
@filters
|
45
|
+
@filters ||= RoutingFilter::Chain.new.tap { |f| @filters = f unless frozen? }
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
def
|
3
|
-
@filters || RoutingFilter::Chain.new.tap { |f| @filters = f unless frozen? }
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
ActionDispatch::Journey::Router.class_eval do
|
8
|
-
def find_routes_with_filtering(env)
|
1
|
+
module ActionDispatchJourneyRouterWithFiltering
|
2
|
+
def find_routes(env)
|
9
3
|
path = env.is_a?(Hash) ? env['PATH_INFO'] : env.path_info
|
10
4
|
filter_parameters = {}
|
11
5
|
original_path = path.dup
|
@@ -14,7 +8,7 @@ ActionDispatch::Journey::Router.class_eval do
|
|
14
8
|
filter_parameters
|
15
9
|
end
|
16
10
|
|
17
|
-
|
11
|
+
super(env).map do |match, parameters, route|
|
18
12
|
[ match, parameters.merge(filter_parameters), route ]
|
19
13
|
end.tap do |match, parameters, route|
|
20
14
|
# restore the original path
|
@@ -25,5 +19,6 @@ ActionDispatch::Journey::Router.class_eval do
|
|
25
19
|
end
|
26
20
|
end
|
27
21
|
end
|
28
|
-
alias_method_chain :find_routes, :filtering
|
29
22
|
end
|
23
|
+
|
24
|
+
ActionDispatch::Journey::Router.send(:prepend, ActionDispatchJourneyRouterWithFiltering)
|
metadata
CHANGED
@@ -1,43 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: routing-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '4.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activesupport
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '4.2'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '5.1'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - "
|
47
|
+
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
49
|
version: '4.2'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '5.1'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: i18n
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +96,22 @@ dependencies:
|
|
84
96
|
name: rails
|
85
97
|
requirement: !ruby/object:Gem::Requirement
|
86
98
|
requirements:
|
87
|
-
- - "
|
99
|
+
- - ">="
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '4.2'
|
102
|
+
- - "<"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '5.1'
|
90
105
|
type: :development
|
91
106
|
prerelease: false
|
92
107
|
version_requirements: !ruby/object:Gem::Requirement
|
93
108
|
requirements:
|
94
|
-
- - "
|
109
|
+
- - ">="
|
95
110
|
- !ruby/object:Gem::Version
|
96
111
|
version: '4.2'
|
112
|
+
- - "<"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '5.1'
|
97
115
|
description: Routing filters wraps around the complex beast that the Rails routing
|
98
116
|
system is, allowing for unseen flexibility and power in Rails URL recognition and
|
99
117
|
generation.
|
@@ -129,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
147
|
requirements:
|
130
148
|
- - ">="
|
131
149
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
150
|
+
version: '2.0'
|
133
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
152
|
requirements:
|
135
153
|
- - ">="
|
@@ -137,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
155
|
version: '0'
|
138
156
|
requirements: []
|
139
157
|
rubyforge_project: "[none]"
|
140
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.5.1
|
141
159
|
signing_key:
|
142
160
|
specification_version: 4
|
143
161
|
summary: Routing filters wraps around the complex beast that the Rails routing system
|