prick 0.39.10 → 0.39.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prick/builder/batch.rb +9 -8
- data/lib/prick/builder/node.rb +4 -1
- data/lib/prick/builder/parser.rb +2 -2
- data/lib/prick/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ebdfba60b4161b0afa671e4c19abf963db5d017376c089acade485e5d895dc8
|
4
|
+
data.tar.gz: a3cff45e06c66cb094fa3ca891b4d3a863d21ab52f2fb13ff1b9c2d026bb494b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a1deeabd509f289eeb1fff91a2880e21794bd1124862b84f0fd9c4cad19c512d22d2733ac9cd7b9bf0b288f536739cd9b1c1da88b002f1e2c4ceb9dd2c677a
|
7
|
+
data.tar.gz: 477ce9af0329c7b07a89be381f73cf47629f97b38395342dc817b0ccc051b20b1381da92e6bd71ed9cebb0f8a0b6e9a559eeaf7944b980f1c215d440f0d56f6f
|
data/lib/prick/builder/batch.rb
CHANGED
@@ -35,23 +35,24 @@ module Prick
|
|
35
35
|
def execute
|
36
36
|
# puts "#execute"
|
37
37
|
super {
|
38
|
-
|
39
|
-
|
40
|
-
file = nil
|
41
|
-
node = nil
|
38
|
+
file = nil
|
39
|
+
node = nil
|
42
40
|
|
41
|
+
begin
|
43
42
|
# A SQL batch allows the first node to be an evaluated or executed node
|
44
43
|
if nodes.first.is_a?(CommandNode)
|
45
44
|
node = nodes.shift
|
46
|
-
|
45
|
+
conn.execute [node.source], silent: true
|
47
46
|
end
|
47
|
+
rescue PG::Error => ex
|
48
|
+
error, line, char = conn.err
|
49
|
+
raise PostgresError.new("Error from #{node.to_s} at #{line}:#{char} - #{error}")
|
50
|
+
end
|
48
51
|
|
49
|
-
|
52
|
+
begin
|
50
53
|
for node in nodes # This is marginally faster than concatenating all nodes
|
51
|
-
# puts node.source
|
52
54
|
conn.execute node.source, silent: true
|
53
55
|
end
|
54
|
-
|
55
56
|
rescue PG::Error => ex
|
56
57
|
error, line, char = conn.err
|
57
58
|
file = nil
|
data/lib/prick/builder/node.rb
CHANGED
@@ -123,6 +123,7 @@ module Prick
|
|
123
123
|
def self.objects() @@objects end
|
124
124
|
end
|
125
125
|
|
126
|
+
# Virtual base class for EvalNode and ExecNode
|
126
127
|
class CommandNode < Node
|
127
128
|
alias_method :command, :to_s
|
128
129
|
|
@@ -146,14 +147,16 @@ module Prick
|
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
150
|
+
# EvalNode executes the command and feeds the output into the database
|
149
151
|
class EvalNode < CommandNode
|
150
152
|
def read_source
|
151
153
|
sql = execute_command
|
152
154
|
@source_lines = 1 + 1 + sql.count("\n")
|
153
|
-
["set search_path to #{schema}, pg_temp
|
155
|
+
["set search_path to #{schema}, pg_temp", sql.join("\n")]
|
154
156
|
end
|
155
157
|
end
|
156
158
|
|
159
|
+
# ExecNode executes the command and ignores its output
|
157
160
|
class ExecNode < CommandNode
|
158
161
|
def read_source
|
159
162
|
execute_command
|
data/lib/prick/builder/parser.rb
CHANGED
@@ -57,7 +57,7 @@ module Prick
|
|
57
57
|
unit = make_build_unit(parent, path)
|
58
58
|
entries = YAML.load(File.read(path)) || []
|
59
59
|
entries.each { |entry|
|
60
|
-
if entry.is_a?(Hash) && (entry.size != 1 || entry.first.first
|
60
|
+
if entry.is_a?(Hash) && (entry.size != 1 || !%w(call sql exec eval).include?(entry.first.first))
|
61
61
|
entry.each { |key, value|
|
62
62
|
if key == "schema"
|
63
63
|
unit.schema = value
|
@@ -195,7 +195,7 @@ module Prick
|
|
195
195
|
|
196
196
|
last = nil
|
197
197
|
for env in [env] + env.ancestors.reverse
|
198
|
-
bash_vars["
|
198
|
+
bash_vars["PRICK_ENVIRONMENT"] = env.name
|
199
199
|
file = expand_variables(filename, bash_vars)
|
200
200
|
# last ||= (file != last and file) or return nil # return if no ENVIRONMENT substitution
|
201
201
|
path = (file.start_with?("/") ? file : File.join(dir, file))
|
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.39.
|
4
|
+
version: 0.39.12
|
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-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|