culturecode_stagehand 0.13.4 → 0.14.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/lib/stagehand/auditor.rb +16 -4
- data/lib/stagehand/staging/commit.rb +7 -0
- data/lib/stagehand/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a2a6a3a01c856120842f041db2e36a5193513d4
|
4
|
+
data.tar.gz: f805ae100d46bd539e53bb2b611cb2a8c520b343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48fc4eeb89f87e4be85eca8da20829ce088b6684094b633d5b2f6751b3a0725ad3edb93db1b0eb7335eeef99993a0f11040cc374fcbd3a31dea98f0426f0cfe8
|
7
|
+
data.tar.gz: 6688e3bcfa1776c98280f6ac4a33898f99365c50d2763683eb7cf0e36773dc65c5a4088ed6f218a69a1ee542004ee0055dc4e45d87a1c7ee6ec2b50ec1a5affd
|
data/lib/stagehand/auditor.rb
CHANGED
@@ -28,11 +28,22 @@ module Stagehand
|
|
28
28
|
print "\nChecking #{table_name} "
|
29
29
|
mismatched = {}
|
30
30
|
limit = 1000
|
31
|
-
|
31
|
+
|
32
|
+
min_id = [
|
33
|
+
Database.staging_connection.select_value("SELECT MIN(id) FROM #{table_name}").to_i,
|
34
|
+
Database.production_connection.select_value("SELECT MIN(id) FROM #{table_name}").to_i
|
35
|
+
].min
|
36
|
+
|
37
|
+
index = min_id / limit
|
38
|
+
|
39
|
+
max_id = [
|
40
|
+
Database.staging_connection.select_value("SELECT MAX(id) FROM #{table_name}").to_i,
|
41
|
+
Database.production_connection.select_value("SELECT MAX(id) FROM #{table_name}").to_i
|
42
|
+
].max
|
32
43
|
|
33
44
|
loop do
|
34
|
-
production_records = Database.production_connection.select_all("SELECT * FROM #{table_name}
|
35
|
-
staging_records = Database.staging_connection.select_all("SELECT * FROM #{table_name}
|
45
|
+
production_records = Database.production_connection.select_all("SELECT * FROM #{table_name} WHERE id BETWEEN #{limit * index} AND #{limit * (index + 1)}")
|
46
|
+
staging_records = Database.staging_connection.select_all("SELECT * FROM #{table_name} WHERE id BETWEEN #{limit * index} AND #{limit * (index + 1)}")
|
36
47
|
id_column = production_records.columns.index('id')
|
37
48
|
|
38
49
|
production_differences = production_records.rows - staging_records.rows
|
@@ -54,7 +65,8 @@ module Stagehand
|
|
54
65
|
end
|
55
66
|
|
56
67
|
index += 1
|
57
|
-
|
68
|
+
|
69
|
+
break if index * limit > max_id
|
58
70
|
end
|
59
71
|
|
60
72
|
if mismatched.present?
|
@@ -9,7 +9,12 @@ module Stagehand
|
|
9
9
|
all.select(&:empty?)
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.capturing?
|
13
|
+
!!@capturing
|
14
|
+
end
|
15
|
+
|
12
16
|
def self.capture(subject_record = nil, except: [], &block)
|
17
|
+
@capturing = true
|
13
18
|
start_operation = start_commit(subject_record)
|
14
19
|
init_session!(start_operation)
|
15
20
|
|
@@ -21,6 +26,8 @@ module Stagehand
|
|
21
26
|
else
|
22
27
|
return end_commit(start_operation, except)
|
23
28
|
end
|
29
|
+
ensure
|
30
|
+
@capturing = false
|
24
31
|
end
|
25
32
|
|
26
33
|
def self.containing(record)
|
data/lib/stagehand/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: culturecode_stagehand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jakobsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|