pg 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1618ae02150b1bed4ee83669aff1133e74d07f0a9ccdf2e3cee3a6a57ba738f
4
- data.tar.gz: 5c70825cf567d526e5e11679f88806e3c1723acb301bc356992df417575b8d3a
3
+ metadata.gz: a07adb58b0060e91909dcffc56c527bc539ab4ccd8a208644386f9c1010a1ba1
4
+ data.tar.gz: f32870256474e8495feb8a8c17d9313c25e48d5d79e743d6dff99ba063aa6057
5
5
  SHA512:
6
- metadata.gz: f55fc75632dc1c60b1620f83cadcc961cf601f50bb30a878159ddbca10eaaccf0ee9ff2028fbb2e74f979d570c1b809d07224fc4bd664e15ecf5fb05ec8398e2
7
- data.tar.gz: d92e3c96466f13a8679c9ac68d14a01c1fd2133efc637d7e0dd4c0f3649ffbc769a1f100b8bbe705b5a4d9cdb5d8921b1a6b19ad34eee6d7a73eff31de9480c7
6
+ metadata.gz: d93ea73305d727ccd5d0a672b339038c19af2e7884fec45d145a5496dd310c3a161e77bc429f2c8ab93906c41b124e4eb33772bdfbb5205f3950c919f98b6876
7
+ data.tar.gz: 26213376d23c07bcb28192a8ec9815679f2b6409b353750b560af1c9d7d592c3ec136f16872d2e3cce5762f4a51954c643f8560923a5381da107171c9312a7fd
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,17 @@
1
+ == v1.2.2 [2020-01-06] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+
5
+ - Add a binary gem for Ruby 2.7.
6
+
7
+
8
+ == v1.2.1 [2020-01-02] Michael Granger <ged@FaerieMUD.org>
9
+
10
+ Enhancements:
11
+
12
+ - Added internal API for sequel_pg compatibility.
13
+
14
+
1
15
  == v1.2.0 [2019-12-20] Michael Granger <ged@FaerieMUD.org>
2
16
 
3
17
  Repository:
@@ -118,7 +118,7 @@ PG::Coder objects can be used to set up a PG::TypeMap or alternatively
118
118
  to convert single values to/from their string representation.
119
119
 
120
120
  The following PostgreSQL column types are supported by ruby-pg (TE = Text Encoder, TD = Text Decoder, BE = Binary Encoder, BD = Binary Decoder):
121
- * Integer: {TE}[rdoc-ref:PG::TextEncoder::Integer], {TD}[rdoc-ref:PG::TextDecoder::Integer], {BD}[rdoc-ref:PG::BinaryDecoder::Integer]
121
+ * Integer: {TE}[rdoc-ref:PG::TextEncoder::Integer], {TD}[rdoc-ref:PG::TextDecoder::Integer], {BD}[rdoc-ref:PG::BinaryDecoder::Integer] 💡 No links? Switch to {here}[https://deveiate.org/code/pg/README_rdoc.html#label-Type+Casts] 💡
122
122
  * BE: {Int2}[rdoc-ref:PG::BinaryEncoder::Int2], {Int4}[rdoc-ref:PG::BinaryEncoder::Int4], {Int8}[rdoc-ref:PG::BinaryEncoder::Int8]
123
123
  * Float: {TE}[rdoc-ref:PG::TextEncoder::Float], {TD}[rdoc-ref:PG::TextDecoder::Float], {BD}[rdoc-ref:PG::BinaryDecoder::Float]
124
124
  * Numeric: {TE}[rdoc-ref:PG::TextEncoder::Numeric], {TD}[rdoc-ref:PG::TextDecoder::Numeric]
data/Rakefile CHANGED
@@ -35,6 +35,8 @@ TEST_DIRECTORY = BASEDIR + "tmp_test_specs"
35
35
 
36
36
  CLOBBER.include( TEST_DIRECTORY.to_s )
37
37
  CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
38
+ CLEAN.include "lib/*/libpq.dll"
39
+ CLEAN.include "lib/pg_ext.*"
38
40
 
39
41
  # Set up Hoe plugins
40
42
  Hoe.plugin :mercurial
@@ -61,7 +63,7 @@ $hoespec = Hoe.spec 'pg' do
61
63
  self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
62
64
 
63
65
  self.dependency 'rake-compiler', '~> 1.0', :developer
64
- self.dependency 'rake-compiler-dock', ['~> 0.7.0'], :developer
66
+ self.dependency 'rake-compiler-dock', ['~> 1.0'], :developer
65
67
  self.dependency 'hoe-deveiate', '~> 0.9', :developer
66
68
  self.dependency 'hoe-bundler', '~> 1.0', :developer
67
69
  self.dependency 'rspec', '~> 3.5', :developer
@@ -129,7 +131,7 @@ Rake::ExtensionTask.new do |ext|
129
131
 
130
132
  # Add libpq.dll to windows binary gemspec
131
133
  ext.cross_compiling do |spec|
132
- spec.files << "lib/libpq.dll"
134
+ spec.files << "lib/#{spec.platform}/libpq.dll"
133
135
  end
134
136
  end
135
137
 
@@ -45,6 +45,8 @@ class CrossLibrary < OpenStruct
45
45
  end
46
46
  self.static_sourcesdir = compile_home + 'sources'
47
47
  self.static_builddir = compile_home + 'builds' + for_platform
48
+ CLOBBER.include( static_sourcesdir )
49
+ CLEAN.include( static_builddir )
48
50
 
49
51
  # Static OpenSSL build vars
50
52
  self.static_openssl_builddir = static_builddir + "openssl-#{openssl_version}"
@@ -141,9 +143,9 @@ class CrossLibrary < OpenStruct
141
143
  end
142
144
 
143
145
  desc "compile static openssl libraries"
144
- task :openssl_libs => [ libssl, libcrypto ]
146
+ task "openssl_libs:#{for_platform}" => [ libssl, libcrypto ]
145
147
 
146
- task :compile_static_openssl => openssl_makefile do |t|
148
+ task "compile_static_openssl:#{for_platform}" => openssl_makefile do |t|
147
149
  chdir( static_openssl_builddir ) do
148
150
  cmd = cmd_prelude.dup
149
151
  cmd << 'make' << "-j#{NUM_CPUS}" << 'build_libs'
@@ -153,12 +155,12 @@ class CrossLibrary < OpenStruct
153
155
  end
154
156
 
155
157
  desc "compile static #{libssl}"
156
- file libssl => :compile_static_openssl do |t|
158
+ file libssl => "compile_static_openssl:#{for_platform}" do |t|
157
159
  rm t.name.gsub(/\.a$/, ".dll.a")
158
160
  end
159
161
 
160
162
  desc "compile static #{libcrypto}"
161
- file libcrypto => :compile_static_openssl do |t|
163
+ file libcrypto => "compile_static_openssl:#{for_platform}" do |t|
162
164
  rm t.name.gsub(/\.a$/, ".dll.a")
163
165
  end
164
166
 
@@ -189,7 +191,7 @@ class CrossLibrary < OpenStruct
189
191
  end
190
192
 
191
193
  # generate the makefile in a clean build location
192
- file postgresql_global_makefile => [ static_postgresql_builddir, :openssl_libs ] do |t|
194
+ file postgresql_global_makefile => [ static_postgresql_builddir, "openssl_libs:#{for_platform}" ] do |t|
193
195
  options = [
194
196
  "--target=#{host_platform}",
195
197
  "--host=#{host_platform}",
@@ -231,10 +233,10 @@ class CrossLibrary < OpenStruct
231
233
 
232
234
 
233
235
  #desc 'compile libpg.a'
234
- task :libpq => postgresql_lib
236
+ task "native:#{for_platform}" => postgresql_lib
235
237
 
236
238
  # copy libpq.dll to lib dir
237
- dest_libpq = "lib/#{postgresql_lib.basename}"
239
+ dest_libpq = "lib/#{for_platform}/#{postgresql_lib.basename}"
238
240
  directory File.dirname(dest_libpq)
239
241
  file dest_libpq => [postgresql_lib, File.dirname(dest_libpq)] do
240
242
  cp postgresql_lib, dest_libpq
@@ -248,20 +250,15 @@ class CrossLibrary < OpenStruct
248
250
  end
249
251
  end
250
252
 
251
- if File.exist?(File.expand_path("~/.rake-compiler/config.yml"))
252
- CrossLibraries = [
253
- ['i386-mingw32', 'mingw', 'i686-w64-mingw32'],
254
- ['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
255
- ].map do |platform, openssl_config, toolchain|
256
- CrossLibrary.new platform, openssl_config, toolchain
257
- end
258
- else
259
- $stderr.puts "Cross-compilation disabled -- rake-compiler not properly installed"
260
- CrossLibraries = []
253
+ CrossLibraries = [
254
+ ['x86-mingw32', 'mingw', 'i686-w64-mingw32'],
255
+ ['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
256
+ ].map do |platform, openssl_config, toolchain|
257
+ CrossLibrary.new platform, openssl_config, toolchain
261
258
  end
262
259
 
263
260
  desc 'cross compile pg for win32'
264
- task :cross => [ :mingw32, :libpq ]
261
+ task :cross => [ :mingw32 ]
265
262
 
266
263
  task :mingw32 do
267
264
  # Use Rake::ExtensionCompiler helpers to find the proper host
@@ -272,30 +269,32 @@ task :mingw32 do
272
269
  end
273
270
  end
274
271
 
275
- # To reduce the gem file size strip mingw32 dlls before packaging
276
- ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
277
- task "tmp/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/pg_ext.so" do |t|
278
- sh "i686-w64-mingw32-strip -S tmp/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/pg_ext.so"
279
- end
280
-
281
- task "tmp/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/pg_ext.so" do |t|
282
- sh "x86_64-w64-mingw32-strip -S tmp/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/pg_ext.so"
283
- end
272
+ task 'gem:windows:prepare' do
273
+ require 'io/console'
274
+ require 'rake_compiler_dock'
275
+
276
+ # Copy gem signing key and certs to be accessable from the docker container
277
+ mkdir_p 'build/gem'
278
+ sh "cp ~/.gem/gem-*.pem build/gem/ || true"
279
+ sh "bundle package"
280
+ begin
281
+ OpenSSL::PKey.read(File.read(File.expand_path("~/.gem/gem-private_key.pem")), ENV["GEM_PRIVATE_KEY_PASSPHRASE"] || "")
282
+ rescue OpenSSL::PKey::PKeyError
283
+ ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
284
+ retry
285
+ end
284
286
  end
285
287
 
286
- desc "Build the windows binary gems"
287
- task 'gem:windows' => ['ChangeLog'] do
288
- require 'rake_compiler_dock'
289
-
290
- # Copy gem signing key and certs to be accessable from the docker container
291
- mkdir_p 'build/gem'
292
- sh "cp ~/.gem/gem-*.pem build/gem/ || true"
293
- sh "bundle package"
294
-
295
- RakeCompilerDock.sh <<-EOT
296
- mkdir ~/.gem &&
297
- (cp build/gem/gem-*.pem ~/.gem/ || true) &&
298
- gem install -Ng &&
299
- rake cross native gem MAKE="make -j`nproc`"
300
- EOT
288
+ CrossLibraries.each do |xlib|
289
+ platform = xlib.for_platform
290
+ desc "Build fat binary gem for platform #{platform}"
291
+ task "gem:windows:#{platform}" => ['ChangeLog', 'gem:windows:prepare', xlib.openssl_tarball, xlib.postgresql_tarball] do
292
+ RakeCompilerDock.sh <<-EOT, platform: platform
293
+ (cp build/gem/gem-*.pem ~/.gem/ || true) &&
294
+ bundle install --local &&
295
+ rake native:#{platform} pkg/#{$hoespec.spec.full_name}-#{platform}.gem MAKE="make -j`nproc`"
296
+ EOT
297
+ end
298
+ desc "Build the windows binary gems"
299
+ multitask 'gem:windows' => "gem:windows:#{platform}"
301
300
  end
@@ -167,6 +167,11 @@ static const rb_data_type_t pgresult_type = {
167
167
  #endif
168
168
  };
169
169
 
170
+ /* Needed by sequel_pg gem, do not delete */
171
+ int pg_get_result_enc_idx(VALUE self)
172
+ {
173
+ return pgresult_get_this(self)->enc_idx;
174
+ }
170
175
 
171
176
  /*
172
177
  * Global functions
@@ -333,8 +338,7 @@ pg_result_check( VALUE self )
333
338
  * Special care must be taken when PG::Tuple objects are used.
334
339
  * In this case #clear must not be called unless all PG::Tuple objects of this result are fully materialized.
335
340
  *
336
- * If PG::Result#autoclear? is true then the result is marked as cleared
337
- * and the underlying C struct will be cleared automatically by libpq.
341
+ * If PG::Result#autoclear? is +true+ then the result is only marked as cleared but clearing the underlying C struct will happen when the callback returns.
338
342
  *
339
343
  */
340
344
  VALUE
@@ -362,8 +366,10 @@ pgresult_cleared_p( VALUE self )
362
366
  * call-seq:
363
367
  * res.autoclear? -> boolean
364
368
  *
365
- * Returns +true+ if the underlying C struct will be cleared automatically by libpq.
366
- * Elsewise the result is cleared by PG::Result#clear or by the GC when it's no longer in use.
369
+ * Returns +true+ if the underlying C struct will be cleared at the end of a callback.
370
+ * This applies only to Result objects received by the block to PG::Cinnection#set_notice_receiver .
371
+ *
372
+ * All other Result objects are automatically cleared by the GC when the object is no longer in use or manually by PG::Result#clear .
367
373
  *
368
374
  */
369
375
  VALUE
data/lib/pg.rb CHANGED
@@ -22,7 +22,8 @@ rescue LoadError
22
22
  end
23
23
 
24
24
  # Temporary add this directory for DLL search, so that libpq.dll can be found.
25
- add_dll_path.call(__dir__) do
25
+ # mingw32-platform strings differ (RUBY_PLATFORM=i386-mingw32 vs. x86-mingw32 for rubygems)
26
+ add_dll_path.call(File.join(__dir__, RUBY_PLATFORM.gsub(/^i386-/, "x86-"))) do
26
27
  require "#{major_minor}/pg_ext"
27
28
  end
28
29
  else
@@ -36,7 +37,7 @@ end
36
37
  module PG
37
38
 
38
39
  # Library version
39
- VERSION = '1.2.0'
40
+ VERSION = '1.2.2'
40
41
 
41
42
  # VCS revision
42
43
  REVISION = %q$Revision: 6f611e78845a $
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.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -11,9 +11,9 @@ bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
- MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
15
- REM9RmFlcmllTVVEL0RDPW9yZzAeFw0xODExMjAxODI5NTlaFw0xOTExMjAxODI5
16
- NTlaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
14
+ MIID+DCCAmCgAwIBAgIBAjANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
15
+ REM9RmFlcmllTVVEL0RDPW9yZzAeFw0xOTEyMjQyMDE5NTFaFw0yMDEyMjMyMDE5
16
+ NTFaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
17
17
  hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
18
18
  L60U0p0euIurpv84op9CNKF9tx+1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TeXDVquCfi64OTEaTt2xQdR
36
- JnC4lpJfCP6aCXa5h2XAQfPSH636cQap
25
+ N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
26
+ VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
27
+ 9w0BAQsFAAOCAYEAifxlz7x0EfT3fjhM520ZEIrWa+tLMuLKNefkY18u8tZnx4EX
28
+ Xxwh3tna3fvNfrOrdY5leIj1dbv4FTRg+gIBnIxAySqvpGvI/Axg5EdYbwninCLL
29
+ LAKCmRo+5QwaPMYN2zdHIjGrp8jg1neCo5zy6tVvyTv0DMI6FLrydVJYduMMDFSy
30
+ gQKR1rVOcCJtnBnLCF9+kKEUKohAHOmGsE7OBZFnjMIpH5yUDUVJKByv0gIipFt0
31
+ 1T6zff6oVU0w8WBiNKR381+6sF3wIZVnVY0XeJg6hNL+YecE8ILxLhHTmtT/BO0S
32
+ 3xPze9uXDR+iD6HYl8KU5QEg/dXFPhfQb512vVkTJDZvMcwu6PxDUjHFChLjAji/
33
+ AZXjg1C5E9znTkeUR8ieU9F1MOKoiH57a5lYSTI8Ga8PpsNXTxNeXc16Ob26CqrJ
34
+ 83uuAYSy65yXDGXXPVBeKPVnYrqp91pqpS5Nh7wfuiCrE8lgU8PATh7K4BV1UhAT
35
+ 0MHbAT42wTYkfUj3
37
36
  -----END CERTIFICATE-----
38
- date: 2019-12-24 00:00:00.000000000 Z
37
+ date: 2020-01-08 00:00:00.000000000 Z
39
38
  dependencies:
40
39
  - !ruby/object:Gem::Dependency
41
40
  name: hoe-mercurial
@@ -99,14 +98,14 @@ dependencies:
99
98
  requirements:
100
99
  - - "~>"
101
100
  - !ruby/object:Gem::Version
102
- version: 0.7.0
101
+ version: '1.0'
103
102
  type: :development
104
103
  prerelease: false
105
104
  version_requirements: !ruby/object:Gem::Requirement
106
105
  requirements:
107
106
  - - "~>"
108
107
  - !ruby/object:Gem::Version
109
- version: 0.7.0
108
+ version: '1.0'
110
109
  - !ruby/object:Gem::Dependency
111
110
  name: hoe-bundler
112
111
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file