prick 0.14.0 → 0.15.0

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: c155692c268326430a0e9225d4a7c156fedd52533114b62fae7e7ce61da01177
4
- data.tar.gz: 4e245212208c3ecc518f313cd9f1af709db5ce41b7281c7247a1078293c486de
3
+ metadata.gz: 65c56eb6650acf4a9a15acc00589075fe551548f06df7f714db56b89fc8f0f7d
4
+ data.tar.gz: 585b320426243c5a3a82df87a924e89e03807c47b618a44350a8c7e646112f34
5
5
  SHA512:
6
- metadata.gz: 38ff771885f6a73a20f36985403cb61a63fc2f025c20f92bb1dea4cb2ba047f908e48c4a564a50b707594d32199a87f796e0640135f6f0da5a521fe572c70cdb
7
- data.tar.gz: 79641d89e168fe1be4d7493aed420fd40cd71cfb29ac98c359c34f82457bd1b7c265883e83cf661c29ff1ea6437bf1a087a652987409221cc4c439768b480922
6
+ metadata.gz: 72f83cb2412de38665afac3c6b3e7bd293d17ad35c64910bec6ef6db5080922d5d6771b044b76dcc52539da60327843861f681f979f3e04739a3cb04f804f8e1
7
+ data.tar.gz: c5460d78662709f1c5cb8bc5badd3243230cd41ff800b3d8fb9eee3d3e49cd314f51548dab060f0435d5c1aa58c3dbdfb22c490acc96b8e4dc101659675af027
data/lib/prick/builder.rb CHANGED
@@ -19,7 +19,7 @@ module Prick
19
19
  # When a resource match a directory, the directory can contain a special
20
20
  # default resource ('build' or 'migrate') that takes over the rest of the
21
21
  # build process for that directory. Typically, you'll use the 'build.yml' or
22
- # 'migrate.yml' to control the build order of the other resources If a
22
+ # 'migrate.yml' to control the build order of the other resources. If a
23
23
  # directory doesn't contain a build resource, the resources in the directory
24
24
  # are built in alphabetic order
25
25
  #
@@ -38,6 +38,7 @@ module Prick
38
38
  @default = default
39
39
  @execute = true
40
40
  @lines = []
41
+ @cwd = Dir.getwd # used in error messages
41
42
  end
42
43
 
43
44
  def build(subject = default, execute: true)
@@ -67,7 +68,13 @@ module Prick
67
68
  # puts "do_sql(#{path})"
68
69
  do_dir(path) { |file|
69
70
  if @execute
70
- Rdbms.exec_file(database.name, file, user: database.user, schema: schema)
71
+ begin
72
+ Rdbms.exec_file(database.name, file, user: database.user, schema: schema)
73
+ rescue Command::Error => ex
74
+ $stderr.puts ex.stderr
75
+ $stderr.puts "in #{reldir}/#{file}"
76
+ exit 1
77
+ end
71
78
  else
72
79
  @lines += IO.readlines(file).map(&:chomp)
73
80
  end
@@ -80,7 +87,13 @@ module Prick
80
87
  do_dir(path) { |file|
81
88
  lines = Command.command "./#{file} #{database.name} #{database.user}" # FIXME Security
82
89
  if @execute
83
- Rdbms.exec_sql(database.name, lines.join("\n"), user: database.user, schema: schema)
90
+ begin
91
+ Rdbms.exec_sql(database.name, lines.join("\n"), user: database.user, schema: schema)
92
+ rescue Command::Error => ex
93
+ $stderr.puts ex.stderr
94
+ $stderr.puts "from #{reldir}/#{file}"
95
+ exit 1
96
+ end
84
97
  else
85
98
  @lines += lines
86
99
  end
@@ -130,6 +143,14 @@ module Prick
130
143
  end
131
144
  }
132
145
  end
146
+
147
+ private
148
+ # Return the relative path to the current directory from the directory of
149
+ # the time of the instantiation of the Builder object. Used in error
150
+ # messages
151
+ def reldir
152
+ Dir.getwd.sub(/^#{@cwd}\//, "")
153
+ end
133
154
  end
134
155
 
135
156
  class MigrationBuilder < Builder
data/lib/prick/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Required by gem
6
6
  module Prick
7
- VERSION = "0.14.0"
7
+ VERSION = "0.15.0"
8
8
  end
9
9
 
10
10
  # Project related code starts here
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.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shellopts
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
- rubygems_version: 3.1.2
158
+ rubygems_version: 3.1.4
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: A release control and management system for postgresql