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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3d3f4fa013d65c71495f42e6afe5dfdfe2af8434
4
- data.tar.gz: b7c95addc7701918a5578f5f471702e08059c63a
2
+ SHA256:
3
+ metadata.gz: b5cec78946494fdc9d3a624cb7dba705becb79f1251e0819543060b188677f71
4
+ data.tar.gz: 87c3abd13986edeea7221d8b99ac9a85b4a9f7f1b6e744c48cab92372781d468
5
5
  SHA512:
6
- metadata.gz: d4c9b9decac15e237464c6eaea561e1ba45d3000c74a52e0d1d16e37b1f5825ed73287f54b1d4fb4ee16e86ec3a48cb43f3cd038c5d7719b5715c032a27dfa0a
7
- data.tar.gz: 64d959ed0dec380d4c8e694b9f5d51f115ce02bfee4561018c87c88481d296c0837eb155b1f4a460337e5ec019042f74306824bc537952835bc52dd40a4821ad
6
+ metadata.gz: 69bce6148be98f32c1fcefacb52b78ffb3c6880c073d2304c9fa47b48083576a766ecd3040dfab73733ef5096b7b7431f86c490b3b3d70b76db155680214ece9
7
+ data.tar.gz: 21e56c99be87f0704c9f797bd582930d7bdf4cec529f7c3515f1a2d5472f74613fea588ab08022beb1cc966e560d8a3b643ec15ba90ac72e763bb3fe3dbcf5b1
@@ -0,0 +1,6 @@
1
+ Style/FrozenStringLiteralComment:
2
+ Enabled: false
3
+
4
+ Style/BlockLength:
5
+ Exclude:
6
+ - 'spec/**/*.rb'
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.2.1
5
3
  - 2.2.2
6
4
  - 2.3.0
5
+ - 2.4.0
7
6
 
8
7
  script:
9
8
  - bundle exec rspec spec
@@ -1,128 +1,165 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passages (1.5.1)
5
- rails (~> 4.0)
4
+ passages (2.2.0)
5
+ rails (~> 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (4.2.4)
11
- actionpack (= 4.2.4)
12
- actionview (= 4.2.4)
13
- activejob (= 4.2.4)
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 (~> 1.0, >= 1.0.5)
16
- actionpack (4.2.4)
17
- actionview (= 4.2.4)
18
- activesupport (= 4.2.4)
19
- rack (~> 1.6)
20
- rack-test (~> 0.6.2)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
22
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- actionview (4.2.4)
24
- activesupport (= 4.2.4)
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
- erubis (~> 2.7.0)
27
- rails-dom-testing (~> 1.0, >= 1.0.5)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- activejob (4.2.4)
30
- activesupport (= 4.2.4)
31
- globalid (>= 0.3.0)
32
- activemodel (4.2.4)
33
- activesupport (= 4.2.4)
34
- builder (~> 3.1)
35
- activerecord (4.2.4)
36
- activemodel (= 4.2.4)
37
- activesupport (= 4.2.4)
38
- arel (~> 6.0)
39
- activesupport (4.2.4)
40
- i18n (~> 0.7)
41
- json (~> 1.7, >= 1.7.7)
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
- arel (6.0.3)
46
- ast (2.2.0)
47
- builder (3.2.2)
48
- diff-lcs (1.2.5)
49
- erubis (2.7.0)
50
- globalid (0.3.6)
51
- activesupport (>= 4.1.0)
52
- i18n (0.7.0)
53
- json (1.8.3)
54
- loofah (2.0.3)
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.6.3)
57
- mime-types (>= 1.16, < 3)
58
- mime-types (2.6.2)
59
- mini_portile (0.6.2)
60
- minitest (5.8.3)
61
- nokogiri (1.6.6.2)
62
- mini_portile (~> 0.6.0)
63
- parser (2.3.0.7)
64
- ast (~> 2.2)
65
- powerpack (0.1.1)
66
- rack (1.6.4)
67
- rack-test (0.6.3)
68
- rack (>= 1.0)
69
- rails (4.2.4)
70
- actionmailer (= 4.2.4)
71
- actionpack (= 4.2.4)
72
- actionview (= 4.2.4)
73
- activejob (= 4.2.4)
74
- activemodel (= 4.2.4)
75
- activerecord (= 4.2.4)
76
- activesupport (= 4.2.4)
77
- bundler (>= 1.3.0, < 2.0)
78
- railties (= 4.2.4)
79
- sprockets-rails
80
- rails-deprecated_sanitizer (1.0.3)
81
- activesupport (>= 4.2.0.alpha)
82
- rails-dom-testing (1.0.7)
83
- activesupport (>= 4.2.0.beta, < 5.0)
84
- nokogiri (~> 1.6.0)
85
- rails-deprecated_sanitizer (>= 1.0.1)
86
- rails-html-sanitizer (1.0.2)
87
- loofah (~> 2.0)
88
- railties (4.2.4)
89
- actionpack (= 4.2.4)
90
- activesupport (= 4.2.4)
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.18.1, < 2.0)
93
- rainbow (2.1.0)
94
- rake (10.4.2)
95
- rspec (3.3.0)
96
- rspec-core (~> 3.3.0)
97
- rspec-expectations (~> 3.3.0)
98
- rspec-mocks (~> 3.3.0)
99
- rspec-core (3.3.2)
100
- rspec-support (~> 3.3.0)
101
- rspec-expectations (3.3.1)
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.3.0)
104
- rspec-mocks (3.3.2)
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.3.0)
107
- rspec-support (3.3.0)
108
- rubocop (0.39.0)
109
- parser (>= 2.3.0.7, < 3.0)
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.7.5)
115
- sprockets (3.3.5)
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.3.3)
118
- actionpack (>= 3.0)
119
- activesupport (>= 3.0)
120
- sprockets (>= 2.8, < 4.0)
121
- thor (0.19.1)
122
- thread_safe (0.3.5)
123
- tzinfo (1.2.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.2)
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.39.0)
170
+ rubocop (= 0.49.0)
134
171
 
135
172
  BUNDLED WITH
136
- 1.11.2
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 %>
@@ -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(application.css application.js)
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
@@ -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
- %w(name verb controller action path)
17
+ ATTRIBUTES_FOR_DISPLAY
16
18
  end
17
19
 
18
20
  def from_raw_route(raw_route)
@@ -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(lib app)
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.0.0'
24
- s.add_dependency 'rails', '~> 4.0'
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.39.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) { anything }
13
- allow(subject).to receive(:engine_routes) { anything }
14
- allow(subject).to receive(:mount_routes) { anything }
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
@@ -18,7 +18,7 @@ module Passages
18
18
  end
19
19
  end
20
20
 
21
- [:internal?, :path].each do |method|
21
+ %i[internal? path].each do |method|
22
22
  describe "##{method}" do
23
23
  it "responds to #{method}" do
24
24
  expect(subject).to respond_to(method)
@@ -1,5 +1,4 @@
1
- require 'action_dispatch/routing'
2
- require 'action_dispatch/routing/inspector'
3
1
  require 'active_support'
2
+ require 'action_dispatch'
4
3
  require 'action_controller'
5
4
  require './lib/passages'
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Passages
2
- MAJOR = 1
3
- MINOR = 5
2
+ MAJOR = 3
3
+ MINOR = 0
4
4
  TINY = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join('.').freeze
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: 1.5.0
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: 2016-03-31 00:00:00.000000000 Z
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: '4.0'
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: '4.0'
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.39.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.39.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.0.0
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
- rubyforge_project:
129
- rubygems_version: 2.5.1
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: