prick 0.38.0 → 0.39.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/prick +9 -0
- data/lib/prick/local/command.rb +2 -2
- data/lib/prick/local/git.rb +2 -0
- data/lib/prick/state.rb +10 -0
- data/lib/prick/subcommand/prick-list.rb +14 -7
- 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: eeb2d80f1ae7102e2b747a822bd8d256f8b4a3f5b1752e6f90691d2250e033c7
|
4
|
+
data.tar.gz: '08c36ae7f22e3aadd6074775786faffaafe0e9f97205ba91c96473cfac694ba7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d378e592a26809fd2535eb3e2b57a8794fdbe2d381338e284e69feabf5753564e98bed9e6e8735c926bcc6d73f96db166c29ee62039bf5dd5b2741ae8345245
|
7
|
+
data.tar.gz: 9cfcba08819dc82d7354d9420c9961ec129f03f2a707a4345c9e0196a64824b6a9eff15e6125dc1b85b6bae84876361f2f985c5e2a519f72862ac0d74865cb2c
|
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
|
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
@@ -286,6 +286,16 @@ module Prick
|
|
286
286
|
end
|
287
287
|
end
|
288
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
|
+
|
289
299
|
def dump
|
290
300
|
puts "State"
|
291
301
|
indent {
|
@@ -42,7 +42,11 @@ 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
|
+
p newest_file
|
48
|
+
fs_time = File.mtime(newest_file)
|
49
|
+
|
46
50
|
git_branch = Git.branch.current
|
47
51
|
git_rev = Git.id[0...8]
|
48
52
|
|
@@ -51,10 +55,7 @@ module Prick::SubCommand
|
|
51
55
|
row = conn.record(%(
|
52
56
|
select
|
53
57
|
'#{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
|
58
|
+
built_at, success
|
58
59
|
from prick.versions
|
59
60
|
))
|
60
61
|
|
@@ -62,13 +63,15 @@ module Prick::SubCommand
|
|
62
63
|
clean = row[:clean]
|
63
64
|
same_revision = row[:branch] == git_branch && row[:rev] == git_rev
|
64
65
|
up2date = fs_time <= row[:built_at]
|
66
|
+
|
67
|
+
# Set state
|
65
68
|
row[:state] =
|
66
69
|
case [clean, same_revision, up2date]
|
67
70
|
in [true, true, true]; "clean" # Clean repo
|
68
|
-
in [true, true, false]; "
|
71
|
+
in [true, true, false]; "clean" # Clean repo but doesn't include latest uncommitted changes
|
69
72
|
in [true, false, _]; "detached" # Clean repo but different revision
|
70
73
|
|
71
|
-
in [false, true, true]; "ok" # Dirty repo
|
74
|
+
in [false, true, true]; "ok" # Dirty repo, work-in-progress
|
72
75
|
in [false, true, false]; "dirty" # Dirty repo, but doesn't include latest changes
|
73
76
|
in [false, false, _]; "stale" # Dirty repo, no way back
|
74
77
|
end
|
@@ -76,6 +79,10 @@ module Prick::SubCommand
|
|
76
79
|
row[:state] = "-"
|
77
80
|
end
|
78
81
|
|
82
|
+
# Convert built_at to string
|
83
|
+
row[:built_at] = row[:built_at]&.strftime("%Y-%m-%d %H:%M")
|
84
|
+
|
85
|
+
# Add current database marker
|
79
86
|
last_column = (Prick.state.database == database ? "*" : "")
|
80
87
|
rows << row.values + [last_column]
|
81
88
|
}
|
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.1
|
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
|