prick 0.20.13 → 0.20.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/prick +6 -2
- data/lib/builder/builder.rb +0 -1
- data/lib/builder/node_pool.rb +8 -1
- data/lib/prick/version.rb +1 -1
- data/lib/subcommand/prick-build.rb +18 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 863269702a01df7b25038a6eae9e0b2f636e20311276919cdecf6f201540d14b
|
4
|
+
data.tar.gz: bdf5d57641b5e250d667ff924eacd02e0a1972ea40e756346642229c815ed8b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1228157e01f3d08383e6addddeabe9f7c9bf66cba682af39428ac961b7260d27fcd457ab0787bb4eaef4c6c2a8eb17bf15ee436d9b83f2737776ce9c8318d61
|
7
|
+
data.tar.gz: 109dc23dd6c225f0d0006afc7bf89d3ec49eb52e62003f4ab969979665d525fcd78e96ac2d9f1120175f1dc61d7102278a1db3c5ae867f6463ab42f8e90f012a
|
data/exe/prick
CHANGED
@@ -74,10 +74,13 @@ SPEC = %(
|
|
74
74
|
Kind can be 'users', 'data', 'schema', 'database' (the default), or 'all'. It is
|
75
75
|
not an error if the object doesn't exist. TODO Only 'users' is currently defined
|
76
76
|
|
77
|
-
build! -t,time --dump=KIND? -- [SCHEMA]
|
77
|
+
build! -f,force -t,time --dump=KIND? -- [SCHEMA]
|
78
78
|
Build the project. If SCHEMA is defined, later schemas are excluded.
|
79
79
|
KIND can be 'nodes', 'allnodes' or 'batches' (the default)
|
80
80
|
|
81
|
+
Usually, schemas marked with 'no refresh' is not built, use --force to
|
82
|
+
rebuild all schemas
|
83
|
+
|
81
84
|
make! -t,time --dump=KIND? -- [SCHEMA]
|
82
85
|
@ Only rebuild changed files
|
83
86
|
|
@@ -180,7 +183,8 @@ begin
|
|
180
183
|
|
181
184
|
when :build!
|
182
185
|
dump = cmd.dump? ? cmd.dump("batches").to_sym : nil
|
183
|
-
Prick::SubCommand.build(
|
186
|
+
Prick::SubCommand.build(
|
187
|
+
database, username, args.expect(0..1), force: cmd.force?, timer: cmd.time?, dump: dump)
|
184
188
|
|
185
189
|
when :make!
|
186
190
|
dump = cmd.dump? ? cmd.dump("batches").to_sym : nil
|
data/lib/builder/builder.rb
CHANGED
data/lib/builder/node_pool.rb
CHANGED
@@ -7,6 +7,9 @@ module Prick
|
|
7
7
|
|
8
8
|
attr_reader :nodes
|
9
9
|
|
10
|
+
# All nodes including nodes deleted later on
|
11
|
+
attr_reader :all_nodes
|
12
|
+
|
10
13
|
attr_reader :init_nodes
|
11
14
|
attr_reader :decl_nodes
|
12
15
|
attr_reader :seed_nodes
|
@@ -25,7 +28,9 @@ module Prick
|
|
25
28
|
# to exclude foreign schemes that doesn't follow the PgGraph naming
|
26
29
|
# conventions
|
27
30
|
def pg_graph_ignore_schemas()
|
28
|
-
|
31
|
+
all_nodes.select { |node|
|
32
|
+
node.is_a?(BuildNode) && node.pg_graph_ignore_schema
|
33
|
+
}.map(&:schema).uniq
|
29
34
|
end
|
30
35
|
|
31
36
|
def refresh_schemas()
|
@@ -43,6 +48,7 @@ module Prick
|
|
43
48
|
def add(*nodes)
|
44
49
|
nodes = Array(nodes).flatten
|
45
50
|
@nodes.concat(nodes)
|
51
|
+
@all_nodes.concat(nodes)
|
46
52
|
nodes.each { |node|
|
47
53
|
@schemas[node.schema] += 1
|
48
54
|
@kind_nodes[node.phase]&.append(node)
|
@@ -83,6 +89,7 @@ module Prick
|
|
83
89
|
else
|
84
90
|
@schemas = Hash.new(0) # map from schema name to number of nodes
|
85
91
|
@nodes = []
|
92
|
+
@all_nodes = []
|
86
93
|
@init_nodes = []
|
87
94
|
@decl_nodes = []
|
88
95
|
@seed_nodes = []
|
data/lib/prick/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'builder/builder.rb'
|
4
4
|
|
5
5
|
module Prick::SubCommand
|
6
|
-
def self.build(database, username, schema, builddir: "schema", timer: nil, dump: nil)
|
6
|
+
def self.build(database, username, schema, builddir: "schema", force: false, timer: nil, dump: nil)
|
7
7
|
Timer.on! if timer
|
8
8
|
time "Prick::Command#build" do
|
9
9
|
begin
|
@@ -24,22 +24,28 @@ module Prick::SubCommand
|
|
24
24
|
builder = Prick::Build::Builder.new(conn, builddir)
|
25
25
|
|
26
26
|
if exist
|
27
|
-
|
28
|
-
|
29
|
-
keep = builder.keep_schemas.reject { |s| s == schema }
|
27
|
+
if force
|
28
|
+
builder.schemas.each { |schema| conn.schema.drop schema, cascade: true }
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
refresh
|
34
|
-
|
30
|
+
else
|
31
|
+
# Explicit schema is always rebuilt
|
32
|
+
refresh = [builder.refresh_schemas, schema].compact.flatten.uniq
|
33
|
+
keep = builder.keep_schemas.reject { |s| s == schema }
|
35
34
|
|
36
|
-
|
37
|
-
|
35
|
+
# Rebuild non-existing keep-schemas
|
36
|
+
keep.reject! { |schema|
|
37
|
+
refresh << schema if !conn.schema.exist?(schema)
|
38
|
+
}
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
# Eliminate keep schemas from build pool
|
41
|
+
builder.pool.delete_schema(keep)
|
42
|
+
|
43
|
+
# Drop refresh schemes
|
44
|
+
refresh.each { |schema| conn.schema.drop(schema, cascade: true) }
|
45
|
+
end
|
41
46
|
end
|
42
47
|
|
48
|
+
# Delete schemas after target scheme if present
|
43
49
|
builder.pool.delete_schema(builder.pool.after_schema(schema)) if schema
|
44
50
|
end
|
45
51
|
|