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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0e4058d31c7fa127cfe022ef763b942c8835187
4
- data.tar.gz: e8ae58b2c8e734631444a810a8d780fa8e52f520
3
+ metadata.gz: 1760dc0e6fbb610de5ed9dc40d2c50087901f5c0
4
+ data.tar.gz: 282699e984535d03896c19d7aaaf5c10fa66e6bb
5
5
  SHA512:
6
- metadata.gz: 2db4e2a2060c9fae17014d38d166d4fac55eeaa2c9377ddb64043abf81ef48bb793eefcdd4a826aad0fa755972d8a30d9542a6b6aec311f62cc76dc2efc6e8d3
7
- data.tar.gz: ccdee35b3d94e968c541c827e7340bcd97542a4c060ca7800cf98c93512e1a7dc3349dad7993d985ff599c945f671db332c64758b672758560d073d40551b089
6
+ metadata.gz: 381fbceeb15cfedf0ca60955e962577287ceebcdc5c674689512419552ed463c87d4dfc443e823ecff4a01ece2800914dae59c847c58b71723faabb2f8b731e3
7
+ data.tar.gz: ab777cb8498dbdf20da9eb702bf843f665d32b7e55e7502e1c11fc7fd9b2960fa7897fc15f2e7d26d8450959be31382c6fadf958b6b2700986eec9e5eb395eba
@@ -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')
@@ -11,8 +11,9 @@ module SqlTracker
11
11
  end
12
12
 
13
13
  def call(name, started, finished, id, payload)
14
- sql = payload[:sql]
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)
@@ -1,3 +1,3 @@
1
1
  module SqlTracker
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Yue