sql_tracker 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sql_tracker/config.rb +2 -1
- data/lib/sql_tracker/handler.rb +2 -1
- data/lib/sql_tracker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1760dc0e6fbb610de5ed9dc40d2c50087901f5c0
|
4
|
+
data.tar.gz: 282699e984535d03896c19d7aaaf5c10fa66e6bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381fbceeb15cfedf0ca60955e962577287ceebcdc5c674689512419552ed463c87d4dfc443e823ecff4a01ece2800914dae59c847c58b71723faabb2f8b731e3
|
7
|
+
data.tar.gz: ab777cb8498dbdf20da9eb702bf843f665d32b7e55e7502e1c11fc7fd9b2960fa7897fc15f2e7d26d8450959be31382c6fadf958b6b2700986eec9e5eb395eba
|
data/lib/sql_tracker/config.rb
CHANGED
@@ -3,10 +3,11 @@ require 'active_support/configurable'
|
|
3
3
|
module SqlTracker
|
4
4
|
class Config
|
5
5
|
include ActiveSupport::Configurable
|
6
|
-
config_accessor :tracked_paths, :tracked_sql_command, :output_path
|
6
|
+
config_accessor :tracked_paths, :tracked_sql_command, :output_path, :enabled
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def apply_defaults
|
10
|
+
self.enabled = enabled.nil? ? true : enabled
|
10
11
|
self.tracked_paths ||= %w(app lib)
|
11
12
|
self.tracked_sql_command ||= %w(SELECT INSERT UPDATE DELETE)
|
12
13
|
self.output_path ||= File.join(Rails.root.to_s, 'tmp')
|
data/lib/sql_tracker/handler.rb
CHANGED
@@ -11,8 +11,9 @@ module SqlTracker
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(name, started, finished, id, payload)
|
14
|
-
|
14
|
+
return unless @config.enabled
|
15
15
|
|
16
|
+
sql = payload[:sql]
|
16
17
|
return unless sql.start_with?(*@config.tracked_sql_command)
|
17
18
|
|
18
19
|
cleaned_trace = clean_trace(caller)
|
data/lib/sql_tracker/version.rb
CHANGED