sql_footprint 0.5.0 → 0.6.0

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: 1ac46ddae41caa7510ac1f722c17437eaca4ccb3
4
- data.tar.gz: dc1c4c55f3b45be3958c2116c9694cc67121fd57
3
+ metadata.gz: a38c5e07752b752b9d8920d73d14e3bf66766901
4
+ data.tar.gz: e62a922d83e3bf971f35bfb7309e79c4d07c3952
5
5
  SHA512:
6
- metadata.gz: a6cca4053a8fe4414c8d54c265f67f393b16435fe9b7dfa111f40a65b088a88b11d69e3246dc1d5c28f97e55b303faa3e84c2f327625cb632cc955a205a5488e
7
- data.tar.gz: 4707ade659f35ff6b18280aa062bbe9c49217f1f57c233d13379a057222c92752e2f1fdc99c2273daef359c1c8b2551c4ddfe014e8e07adcacb811156f26a56c
6
+ metadata.gz: 4af61e5cf254aa66e39210cf30707dca03bbd87cb640e9b257a4f9c272fb8ac69b893e7dfc630b86b98c67f03565c45222496c8775da1d4e04d5d4d26b253728
7
+ data.tar.gz: 739c457a97b5850483e7d22e22b610ffd1a5da109f4cbb3a0e84416988eb47f86b1c2e39ab31192e851c4e786c8a4876465f6a3c2cad2c2d02f5f7b6d013f61f
data/README.md CHANGED
@@ -21,7 +21,7 @@ And then execute:
21
21
 
22
22
  Typically, you would want to run this while you're running your specs.
23
23
  For example w/ RSpec:
24
- ```
24
+ ```ruby
25
25
  RSpec.configure do |config|
26
26
  config.before(:suite) { SqlFootprint.start }
27
27
  config.after(:suite) { SqlFootprint.stop }
@@ -33,7 +33,7 @@ After running your specs you'll find a 'footprint.sql' file in your project.
33
33
  #### Excluding Setup Code
34
34
 
35
35
  If you want to exclude queries that your tests generate for fixture data, you can use the ```.exclude``` method. For example:
36
- ```
36
+ ```ruby
37
37
  before do
38
38
  SqlFootprint.exclude do
39
39
  Model.create!(args*) # this query will not be included in your footprint
@@ -42,7 +42,7 @@ end
42
42
  ```
43
43
 
44
44
  Or if you're using FactoryGirl you could do something like this:
45
- ```
45
+ ```ruby
46
46
  RSpec.configure do |config|
47
47
  module FactoryBoy
48
48
  def create(*args)
@@ -0,0 +1,11 @@
1
+ module SqlFootprint
2
+ class SqlFilter
3
+ EXCLUDE_REGEXS = [
4
+ /\ASHOW\s/
5
+ ].freeze
6
+
7
+ def capture? sql
8
+ EXCLUDE_REGEXS.none? { |regex| regex =~ sql }
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module SqlFootprint
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
data/lib/sql_footprint.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'sql_footprint/version'
2
2
  require 'sql_footprint/sql_anonymizer'
3
+ require 'sql_footprint/sql_filter'
3
4
  require 'set'
4
5
  require 'active_support/notifications'
5
6
 
@@ -14,6 +15,7 @@ module SqlFootprint
14
15
  class << self
15
16
  def start
16
17
  @anonymizer = SqlAnonymizer.new
18
+ @filter = SqlFilter.new
17
19
  @capture = true
18
20
  @lines = Set.new
19
21
  end
@@ -35,7 +37,7 @@ module SqlFootprint
35
37
  end
36
38
 
37
39
  def capture sql
38
- return unless @capture
40
+ return unless @capture && @filter.capture?(sql)
39
41
  @lines << @anonymizer.anonymize(sql)
40
42
  end
41
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql_footprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Joyce
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -154,6 +154,7 @@ files:
154
154
  - bin/setup
155
155
  - lib/sql_footprint.rb
156
156
  - lib/sql_footprint/sql_anonymizer.rb
157
+ - lib/sql_footprint/sql_filter.rb
157
158
  - lib/sql_footprint/version.rb
158
159
  - sql_footprint.gemspec
159
160
  homepage: https://github.com/covermymeds/sql_footprint