prick 0.20.16 → 0.20.19

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: 20f00d302f4282832c257119bf9bfe5f2d171c9d706ec74bca142681d670a596
4
- data.tar.gz: 5facc31ae461bcc1919509d81d71ea4f9244c20fae8e5a693f991b419343d47b
3
+ metadata.gz: 523f3f63b46850833fd679103f6a2ed389fee673376be4ffd54ab85ed76e9dfb
4
+ data.tar.gz: 58d881d1e9a5ebaea7b16caf35fc7d34670a6fa7f1a404357463f3dbbb73e81c
5
5
  SHA512:
6
- metadata.gz: 726d74592d2568c862538ea0692a01067eda7a7ffd3f5dba6b80abea1b3d3a96ae0f11faa5a4ee65792de764a628f4f73691d172f9e095b24b40cba9f140efc8
7
- data.tar.gz: 708e3863256205385a418b4ce3436d3639f576fd6700d478b7e11933232187af6bda60988d0a952942cd56351d896835c574b8a31c920b991ac7a663dc89147e
6
+ metadata.gz: c5f95a314a5dbaddef93d4e184ed5c10c35118b6e29f8ac8111589e4e79031dc83f254345853da84591edb9b511c5eab299dfa6716dc8db91b70361fe56ada12
7
+ data.tar.gz: '08eef7aaeea483bd45956898d290d69bb2859d41caafcc2ea64ce45bd9c2edd348a0cb003ba76054192e078fae3cf325c009ddb271d5d9e863915eb8eed95fe7'
data/exe/prick CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  #$LOAD_PATH.unshift "/home/clr/prj/shellopts/lib"
4
4
  #$LOAD_PATH.unshift "/home/clr/prj/pg_graph/lib"
5
+ #$LOAD_PATH.unshift "/home/clr/prj/fixture_fox/lib"
5
6
 
6
7
  require 'bootsnap'
7
8
  begin
data/lib/builder/batch.rb CHANGED
@@ -138,7 +138,7 @@ module Prick
138
138
  # FIXME: Why only in FoxBatch - should be set higher up in the system
139
139
  conn.execute "update prick.versions set built_at = now() at time zone 'UTC'"
140
140
  rescue PG::SyntaxError, PG::Error => ex
141
- raise PostgresError, "prick: #{error} from #{node.path}"
141
+ raise PostgresError, "prick: #{ex.message}"
142
142
  end
143
143
  }
144
144
  t_type.emit
@@ -93,8 +93,6 @@ module Prick
93
93
  def execute(conn, create_schemas: schemas)
94
94
  group if batches.nil?
95
95
  conn.exec create_schemas.grep_v("public").map { |schema| "create schema #{schema}" }
96
- conn.schema.create("public", authorization: "postgres")
97
- conn.exec "grant usage, create on schema public to public"
98
96
  for batch in batches
99
97
  batch.execute
100
98
  end
@@ -76,30 +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!(/\/$/, "")
96
- if name =~ /^(\S+)\s+(.*)$/ # exe
97
- file = $1
98
- args = $2
99
- else
100
- file = name
101
- end
102
- path = "#{dir}/#{file}"
111
+ path, name, file, args = parse_file_entry(dir, entry)
103
112
  if File.directory? path
104
113
  parse_directory(unit, path)
105
114
  elsif File.executable? path
@@ -111,7 +120,7 @@ module Prick
111
120
  when /\.fox$/
112
121
  FoxNode.new(unit, :seed, path)
113
122
  else
114
- raise Error, "Unrecognized file type #{File.basename(path)} in #{unit.dir}"
123
+ raise Error, "Unrecognized file type #{File.basename(path)} in #{dir}"
115
124
  end
116
125
  else
117
126
  raise Error, "Can't find #{name} in #{dir} from #{unit}"
@@ -121,3 +130,4 @@ module Prick
121
130
  end
122
131
  end
123
132
  end
133
+
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.16"
4
+ VERSION = "0.20.19"
5
5
  end
@@ -27,7 +27,7 @@ module Prick::SubCommand
27
27
 
28
28
  if exist
29
29
  if force
30
- # Drop all schemas
30
+ # Drop all schemas but re-creates the public schema
31
31
  super_conn.rdbms.empty!(database)
32
32
 
33
33
  else
@@ -46,6 +46,10 @@ module Prick::SubCommand
46
46
 
47
47
  # Drop refresh schemes
48
48
  refresh_schemas.each { |schema| conn.schema.drop(schema, cascade: true) }
49
+
50
+ # Re-create public schema
51
+ conn.schema.create("public", authorization: "postgres")
52
+ conn.exec "grant usage, create on schema public to public"
49
53
  end
50
54
  end
51
55
 
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.16
4
+ version: 0.20.19
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-05-23 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  requirements: []
233
- rubygems_version: 3.1.4
233
+ rubygems_version: 3.1.2
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: A release control and management system for postgresql