prick 0.39.7 → 0.39.9

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: 7d27db668e8163dce24bb6c7548f5332a5f5e8c72ee4a5e266b10a032a06b782
4
- data.tar.gz: c3e293fec4e73625c45e28198f112a52cef7d83816274ca3a63231cfc6746c28
3
+ metadata.gz: db7a57d14d65cd631793874989d504c0b9aeeeee1022e4d57fd451ff62663e19
4
+ data.tar.gz: 20c53aa36943b9b2d8dd17c4f4fbc125d6b416392251f98b03cbbbe5e015a5eb
5
5
  SHA512:
6
- metadata.gz: 02fcb89d65a6c99e95b9263266c84353eac7a572a6338bcabde51d699377a4c32161dd785ef1b9ccdd16f58ba85e92174ba09e086eda7fd11426449d30c2fa2e
7
- data.tar.gz: 7079b45ddf107b13c1ea22e131ea580c16c9e3378fc0f0ff3e1eb22b8b0e8b3c22a61e3732efb1f58180a29fc97d5453a0ff2a96cec2c4d3ac1a5083948a8e97
6
+ metadata.gz: 312a5a5e15b995d47b75464ca5284e8b192f978dcf3ab6cc6a282fe482aeff2a76a6ff18be1d6b67b7aa44b4864378f7d02ffe06d184a88ff79cc9f8395dea0e
7
+ data.tar.gz: 8f952347b1992b473904a5865a612f72717b4376c357392cae82b4db60904b30e336ccafc9ee63f6566a258bbe109d5745e5aab5cbbabf52d25d4469cfd56750
@@ -16,9 +16,13 @@ module Prick
16
16
 
17
17
  def execute(**opts, &block)
18
18
  name = self.class.to_s.sub(/.*::/, "").split(/(?=[A-Z])/).map(&:downcase).join(" ")
19
+ node_paths = nodes.map(&:relpath)
19
20
  time "Execute #{name} (nodes: #{nodes.size})" do
20
21
  yield(**opts)
21
22
  end
23
+ if Timer.on?
24
+ ::Timer.file.indent { |f| f.puts node_paths }
25
+ end
22
26
  end
23
27
 
24
28
  def dump
@@ -88,6 +88,7 @@ module Prick
88
88
  batch = nil
89
89
 
90
90
  for node in [init_nodes, decl_nodes, fox_seed_nodes, sql_seed_nodes, term_nodes.reverse].flatten
91
+ # Create new batch if required. Order of when-clauses is important
91
92
  case node.kind
92
93
  when :module
93
94
  if batch&.kind != :module
@@ -103,7 +104,7 @@ module Prick
103
104
  batch = SqlBatch.new(self)
104
105
  end
105
106
  when :sql || node.kind == :inline
106
- if batch&.kind != :exe
107
+ if batch&.kind != :exe || step
107
108
  @batches << batch if batch
108
109
  batch = SqlBatch.new(self)
109
110
  end
@@ -113,11 +114,13 @@ module Prick
113
114
  when :fox
114
115
  @batches << batch if batch
115
116
  batch = FoxBatch.new(self)
116
- when :yml
117
+ when :yml # build.yml files
117
118
  next
118
119
  else
119
120
  raise Error, "Unexpected node kind: #{node.kind}"
120
121
  end
122
+
123
+ # Add node to current batch
121
124
  batch.nodes << node
122
125
  end
123
126
  @batches << batch if batch
@@ -9,6 +9,7 @@ module Prick
9
9
  attr_reader :args # only defined for :exe (String)
10
10
 
11
11
  def name() @name = File.basename(path) end
12
+ def relpath = path.sub(/^#{Dir.getwd}\//, "")
12
13
 
13
14
  # Note that schema defaults to 'public' which may not be what you want in
14
15
  # some cases
@@ -126,7 +127,6 @@ module Prick
126
127
  alias_method :command, :to_s
127
128
 
128
129
  def filename = File.basename(path)
129
- def relpath = path.sub(/^#{Dir.getwd}\//, "")
130
130
 
131
131
  def initialize(parent, phase, path, args = nil)
132
132
  constrain args, [String]
@@ -43,7 +43,7 @@ module Timer
43
43
  def file() ::Timer.file end
44
44
 
45
45
  def self.on!() ::Timer.on! end
46
- def self.on?() ::Time.on? end
46
+ def self.on?() ::Timer.on? end
47
47
 
48
48
  def unit() ::Timer.unit end
49
49
  def unit=(unit) ::Timer.unit = unit end
data/lib/prick/state.rb CHANGED
@@ -357,12 +357,12 @@ module Prick
357
357
 
358
358
  def insert_record(table, attrs = {})
359
359
  sql_fields = attrs.keys.join(", ")
360
- sql_values = attrs.values.map { conn.quote_literal(_1) }.join(", ")
360
+ sql_values = attrs.values.map { conn.quote_value(_1) }.join(", ")
361
361
  conn.value "insert into #{table} (#{sql_fields}) values (#{sql_values}) returning id"
362
362
  end
363
363
 
364
364
  def update_record(table, id, attrs = {})
365
- sql_assign = attrs.map { |k,v| "#{conn.quote_identifier(k)} = #{conn.quote_literal(v)}" }.join(", ")
365
+ sql_assign = attrs.map { |k,v| "#{conn.quote_identifier(k)} = #{conn.quote_value(v)}" }.join(", ")
366
366
  sql_id_cond = (id.nil? ? "true" : "id = #{id}")
367
367
  conn.exec "update #{table} set #{sql_assign} where #{sql_id_cond}"
368
368
  end
@@ -50,8 +50,8 @@ module Prick::SubCommand
50
50
  pool = builder.pool
51
51
  schemas = pool.refresh_schemas
52
52
  end
53
- schema_list = conn.quote_literal_list(schemas)
54
- schema_expr = schemas ? "true = true" : "schema_name in #{schema_list}"
53
+ schema_list = conn.quote_values(schemas)
54
+ schema_expr = schemas ? "true = true" : "schema_name in (#{schema_list})"
55
55
  tables = conn.tuples %(
56
56
  select schema_name, table_name, max_id
57
57
  from prick.snapshots
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.39.7"
4
+ VERSION = "0.39.9"
5
5
  end
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.39.7
4
+ version: 0.39.9
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-07-28 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic