prick 0.37.0 → 0.39.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 +14 -0
- data/lib/prick/local/command.rb +2 -2
- data/lib/prick/local/git.rb +2 -0
- data/lib/prick/state.rb +14 -3
- data/lib/prick/subcommand/prick-list.rb +11 -5
- data/lib/prick/subcommand/prick-touch.rb +9 -0
- data/lib/prick/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cc939a1ea84c9e16f586cc4d3ce2a17c63e188996a46cb1b0e8f1b75c25eec8
|
4
|
+
data.tar.gz: e379b3a003ceed1b49240a1083f0db8f8cc2fb80d9c4a2800cd82e1005eba03f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20c6a454644bf1bc6770eb56cebf20c3bfda8fcde9d70dd2ce0fae7290f47da1b8a5a9254c0b5f04fde8042d38dd0e2f97513fd1b456eff5f49006af36150181
|
7
|
+
data.tar.gz: 8b16d64e31172c373d80abd5a5b8303a63888b3a9e5a999e60817a218d3d32ddb12b752bbb1c82057392be39f5ec0cd4811d05464b39f00271fb4deddf06f7a7
|
data/exe/prick
CHANGED
@@ -140,6 +140,10 @@ SPEC = %(
|
|
140
140
|
|
141
141
|
The --schema option sets the current schema before executing the PATH
|
142
142
|
|
143
|
+
touch! -- [SUCCESS]
|
144
|
+
Record a build. SUCCESS can be 'true' (default) or 'false'. 'touch' is
|
145
|
+
used by external build processes that doesn't involve prick
|
146
|
+
|
143
147
|
bash! --main
|
144
148
|
Emit a bash script to build the database. The script is constructed from
|
145
149
|
the build attributes in the environment file
|
@@ -399,6 +403,11 @@ begin
|
|
399
403
|
database, username, args.expect(1),
|
400
404
|
step: cmd.step?, timer: cmd.time?, dump: dump, schema: cmd.schema)
|
401
405
|
|
406
|
+
when :touch!
|
407
|
+
success = args.expect(0..1) || 'true'
|
408
|
+
%w(true false).include?(success) or ShellOpts.error "Illegal argument '#{success}'"
|
409
|
+
Prick::SubCommand.touch(success == "true")
|
410
|
+
|
402
411
|
when :bash!
|
403
412
|
args.expect(0)
|
404
413
|
clean_pg_meta_cache
|
@@ -413,6 +422,11 @@ begin
|
|
413
422
|
args.expect(0)
|
414
423
|
Prick::SubCommand.snapshot(database, username)
|
415
424
|
|
425
|
+
when :reset!
|
426
|
+
require_db
|
427
|
+
args.expect(0)
|
428
|
+
Prick::SubCommand.drop_data(database)
|
429
|
+
|
416
430
|
when :drop!
|
417
431
|
case cmd.subcommand
|
418
432
|
when :users!
|
data/lib/prick/local/command.rb
CHANGED
@@ -97,8 +97,8 @@ module Command
|
|
97
97
|
# will instead return a tuple of stdout/stderr lines. If :stderr is false,
|
98
98
|
# stderr is ignored and is the same as adding "2>/dev/null" to the command
|
99
99
|
#
|
100
|
-
# #command raises a Command::Error exception if the command returns with an
|
101
|
-
# code != 0 unless :fail is false. In that case the the exit code can be
|
100
|
+
# #command raises a Command::Error exception if the command returns with an
|
101
|
+
# exit code != 0 unless :fail is false. In that case the the exit code can be
|
102
102
|
# fetched from Command::status
|
103
103
|
#
|
104
104
|
def command(env = {}, cmd, stdin: nil, stderr: nil, fail: true)
|
data/lib/prick/local/git.rb
CHANGED
data/lib/prick/state.rb
CHANGED
@@ -239,7 +239,7 @@ module Prick
|
|
239
239
|
# It is an error if the project file exists.
|
240
240
|
def save_project(overwrite: false)
|
241
241
|
overwrite || !File.exists?(project_file) or Prick.error "Won't overwrite '#{project_file}'"
|
242
|
-
hash = { name: name, title: title, version: version.to_s, prick:
|
242
|
+
hash = { name: name, title: title, version: version.to_s, prick: Prick::VERSION }
|
243
243
|
save_yaml(project_file, hash)
|
244
244
|
end
|
245
245
|
|
@@ -264,10 +264,11 @@ module Prick
|
|
264
264
|
@build_id = insert_record(
|
265
265
|
"prick.builds",
|
266
266
|
name: name,
|
267
|
-
version: version.to_s, prick:
|
267
|
+
version: version.to_s, prick: Prick::VERSION,
|
268
268
|
branch: branch, rev: rev(kind: :short), clean: clean?,
|
269
269
|
environment: environment)
|
270
270
|
end
|
271
|
+
# version: version.to_s, prick: prick_version,
|
271
272
|
end
|
272
273
|
|
273
274
|
def save_build_end(success, duration)
|
@@ -278,13 +279,23 @@ module Prick
|
|
278
279
|
insert_record(
|
279
280
|
"prick.builds",
|
280
281
|
name: name,
|
281
|
-
version: version.to_s, prick:
|
282
|
+
version: version.to_s, prick: Prick::VERSION,
|
282
283
|
branch: branch, rev: rev(kind: :short), clean: clean?,
|
283
284
|
environment: environment,
|
284
285
|
success: success, duration: duration, prick_duration: dt)
|
285
286
|
end
|
286
287
|
end
|
287
288
|
|
289
|
+
def save_build(success = true)
|
290
|
+
insert_record(
|
291
|
+
"prick.builds",
|
292
|
+
name: name,
|
293
|
+
version: version.to_s, prick: Prick::VERSION,
|
294
|
+
branch: branch, rev: rev(kind: :short), clean: clean?,
|
295
|
+
environment: environment,
|
296
|
+
success: success)
|
297
|
+
end
|
298
|
+
|
288
299
|
def dump
|
289
300
|
puts "State"
|
290
301
|
indent {
|
@@ -42,7 +42,10 @@ module Prick::SubCommand
|
|
42
42
|
if format == :short
|
43
43
|
puts Prick.databases
|
44
44
|
else
|
45
|
-
|
45
|
+
# Timestamp of newest file under git control
|
46
|
+
newest_file = Command.command("ls -tr #{Git.list.join(" ")} | tail -1").last
|
47
|
+
fs_time = File.mtime(newest_file)
|
48
|
+
|
46
49
|
git_branch = Git.branch.current
|
47
50
|
git_rev = Git.id[0...8]
|
48
51
|
|
@@ -51,10 +54,7 @@ module Prick::SubCommand
|
|
51
54
|
row = conn.record(%(
|
52
55
|
select
|
53
56
|
'#{database}' as "database", name, version, branch, rev, clean, environment,
|
54
|
-
|
55
|
-
built_at at time zone 'UTC' at time zone current_setting('TimeZone'),
|
56
|
-
'YYYY-MM-DD HH24:MI') as "built_at",
|
57
|
-
success
|
57
|
+
built_at, success
|
58
58
|
from prick.versions
|
59
59
|
))
|
60
60
|
|
@@ -62,6 +62,8 @@ module Prick::SubCommand
|
|
62
62
|
clean = row[:clean]
|
63
63
|
same_revision = row[:branch] == git_branch && row[:rev] == git_rev
|
64
64
|
up2date = fs_time <= row[:built_at]
|
65
|
+
|
66
|
+
# Set state
|
65
67
|
row[:state] =
|
66
68
|
case [clean, same_revision, up2date]
|
67
69
|
in [true, true, true]; "clean" # Clean repo
|
@@ -76,6 +78,10 @@ module Prick::SubCommand
|
|
76
78
|
row[:state] = "-"
|
77
79
|
end
|
78
80
|
|
81
|
+
# Convert built_at to string
|
82
|
+
row[:built_at] = row[:built_at].strftime("%Y-%m-%d %H:%M")
|
83
|
+
|
84
|
+
# Add current database marker
|
79
85
|
last_column = (Prick.state.database == database ? "*" : "")
|
80
86
|
rows << row.values + [last_column]
|
81
87
|
}
|
data/lib/prick/version.rb
CHANGED
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.
|
4
|
+
version: 0.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|
@@ -235,6 +235,7 @@ files:
|
|
235
235
|
- lib/prick/subcommand/prick-setup.rb
|
236
236
|
- lib/prick/subcommand/prick-snapshot.rb
|
237
237
|
- lib/prick/subcommand/prick-teardown.rb
|
238
|
+
- lib/prick/subcommand/prick-touch.rb
|
238
239
|
- lib/prick/subcommand/subcommand.rb
|
239
240
|
- lib/prick/version.rb
|
240
241
|
- prick.gemspec
|