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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4435f17e31e98bc0c62c1f7c92818f71f059bc308522ab1ed8ac6acb17825768
4
- data.tar.gz: aaaf83164a0de30d6a134cc12159cf5fed858806a68e4dba9738da93abd24e15
3
+ metadata.gz: 863269702a01df7b25038a6eae9e0b2f636e20311276919cdecf6f201540d14b
4
+ data.tar.gz: bdf5d57641b5e250d667ff924eacd02e0a1972ea40e756346642229c815ed8b0
5
5
  SHA512:
6
- metadata.gz: 0b6939f154a1e04af830c9bad778deb871f6573dd729afebf776fad34b06bbda1d6debe11b3d38278ec1f09357a6218723e70e0983a93dd6f3f6db2c4311fb5e
7
- data.tar.gz: c291aeef50d1e5a133c47c7908653762da31d047852bcdfcfe19a0a97114efeb3118f9d2c759466621ece995120e3380107b57e97614410cbc82b18f813a1d7c
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(database, username, args.expect(0..1), timer: cmd.time?, dump: dump)
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
@@ -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
@@ -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
- build_nodes.select(&:pg_graph_ignore_schema).map(&:schema).uniq
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prick
4
- VERSION = "0.20.13"
4
+ VERSION = "0.20.14"
5
5
  end
@@ -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
- # Explicit schema is always rebuilt
28
- refresh = [builder.refresh_schemas, schema].compact.flatten.uniq
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
- # Rebuild non-existing keep-schemas
32
- keep.reject! { |schema|
33
- refresh << schema if !conn.schema.exist?(schema)
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
- # Eliminate keep schemas from build pool
37
- builder.pool.delete_schema(keep)
35
+ # Rebuild non-existing keep-schemas
36
+ keep.reject! { |schema|
37
+ refresh << schema if !conn.schema.exist?(schema)
38
+ }
38
39
 
39
- # Drop refresh schemes
40
- refresh.each { |schema| conn.schema.drop(schema, cascade: true) }
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.13
4
+ version: 0.20.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen