foundries 0.1.4 → 0.1.5
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/CHANGELOG.md +12 -6
- data/lib/foundries/similarity/comparator.rb +1 -1
- data/lib/foundries/similarity/structure_tree.rb +1 -1
- data/lib/foundries/snapshot/adapters/postgres_adapter.rb +4 -0
- data/lib/foundries/snapshot/adapters/sqlite_adapter.rb +5 -1
- data/lib/foundries/snapshot/store.rb +35 -1
- data/lib/foundries/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05ac2ed1c8c00feab7b078f4e3dcd9b5fd8c24fdb6c1f7278aab3c4df6f85898
|
|
4
|
+
data.tar.gz: 174371e6e22eb9b6764dd4d70fb90988bc276e4a0e32c032b45254d924261f80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f79398b03c229960553bb6d2283254f5fa832166e497811ba7fc488db50a499288ee987a379f18e92cdc3a237bae6dcc41aefb5c6ddb1f3ecc861b7f354b62cb
|
|
7
|
+
data.tar.gz: 8870ca65270252f4f7f29392e456a230c167aa170a7d6bacc54d6a10452e3398a42fefc3767d283faac944e0620c800d9c58dd1170bbeff4f932fdf282fcc48e
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [0.1.5] - 2026-08-12
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Development dependencies are locked (1129826)
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Snapshot no longer caches a partial tree when a preset writes to a table that already held rows (2e9f863)
|
|
17
|
+
- Lint under standard 1.56.0 (52be9eb)
|
|
18
|
+
- Releases write a SHA512 checksum again (813a2ae)
|
|
19
|
+
|
|
8
20
|
## [0.1.4] - 2026-03-16
|
|
9
21
|
|
|
10
22
|
### Added
|
|
@@ -15,9 +27,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
15
27
|
### Changed
|
|
16
28
|
|
|
17
29
|
- README now covers Recording feature and parallel_tests support (69fa45b)
|
|
18
|
-
|
|
19
|
-
## [0.1.3] - 2026-03-13
|
|
20
|
-
|
|
21
|
-
### Added
|
|
22
|
-
|
|
23
|
-
- ancestor DSL and ancestors_for for path-based hierarchy building (7027e06)
|
|
@@ -16,6 +16,10 @@ module Foundries
|
|
|
16
16
|
@connection.select_value("SELECT NOT EXISTS (SELECT 1 FROM #{quoted(table_name)})")
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def count(table_name)
|
|
20
|
+
@connection.select_value("SELECT COUNT(*) FROM #{quoted(table_name)}")
|
|
21
|
+
end
|
|
22
|
+
|
|
19
23
|
def capture(table_name, io)
|
|
20
24
|
raw = @connection.raw_connection
|
|
21
25
|
raw.copy_data("COPY #{quoted(table_name)} TO STDOUT") do
|
|
@@ -13,7 +13,11 @@ module Foundries
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def empty?(table_name)
|
|
16
|
-
|
|
16
|
+
count(table_name) == 0
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def count(table_name)
|
|
20
|
+
@connection.select_value("SELECT COUNT(*) FROM #{quoted(table_name)}")
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
def capture(table_name, io)
|
|
@@ -25,11 +25,34 @@ module Foundries
|
|
|
25
25
|
|
|
26
26
|
# Record which tables are empty before the preset block runs.
|
|
27
27
|
# Only these tables will be captured after the block completes.
|
|
28
|
+
#
|
|
29
|
+
# The already-populated tables are counted too, so #capture can tell
|
|
30
|
+
# whether the preset wrote into one of them. A preset that only updates
|
|
31
|
+
# existing rows leaves the count unchanged and slips past this check;
|
|
32
|
+
# presets insert, so the count is a good enough signal.
|
|
28
33
|
def record_empty_tables
|
|
29
|
-
@capturable_tables =
|
|
34
|
+
@capturable_tables = []
|
|
35
|
+
@preexisting_counts = {}
|
|
36
|
+
|
|
37
|
+
@adapter.table_names.each do |table|
|
|
38
|
+
if @adapter.empty?(table)
|
|
39
|
+
@capturable_tables << table
|
|
40
|
+
else
|
|
41
|
+
@preexisting_counts[table] = @adapter.count(table)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
30
44
|
end
|
|
31
45
|
|
|
32
46
|
def capture
|
|
47
|
+
spoiled = spoiled_tables
|
|
48
|
+
unless spoiled.empty?
|
|
49
|
+
warn "[Foundries] Not caching preset :#{@preset_name} — it wrote to " \
|
|
50
|
+
"#{spoiled.join(", ")}, which already held rows when it ran. " \
|
|
51
|
+
"Only tables the preset fills from empty can be snapshotted, so " \
|
|
52
|
+
"caching this would restore an incomplete tree."
|
|
53
|
+
return
|
|
54
|
+
end
|
|
55
|
+
|
|
33
56
|
tables = @capturable_tables || @adapter.table_names
|
|
34
57
|
|
|
35
58
|
tmp_dir = Pathname.new("#{cache_dir}.#{$$}.tmp")
|
|
@@ -64,6 +87,17 @@ module Foundries
|
|
|
64
87
|
|
|
65
88
|
private
|
|
66
89
|
|
|
90
|
+
# Pre-populated tables whose row count moved while the preset ran. Their
|
|
91
|
+
# new rows can't be told apart from the ones that were already there, so
|
|
92
|
+
# the snapshot would silently omit them.
|
|
93
|
+
def spoiled_tables
|
|
94
|
+
return [] unless @preexisting_counts
|
|
95
|
+
|
|
96
|
+
@preexisting_counts.filter_map do |table, count|
|
|
97
|
+
table unless @adapter.count(table) == count
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
67
101
|
def cache_dir
|
|
68
102
|
@cache_dir ||= Pathname.new(@storage_path).join(@preset_name)
|
|
69
103
|
end
|
data/lib/foundries/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foundries
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Dowd
|
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
94
|
version: '0'
|
|
95
95
|
requirements: []
|
|
96
|
-
rubygems_version: 4.0.
|
|
96
|
+
rubygems_version: 4.0.16
|
|
97
97
|
specification_version: 4
|
|
98
98
|
summary: Declarative trees of related data using factory_bot
|
|
99
99
|
test_files: []
|