filter_decrufter 0.0.3 → 0.0.4
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.md +4 -3
- data/lib/filter_decrufter/checker.rb +9 -5
- data/lib/filter_decrufter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fecce40a8c9791aef1700866251dc72175bfb7b2
|
4
|
+
data.tar.gz: 6980da08ea0c95878f145ef12ff2ab14e8834dd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9bfb7bc2c13ce2cdc3156aeead413c9e63b70d1bf8486f143e81765bb0c52ba09f0735aea3cc26a79009847f720acf3ed2fcec54ea7ff5a21b239ae445e0217
|
7
|
+
data.tar.gz: 49d8d4df671c32e541df18b3f53b6493ad0e5a3000d7ffa92fae57b58a584cb77a2d060ebd468837e012a3d2ed2b9eaec7759609fc72e5be8f84ac26a2980f77
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -21,9 +21,10 @@ Run the task!
|
|
21
21
|
Api::V1::WidgetsController before_filter 'find_widget' has an :only constraint with a non-existent action name 'show'
|
22
22
|
EmployeesController after_filter 'set_name' has an :only constraint with a non-existent action name 'frobnicate'
|
23
23
|
|
24
|
-
Tested with Rails 3.2.
|
24
|
+
Tested with Rails 3.2, 4.0, and 4.2.
|
25
25
|
|
26
26
|
# Credits
|
27
27
|
|
28
|
-
*
|
29
|
-
*
|
28
|
+
* [Sandeep Kumar](https://whatpeoplethink.wordpress.com/) - Rails 4.2 support
|
29
|
+
* [Tom Copeland](http://thomasleecopeland.com) - author
|
30
|
+
* [John Moon](http://www.thinkandgrowentrepreneur.com/) - design discussions
|
@@ -2,11 +2,11 @@ module FilterDecrufter
|
|
2
2
|
|
3
3
|
class Hit
|
4
4
|
|
5
|
-
attr_accessor :controller_class, :
|
5
|
+
attr_accessor :controller_class, :filter_name, :options, :filter_type
|
6
6
|
|
7
|
-
def initialize(controller_class,
|
7
|
+
def initialize(controller_class, filter_name, options, filter_type)
|
8
8
|
@controller_class = controller_class
|
9
|
-
@
|
9
|
+
@filter_name = filter_name
|
10
10
|
@options = options
|
11
11
|
@filter_type = filter_type
|
12
12
|
end
|
@@ -58,7 +58,7 @@ module FilterDecrufter
|
|
58
58
|
[hit.populated_only_except_options[name]].flatten.each do |action_syms|
|
59
59
|
[action_syms].flatten.each do |action_name|
|
60
60
|
if !hit.actions_include?(action_name)
|
61
|
-
puts "#{hit.controller_class} #{hit.filter_type} '#{hit.
|
61
|
+
puts "#{hit.controller_class} #{hit.filter_type} '#{hit.filter_name}' has an :#{name} constraint with a non-existent action name '#{action_name}'"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -74,7 +74,7 @@ module FilterDecrufter
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def check
|
77
|
-
|
77
|
+
filter_method_names.each {|s| patch_method(s) }
|
78
78
|
load_all_controllers
|
79
79
|
show_report
|
80
80
|
nil
|
@@ -82,6 +82,10 @@ module FilterDecrufter
|
|
82
82
|
|
83
83
|
private
|
84
84
|
|
85
|
+
def filter_method_names
|
86
|
+
[:before, :around, :after].map {|s| ["#{s}_filter", "#{s}_action"]}.flatten.sort.map(&:to_sym)
|
87
|
+
end
|
88
|
+
|
85
89
|
def show_report
|
86
90
|
Report.instance.find_problems
|
87
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filter_decrufter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Copeland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|