prick 0.20.18 → 0.20.22

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: 69e1bed1482431efd5f5e449ba9d2b3d5cccfef223398e51879aeda7374fd6e1
4
- data.tar.gz: 99984a969cb456c6efbf4943f56433d1c207246dfc615956fbd550511c30bfee
3
+ metadata.gz: 99ba6fb22cc049f8f7a42f94c939c27b0d2496ec2218c8dec3c327478fd664cb
4
+ data.tar.gz: 5d8eff4ca98279c775de052cd1511bae449d658c9fd73adc865fb15e1530ff7a
5
5
  SHA512:
6
- metadata.gz: 7359ccc4a5da931531579431375e94007d7b7c66dc128c1a15c26fce5aa8b206b2ed89b33e9d15054c49f4dc64b61a31ea5647e387c219f5fdd1f0a7eed1fe25
7
- data.tar.gz: 3713cb328f4aea15e7ac67d0e40dd7d1ae07e31528368aaf24d634fcd6ffbb91c2b512764a2c82cd01abe7c9aa191c784332196ba9b0f8232c5f4fe5a2b56fff
6
+ metadata.gz: b08ba8c172f31f336aba28c2eee8c84a1d752dcd4fc2183bff2459d76f4b1a9fdf9ab4effcb2bf6395ea2e39438bacb4ff238adaaa21e89b69eb0fbeb2d7c2be
7
+ data.tar.gz: c3e79178490e6f777170e0ccd1f888c28951c68b756067c21caee02a6650ceda3406a108a7ff1f2ecb07dc568ff5fa6e6086d160f3b922fdfafe602c9fbed1ba
data/lib/builder/node.rb CHANGED
@@ -131,12 +131,16 @@ module Prick
131
131
  @pipe = Command::Pipe.new(to_s, stderr: nil)
132
132
  end
133
133
 
134
- def inspect() "#{path}(#{args.join(", ")})" end
134
+ def inspect() "#{path}(#{(args || []).join(", ")})" end
135
135
 
136
136
  protected
137
137
  def read_source
138
138
  pipe.puts [conn.name, conn.user]
139
139
  sql = pipe.wait
140
+ if pipe.status != 0
141
+ $stderr.puts pipe.error
142
+ raise Prick::Error, "Failed executing #{pipe.cmd}"
143
+ end
140
144
  @source_lines = 1 + 1 + sql.count("\n")
141
145
  ["set search_path to #{schema};\n", sql]
142
146
  end
@@ -76,31 +76,39 @@ module Prick
76
76
  unit
77
77
  end
78
78
 
79
+ def parse_file_entry(dir, entry)
80
+ name = entry.dup
81
+ name.sub!(/\$ENVIRONMENT/, Prick.state.environment.to_s)
82
+ name.sub!(/\/$/, "")
83
+ if name =~ /^(\S+)\s+(.*)$/ # exe
84
+ file = $1
85
+ args = $2
86
+ else
87
+ file = name
88
+ end
89
+ path = "#{dir}/#{file}"
90
+ [path, name, file, args]
91
+ end
92
+
79
93
  def parse_entry(unit, phase, dir, entry)
80
94
  if entry.is_a?(Hash)
81
95
  entry.size == 1 or raise Error, "sql and module are single-line values"
82
96
  key, value = entry.first
83
97
  case key
84
98
  when "sql"; InlineNode.new(unit, phase, unit.path, value)
85
- when "call";
99
+ when "call"
86
100
  args = value.split(/\s+/)
87
101
  args.size >= 3 or raise "Illegal number of arguments: #{value}"
88
102
  file, klass, command, args = *args
89
103
  ModuleNode.new(unit, phase, "#{dir}/#{file}", klass, command, args)
104
+ when "exec"
105
+ path, name, file, args = parse_file_entry(dir, value)
106
+ ExeNode.new(unit, phase, path, args)
90
107
  else
91
108
  raise Error, "Illegal key: #{key}"
92
109
  end
93
110
  else
94
- name = entry
95
- name.sub!(/\$ENVIRONMENT/, Prick.state.environment.to_s)
96
- name.sub!(/\/$/, "")
97
- if name =~ /^(\S+)\s+(.*)$/ # exe
98
- file = $1
99
- args = $2
100
- else
101
- file = name
102
- end
103
- path = "#{dir}/#{file}"
111
+ path, name, file, args = parse_file_entry(dir, entry)
104
112
  if File.directory? path
105
113
  parse_directory(unit, path)
106
114
  elsif File.executable? path
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.20.18"
4
+ VERSION = "0.20.22"
5
5
  end
@@ -4,7 +4,7 @@ require 'builder/builder.rb'
4
4
 
5
5
  module Prick::SubCommand
6
6
  def self.setup(database, username)
7
- conn = PgConn.new
7
+ conn = PgConn.new("template1") # Connect to template1 because database might not exist
8
8
  if !conn.role.exist? username
9
9
  # FIXME Should not be created as superuser but we can't do that before we
10
10
  # have a super: option in build
data/prick.gemspec CHANGED
@@ -37,9 +37,10 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency "fixture_fox", "~> 0.1.3"
38
38
  spec.add_dependency "postspec"
39
39
  spec.add_dependency "pg_graph", "~> 0.1.8"
40
- spec.add_dependency "shellopts", "~> 2.0.23"
40
+ spec.add_dependency "shellopts", "~> 2.0.24"
41
41
 
42
42
  spec.add_development_dependency "ruby-prof"
43
+ spec.add_development_dependency "dbutils"
43
44
 
44
45
  # Also un-comment in spec/spec_helper to use simplecov
45
46
  # spec.add_development_dependency "simplecov"
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.20.18
4
+ version: 0.20.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.0.23
131
+ version: 2.0.24
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 2.0.23
138
+ version: 2.0.24
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: ruby-prof
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: dbutils
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  description: A release control and management system for postgresql
154
168
  email:
155
169
  - claus.l.rasmussen@gmail.com