oink 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
data/lib/oink/middleware.rb
CHANGED
@@ -28,9 +28,10 @@ module Oink
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def log_routing(env)
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
routing_info = rails3_routing_info(env) || rails2_routing_info(env)
|
32
|
+
if routing_info
|
33
|
+
controller = routing_info['controller']
|
34
|
+
action = routing_info['action']
|
34
35
|
@logger.info("Oink Action: #{controller}##{action}")
|
35
36
|
end
|
36
37
|
end
|
@@ -53,6 +54,14 @@ module Oink
|
|
53
54
|
|
54
55
|
private
|
55
56
|
|
57
|
+
def rails3_routing_info(env)
|
58
|
+
env['action_dispatch.request.parameters']
|
59
|
+
end
|
60
|
+
|
61
|
+
def rails2_routing_info(env)
|
62
|
+
env['action_controller.request.path_parameters']
|
63
|
+
end
|
64
|
+
|
56
65
|
def reset_objects_instantiated
|
57
66
|
ActiveRecord::Base.reset_instance_type_count
|
58
67
|
end
|
@@ -42,10 +42,20 @@ describe Oink::Middleware do
|
|
42
42
|
log_output.string.should include("Oink Log Entry Complete")
|
43
43
|
end
|
44
44
|
|
45
|
-
it "logs the action and controller" do
|
45
|
+
it "logs the action and controller in rails 3.x" do
|
46
46
|
get "/no_pigs", {}, {'action_dispatch.request.parameters' => {'controller' => 'oinkoink', 'action' => 'piggie'}}
|
47
47
|
log_output.string.should include("Oink Action: oinkoink#piggie")
|
48
48
|
end
|
49
|
+
|
50
|
+
it "logs the action and controller in rails 2.3.x" do
|
51
|
+
get "/no_pigs", {}, {'action_controller.request.path_parameters' => {'controller' => 'oinkoink', 'action' => 'piggie'}}
|
52
|
+
log_output.string.should include("Oink Action: oinkoink#piggie")
|
53
|
+
end
|
54
|
+
|
55
|
+
it "logs the action and controller within a module" do
|
56
|
+
get "/no_pigs", {}, {'action_dispatch.request.parameters' => {'controller' => 'oinkoink/admin', 'action' => 'piggie'}}
|
57
|
+
log_output.string.should include("Oink Action: oinkoink/admin#piggie")
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
it "reports 0 totals" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 3
|
10
|
+
version: 0.9.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Noah Davis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-08 00:00:00 -04:00
|
19
19
|
default_executable: oink
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|