prick 0.20.13 → 0.20.16
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/batch.rb +2 -0
- data/lib/builder/builder.rb +1 -1
- data/lib/builder/node_pool.rb +8 -1
- data/lib/prick/version.rb +1 -1
- data/lib/subcommand/prick-build.rb +24 -14
- 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: 20f00d302f4282832c257119bf9bfe5f2d171c9d706ec74bca142681d670a596
|
4
|
+
data.tar.gz: 5facc31ae461bcc1919509d81d71ea4f9244c20fae8e5a693f991b419343d47b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 726d74592d2568c862538ea0692a01067eda7a7ffd3f5dba6b80abea1b3d3a96ae0f11faa5a4ee65792de764a628f4f73691d172f9e095b24b40cba9f140efc8
|
7
|
+
data.tar.gz: 708e3863256205385a418b4ce3436d3639f576fd6700d478b7e11933232187af6bda60988d0a952942cd56351d896835c574b8a31c920b991ac7a663dc89147e
|
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/batch.rb
CHANGED
@@ -134,6 +134,8 @@ module Prick
|
|
134
134
|
delete = builder.clean ? :none : :touched
|
135
135
|
begin
|
136
136
|
conn.execute fox.to_sql(format: :exec, delete: delete)
|
137
|
+
|
138
|
+
# FIXME: Why only in FoxBatch - should be set higher up in the system
|
137
139
|
conn.execute "update prick.versions set built_at = now() at time zone 'UTC'"
|
138
140
|
rescue PG::SyntaxError, PG::Error => ex
|
139
141
|
raise PostgresError, "prick: #{error} from #{node.path}"
|
data/lib/builder/builder.rb
CHANGED
@@ -47,7 +47,6 @@ module Prick
|
|
47
47
|
@clean = clean
|
48
48
|
@pool = NodePool.new
|
49
49
|
@root = Parser.parse(conn, dir)
|
50
|
-
@pg_graph_ignore_schemas = []
|
51
50
|
load_pool(@root) # Collect nodes into pool
|
52
51
|
@batches = nil # Initialized by #group
|
53
52
|
end
|
@@ -95,6 +94,7 @@ module Prick
|
|
95
94
|
group if batches.nil?
|
96
95
|
conn.exec create_schemas.grep_v("public").map { |schema| "create schema #{schema}" }
|
97
96
|
conn.schema.create("public", authorization: "postgres")
|
97
|
+
conn.exec "grant usage, create on schema public to public"
|
98
98
|
for batch in batches
|
99
99
|
batch.execute
|
100
100
|
end
|
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,11 +3,13 @@
|
|
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
|
10
|
-
super_conn = PgConn.new
|
10
|
+
super_conn = PgConn.new # Used to create new databases (doesn't make a
|
11
|
+
# difference right now as the mikras user is
|
12
|
+
# still a superuser)
|
11
13
|
|
12
14
|
conn = nil
|
13
15
|
builder = nil
|
@@ -18,28 +20,36 @@ module Prick::SubCommand
|
|
18
20
|
else
|
19
21
|
super_conn.rdbms.create database, owner: username
|
20
22
|
conn = PgConn.new(database, username)
|
21
|
-
|
23
|
+
exist = false
|
22
24
|
end
|
23
25
|
|
24
26
|
builder = Prick::Build::Builder.new(conn, builddir)
|
25
27
|
|
26
28
|
if exist
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
if force
|
30
|
+
# Drop all schemas
|
31
|
+
super_conn.rdbms.empty!(database)
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
else
|
34
|
+
# Find schemas to refresh. This includes all schemas in the
|
35
|
+
# database
|
36
|
+
refresh_schemas = conn.schema.list
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
+
# Find existing keep-schemas
|
39
|
+
keep_schemas = builder.keep_schemas.select { |s| conn.schema.exist?(s) }
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
+
# Remove keep-schemas from list of schemas
|
42
|
+
refresh_schemas -= keep_schemas
|
43
|
+
|
44
|
+
# Eliminate keep schemas from build pool
|
45
|
+
builder.pool.delete_schema(keep_schemas)
|
46
|
+
|
47
|
+
# Drop refresh schemes
|
48
|
+
refresh_schemas.each { |schema| conn.schema.drop(schema, cascade: true) }
|
49
|
+
end
|
41
50
|
end
|
42
51
|
|
52
|
+
# Delete schemas after target scheme if present
|
43
53
|
builder.pool.delete_schema(builder.pool.after_schema(schema)) if schema
|
44
54
|
end
|
45
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|