prick 0.46.1 → 0.47.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2b735f370a697a579d10b8b651950f6eeef7fa061ee787976e5eeff3ee2fdc5
4
- data.tar.gz: b641d15c6035891358b913b57b2b01b7c10bbe9c9dd56a7c5b5e229bcaa00374
3
+ metadata.gz: 6132b3743cc00dba96e3f612a7f4aba150d50b6fc49dde9cc4fba02077c7bdfe
4
+ data.tar.gz: 13fb9740a59f487f30169931fd8b6efcfc4332964979042f0aff8af5f3df1e0a
5
5
  SHA512:
6
- metadata.gz: bacc0e9d3c6bb77b856a7ee9e955693f784ed3aedef5b8dfa4678a8570800277a423e3e2c3c91b0269fcce5622475d1158224bba8b74ff9acfed65cc40e7de21
7
- data.tar.gz: 3670e4ec7a3ec1c77ad72ca4b0e5d1dcc4652924c9afd4750c160ed0972a1d252e1ffaf68ce49f535f3db8f44d05ee76ba455d2c8bf7a1e05fc8a77b1d9109dd
6
+ metadata.gz: 7c47703c827137d10397f1993bc81f09a9c5e19eedae5708fd0728819a20b9403cceca3c9da0aff5c43a0386c70c9b2b52bc21adcc2d94ca613a12a336f4cb2c
7
+ data.tar.gz: 416f78b89764f1f0d63cb707b198991fbd5382feadec65691e35263f5736b975f3d921145e31cae7b62ec0d97d2be4b143fc9cdbfecc6407292ad3a945547f42
data/exe/prick CHANGED
@@ -140,10 +140,12 @@ SPEC = %(
140
140
  useful to run 'prick snapshot' immediately after you complete building
141
141
  the database
142
142
 
143
- build! --step -f,force -t,time --dump=KIND? -- [SCHEMA]
143
+ build! --step -f,force -t,time --dump=KIND? --path=BUILD_FILE -- [SCHEMA]
144
144
  Build the project. If SCHEMA is defined, later schemas are excluded. KIND
145
145
  can be 'nodes', 'allnodes' or 'batches' (the default). Schemas marked
146
- with 'no refresh' is not built unless the --force is present
146
+ with 'no refresh' is not built unless the --force is present. The --file
147
+ option sets the initial build file or directory, default is
148
+ SCHEMA_DIR/build.yml
147
149
 
148
150
  make! --step -t,time --dump=KIND? -- [SCHEMA]
149
151
  @ Only rebuild changed files
@@ -188,7 +190,7 @@ SPEC = %(
188
190
  the snapshot. Only one snapshot can be created at a time
189
191
 
190
192
  reset!
191
- Restore database to the last snapshot. TODO
193
+ Restore database to the last snapshot
192
194
 
193
195
  version!
194
196
  Print project version
@@ -441,6 +443,7 @@ begin
441
443
  # exclude = cmd.exclude? ? cmd.exclude.split(",") : []
442
444
  Prick::SubCommand.build(
443
445
  database, username, args.expect(0..1),
446
+ path: cmd.path,
444
447
  force: cmd.force?, step: cmd.step?, timer: cmd.time?, dump: dump)
445
448
 
446
449
  when :make!
@@ -62,7 +62,7 @@ module Prick
62
62
 
63
63
  def initialize(conn, path, clean = true, single: false, touched: false, load_pool: true, step: false)
64
64
  File.exist?(path) or raise Error, "Can't find #{path}"
65
- single || File.directory?(path) or raise Error, "Can't find directory #{path}"
65
+ ! single || File.file?(path) or raise Error, "Not a file - #{path}"
66
66
 
67
67
  @conn = conn
68
68
  @path = path
@@ -17,9 +17,9 @@ module Prick
17
17
  def parse(path, single: false)
18
18
  File.exist?(path) or raise Error, "Can't find #{path}"
19
19
  if single
20
- parse_path(path)
20
+ parse_single(path)
21
21
  else
22
- parse_directory(nil, path)
22
+ parse_path(nil, path)
23
23
  end
24
24
  self
25
25
  end
@@ -34,7 +34,7 @@ module Prick
34
34
  end
35
35
  end
36
36
 
37
- def parse_path(path, schema: nil)
37
+ def parse_single(path, schema: nil)
38
38
  File.exist?(path) or raise Error, "Can't find #{file}"
39
39
  dir = File.dirname(path)
40
40
  file = File.basename(path)
@@ -44,8 +44,15 @@ module Prick
44
44
  unit
45
45
  end
46
46
 
47
- def parse_directory(parent, dir)
48
- build_file = "#{dir}/build.yml".sub(/\/\//, "/")
47
+ def parse_path(parent, path)
48
+ if File.directory?(path)
49
+ dir = path
50
+ build_file = "#{path}/build.yml".sub(/\/\//, "/")
51
+ elsif File.file?(path)
52
+ dir = File.dirname(path)
53
+ build_file = path
54
+ end
55
+
49
56
  if File.exist? build_file
50
57
  parse_build_file(parent, dir, build_file)
51
58
  else
@@ -161,7 +168,7 @@ module Prick
161
168
  else
162
169
  (path, args = parse_file_entry(unit, dir, entry)) or return nil
163
170
  if File.directory? path
164
- parse_directory(unit, path)
171
+ parse_path(unit, path)
165
172
  elsif File.executable?(path)
166
173
  SysExecNode.new(unit, phase, path, args)
167
174
  elsif File.file? path
data/lib/prick/state.rb CHANGED
@@ -191,7 +191,7 @@ module Prick
191
191
  "PRICK_SPOOLDIR" => File.join(Prick.state.prick_dir, SPOOL_DIR),
192
192
  "PRICK_TMPDIR" => File.join(Prick.state.prick_dir, TMP_DIR),
193
193
  "PRICK_CLONEDIR" => File.join(Prick.state.prick_dir, CLONE_DIR),
194
- "PRICK_SPECDIR" => File.join(Prick.state.prick_dir, BIN_DIR),
194
+ "PRICK_SPECDIR" => File.join(Prick.state.prick_dir, SPEC_DIR),
195
195
  })
196
196
  end
197
197
 
@@ -5,10 +5,13 @@ require_relative '../builder/builder.rb'
5
5
  module Prick::SubCommand
6
6
  def self.build(
7
7
  database, username, schema,
8
- builddir: Prick.state.schema_dir,
8
+ path: nil, # Default SCHEMA_DIR
9
9
  force: false, # Build all schemas
10
10
  step: false, timer: nil, dump: nil)
11
11
 
12
+ path ||= Prick.state.schema_dir
13
+ File.exist?(path) or Prick.error "Can't find #{path}"
14
+
12
15
  Timer.on! if timer
13
16
 
14
17
  Timer.time "Prick::Command#build" do
@@ -30,7 +33,7 @@ module Prick::SubCommand
30
33
  end
31
34
  conn = Prick.state.connection
32
35
 
33
- builder = Prick::Build::Builder.new(conn, builddir, step: step)
36
+ builder = Prick::Build::Builder.new(conn, path, step: step)
34
37
 
35
38
  if exist # Empty (part of) the database
36
39
  if force
@@ -54,8 +54,7 @@ module Prick::SubCommand
54
54
  Prick.databases { |database, conn|
55
55
  row = conn.record(%(
56
56
  select
57
- '#{database}' as "database", name, version, branch, rev, clean, environment,
58
- built_at, success
57
+ '#{database}' as "database", name, version, branch, rev, clean, environment, built_at, success
59
58
  from prick.versions
60
59
  ))
61
60
 
@@ -66,7 +65,7 @@ module Prick::SubCommand
66
65
  end
67
66
 
68
67
  if row[:success]
69
- clean = row[:clean]
68
+ clean = row.delete(:clean)
70
69
  same_revision = row[:branch] == git_branch && row[:rev] == git_rev
71
70
  up2date = fs_time <= row[:built_at]
72
71
 
@@ -90,13 +89,16 @@ module Prick::SubCommand
90
89
  # Convert built_at to string
91
90
  row[:built_at] = row[:built_at]&.strftime("%Y-%m-%d %H:%M")
92
91
 
92
+ # Add dirty flag
93
+ row[:rev] = (clean ? " " : "*") + row[:rev]
94
+
93
95
  # Add current database marker
94
96
  last_column = (is_current_database ? "*" : "")
95
97
 
96
98
  rows << row.values + [last_column]
97
99
  }
98
100
 
99
- headers = %w(database project version branch rev clean environment built success state) + [" "]
101
+ headers = %w(database project version branch rev environment built success state) + [" "]
100
102
  Fmt.puts_table(headers, rows, bold: current_database_row)
101
103
  end
102
104
  end
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.46.1"
4
+ VERSION = "0.47.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.46.1
4
+ version: 0.47.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-04-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: semantic
@@ -258,7 +257,6 @@ files:
258
257
  homepage: http://www.nowhere.com/
259
258
  licenses: []
260
259
  metadata: {}
261
- post_install_message:
262
260
  rdoc_options: []
263
261
  require_paths:
264
262
  - lib
@@ -273,8 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
271
  - !ruby/object:Gem::Version
274
272
  version: '0'
275
273
  requirements: []
276
- rubygems_version: 3.3.7
277
- signing_key:
274
+ rubygems_version: 3.6.9
278
275
  specification_version: 4
279
276
  summary: A release control and management system for postgresql
280
277
  test_files: []