sql_footprint 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/sql_footprint/sql_filter.rb +11 -0
- data/lib/sql_footprint/version.rb +1 -1
- data/lib/sql_footprint.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a38c5e07752b752b9d8920d73d14e3bf66766901
|
4
|
+
data.tar.gz: e62a922d83e3bf971f35bfb7309e79c4d07c3952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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.
|
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-
|
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
|