controller_filter_logging 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/controller_filter_logging.gemspec +21 -0
- data/init.rb +1 -0
- data/lib/controller_filter_logging.rb +27 -0
- data/lib/controller_filter_logging/version.rb +3 -0
- metadata +63 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "controller_filter_logging/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "controller_filter_logging"
|
7
|
+
s.version = ControllerFilterLogging::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jon Moses"]
|
10
|
+
s.email = ["jon@burningbush.us"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Bring back controller filter logging to rails 3}
|
13
|
+
s.description = %q{Gem to log execution and results of before_filter's for Rails 3}
|
14
|
+
|
15
|
+
s.rubyforge_project = "controller_filter_logging"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'lib/controller_filter_logging' unless Rails.env.production?
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module AbstractController::Callbacks::ClassMethods
|
2
|
+
def before_filter_with_logging(filter_name, *args)
|
3
|
+
create_logging_filter(filter_name)
|
4
|
+
before_filter_without_logging "#{filter_name}_with_logging".to_sym, *args
|
5
|
+
end
|
6
|
+
alias_method_chain :before_filter, :logging
|
7
|
+
|
8
|
+
def skip_before_filter_with_logging(filter_name, *args)
|
9
|
+
skip_before_filter_without_logging("#{filter_name}_with_logging".to_sym, *args)
|
10
|
+
end
|
11
|
+
alias_method_chain :skip_before_filter, :logging
|
12
|
+
|
13
|
+
def prepend_before_filter_with_logging(filter_name, *args)
|
14
|
+
create_logging_filter(filter_name)
|
15
|
+
prepend_before_filter_without_logging("#{filter_name}_with_logging".to_sym, *args)
|
16
|
+
end
|
17
|
+
alias_method_chain :prepend_before_filter, :logging
|
18
|
+
|
19
|
+
def create_logging_filter(filter_name)
|
20
|
+
define_method("#{filter_name}_with_logging") do
|
21
|
+
Rails.logger.debug("Entering before_filter: #{filter_name}")
|
22
|
+
send(filter_name).tap do |result|
|
23
|
+
Rails.logger.debug(" result: #{result}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: controller_filter_logging
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jon Moses
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-08 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Gem to log execution and results of before_filter's for Rails 3
|
18
|
+
email:
|
19
|
+
- jon@burningbush.us
|
20
|
+
executables: []
|
21
|
+
|
22
|
+
extensions: []
|
23
|
+
|
24
|
+
extra_rdoc_files: []
|
25
|
+
|
26
|
+
files:
|
27
|
+
- .gitignore
|
28
|
+
- Gemfile
|
29
|
+
- Rakefile
|
30
|
+
- controller_filter_logging.gemspec
|
31
|
+
- init.rb
|
32
|
+
- lib/controller_filter_logging.rb
|
33
|
+
- lib/controller_filter_logging/version.rb
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: ""
|
36
|
+
licenses: []
|
37
|
+
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
requirements: []
|
56
|
+
|
57
|
+
rubyforge_project: controller_filter_logging
|
58
|
+
rubygems_version: 1.5.2
|
59
|
+
signing_key:
|
60
|
+
specification_version: 3
|
61
|
+
summary: Bring back controller filter logging to rails 3
|
62
|
+
test_files: []
|
63
|
+
|