traceroute 0.3.0 → 0.4.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: 25f82c67be02c675044f71eb41df6524599e479a
4
- data.tar.gz: 68ab012a63518d6737521c40d6247e41acdd1002
3
+ metadata.gz: e3b6798196323becbcafa21da7194fc6f277b76c
4
+ data.tar.gz: 5bad050aa0eeaac3caafec59897e5accabec0cb6
5
5
  SHA512:
6
- metadata.gz: 171891b307a39d6e9e9a70c30716806bb1950ac52105dbe3361f7a36540713b309837fb2c5a190bd142ce9837052f8faf0ca5f9eeaee5cb70b7b885d18fa1c38
7
- data.tar.gz: bcdbf583a1d7469f6a8b6f18be43d225d57de4fa1aa2adbbc3edc9e428748aee5eb62b4b49e0604fb85086f86d162c31678fec68dfef80f00d25a1f963343ec7
6
+ metadata.gz: c7f1d5534e1c1faf86556feb9a070da0fbe80f56e6515bfec3c77a184d9ea62c77239468f9a5d41919090d5d0761eb1039919f28251dc221672aaeeec93aa5b0
7
+ data.tar.gz: a703004cd3574d8d6f09a791eb6443e27326ee891c63d2790aa0b0a7a6edd5e37d19929f85d380f18367d88f82d83ef7884716cd3c2da93f0893b94d17e78db5
@@ -1,18 +1,18 @@
1
1
  = Traceroute
2
2
 
3
- A Rake task that helps you find the dead routes and actions for your Rails 3 app
3
+ A Rake task that helps you find dead routes and unused actions in your Rails 3/4 app.
4
4
 
5
5
 
6
6
  == Features
7
7
 
8
- This Rake task investigates your Rails 3 application's routes definition, then tells you unused routes and unreachable action methods.
8
+ This Rake task investigates your Rails application's routes definition, then shows you the unused routes and unreachable action methods.
9
9
 
10
10
 
11
11
  == Supported versions
12
12
 
13
13
  * Ruby 1.8.7, 1.9.2, 1.9.3, 2.0, 2.1 (trunk)
14
14
 
15
- * Rails 3.0.x, 3.1.x, 3.2.x, 4.0 (edge)
15
+ * Rails 3.0.x, 3.1.x, 3.2.x, 4.0.x, 4.1.x
16
16
 
17
17
 
18
18
  == Install
@@ -56,11 +56,11 @@ Consider you have the following routes.rb and a controller:
56
56
 
57
57
  Running the Rake task will print something like this for you:
58
58
 
59
- Unused routes:
59
+ Unused routes (3):
60
60
  users#create
61
61
  users#new
62
62
  catalog#purchase
63
- Unreachable action methods:
63
+ Unreachable action methods (1):
64
64
  users#index2
65
65
 
66
66
  OMG super helpful, isn't it?
@@ -1,12 +1,15 @@
1
1
  desc 'Prints out unused routes and unreachable action methods'
2
2
  task :traceroute => :environment do
3
3
  Rails.application.eager_load!
4
+ ::Rails::InfoController rescue NameError
5
+ ::Rails::WelcomeController rescue NameError
6
+ ::Rails::MailersController rescue NameError
4
7
  Rails.application.reload_routes!
5
8
 
6
9
  routes = Rails.application.routes.routes.reject {|r| r.name.nil? && r.requirements.blank?}
7
10
 
8
11
  if Rails.application.config.respond_to?(:assets)
9
- exclusion_regexp = %r{/rails/info/properties|^#{Rails.application.config.assets.prefix}}
12
+ exclusion_regexp = %r{^#{Rails.application.config.assets.prefix}}
10
13
 
11
14
  routes.reject! do |route|
12
15
  path = (defined?(ActionDispatch::Journey::Route) || defined?(Journey::Route)) ? route.path.spec.to_s : route.path
@@ -14,11 +17,11 @@ task :traceroute => :environment do
14
17
  end
15
18
  end
16
19
 
17
- defined_action_methods = ApplicationController.descendants.map {|controller|
20
+ defined_action_methods = ActionController::Base.descendants.map do |controller|
18
21
  controller.action_methods.reject {|a| (a =~ /\A(_conditional)?_callback_/) || (a == '_layout_from_proc')}.map do |action|
19
22
  "#{controller.controller_path}##{action}"
20
23
  end
21
- }.flatten
24
+ end.flatten
22
25
 
23
26
  routed_actions = routes.map do |r|
24
27
  if r.requirements[:controller].blank? && r.requirements[:action].blank? && (r.path == '/:controller(/:action(/:id(.:format)))')
@@ -28,8 +31,11 @@ task :traceroute => :environment do
28
31
  end
29
32
  end
30
33
 
31
- puts 'Unused routes:'
32
- (routed_actions - defined_action_methods).each {|a| puts " #{a}"}
33
- puts 'Unreachable action methods:'
34
- (defined_action_methods - routed_actions).each {|a| puts " #{a}"}
34
+ unused_routes = routed_actions - defined_action_methods
35
+ unreachable_action_methods = defined_action_methods - routed_actions
36
+
37
+ puts "Unused routes (#{unused_routes.count}):"
38
+ unused_routes.each {|route| puts " #{route}"}
39
+ puts "Unreachable action methods (#{unreachable_action_methods.count}):"
40
+ unreachable_action_methods.each {|action| puts " #{action}"}
35
41
  end
@@ -1,3 +1,3 @@
1
1
  module Traceroute
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceroute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-15 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.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
26
  version: 3.0.0
27
27
  description: This Rake task investigates the application's routes definition, then
@@ -33,7 +33,7 @@ extensions: []
33
33
  extra_rdoc_files:
34
34
  - README.rdoc
35
35
  files:
36
- - .gitignore
36
+ - ".gitignore"
37
37
  - Gemfile
38
38
  - README.rdoc
39
39
  - Rakefile
@@ -51,17 +51,17 @@ require_paths:
51
51
  - lib
52
52
  required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
63
  rubyforge_project: traceroute
64
- rubygems_version: 2.0.0
64
+ rubygems_version: 2.2.2
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: A Rake task that helps you find the dead routes and actions for your Rails