pg 1.3.0.rc4-x86-mingw32 → 1.3.3-x86-mingw32

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: 77f5e29e54f6b610fb98ed5ff7a33ade9766342337903166d7b1f9e4da525bb4
4
- data.tar.gz: 0be2968011204bbff9bf0a8939bf6f6dd11dfdd0e8a445748336bb6c08ae0eb5
3
+ metadata.gz: 1d5da0cfcf68e16db9a1c11999e660d57e7434c8d1dd3c326ee490a1d4e10e06
4
+ data.tar.gz: 472237ce516723618f6c544e057284227fb8a36ee4ed4a599eed0b0654c14828
5
5
  SHA512:
6
- metadata.gz: fb17b6305dec8cece32091eabf3b9eb47beb96eb01ec6686ef80144f0f4523132cf9443d3eeb363b61a52875a379d3672b309c8732006973c49dbb1e1c61788d
7
- data.tar.gz: 5c97874ec1d64ba89c584be5305cf568a01638f56bfe69dd5cb1168af146d4f6823177388bf1fdde117371cbf45927286108582bd7e9a84a988ad7f3800d207e
6
+ metadata.gz: aab78a4df6b198a9a0c4c541bcdde42fe2f3b9f6e7b5a0a1cec1350303e94f9c978052a32bd88dca77e101d94f87875fb1178afc9d216d8e50b54cccfb4b5cb7
7
+ data.tar.gz: 467a38ea236eb7ff2f1fcd6d85001b7730273347b7676e74775abf770c24129ede5ff333e3e4df720313a7e8d7b26ead79384c05e23a9f34f848fe3cecec789b
checksums.yaml.gz.sig CHANGED
Binary file
data/.appveyor.yml CHANGED
@@ -29,7 +29,7 @@ environment:
29
29
  matrix:
30
30
  - ruby_version: "head"
31
31
  RUBYDOWNLOAD: x86
32
- PGVERSION: 10.16-1-windows
32
+ PGVERSION: 10.20-1-windows
33
33
  PGVER: 10
34
34
  - ruby_version: "25"
35
35
  PGVERSION: 9.3.25-1-windows
@@ -45,10 +45,10 @@ jobs:
45
45
  include:
46
46
  - ruby: "3.1"
47
47
  platform: "x64-mingw-ucrt"
48
- PGVERSION: 14.0-1-windows-x64
48
+ PGVERSION: 14.2-1-windows-x64
49
49
  - ruby: "2.5"
50
50
  platform: "x64-mingw32"
51
- PGVERSION: 10.16-1-windows
51
+ PGVERSION: 10.20-1-windows
52
52
 
53
53
  runs-on: windows-latest
54
54
  env:
@@ -56,7 +56,7 @@ jobs:
56
56
  steps:
57
57
  - uses: actions/checkout@v2
58
58
  - name: Set up Ruby
59
- uses: MSP-Greg/ruby-setup-ruby@win-ucrt-1
59
+ uses: ruby/setup-ruby@v1
60
60
  with:
61
61
  ruby-version: ${{ matrix.ruby }}
62
62
 
@@ -31,12 +31,12 @@ jobs:
31
31
  include:
32
32
  - os: windows
33
33
  ruby: "head"
34
- PGVERSION: 14.1-1-windows-x64
34
+ PGVERSION: 14.2-1-windows-x64
35
35
  PGVER: "14"
36
36
  - os: windows
37
37
  ruby: "2.5"
38
- PGVERSION: 9.3.25-1-windows-x64
39
- PGVER: "9.3"
38
+ PGVERSION: 9.4.26-1-windows-x64
39
+ PGVER: "9.4"
40
40
  - os: ubuntu
41
41
  ruby: "head"
42
42
  PGVER: "14"
@@ -54,7 +54,7 @@ jobs:
54
54
  PGVER: "14"
55
55
  - os: macos
56
56
  ruby: "head"
57
- PGVERSION: 14.1-1-osx
57
+ PGVERSION: 14.2-1-osx
58
58
  PGVER: "14"
59
59
 
60
60
  runs-on: ${{ matrix.os }}-latest
@@ -65,7 +65,7 @@ jobs:
65
65
  steps:
66
66
  - uses: actions/checkout@v2
67
67
  - name: Set up Ruby
68
- uses: MSP-Greg/ruby-setup-ruby@win-ucrt-1
68
+ uses: ruby/setup-ruby@v1
69
69
  with:
70
70
  ruby-version: ${{ matrix.ruby }}
71
71
 
@@ -116,7 +116,6 @@ jobs:
116
116
  - run: gem install --local *.gem --verbose
117
117
 
118
118
  - name: Run specs
119
- continue-on-error: ${{ matrix.ruby == 'truffleruby-head' }}
120
119
  env:
121
120
  PG_DEBUG: 0
122
121
  run: ruby -rpg -S rspec spec/**/*_spec.rb -cfdoc
data/History.rdoc CHANGED
@@ -1,4 +1,41 @@
1
- == v1.3.0 [YYY-MM-DD] Michael Granger <ged@FaerieMUD.org>
1
+ == v1.3.3 [2022-02-22] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ Bugfixes:
4
+
5
+ - Fix omission of the third digit of IPv4 addresses in connection URI. #435
6
+ - Fix wrong permission of certs/larskanis-2022.pem in the pg-1.3.2.gem. #432
7
+
8
+
9
+ == v1.3.2 [2022-02-14] Lars Kanis <lars@greiz-reinsdorf.de>
10
+
11
+ Bugfixes:
12
+
13
+ - Cancel only active query after failing transaction. #430
14
+ This avoids an incompatibility with pgbouncer since pg-1.3.0.
15
+ - Fix String objects with non-applied encoding when using COPY or record decoders. #427
16
+ - Update Windows fat binary gem to PostgreSQL-14.2.
17
+
18
+ Enhancements:
19
+
20
+ - Improve extconf.rb checks to reduces the number of compiler calls.
21
+ - Add a check for PGRES_PIPELINE_SYNC, to make sure the library version and the header files are PostgreSQL-14+. #429
22
+
23
+
24
+ == v1.3.1 [2022-02-01] Michael Granger <ged@FaerieMUD.org>
25
+
26
+ Bugfixes:
27
+
28
+ - Fix wrong handling of socket writability on Windows introduced in #417.
29
+ This caused starvation in conn.put_copy_data.
30
+ - Fix error in PG.version_string(true). #419
31
+ - Fix a regression in pg 1.3.0 where Ruby 2.x busy-looping any fractional seconds for every wait. #420
32
+
33
+ Enhancements:
34
+
35
+ - Raise an error when conn.copy_data is used in nonblocking mode.
36
+
37
+
38
+ == v1.3.0 [2022-01-20] Michael Granger <ged@FaerieMUD.org>
2
39
 
3
40
  Install Enhancements:
4
41
  - Print some install help if libpq wasn't found. #396
@@ -26,7 +63,9 @@ API Enhancements:
26
63
  - Run Connection.ping in a second thread.
27
64
  - Make discard_results scheduler friendly
28
65
  - Do all socket waiting through the conn.socket_io object.
29
- - Avoid PG.connect blocking while address resolution by automatically providing the +hostaddr+ parameter.
66
+ - Avoid PG.connect blocking while address resolution by automatically providing the +hostaddr+ parameter and resolving in Ruby instead of libpq.
67
+ - On Windows Fiber.scheduler support requires Ruby-3.1+.
68
+ It is also only partly usable since may ruby IO methods are not yet scheduler aware on Windows.
30
69
  - Add support for pipeline mode of PostgreSQL-14. #401
31
70
  - Allow specification of multiple hosts in PostgreSQL URI. #387
32
71
  - Add new method conn.backend_key - used to implement our own cancel method.
@@ -46,8 +85,9 @@ Other Enhancements:
46
85
  - Add PG::CONNECTION_* constants for conn.status of newer PostgreSQL versions.
47
86
  - Add better support for logical replication. #339
48
87
  - Change conn.socket_io to read+write mode and to a BasicSocket object instead of IO.
49
- - Use rb_io_wait() and the conn.socket_io object if available and remove Windows specific wait functions.
50
- Fall back to rb_wait_for_single_fd() on ruby < 3.0, which works on Windows as well.
88
+ - Use rb_io_wait() and the conn.socket_io object if available for better compatibility to Fiber.scheduler .
89
+ Fall back to rb_wait_for_single_fd() on ruby < 3.0.
90
+ - On Windows use a specialized wait function as a workaround for very poor performance of rb_io_wait(). #416
51
91
 
52
92
  Bugfixes:
53
93
  - Release GVL while calling PQping which is a blocking method, but it didn't release GVL so far.
@@ -62,6 +102,7 @@ Deprecated:
62
102
  Removed:
63
103
  - Remove support of ruby-2.2, 2.3 and 2.4. Minimum is ruby-2.5 now.
64
104
  - Remove support for PostgreSQL-9.2. Minimum is PostgreSQL-9.3 now.
105
+ - Remove constant PG::REVISION, which was broken since pg-1.1.4.
65
106
 
66
107
  Repository:
67
108
  - Replace Hoe by Bundler for gem packaging
data/Rakefile.cross CHANGED
@@ -7,6 +7,7 @@ require 'rake/clean'
7
7
  require 'rake/extensiontask'
8
8
  require 'rake/extensioncompiler'
9
9
  require 'ostruct'
10
+ require_relative 'rakelib/task_extension'
10
11
 
11
12
  MISCDIR = BASEDIR + 'misc'
12
13
 
@@ -20,6 +21,7 @@ end
20
21
 
21
22
  class CrossLibrary < OpenStruct
22
23
  include Rake::DSL
24
+ prepend TaskExtension
23
25
 
24
26
  def initialize(for_platform, openssl_config, toolchain)
25
27
  super()
@@ -30,7 +32,7 @@ class CrossLibrary < OpenStruct
30
32
 
31
33
  # Cross-compilation constants
32
34
  self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1m'
33
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '14.1'
35
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '14.2'
34
36
 
35
37
  # Check if symlinks work in the current working directory.
36
38
  # This fails, if rake-compiler-dock is running on a Windows box.
data/certs/ged.pem CHANGED
@@ -1,7 +1,7 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIID+DCCAmCgAwIBAgIBAzANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
3
- REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMDEyMjQyMDU1MjlaFw0yMTEyMjQyMDU1
4
- MjlaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
2
+ MIID+DCCAmCgAwIBAgIBBDANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
3
+ REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMjAxMDcyMzU4MTRaFw0yMzAxMDcyMzU4
4
+ MTRaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
5
5
  hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
6
6
  L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
7
7
  M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
@@ -12,13 +12,13 @@ dXzdHqq+zbGZVSQ7pRYHYomD0IiDe1DbIouFnPWmagaBnGHwXkDT2bKKP+s2v21m
12
12
  ozilJg4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
13
13
  N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNg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
+ BgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUOIdbSMr3VFrTCO9/cTM0
15
+ 0exHzBcwIgYDVR0RBBswGYEXbGFyc0BncmVpei1yZWluc2RvcmYuZGUwIgYDVR0S
16
+ BBswGYEXbGFyc0BncmVpei1yZWluc2RvcmYuZGUwDQYJKoZIhvcNAQELBQADggGB
17
+ AFWP7F/y3Oq3NgrqUOnjKOeDaBa7AqNhHS+PZg+C90lnJzMgOs4KKgZYxqSQVSab
18
+ SCEmzIO/StkXY4NpJ4fYLrHemf/fJy1wPyu+fNdp5SEEUwEo+2toRFlzTe4u4LdS
19
+ QC636nPPTMt8H3xz2wf/lUIUeo2Qc95Qt2BQM465ibbG9kmA3c7Sopx6yOabYOAl
20
+ KPRbOSEPiWYcF9Suuz8Gdf8jxEtPlnZiwRvnYJ+IHMq3XQCJWPpMzdDMbtlgHbXE
21
+ vq1zOTLMSYAS0UB3uionR4yo1hLz60odwkCm7qf0o2Ci/5OjtB0a89VuyqRU2vUJ
22
+ QH95WBjDJ6lCCW7J0mrMPnJQSUFTmufsU6jOChvPaCeAzW1YwrsP/YKnvwueG7ip
23
+ VOdW6RitjtFxhS7evRL0201+KUvLz12zZWWjOcujlQs64QprxOtiv/MiisKb1Ng+
24
+ oL1mUdzB8KrZL4/WbG5YNX6UTtJbIOu9qEFbBAy4/jtIkJX+dlNoFwd4GXQW1YNO
25
+ nA==
26
+ -----END CERTIFICATE-----
data/ext/extconf.rb CHANGED
@@ -37,12 +37,12 @@ else
37
37
 
38
38
  if pgconfig && pgconfig != 'ignore'
39
39
  $stderr.puts "Using config values from %s" % [ pgconfig ]
40
- incdir = `"#{pgconfig}" --includedir`.chomp
41
- libdir = `"#{pgconfig}" --libdir`.chomp
40
+ incdir = IO.popen([pgconfig, "--includedir"], &:read).chomp
41
+ libdir = IO.popen([pgconfig, "--libdir"], &:read).chomp
42
42
  dir_config 'pg', incdir, libdir
43
43
 
44
44
  # Windows traditionally stores DLLs beside executables, not in libdir
45
- dlldir = RUBY_PLATFORM=~/mingw|mswin/ ? `"#{pgconfig}" --bindir`.chomp : libdir
45
+ dlldir = RUBY_PLATFORM=~/mingw|mswin/ ? IO.popen([pgconfig, "--bindir"], &:read).chomp : libdir
46
46
 
47
47
  elsif checking_for "libpq per pkg-config" do
48
48
  _cflags, ldflags, _libs = pkg_config("libpq")
@@ -87,7 +87,7 @@ begin
87
87
  have_library( 'libpq', 'PQconnectdb', ['libpq-fe.h'] ) ||
88
88
  have_library( 'ms/libpq', 'PQconnectdb', ['libpq-fe.h'] )
89
89
 
90
- rescue SystemExit => err
90
+ rescue SystemExit
91
91
  install_text = case RUBY_PLATFORM
92
92
  when /linux/
93
93
  <<-EOT
@@ -138,15 +138,18 @@ if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
138
138
  end
139
139
  end
140
140
 
141
- have_func 'PQconninfo' or
141
+ have_func 'PQconninfo', 'libpq-fe.h' or
142
142
  abort "Your PostgreSQL is too old. Either install an older version " +
143
143
  "of this gem or upgrade your database to at least PostgreSQL-9.3."
144
144
  # optional headers/functions
145
- have_func 'PQsslAttribute' # since PostgreSQL-9.5
146
- have_func 'PQresultVerboseErrorMessage' # since PostgreSQL-9.6
147
- have_func 'PQencryptPasswordConn' # since PostgreSQL-10
148
- have_func 'PQresultMemorySize' # since PostgreSQL-12
149
- have_func 'PQenterPipelineMode' # since PostgreSQL-14
145
+ have_func 'PQsslAttribute', 'libpq-fe.h' # since PostgreSQL-9.5
146
+ have_func 'PQresultVerboseErrorMessage', 'libpq-fe.h' # since PostgreSQL-9.6
147
+ have_func 'PQencryptPasswordConn', 'libpq-fe.h' # since PostgreSQL-10
148
+ have_func 'PQresultMemorySize', 'libpq-fe.h' # since PostgreSQL-12
149
+ have_func 'PQenterPipelineMode', 'libpq-fe.h' do |src| # since PostgreSQL-14
150
+ # Ensure header files fit as well
151
+ src + " int con(){ return PGRES_PIPELINE_SYNC; }"
152
+ end
150
153
  have_func 'timegm'
151
154
  have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
152
155
  have_func 'rb_gc_mark_movable' # since ruby-2.7
data/ext/pg_connection.c CHANGED
@@ -2241,19 +2241,15 @@ pg_rb_thread_io_wait(VALUE io, VALUE events, VALUE timeout) {
2241
2241
  GetOpenFile((io), fptr);
2242
2242
  if( !NIL_P(timeout) ){
2243
2243
  ptimeout.tv_sec = (time_t)(NUM2DBL(timeout));
2244
- ptimeout.tv_usec = (time_t)(NUM2DBL(timeout) - (double)ptimeout.tv_sec);
2244
+ ptimeout.tv_usec = (time_t)((NUM2DBL(timeout) - (double)ptimeout.tv_sec) * 1e6);
2245
2245
 
2246
2246
  gettimeofday(&currtime, NULL);
2247
2247
  timeradd(&currtime, &ptimeout, &aborttime);
2248
2248
  }
2249
2249
 
2250
- if(rb_events & PG_RUBY_IO_READABLE) {
2251
- w32_events |= FD_READ | FD_ACCEPT | FD_CLOSE;
2252
- } else if(rb_events & PG_RUBY_IO_WRITABLE) {
2253
- w32_events |= FD_WRITE | FD_CONNECT;
2254
- } else if(rb_events & PG_RUBY_IO_PRIORITY) {
2255
- w32_events |= FD_OOB;
2256
- }
2250
+ if(rb_events & PG_RUBY_IO_READABLE) w32_events |= FD_READ | FD_ACCEPT | FD_CLOSE;
2251
+ if(rb_events & PG_RUBY_IO_WRITABLE) w32_events |= FD_WRITE | FD_CONNECT;
2252
+ if(rb_events & PG_RUBY_IO_PRIORITY) w32_events |= FD_OOB;
2257
2253
 
2258
2254
  for(;;) {
2259
2255
  if ( WSAEventSelect(_get_osfhandle(fptr->fd), hEvent, w32_events) == SOCKET_ERROR ) {
@@ -2336,7 +2332,7 @@ pg_rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
2336
2332
  GetOpenFile((io), fptr);
2337
2333
  if( !NIL_P(timeout) ){
2338
2334
  waittime.tv_sec = (time_t)(NUM2DBL(timeout));
2339
- waittime.tv_usec = (time_t)(NUM2DBL(timeout) - (double)waittime.tv_sec);
2335
+ waittime.tv_usec = (time_t)((NUM2DBL(timeout) - (double)waittime.tv_sec) * 1e6);
2340
2336
  }
2341
2337
  res = rb_wait_for_single_fd(fptr->fd, NUM2UINT(events), NIL_P(timeout) ? NULL : &waittime);
2342
2338
 
@@ -76,6 +76,7 @@ pg_tmas_fit_to_copy_get( VALUE self )
76
76
  static VALUE
77
77
  pg_tmas_typecast_copy_get( t_typemap *p_typemap, VALUE field_str, int fieldno, int format, int enc_idx )
78
78
  {
79
+ rb_str_modify(field_str);
79
80
  if( format == 0 ){
80
81
  PG_ENCODING_SET_NOCHECK( field_str, enc_idx );
81
82
  } else {
@@ -150,10 +150,12 @@ pg_tmbc_typecast_copy_get( t_typemap *p_typemap, VALUE field_str, int fieldno, i
150
150
 
151
151
  /* Is it a pure String conversion? Then we can directly send field_str to the user. */
152
152
  if( dec_func == pg_text_dec_string ){
153
+ rb_str_modify(field_str);
153
154
  PG_ENCODING_SET_NOCHECK( field_str, enc_idx );
154
155
  return field_str;
155
156
  }
156
157
  if( dec_func == pg_bin_dec_bytea ){
158
+ rb_str_modify(field_str);
157
159
  PG_ENCODING_SET_NOCHECK( field_str, rb_ascii8bit_encindex() );
158
160
  return field_str;
159
161
  }
data/lib/2.5/pg_ext.so CHANGED
Binary file
data/lib/2.6/pg_ext.so CHANGED
Binary file
data/lib/2.7/pg_ext.so CHANGED
Binary file
data/lib/3.0/pg_ext.so CHANGED
Binary file
data/lib/3.1/pg_ext.so CHANGED
Binary file
data/lib/pg/connection.rb CHANGED
@@ -105,7 +105,7 @@ class PG::Connection
105
105
  end
106
106
  # extract "host1,host2" from "host1:5432,host2:5432"
107
107
  iopts[:host] = uri_match['hostports'].split(',', -1).map do |hostport|
108
- hostmatch = HOST_AND_PORT.match(hostport)
108
+ hostmatch = /\A#{HOST_AND_PORT}\z/.match(hostport)
109
109
  hostmatch['IPv6address'] || hostmatch['IPv4address'] || hostmatch['reg-name']&.gsub(/%(\h\h)/){ $1.hex.chr }
110
110
  end.join(',')
111
111
  oopts = {}
@@ -241,6 +241,7 @@ class PG::Connection
241
241
  # ["more", "data", "to", "copy"]
242
242
 
243
243
  def copy_data( sql, coder=nil )
244
+ raise PG::NotInBlockingMode, "copy_data can not be used in nonblocking mode" if nonblocking?
244
245
  res = exec( sql )
245
246
 
246
247
  case res.result_status
@@ -312,7 +313,7 @@ class PG::Connection
312
313
  exec "BEGIN"
313
314
  res = yield(self)
314
315
  rescue Exception
315
- cancel if transaction_status != PG::PQTRANS_IDLE
316
+ cancel if transaction_status == PG::PQTRANS_ACTIVE
316
317
  block
317
318
  exec "ROLLBACK"
318
319
  raise
@@ -385,7 +386,7 @@ class PG::Connection
385
386
  # If the optional code block is given, it will be passed <i>result</i> as an argument,
386
387
  # and the PG::Result object will automatically be cleared when the block terminates.
387
388
  # In this instance, <code>conn.exec</code> returns the value of the block.
388
- def get_result(*args)
389
+ def get_result
389
390
  block
390
391
  sync_get_result
391
392
  end
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.3.0.rc4'
3
+ VERSION = '1.3.3'
4
4
  end
data/lib/pg.rb CHANGED
@@ -53,12 +53,14 @@ module PG
53
53
 
54
54
  class NotAllCopyDataRetrieved < PG::Error
55
55
  end
56
+ class NotInBlockingMode < PG::Error
57
+ end
56
58
 
57
- ### Get the PG library version. If +include_buildnum+ is +true+, include the build ID.
58
- def self::version_string( include_buildnum=false )
59
- vstring = "%s %s" % [ self.name, VERSION ]
60
- vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
61
- return vstring
59
+ # Get the PG library version.
60
+ #
61
+ # +include_buildnum+ is no longer used and any value passed will be ignored.
62
+ def self::version_string( include_buildnum=nil )
63
+ return "%s %s" % [ self.name, VERSION ]
62
64
  end
63
65
 
64
66
 
Binary file
@@ -0,0 +1,46 @@
1
+ # This source code is borrowed from:
2
+ # https://github.com/oneclick/rubyinstaller2/blob/b3dcbf69f131e44c78ea3a1c5e0041c223f266ce/lib/ruby_installer/build/utils.rb#L104-L144
3
+
4
+ module TaskExtension
5
+ # Extend rake's file task to be defined only once and to check the expected file is indeed generated
6
+ #
7
+ # The same as #task, but for #file.
8
+ # In addition this file task raises an error, if the file that is expected to be generated is not present after the block was executed.
9
+ def file(name, *args, &block)
10
+ task_once(name, block) do
11
+ super(name, *args) do |ta|
12
+ block.call(ta).tap do
13
+ raise "file #{ta.name} is missing after task executed" unless File.exist?(ta.name)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ # Extend rake's task definition to be defined only once, even if called several times
20
+ #
21
+ # This allows to define common tasks next to specific tasks.
22
+ # It is expected that any variation of the task's block is reflected in the task name or namespace.
23
+ # If the task name is identical, the task block is executed only once, even if the file task definition is executed twice.
24
+ def task(name, *args, &block)
25
+ task_once(name, block) do
26
+ super
27
+ end
28
+ end
29
+
30
+ private def task_once(name, block)
31
+ name = name.keys.first if name.is_a?(Hash)
32
+ if block &&
33
+ Rake::Task.task_defined?(name) &&
34
+ Rake::Task[name].instance_variable_get('@task_block_location') == block.source_location
35
+ # task is already defined for this target and the same block
36
+ # So skip double definition of the same action
37
+ Rake::Task[name]
38
+ elsif block
39
+ yield.tap do
40
+ Rake::Task[name].instance_variable_set('@task_block_location', block.source_location)
41
+ end
42
+ else
43
+ yield
44
+ end
45
+ end
46
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.rc4
4
+ version: 1.3.3
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Michael Granger
@@ -12,31 +12,31 @@ cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
14
  MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
15
- L0RDPWdyZWl6LXJl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Cd6KsCmK5Zvxd5FMMjrQCsZD6OgReshsok5r6tSiNXc
34
- YgnBIIAFeoeGz8q+dsm6hPtkii/zr25MPRPmKnbRV7bV/zlbmwpIPxhso95lq3R5
35
- H5q2yo7qMajDFkxRffqQO8ONvDLGecxbuv1QEyzNBdehVt4I7UedIfxyOvKd9cg2
36
- d5T9wAD7jW/0seVujw+76/YOJWO3Dft+FQmMBbdd8s3J47HbN9R2mDt6fl6he+X/
37
- gw==
29
+ AFWP7F/y3Oq3NgrqUOnjKOeDaBa7AqNhHS+PZg+C90lnJzMgOs4KKgZYxqSQVSab
30
+ SCEmzIO/StkXY4NpJ4fYLrHemf/fJy1wPyu+fNdp5SEEUwEo+2toRFlzTe4u4LdS
31
+ QC636nPPTMt8H3xz2wf/lUIUeo2Qc95Qt2BQM465ibbG9kmA3c7Sopx6yOabYOAl
32
+ KPRbOSEPiWYcF9Suuz8Gdf8jxEtPlnZiwRvnYJ+IHMq3XQCJWPpMzdDMbtlgHbXE
33
+ vq1zOTLMSYAS0UB3uionR4yo1hLz60odwkCm7qf0o2Ci/5OjtB0a89VuyqRU2vUJ
34
+ QH95WBjDJ6lCCW7J0mrMPnJQSUFTmufsU6jOChvPaCeAzW1YwrsP/YKnvwueG7ip
35
+ VOdW6RitjtFxhS7evRL0201+KUvLz12zZWWjOcujlQs64QprxOtiv/MiisKb1Ng+
36
+ oL1mUdzB8KrZL4/WbG5YNX6UTtJbIOu9qEFbBAy4/jtIkJX+dlNoFwd4GXQW1YNO
37
+ nA==
38
38
  -----END CERTIFICATE-----
39
- date: 2022-01-22 00:00:00.000000000 Z
39
+ date: 2022-02-22 00:00:00.000000000 Z
40
40
  dependencies: []
41
41
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
42
42
  9.3 and later.
@@ -73,6 +73,7 @@ files:
73
73
  - Rakefile
74
74
  - Rakefile.cross
75
75
  - certs/ged.pem
76
+ - certs/larskanis-2022.pem
76
77
  - ext/errorcodes.def
77
78
  - ext/errorcodes.rb
78
79
  - ext/errorcodes.txt
@@ -138,6 +139,7 @@ files:
138
139
  - misc/ruby-pg/Rakefile
139
140
  - misc/ruby-pg/lib/ruby/pg.rb
140
141
  - pg.gemspec
142
+ - rakelib/task_extension.rb
141
143
  - sample/array_insert.rb
142
144
  - sample/async_api.rb
143
145
  - sample/async_copyto.rb
@@ -181,9 +183,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
183
  version: 3.2.dev
182
184
  required_rubygems_version: !ruby/object:Gem::Requirement
183
185
  requirements:
184
- - - ">"
186
+ - - ">="
185
187
  - !ruby/object:Gem::Version
186
- version: 1.3.1
188
+ version: '0'
187
189
  requirements: []
188
190
  rubygems_version: 3.3.4
189
191
  signing_key:
metadata.gz.sig CHANGED
Binary file