filter_decrufter 0.0.3 → 0.0.4

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
2
  SHA1:
3
- metadata.gz: cd9c4f9c59da12771bbf12d09fadb5ce6fe282a3
4
- data.tar.gz: 115f66febd38a0cefc999919eccb2ae03a2f09af
3
+ metadata.gz: fecce40a8c9791aef1700866251dc72175bfb7b2
4
+ data.tar.gz: 6980da08ea0c95878f145ef12ff2ab14e8834dd6
5
5
  SHA512:
6
- metadata.gz: 25fa82579c3e2c0daf3b620b1fd1800632cc20a1108dac15bc359e7d38a0082b40dd49aa3ca8a8e068bebdbdb0de274e59005d0d1fb2620888378a8059bdf4ca
7
- data.tar.gz: a469df57be33490c3dcc4ea499085a3f61b215815a6859b8954da39d38f73e7c04382360599594ee64188de23636a4bee50f55ff0105d124f2f2aab2a407a4bd
6
+ metadata.gz: a9bfb7bc2c13ce2cdc3156aeead413c9e63b70d1bf8486f143e81765bb0c52ba09f0735aea3cc26a79009847f720acf3ed2fcec54ea7ff5a21b239ae445e0217
7
+ data.tar.gz: 49d8d4df671c32e541df18b3f53b6493ad0e5a3000d7ffa92fae57b58a584cb77a2d060ebd468837e012a3d2ed2b9eaec7759609fc72e5be8f84ac26a2980f77
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.4 (2015-02-27)
2
+
3
+ * [FIXED] Check for before|after|around_action for Rails 4.2
4
+
1
5
  ## 0.0.3 (2015-02-18)
2
6
 
3
7
  * [FIXED] No longer reports all violations as being for before_filters
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
- * Tom Copeland - author
29
- * John Moon - design discussions
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, :before_filter_name, :options, :filter_type
5
+ attr_accessor :controller_class, :filter_name, :options, :filter_type
6
6
 
7
- def initialize(controller_class, before_filter_name, options, filter_type)
7
+ def initialize(controller_class, filter_name, options, filter_type)
8
8
  @controller_class = controller_class
9
- @before_filter_name = before_filter_name
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.before_filter_name}' has an :#{name} constraint with a non-existent action name '#{action_name}'"
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
- [:before_filter, :around_filter, :after_filter].each {|s| patch_method(s) }
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
@@ -1,3 +1,3 @@
1
1
  module FilterDecrufter
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  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.3
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-23 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake