filter_decrufter 0.0.4 → 0.0.5
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 +5 -0
- data/README.md +2 -1
- data/lib/filter_decrufter/checker.rb +11 -9
- 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: e6f033cc671a5c826ed0f7263fc969bf133ae999
|
4
|
+
data.tar.gz: 1b0541e2781f0cd93b70fea3043f09dfaf5e6afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90de28ef44365692237c502b0bdd1311c28cb69995efe6be3c516d4a8d6bb8367b8e27d7460bb92e46626c7f1f81e122f6c29d2b8cbfeb43f46d05375248e7b
|
7
|
+
data.tar.gz: 7cd8f3acedc1ee1f4496419318706b1f1023c2a58eb204e5a3d70bd4b5ec1264658b557e48243fd6f98b1cd324126c70364832519c3719daa7d386fb933ad024
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.0.5 (2015-02-28)
|
2
|
+
|
3
|
+
* [FIXED] If a filter/action contains both an 'except' and an 'only' constraint and both referred to an unused action, FilterDecrufter will no longer display both as being 'only' constraints.
|
4
|
+
* [FIXED] No longer is an exception raised if a filter is defined with multiple methods, e.g., `before_action :foo, :bar, :only => :buz`
|
5
|
+
|
1
6
|
## 0.0.4 (2015-02-27)
|
2
7
|
|
3
8
|
* [FIXED] Check for before|after|around_action for Rails 4.2
|
data/README.md
CHANGED
@@ -25,6 +25,7 @@ Tested with Rails 3.2, 4.0, and 4.2.
|
|
25
25
|
|
26
26
|
# Credits
|
27
27
|
|
28
|
+
* [John Moon](http://www.thinkandgrowentrepreneur.com/) - design discussions
|
29
|
+
* [Mike Foley](https://twitter.com/m1foley) - filter with multiple method bug report
|
28
30
|
* [Sandeep Kumar](https://whatpeoplethink.wordpress.com/) - Rails 4.2 support
|
29
31
|
* [Tom Copeland](http://thomasleecopeland.com) - author
|
30
|
-
* [John Moon](http://www.thinkandgrowentrepreneur.com/) - design discussions
|
@@ -15,8 +15,8 @@ module FilterDecrufter
|
|
15
15
|
action_methods.include?(action_name)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
options.select {|opt_name,opt_value|
|
18
|
+
def populated_options_for(name)
|
19
|
+
options.select {|opt_name,opt_value| opt_name == name && !opt_value.empty? }
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -46,16 +46,14 @@ module FilterDecrufter
|
|
46
46
|
|
47
47
|
def find_problems
|
48
48
|
hits.each do |hit|
|
49
|
-
|
50
|
-
|
51
|
-
check_constraint(constraint_name, hit) if hit.populated_only_except_options[constraint_name].present?
|
52
|
-
end
|
49
|
+
[:only, :except].each do |constraint_name|
|
50
|
+
check_constraint(constraint_name, hit) if hit.populated_options_for(constraint_name)[constraint_name].present?
|
53
51
|
end
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
57
55
|
def check_constraint(name, hit)
|
58
|
-
[hit.
|
56
|
+
[hit.populated_options_for(name)[name]].flatten.each do |action_syms|
|
59
57
|
[action_syms].flatten.each do |action_name|
|
60
58
|
if !hit.actions_include?(action_name)
|
61
59
|
puts "#{hit.controller_class} #{hit.filter_type} '#{hit.filter_name}' has an :#{name} constraint with a non-existent action name '#{action_name}'"
|
@@ -92,8 +90,12 @@ module FilterDecrufter
|
|
92
90
|
|
93
91
|
def patch_method(filter_sym)
|
94
92
|
ApplicationController.define_singleton_method(filter_sym) do |*args, &blk|
|
95
|
-
|
96
|
-
|
93
|
+
filter_names = args.select {|a| a.kind_of?(Symbol) }
|
94
|
+
filter_options = args.detect {|a| a.kind_of?(Hash) }
|
95
|
+
if filter_options.present? && (filter_options[:only].present? || filter_options[:except].present?)
|
96
|
+
filter_names.each do |name|
|
97
|
+
Report.instance.add(FilterDecrufter::Hit.new(self, name, filter_options, filter_sym))
|
98
|
+
end
|
97
99
|
end
|
98
100
|
super(*args, &blk)
|
99
101
|
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.5
|
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-
|
11
|
+
date: 2015-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|