prick 0.47.3 → 0.48.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/exe/prick +12 -7
- data/lib/prick/builder/batch.rb +1 -1
- data/lib/prick/builder/builder.rb +26 -7
- data/lib/prick/builder/node.rb +27 -11
- data/lib/prick/builder/node_pool.rb +8 -1
- data/lib/prick/builder/parser.rb +36 -18
- data/lib/prick/constants.rb +3 -3
- data/lib/prick/local/command.rb +2 -2
- data/lib/prick/subcommand/prick-build.rb +2 -2
- data/lib/prick/subcommand/prick-make.rb +5 -4
- data/lib/prick/subcommand/prick-run.rb +4 -2
- data/lib/prick/version.rb +1 -1
- 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: 174ae3f514ca2eda0f8eea870922d85e6676f0c979dc783d3763063f238923af
|
4
|
+
data.tar.gz: 41acf5e250fb735f9d1297a67f2a758d6642358b7a15c39fde0f963f0b897395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b638fcb0b5b4b3558361f5a05450ce9b378b34466dd9a3833ec382e4c61f7a618398457d6996fd88b32780de4268db9c311cfe28f20e871e74c17a536713df1
|
7
|
+
data.tar.gz: 41eed12f679709b00b5505f6f99e0a1fb5288470111f8b2fdf621d6c731b759a5aea32077a7cce62858db2c018bc945f4092e6a370a81c1bb33d47e931765386
|
data/exe/prick
CHANGED
@@ -140,21 +140,23 @@ SPEC = %(
|
|
140
140
|
useful to run 'prick snapshot' immediately after you complete building
|
141
141
|
the database
|
142
142
|
|
143
|
-
build!
|
144
|
-
Build the project
|
145
|
-
|
146
|
-
|
143
|
+
build! -S,no-seeds -A,no-auth -s,step -f,force -t,time --dump=KIND? --path=BUILD_FILE -- [SCHEMA]
|
144
|
+
Build the project, if SCHEMA is defined, later schemas are excluded. The
|
145
|
+
'no-seeds' option excludes seed and auth files from the build while
|
146
|
+
'no-auth' only excludes the auth files Schemas marked with 'no refresh'
|
147
|
+
in the build is not built unless the --force is present. The --file
|
147
148
|
option sets the initial build file or directory, default is
|
148
|
-
SCHEMA_DIR/build.yml
|
149
|
+
$SCHEMA_DIR/build.yml. Dump KIND can be 'nodes', 'allnodes' or 'batches'
|
150
|
+
(the default)
|
149
151
|
|
150
|
-
make! --step -t,time --dump=KIND? -- [SCHEMA]
|
152
|
+
make! -S,no-seeds -A,no-auth --step -t,time --dump=KIND? -- [SCHEMA]
|
151
153
|
@ Only rebuild changed files
|
152
154
|
|
153
155
|
Checks file timestamps against the time of the last build and only
|
154
156
|
rebuild affected parts of the project. KIND can be 'nodes', 'allnodes' or
|
155
157
|
'batches' (the default)
|
156
158
|
|
157
|
-
run! --step -t,time --dump=KIND? --schema=SCHEMA -- PATH
|
159
|
+
run! -S,no-seeds -A,no-auth --step -t,time --dump=KIND? --schema=SCHEMA -- PATH
|
158
160
|
@ Execute path in Prick environment
|
159
161
|
|
160
162
|
Execute a single build directory or file within the Prick environment. If
|
@@ -444,6 +446,7 @@ begin
|
|
444
446
|
Prick::SubCommand.build(
|
445
447
|
database, username, args.expect(0..1),
|
446
448
|
path: cmd.path,
|
449
|
+
seeds: !cmd.no_seeds, auth: !cmd.no_auth,
|
447
450
|
force: cmd.force?, step: cmd.step?, timer: cmd.time?, dump: dump)
|
448
451
|
|
449
452
|
when :make!
|
@@ -453,6 +456,7 @@ begin
|
|
453
456
|
dump = cmd.dump? ? cmd.dump("batches")&.to_sym || :batches : nil
|
454
457
|
Prick::SubCommand.make(
|
455
458
|
database, username, args.expect(0..1),
|
459
|
+
seeds: !cmd.no_seeds, auth: !cmd.no_auth,
|
456
460
|
step: cmd.step?, timer: cmd.time?, dump: dump)
|
457
461
|
|
458
462
|
when :run!
|
@@ -461,6 +465,7 @@ begin
|
|
461
465
|
dump = cmd.dump? ? cmd.dump("batches")&.to_sym || :batches : nil
|
462
466
|
Prick::SubCommand.run(
|
463
467
|
database, username, args.expect(1),
|
468
|
+
seeds: !cmd.no_seeds, auth: !cmd.no_auth,
|
464
469
|
step: cmd.step?, timer: cmd.time?, dump: dump, schema: cmd.schema)
|
465
470
|
|
466
471
|
when :touch!
|
data/lib/prick/builder/batch.rb
CHANGED
@@ -42,11 +42,18 @@ module Prick
|
|
42
42
|
# Root build node
|
43
43
|
attr_reader :root
|
44
44
|
|
45
|
-
# True if this is a single-file build
|
45
|
+
# True if this is a single-file build. Default false
|
46
46
|
attr_reader :single
|
47
47
|
|
48
|
+
# True if seed data should be loaded. Default true
|
49
|
+
def seeds?() @seeds end
|
50
|
+
|
51
|
+
# True if auth data should be loaded. Default true
|
52
|
+
def auth?() @auth end
|
53
|
+
|
48
54
|
# True if SQL entries should be single-stepped. Default false
|
49
|
-
|
55
|
+
def step?() = @step
|
56
|
+
# def step?() @step end
|
50
57
|
|
51
58
|
# Pool of nodes. Initialized by #load_pool
|
52
59
|
attr_reader :pool
|
@@ -54,13 +61,15 @@ module Prick
|
|
54
61
|
forward_to :pool, :schemas,
|
55
62
|
:nodes, :decl_nodes, :init_nodes, :term_nodes,
|
56
63
|
:seed_nodes, :fox_seed_nodes, :sql_seed_nodes,
|
64
|
+
:auth_nodes,
|
57
65
|
:build_nodes,
|
58
66
|
:pg_graph_ignore_schemas,
|
59
67
|
:refresh_schemas, :keep_schemas
|
60
68
|
|
61
69
|
def batches() @batches || create_batches end
|
62
70
|
|
63
|
-
def initialize(conn, path, clean = true,
|
71
|
+
def initialize(conn, path, clean = true,
|
72
|
+
single: false, touched: false, load_pool: true, seeds: true, auth: true, step: false)
|
64
73
|
File.exist?(path) or raise Error, "Can't find #{path}"
|
65
74
|
! single || File.file?(path) or raise Error, "Not a file - #{path}"
|
66
75
|
|
@@ -69,6 +78,8 @@ module Prick
|
|
69
78
|
@reflections_file = Prick.state.reflections_file
|
70
79
|
@clean = clean
|
71
80
|
@single = single
|
81
|
+
@seeds = seeds
|
82
|
+
@auth = auth
|
72
83
|
@step = step
|
73
84
|
@root = Parser.parse(conn, path, single: single)
|
74
85
|
@pool = nil # Initialized by #load_pool
|
@@ -87,8 +98,15 @@ module Prick
|
|
87
98
|
kind = nil
|
88
99
|
batch = nil
|
89
100
|
|
101
|
+
nodes = (
|
102
|
+
[init_nodes, decl_nodes] +
|
103
|
+
(seeds? ? [fox_seed_nodes, sql_seed_nodes] : []) +
|
104
|
+
(auth? ? auth_nodes : []) +
|
105
|
+
[term_nodes.reverse]
|
106
|
+
).flatten
|
107
|
+
|
90
108
|
# TODO: Refactor
|
91
|
-
for node in
|
109
|
+
for node in nodes
|
92
110
|
# Create new batch if required. Order of when-clauses is important
|
93
111
|
case node.kind
|
94
112
|
when :module
|
@@ -101,15 +119,15 @@ module Prick
|
|
101
119
|
batch = SqlBatch.new(self)
|
102
120
|
when batch&.kind # Same kind as current batch. After this when-clause
|
103
121
|
# we know that the node kind has changed
|
104
|
-
if node.kind == :sql && step
|
122
|
+
if node.kind == :sql && step?
|
105
123
|
@batches << batch if batch
|
106
124
|
batch = SqlBatch.new(self)
|
107
|
-
elsif node.kind == :psql && step
|
125
|
+
elsif node.kind == :psql && step?
|
108
126
|
@batches << batch if batch
|
109
127
|
batch = SqlBatch.new(self)
|
110
128
|
end
|
111
129
|
when :sql || node.kind == :inline
|
112
|
-
if batch&.kind != :exe || step
|
130
|
+
if batch&.kind != :exe || step?
|
113
131
|
@batches << batch if batch
|
114
132
|
batch = SqlBatch.new(self)
|
115
133
|
end
|
@@ -178,6 +196,7 @@ module Prick
|
|
178
196
|
load_pool_impl(node) if node.kind == :yml
|
179
197
|
}
|
180
198
|
pool.add(build_node.seed_nodes)
|
199
|
+
pool.add(build_node.auth_nodes)
|
181
200
|
pool.add(build_node.term_nodes)
|
182
201
|
end
|
183
202
|
end
|
data/lib/prick/builder/node.rb
CHANGED
@@ -8,8 +8,9 @@ module Prick
|
|
8
8
|
attr_reader :path
|
9
9
|
attr_reader :args # only defined for :exe (String)
|
10
10
|
|
11
|
-
def name() @name
|
12
|
-
def
|
11
|
+
def name() @name ||= path && File.basename(path) end
|
12
|
+
def dir() @dir ||= path && File.dirname(path) end
|
13
|
+
def relpath() @relpath ||= path&.sub(/^#{Dir.getwd}\//, "") end
|
13
14
|
|
14
15
|
# Note that schema defaults to 'public' which may not be what you want in
|
15
16
|
# some cases
|
@@ -32,7 +33,7 @@ module Prick
|
|
32
33
|
|
33
34
|
def initialize(parent, phase, kind, path, args = nil)
|
34
35
|
constrain parent, BuildNode, NilClass
|
35
|
-
constrain phase, :init, :decl, :seed, :term, nil
|
36
|
+
constrain phase, :init, :decl, :seed, :auth, :term, nil
|
36
37
|
constrain kind, :sql, :psql, :exe, :fox, :yml, :inline, :module
|
37
38
|
constrain path, String, NilClass
|
38
39
|
@parent, @phase, @kind, @path = parent, phase, kind, path
|
@@ -45,7 +46,13 @@ module Prick
|
|
45
46
|
|
46
47
|
def to_s() @to_s ||= [path, *args].join(" ") end
|
47
48
|
def inspect() to_s end
|
48
|
-
def dump()
|
49
|
+
def dump()
|
50
|
+
if path =~ /(?:^|\/)schema\/#{@schema}\//
|
51
|
+
puts inspect
|
52
|
+
else
|
53
|
+
puts "#{inspect} (#{@schema || 'nil'})"
|
54
|
+
end
|
55
|
+
end
|
49
56
|
|
50
57
|
protected
|
51
58
|
def read_source
|
@@ -198,7 +205,7 @@ module Prick
|
|
198
205
|
end
|
199
206
|
|
200
207
|
# Note that script nodes are evaluated within the running Prick process so
|
201
|
-
# it inherites all constants, classes, load path etc.
|
208
|
+
# it inherites all constants, classes, load path etc. Note that this
|
202
209
|
# means that a script can't require a file that is also not required by
|
203
210
|
# prick
|
204
211
|
#
|
@@ -237,27 +244,36 @@ module Prick
|
|
237
244
|
alias_method :read_source, :exec_cmd
|
238
245
|
end
|
239
246
|
|
247
|
+
# class PSqlNode < SysExecNode
|
248
|
+
# def initialize(parent, phase, path)
|
249
|
+
# super(parent, phase, :psql, path)
|
250
|
+
# end
|
251
|
+
# end
|
252
|
+
|
240
253
|
# A build.yml file node
|
241
254
|
class BuildNode < Node
|
242
255
|
# True if the build file contains a 'schema' attribute
|
243
256
|
attr_accessor :has_schema
|
244
257
|
|
245
|
-
def nodes() @nodes ||= init_nodes + decl_nodes + seed_nodes + term_nodes end
|
258
|
+
def nodes() @nodes ||= init_nodes + decl_nodes + seed_nodes + auth_nodes + term_nodes end
|
246
259
|
|
247
|
-
|
260
|
+
# Nodes are executed in this order:
|
248
261
|
attr_reader :init_nodes
|
249
|
-
attr_reader :
|
262
|
+
attr_reader :decl_nodes
|
250
263
|
attr_reader :seed_nodes
|
264
|
+
attr_reader :auth_nodes
|
265
|
+
attr_reader :term_nodes
|
251
266
|
|
252
267
|
attr_accessor :pg_graph_ignore_schema
|
253
268
|
attr_accessor :refresh_schema
|
254
269
|
|
255
270
|
def initialize(parent, path)
|
256
271
|
super(parent, nil, :yml, path)
|
257
|
-
@decl_nodes = []
|
258
272
|
@init_nodes = []
|
259
|
-
@
|
273
|
+
@decl_nodes = []
|
260
274
|
@seed_nodes = []
|
275
|
+
@auth_nodes = []
|
276
|
+
@term_nodes = []
|
261
277
|
@pg_graph_ignore_schema = false
|
262
278
|
@refresh_schema = true
|
263
279
|
end
|
@@ -272,7 +288,7 @@ module Prick
|
|
272
288
|
puts "refresh: #{refresh_schema.to_s}"
|
273
289
|
puts "pg_graph_ignore_schema: #{pg_graph_ignore_schema}"
|
274
290
|
decl_nodes.each(&:dump)
|
275
|
-
for kind in [:init, :
|
291
|
+
for kind in [:init, :seed, :auth, :term]
|
276
292
|
kind_nodes = self.send("#{kind}_nodes".to_sym)
|
277
293
|
if !kind_nodes.empty?
|
278
294
|
puts "#{kind}:"
|
@@ -13,13 +13,14 @@ module Prick
|
|
13
13
|
attr_reader :init_nodes
|
14
14
|
attr_reader :decl_nodes
|
15
15
|
attr_reader :seed_nodes
|
16
|
+
attr_reader :auth_nodes
|
16
17
|
attr_reader :term_nodes
|
17
18
|
|
18
19
|
# attr_reader :setup_nodes
|
19
20
|
# attr_reader :teardown_nodes
|
20
21
|
|
21
22
|
def fox_seed_nodes() seed_nodes.select { |node| node.kind == :fox } end
|
22
|
-
def sql_seed_nodes() seed_nodes.select { |node| node.kind
|
23
|
+
def sql_seed_nodes() seed_nodes.select { |node| [:sql, :psql].include? node.kind } end
|
23
24
|
|
24
25
|
# List of BuildNode nodes
|
25
26
|
def build_nodes() nodes.select { |node| node.is_a?(BuildNode) } end
|
@@ -101,11 +102,13 @@ module Prick
|
|
101
102
|
@init_nodes = []
|
102
103
|
@decl_nodes = []
|
103
104
|
@seed_nodes = []
|
105
|
+
@auth_nodes = []
|
104
106
|
@term_nodes = []
|
105
107
|
@kind_nodes = {
|
106
108
|
decl: @decl_nodes,
|
107
109
|
init: @init_nodes,
|
108
110
|
seed: @seed_nodes,
|
111
|
+
auth: @auth_nodes,
|
109
112
|
term: @term_nodes,
|
110
113
|
yml: nil
|
111
114
|
}
|
@@ -121,11 +124,15 @@ module Prick
|
|
121
124
|
indent { @decl_nodes.each &:dump }
|
122
125
|
puts "seed_nodes:"
|
123
126
|
indent { @seed_nodes.each &:dump }
|
127
|
+
puts "auth_nodes:"
|
128
|
+
indent { @auth_nodes.each &:dump }
|
124
129
|
puts "term_nodes:"
|
125
130
|
indent { @term_nodes.each &:dump }
|
126
131
|
}
|
127
132
|
end
|
128
133
|
|
134
|
+
def inspect() "<INSTANCE>" end
|
135
|
+
|
129
136
|
private
|
130
137
|
def delete_node(node)
|
131
138
|
# puts "#delete_node"
|
data/lib/prick/builder/parser.rb
CHANGED
@@ -38,7 +38,7 @@ module Prick
|
|
38
38
|
File.exist?(path) or raise Error, "Can't find #{file}"
|
39
39
|
dir = File.dirname(path)
|
40
40
|
file = File.basename(path)
|
41
|
-
unit = make_build_unit(nil, nil)
|
41
|
+
unit = make_build_unit(nil, nil) # <- only reason we drag #dir through every function FIXME
|
42
42
|
unit.schema = schema if schema
|
43
43
|
entry = parse_build_entry(unit, dir, file)
|
44
44
|
unit
|
@@ -67,21 +67,29 @@ module Prick
|
|
67
67
|
if entry.is_a?(Hash) \
|
68
68
|
&& (entry.size != 1 || !%w(call sql exec eval sysexec syseval).include?(entry.first.first))
|
69
69
|
entry.each { |key, value|
|
70
|
-
if key == "
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
when "seed"; unit.seed_nodes
|
70
|
+
key = "seed" if key == "seeds" # Resolve alias
|
71
|
+
case key
|
72
|
+
when "schema"
|
73
|
+
unit.schema = value
|
74
|
+
unit.has_schema = true
|
75
|
+
when "standard"
|
76
|
+
unit.pg_graph_ignore_schema = !value
|
77
|
+
when "refresh"
|
78
|
+
unit.refresh_schema = value
|
79
|
+
when "make"
|
80
|
+
execute_make(unit, value)
|
82
81
|
else
|
83
|
-
|
84
|
-
|
82
|
+
# Find LVAL
|
83
|
+
case key
|
84
|
+
when "init"; unit.init_nodes
|
85
|
+
when "seed"; unit.seed_nodes
|
86
|
+
when "auth"; unit.auth_nodes
|
87
|
+
when "term"; unit.term_nodes
|
88
|
+
else
|
89
|
+
raise Error, "Illegal key in #{unit.path}: #{key}"
|
90
|
+
end
|
91
|
+
# then concat
|
92
|
+
.concat(Array(value).map { |value| parse_entry(unit, key.to_sym, dir, value) }.compact)
|
85
93
|
end
|
86
94
|
}
|
87
95
|
else
|
@@ -91,6 +99,13 @@ module Prick
|
|
91
99
|
unit
|
92
100
|
end
|
93
101
|
|
102
|
+
def execute_make(unit, bash)
|
103
|
+
# env = Prick.state.bash_environment # FIXME Doesn't work for some reason
|
104
|
+
env = ENV.to_h.merge "PATH" => Prick::PRICK_PATH
|
105
|
+
cmd = "cd #{unit.dir} && { #{bash} }"
|
106
|
+
system(env, cmd, exception: false) or raise Error, "Make command failed:\n\n#{cmd}\n"
|
107
|
+
end
|
108
|
+
|
94
109
|
def parse_build_entry(unit, dir, file)
|
95
110
|
node = parse_entry(unit, :decl, dir, file) or return nil
|
96
111
|
if node.kind == :fox
|
@@ -122,6 +137,7 @@ module Prick
|
|
122
137
|
[path, Array(args).flatten]
|
123
138
|
end
|
124
139
|
|
140
|
+
# FIXME Why?
|
125
141
|
def parse_psql_file_entry(unit, dir, entry)
|
126
142
|
if entry =~ /^[a-zA-Z0-9_.-]+$/
|
127
143
|
path = File.join(dir, entry)
|
@@ -134,6 +150,7 @@ module Prick
|
|
134
150
|
|
135
151
|
def parse_entry(unit, phase, dir, entry)
|
136
152
|
# puts "#parse_entry(#{unit.inspect}, #{phase.inspect}, #{dir.inspect}, #{entry.inspect})"
|
153
|
+
|
137
154
|
if entry.is_a?(Hash)
|
138
155
|
entry.size == 1 or raise Error, "sql and module are single-line values"
|
139
156
|
key, value = entry.first
|
@@ -162,10 +179,10 @@ module Prick
|
|
162
179
|
else
|
163
180
|
raise Error, "Illegal key: #{key}"
|
164
181
|
end
|
165
|
-
elsif entry =~ /\.psql$/
|
182
|
+
elsif entry =~ /\.psql$/ # FIXME: Move below?
|
166
183
|
path = parse_psql_file_entry(unit, dir, entry)
|
167
184
|
PSqlNode.new(unit, phase, path)
|
168
|
-
else
|
185
|
+
else # file argument(s)
|
169
186
|
(path, args = parse_file_entry(unit, dir, entry)) or return nil
|
170
187
|
if File.directory? path
|
171
188
|
parse_path(unit, path)
|
@@ -176,7 +193,8 @@ module Prick
|
|
176
193
|
when /\.sql$/
|
177
194
|
SqlNode.new(unit, phase, path)
|
178
195
|
when /\.fox$/
|
179
|
-
|
196
|
+
fox_phase = (phase == :decl ? :seed : phase) # Move .fox files to seed section
|
197
|
+
FoxNode.new(unit, fox_phase, path)
|
180
198
|
when /(?:^|\/)build-.*\.yml$/
|
181
199
|
parse_build_file(unit, dir, path)
|
182
200
|
when /(?:^|\/)build.yml$/ # Only used when building a single file
|
data/lib/prick/constants.rb
CHANGED
@@ -26,9 +26,6 @@ module Prick
|
|
26
26
|
SPEC_DIR = "spec"
|
27
27
|
]
|
28
28
|
|
29
|
-
# Search path for executables
|
30
|
-
# PRICK_PATH = "#{ENV['PATH']}:#{PRICK_DIR}/#{BIN_DIR}:#{PRICK_DIR}/#{LIBEXEC_DIR}"
|
31
|
-
|
32
29
|
# Project filename
|
33
30
|
PRICK_PROJECT_FILE = "prick.yml"
|
34
31
|
|
@@ -47,6 +44,9 @@ module Prick
|
|
47
44
|
end
|
48
45
|
end
|
49
46
|
|
47
|
+
# Search path for executables
|
48
|
+
PRICK_PATH = "#{PRICK_DIR}/#{BIN_DIR}:#{ENV['PATH']}"
|
49
|
+
|
50
50
|
# Project file path
|
51
51
|
PRICK_PROJECT_PATH = File.join(PRICK_DIR, PRICK_PROJECT_FILE)
|
52
52
|
|
data/lib/prick/local/command.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fcntl'
|
2
|
+
|
2
3
|
module Command
|
3
4
|
class Error < RuntimeError
|
4
5
|
attr_reader :cmd
|
@@ -48,8 +49,7 @@ module Command
|
|
48
49
|
# Setup environment
|
49
50
|
env = env.map { |k,v| [k.to_s, v.to_s] }.to_h # Convert array values to strings
|
50
51
|
env.each { |k,v| ENV[k] = v }
|
51
|
-
|
52
|
-
Kernel.exec(env, bashcmd)
|
52
|
+
Kernel.exec(ENV, bashcmd)
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
@@ -7,7 +7,7 @@ module Prick::SubCommand
|
|
7
7
|
database, username, schema,
|
8
8
|
path: nil, # Default SCHEMA_DIR
|
9
9
|
force: false, # Build all schemas
|
10
|
-
step: false, timer: nil, dump: nil)
|
10
|
+
seeds: true, auth: true, step: false, timer: nil, dump: nil)
|
11
11
|
|
12
12
|
path ||= Prick.state.schema_dir
|
13
13
|
File.exist?(path) or Prick.error "Can't find #{path}"
|
@@ -33,7 +33,7 @@ module Prick::SubCommand
|
|
33
33
|
end
|
34
34
|
conn = Prick.state.connection
|
35
35
|
|
36
|
-
builder = Prick::Build::Builder.new(conn, path, step: step)
|
36
|
+
builder = Prick::Build::Builder.new(conn, path, seeds: seeds, auth: auth, step: step)
|
37
37
|
|
38
38
|
if exist # Empty (part of) the database
|
39
39
|
if force
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative '../builder/builder.rb'
|
4
4
|
|
5
5
|
module Prick::SubCommand
|
6
|
-
def self.make(database, username, schema, step: false, timer: nil, dump: nil)
|
6
|
+
def self.make(database, username, schema, seeds: true, auth: true, step: false, timer: nil, dump: nil)
|
7
7
|
Timer.on! if timer
|
8
8
|
Timer.time "Prick::Command#make" do
|
9
9
|
begin
|
@@ -26,7 +26,7 @@ module Prick::SubCommand
|
|
26
26
|
clean = true
|
27
27
|
end
|
28
28
|
|
29
|
-
builder = Prick::Build::Builder.new(conn, "schema", clean, step: step)
|
29
|
+
builder = Prick::Build::Builder.new(conn, "schema", clean, seeds: seeds, auth: true, step: step)
|
30
30
|
|
31
31
|
if schema
|
32
32
|
after_schemas = builder.pool.after_schema(schema)
|
@@ -58,10 +58,11 @@ module Prick::SubCommand
|
|
58
58
|
if touched_phases.include?(:decl) || touched_phases.empty?
|
59
59
|
create_schemas = [build_schema] + builder.pool.after_schema(build_schema)
|
60
60
|
create_schemas.each { |schema| conn.schema.drop(schema, cascade: true) }
|
61
|
-
builder.pool.delete_schema(builder.pool.before_schema(build_schema), exclude: [:seed])
|
61
|
+
builder.pool.delete_schema(builder.pool.before_schema(build_schema), exclude: [:seed, :auth])
|
62
62
|
elsif touched_phases.include?(:init) || touched_phases.include?(:term)
|
63
63
|
builder.pool.clear(:decl, :seed)
|
64
|
-
|
64
|
+
builder.pool.clear(:decl, :auth)
|
65
|
+
elsif touched_phases.include?(:seed) || touched_phases.include?(:auth)
|
65
66
|
builder.pool.clear(:init, :decl, :term)
|
66
67
|
end
|
67
68
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative '../builder/builder.rb'
|
4
4
|
|
5
5
|
module Prick::SubCommand
|
6
|
-
def self.run(database, username, path, step: false, timer: nil, dump: nil, schema: nil)
|
6
|
+
def self.run(database, username, path, seeds: true, auth: true, step: false, timer: nil, dump: nil, schema: nil)
|
7
7
|
|
8
8
|
Timer.on! if timer
|
9
9
|
|
@@ -27,7 +27,9 @@ module Prick::SubCommand
|
|
27
27
|
conn = Prick.state.connection
|
28
28
|
|
29
29
|
# Parse
|
30
|
-
builder = Prick::Build::Builder.new(
|
30
|
+
builder = Prick::Build::Builder.new(
|
31
|
+
conn, path,
|
32
|
+
single: true, load_pool: false, seeds: seeds, auth: auth, step: step)
|
31
33
|
|
32
34
|
# Register if a build file is referenced and normalize path to
|
33
35
|
# include build.yml of directories
|
data/lib/prick/version.rb
CHANGED