passages 1.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +6 -0
- data/.travis.yml +1 -2
- data/Gemfile.lock +143 -106
- data/README.md +5 -0
- data/app/controllers/passages/routes_controller.rb +4 -1
- data/app/views/passages/routes/_route.html.erb +1 -1
- data/lib/passages/engine.rb +3 -2
- data/lib/passages/route.rb +3 -1
- data/passages.gemspec +4 -4
- data/spec/controllers/passages/routes_controller_spec.rb +18 -3
- data/spec/lib/passages/mount_route_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- data/version.rb +2 -2
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b5cec78946494fdc9d3a624cb7dba705becb79f1251e0819543060b188677f71
|
4
|
+
data.tar.gz: 87c3abd13986edeea7221d8b99ac9a85b4a9f7f1b6e744c48cab92372781d468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69bce6148be98f32c1fcefacb52b78ffb3c6880c073d2304c9fa47b48083576a766ecd3040dfab73733ef5096b7b7431f86c490b3b3d70b76db155680214ece9
|
7
|
+
data.tar.gz: 21e56c99be87f0704c9f797bd582930d7bdf4cec529f7c3515f1a2d5472f74613fea588ab08022beb1cc966e560d8a3b643ec15ba90ac72e763bb3fe3dbcf5b1
|
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,128 +1,165 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
passages (
|
5
|
-
rails (~>
|
4
|
+
passages (2.2.0)
|
5
|
+
rails (~> 6.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
actionpack (=
|
12
|
-
|
13
|
-
|
10
|
+
actioncable (6.0.3.4)
|
11
|
+
actionpack (= 6.0.3.4)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailbox (6.0.3.4)
|
15
|
+
actionpack (= 6.0.3.4)
|
16
|
+
activejob (= 6.0.3.4)
|
17
|
+
activerecord (= 6.0.3.4)
|
18
|
+
activestorage (= 6.0.3.4)
|
19
|
+
activesupport (= 6.0.3.4)
|
20
|
+
mail (>= 2.7.1)
|
21
|
+
actionmailer (6.0.3.4)
|
22
|
+
actionpack (= 6.0.3.4)
|
23
|
+
actionview (= 6.0.3.4)
|
24
|
+
activejob (= 6.0.3.4)
|
14
25
|
mail (~> 2.5, >= 2.5.4)
|
15
|
-
rails-dom-testing (~>
|
16
|
-
actionpack (
|
17
|
-
actionview (=
|
18
|
-
activesupport (=
|
19
|
-
rack (~>
|
20
|
-
rack-test (
|
21
|
-
rails-dom-testing (~>
|
22
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
23
|
-
|
24
|
-
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
actionpack (6.0.3.4)
|
28
|
+
actionview (= 6.0.3.4)
|
29
|
+
activesupport (= 6.0.3.4)
|
30
|
+
rack (~> 2.0, >= 2.0.8)
|
31
|
+
rack-test (>= 0.6.3)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
+
actiontext (6.0.3.4)
|
35
|
+
actionpack (= 6.0.3.4)
|
36
|
+
activerecord (= 6.0.3.4)
|
37
|
+
activestorage (= 6.0.3.4)
|
38
|
+
activesupport (= 6.0.3.4)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
actionview (6.0.3.4)
|
41
|
+
activesupport (= 6.0.3.4)
|
25
42
|
builder (~> 3.1)
|
26
|
-
|
27
|
-
rails-dom-testing (~>
|
28
|
-
rails-html-sanitizer (~> 1.
|
29
|
-
activejob (
|
30
|
-
activesupport (=
|
31
|
-
globalid (>= 0.3.
|
32
|
-
activemodel (
|
33
|
-
activesupport (=
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
erubi (~> 1.4)
|
44
|
+
rails-dom-testing (~> 2.0)
|
45
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
+
activejob (6.0.3.4)
|
47
|
+
activesupport (= 6.0.3.4)
|
48
|
+
globalid (>= 0.3.6)
|
49
|
+
activemodel (6.0.3.4)
|
50
|
+
activesupport (= 6.0.3.4)
|
51
|
+
activerecord (6.0.3.4)
|
52
|
+
activemodel (= 6.0.3.4)
|
53
|
+
activesupport (= 6.0.3.4)
|
54
|
+
activestorage (6.0.3.4)
|
55
|
+
actionpack (= 6.0.3.4)
|
56
|
+
activejob (= 6.0.3.4)
|
57
|
+
activerecord (= 6.0.3.4)
|
58
|
+
marcel (~> 0.3.1)
|
59
|
+
activesupport (6.0.3.4)
|
60
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
61
|
+
i18n (>= 0.7, < 2)
|
42
62
|
minitest (~> 5.1)
|
43
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
44
63
|
tzinfo (~> 1.1)
|
45
|
-
|
46
|
-
ast (2.
|
47
|
-
builder (3.2.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
64
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
65
|
+
ast (2.4.0)
|
66
|
+
builder (3.2.4)
|
67
|
+
concurrent-ruby (1.1.7)
|
68
|
+
crass (1.0.6)
|
69
|
+
diff-lcs (1.3)
|
70
|
+
erubi (1.9.0)
|
71
|
+
globalid (0.4.2)
|
72
|
+
activesupport (>= 4.2.0)
|
73
|
+
i18n (1.8.5)
|
74
|
+
concurrent-ruby (~> 1.0)
|
75
|
+
loofah (2.7.0)
|
76
|
+
crass (~> 1.0.2)
|
55
77
|
nokogiri (>= 1.5.9)
|
56
|
-
mail (2.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
78
|
+
mail (2.7.1)
|
79
|
+
mini_mime (>= 0.1.1)
|
80
|
+
marcel (0.3.3)
|
81
|
+
mimemagic (~> 0.3.2)
|
82
|
+
method_source (1.0.0)
|
83
|
+
mimemagic (0.3.5)
|
84
|
+
mini_mime (1.0.2)
|
85
|
+
mini_portile2 (2.4.0)
|
86
|
+
minitest (5.14.2)
|
87
|
+
nio4r (2.5.4)
|
88
|
+
nokogiri (1.10.10)
|
89
|
+
mini_portile2 (~> 2.4.0)
|
90
|
+
parallel (1.12.1)
|
91
|
+
parser (2.5.1.0)
|
92
|
+
ast (~> 2.4.0)
|
93
|
+
powerpack (0.1.2)
|
94
|
+
rack (2.2.3)
|
95
|
+
rack-test (1.1.0)
|
96
|
+
rack (>= 1.0, < 3)
|
97
|
+
rails (6.0.3.4)
|
98
|
+
actioncable (= 6.0.3.4)
|
99
|
+
actionmailbox (= 6.0.3.4)
|
100
|
+
actionmailer (= 6.0.3.4)
|
101
|
+
actionpack (= 6.0.3.4)
|
102
|
+
actiontext (= 6.0.3.4)
|
103
|
+
actionview (= 6.0.3.4)
|
104
|
+
activejob (= 6.0.3.4)
|
105
|
+
activemodel (= 6.0.3.4)
|
106
|
+
activerecord (= 6.0.3.4)
|
107
|
+
activestorage (= 6.0.3.4)
|
108
|
+
activesupport (= 6.0.3.4)
|
109
|
+
bundler (>= 1.3.0)
|
110
|
+
railties (= 6.0.3.4)
|
111
|
+
sprockets-rails (>= 2.0.0)
|
112
|
+
rails-dom-testing (2.0.3)
|
113
|
+
activesupport (>= 4.2.0)
|
114
|
+
nokogiri (>= 1.6)
|
115
|
+
rails-html-sanitizer (1.3.0)
|
116
|
+
loofah (~> 2.3)
|
117
|
+
railties (6.0.3.4)
|
118
|
+
actionpack (= 6.0.3.4)
|
119
|
+
activesupport (= 6.0.3.4)
|
120
|
+
method_source
|
91
121
|
rake (>= 0.8.7)
|
92
|
-
thor (>= 0.
|
93
|
-
rainbow (2.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
rspec-
|
98
|
-
rspec-
|
99
|
-
|
100
|
-
|
101
|
-
|
122
|
+
thor (>= 0.20.3, < 2.0)
|
123
|
+
rainbow (2.2.2)
|
124
|
+
rake
|
125
|
+
rake (12.3.1)
|
126
|
+
rspec (3.7.0)
|
127
|
+
rspec-core (~> 3.7.0)
|
128
|
+
rspec-expectations (~> 3.7.0)
|
129
|
+
rspec-mocks (~> 3.7.0)
|
130
|
+
rspec-core (3.7.1)
|
131
|
+
rspec-support (~> 3.7.0)
|
132
|
+
rspec-expectations (3.7.0)
|
102
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
103
|
-
rspec-support (~> 3.
|
104
|
-
rspec-mocks (3.
|
134
|
+
rspec-support (~> 3.7.0)
|
135
|
+
rspec-mocks (3.7.0)
|
105
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
-
rspec-support (~> 3.
|
107
|
-
rspec-support (3.
|
108
|
-
rubocop (0.
|
109
|
-
|
137
|
+
rspec-support (~> 3.7.0)
|
138
|
+
rspec-support (3.7.1)
|
139
|
+
rubocop (0.49.0)
|
140
|
+
parallel (~> 1.10)
|
141
|
+
parser (>= 2.3.3.1, < 3.0)
|
110
142
|
powerpack (~> 0.1)
|
111
143
|
rainbow (>= 1.99.1, < 3.0)
|
112
144
|
ruby-progressbar (~> 1.7)
|
113
145
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
114
|
-
ruby-progressbar (1.
|
115
|
-
sprockets (
|
146
|
+
ruby-progressbar (1.9.0)
|
147
|
+
sprockets (4.0.2)
|
148
|
+
concurrent-ruby (~> 1.0)
|
116
149
|
rack (> 1, < 3)
|
117
|
-
sprockets-rails (2.
|
118
|
-
actionpack (>=
|
119
|
-
activesupport (>=
|
120
|
-
sprockets (>=
|
121
|
-
thor (0.
|
122
|
-
thread_safe (0.3.
|
123
|
-
tzinfo (1.2.
|
150
|
+
sprockets-rails (3.2.2)
|
151
|
+
actionpack (>= 4.0)
|
152
|
+
activesupport (>= 4.0)
|
153
|
+
sprockets (>= 3.0.0)
|
154
|
+
thor (1.0.1)
|
155
|
+
thread_safe (0.3.6)
|
156
|
+
tzinfo (1.2.7)
|
124
157
|
thread_safe (~> 0.1)
|
125
|
-
unicode-display_width (1.0
|
158
|
+
unicode-display_width (1.4.0)
|
159
|
+
websocket-driver (0.7.3)
|
160
|
+
websocket-extensions (>= 0.1.0)
|
161
|
+
websocket-extensions (0.1.5)
|
162
|
+
zeitwerk (2.4.0)
|
126
163
|
|
127
164
|
PLATFORMS
|
128
165
|
ruby
|
@@ -130,7 +167,7 @@ PLATFORMS
|
|
130
167
|
DEPENDENCIES
|
131
168
|
passages!
|
132
169
|
rspec (~> 3.2)
|
133
|
-
rubocop (= 0.
|
170
|
+
rubocop (= 0.49.0)
|
134
171
|
|
135
172
|
BUNDLED WITH
|
136
|
-
1.
|
173
|
+
1.17.3
|
data/README.md
CHANGED
@@ -47,6 +47,11 @@ end
|
|
47
47
|
|
48
48
|
With the Engine mounted at `/passages`, the rendered page will display a search box and list of all known routes within the application.
|
49
49
|
|
50
|
+
### Rails 5 and Above
|
51
|
+
|
52
|
+
Rails 5 apps should use version 2.0 of this gem, everyone below should use
|
53
|
+
1.5.2
|
54
|
+
|
50
55
|
## Authorization
|
51
56
|
|
52
57
|
Since there are no environment dependent checks, the `/passages` page uses configurable http basic authentication.
|
@@ -12,8 +12,11 @@ module Passages
|
|
12
12
|
|
13
13
|
def routes
|
14
14
|
@routes = application_routes
|
15
|
-
@engine_routes = engine_routes
|
16
15
|
@mount_routes = mount_routes
|
16
|
+
mounted_engines = @mount_routes.keys
|
17
|
+
@engine_routes = engine_routes.select do |r|
|
18
|
+
mounted_engines.include?(r[:engine])
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
22
|
private
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<tr>
|
2
2
|
<% Passages::Route.attributes_for_display.each do |attribute| %>
|
3
|
-
<td data-search='<%= route.send(attribute).downcase %>' data-matching-attribute='<%=attribute%>'>
|
3
|
+
<td data-search='<%= route.send(attribute).try(:downcase) %>' data-matching-attribute='<%=attribute%>'>
|
4
4
|
<%= route.send(attribute) %>
|
5
5
|
</td>
|
6
6
|
<% end %>
|
data/lib/passages/engine.rb
CHANGED
@@ -8,7 +8,7 @@ module Passages
|
|
8
8
|
# Necessary for rake assets:precompile in a main application
|
9
9
|
# to compile this Engine's assets as well
|
10
10
|
initializer 'passages.assets.precompile' do |app|
|
11
|
-
app.config.assets.precompile += %w
|
11
|
+
app.config.assets.precompile += %w[passages/application.css passages/application.js]
|
12
12
|
end
|
13
13
|
|
14
14
|
# Optionally mount the /passages route at an applications top
|
@@ -25,7 +25,8 @@ module Passages
|
|
25
25
|
unless Passages.config.no_auth?
|
26
26
|
Passages::RoutesController.http_basic_authenticate_with(
|
27
27
|
name: Passages.username,
|
28
|
-
password: Passages.password
|
28
|
+
password: Passages.password
|
29
|
+
)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
data/lib/passages/route.rb
CHANGED
@@ -6,13 +6,15 @@ module Passages
|
|
6
6
|
# Main DelegateClass used for decoration and discerning if a route is
|
7
7
|
# a "regular" route or a mount route
|
8
8
|
class Route < DelegateClass(ActionDispatch::Routing::RouteWrapper)
|
9
|
+
ATTRIBUTES_FOR_DISPLAY = %w[name verb controller action path].freeze
|
10
|
+
|
9
11
|
def initialize(route)
|
10
12
|
super(ActionDispatch::Routing::RouteWrapper.new(route))
|
11
13
|
end
|
12
14
|
|
13
15
|
class << self
|
14
16
|
def attributes_for_display
|
15
|
-
|
17
|
+
ATTRIBUTES_FOR_DISPLAY
|
16
18
|
end
|
17
19
|
|
18
20
|
def from_raw_route(raw_route)
|
data/passages.gemspec
CHANGED
@@ -16,13 +16,13 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.homepage = 'https://github.com/yez/passages'
|
17
17
|
s.license = 'MIT'
|
18
18
|
|
19
|
-
s.require_paths = %w
|
19
|
+
s.require_paths = %w[lib app]
|
20
20
|
s.files = `git ls-files`.split("\n")
|
21
21
|
s.test_files = s.files.grep(%r{^spec/})
|
22
22
|
|
23
|
-
s.required_ruby_version = '>= 2.
|
24
|
-
s.add_dependency 'rails', '~>
|
23
|
+
s.required_ruby_version = '>= 2.2.2'
|
24
|
+
s.add_dependency 'rails', '~> 6.0'
|
25
25
|
|
26
26
|
s.add_development_dependency 'rspec', '~> 3.2'
|
27
|
-
s.add_development_dependency 'rubocop', '0.
|
27
|
+
s.add_development_dependency 'rubocop', '0.49.0'
|
28
28
|
end
|
@@ -9,9 +9,9 @@ module Passages
|
|
9
9
|
describe RoutesController do
|
10
10
|
describe '#routes' do
|
11
11
|
before do
|
12
|
-
allow(subject).to receive(:application_routes) {
|
13
|
-
allow(subject).to receive(:engine_routes) {
|
14
|
-
allow(subject).to receive(:mount_routes) {
|
12
|
+
allow(subject).to receive(:application_routes) { [] }
|
13
|
+
allow(subject).to receive(:engine_routes) { [] }
|
14
|
+
allow(subject).to receive(:mount_routes) { {} }
|
15
15
|
subject.routes
|
16
16
|
end
|
17
17
|
|
@@ -23,6 +23,21 @@ module Passages
|
|
23
23
|
expect(subject.instance_variable_get(:@engine_routes)).to_not be_nil
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'sets @engine_routes only if a corresponding mounte route exists' do
|
27
|
+
first_engine_route = { engine: :foo, routes: [anything] }
|
28
|
+
second_engine_route = { engine: :bar, routes: [anything] }
|
29
|
+
allow(subject).to receive(:engine_routes) do
|
30
|
+
[
|
31
|
+
first_engine_route,
|
32
|
+
second_engine_route
|
33
|
+
]
|
34
|
+
end
|
35
|
+
allow(subject).to receive(:mount_routes) { { foo: anything } }
|
36
|
+
expected = [first_engine_route]
|
37
|
+
subject.routes
|
38
|
+
expect(subject.instance_variable_get(:@engine_routes)).to eq(expected)
|
39
|
+
end
|
40
|
+
|
26
41
|
it 'sets @mount_routes' do
|
27
42
|
expect(subject.instance_variable_get(:@mount_routes)).to_not be_nil
|
28
43
|
end
|
data/spec/spec_helper.rb
CHANGED
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Yesbeck
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.49.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.49.0
|
55
55
|
description: |-
|
56
56
|
Rails Engine to make internal routes searchable and
|
57
57
|
discoverable for more than just the name of the route.
|
@@ -63,6 +63,7 @@ extensions: []
|
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
65
|
- ".gitignore"
|
66
|
+
- ".rubocop.yml"
|
66
67
|
- ".travis.yml"
|
67
68
|
- Gemfile
|
68
69
|
- Gemfile.lock
|
@@ -109,7 +110,7 @@ homepage: https://github.com/yez/passages
|
|
109
110
|
licenses:
|
110
111
|
- MIT
|
111
112
|
metadata: {}
|
112
|
-
post_install_message:
|
113
|
+
post_install_message:
|
113
114
|
rdoc_options: []
|
114
115
|
require_paths:
|
115
116
|
- lib
|
@@ -118,16 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
119
|
requirements:
|
119
120
|
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
|
-
version: 2.
|
122
|
+
version: 2.2.2
|
122
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
124
|
requirements:
|
124
125
|
- - ">="
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: '0'
|
127
128
|
requirements: []
|
128
|
-
|
129
|
-
|
130
|
-
signing_key:
|
129
|
+
rubygems_version: 3.0.4
|
130
|
+
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Display and search capabilities for Ruby on Rails routes
|
133
133
|
test_files:
|