pg 0.18.2 → 1.4.5
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/.appveyor.yml +36 -0
- data/.gems +6 -0
- data/.github/workflows/binary-gems.yml +86 -0
- data/.github/workflows/source-gem.yml +131 -0
- data/.gitignore +13 -0
- data/.hgsigs +34 -0
- data/.hgtags +41 -0
- data/.irbrc +23 -0
- data/.pryrc +23 -0
- data/.tm_properties +21 -0
- data/.travis.yml +49 -0
- data/BSDL +2 -2
- data/Gemfile +14 -0
- data/History.rdoc +480 -4
- data/Manifest.txt +8 -21
- data/README-Windows.rdoc +17 -28
- data/README.ja.rdoc +1 -2
- data/README.rdoc +92 -20
- data/Rakefile +33 -133
- data/Rakefile.cross +89 -67
- data/certs/ged.pem +24 -0
- data/certs/larskanis-2022.pem +26 -0
- data/ext/errorcodes.def +113 -0
- data/ext/errorcodes.rb +1 -1
- data/ext/errorcodes.txt +36 -2
- data/ext/extconf.rb +120 -54
- data/ext/gvl_wrappers.c +8 -0
- data/ext/gvl_wrappers.h +44 -33
- data/ext/pg.c +216 -172
- data/ext/pg.h +93 -98
- data/ext/pg_binary_decoder.c +85 -16
- data/ext/pg_binary_encoder.c +25 -22
- data/ext/pg_coder.c +176 -40
- data/ext/pg_connection.c +1735 -1138
- data/ext/pg_copy_coder.c +95 -28
- data/ext/pg_errors.c +1 -1
- data/ext/pg_record_coder.c +521 -0
- data/ext/pg_result.c +642 -221
- data/ext/pg_text_decoder.c +609 -41
- data/ext/pg_text_encoder.c +254 -100
- data/ext/pg_tuple.c +569 -0
- data/ext/pg_type_map.c +62 -22
- data/ext/pg_type_map_all_strings.c +20 -6
- data/ext/pg_type_map_by_class.c +55 -25
- data/ext/pg_type_map_by_column.c +81 -42
- data/ext/pg_type_map_by_mri_type.c +49 -20
- data/ext/pg_type_map_by_oid.c +56 -26
- data/ext/pg_type_map_in_ruby.c +52 -21
- data/ext/{util.c → pg_util.c} +12 -12
- data/ext/{util.h → pg_util.h} +2 -2
- data/lib/pg/basic_type_map_based_on_result.rb +47 -0
- data/lib/pg/basic_type_map_for_queries.rb +193 -0
- data/lib/pg/basic_type_map_for_results.rb +81 -0
- data/lib/pg/basic_type_registry.rb +301 -0
- data/lib/pg/binary_decoder.rb +23 -0
- data/lib/pg/coder.rb +24 -3
- data/lib/pg/connection.rb +711 -64
- data/lib/pg/constants.rb +2 -1
- data/lib/pg/exceptions.rb +9 -2
- data/lib/pg/result.rb +24 -7
- data/lib/pg/text_decoder.rb +27 -23
- data/lib/pg/text_encoder.rb +40 -8
- data/lib/pg/tuple.rb +30 -0
- data/lib/pg/type_map_by_column.rb +3 -2
- data/lib/pg/version.rb +4 -0
- data/lib/pg.rb +61 -36
- data/misc/openssl-pg-segfault.rb +31 -0
- data/misc/postgres/History.txt +9 -0
- data/misc/postgres/Manifest.txt +5 -0
- data/misc/postgres/README.txt +21 -0
- data/misc/postgres/Rakefile +21 -0
- data/misc/postgres/lib/postgres.rb +16 -0
- data/misc/ruby-pg/History.txt +9 -0
- data/misc/ruby-pg/Manifest.txt +5 -0
- data/misc/ruby-pg/README.txt +21 -0
- data/misc/ruby-pg/Rakefile +21 -0
- data/misc/ruby-pg/lib/ruby/pg.rb +16 -0
- data/pg.gemspec +32 -0
- data/rakelib/task_extension.rb +46 -0
- data/sample/array_insert.rb +1 -1
- data/sample/async_api.rb +4 -8
- data/sample/async_copyto.rb +1 -1
- data/sample/async_mixed.rb +1 -1
- data/sample/check_conn.rb +1 -1
- data/sample/copydata.rb +71 -0
- data/sample/copyfrom.rb +1 -1
- data/sample/copyto.rb +1 -1
- data/sample/cursor.rb +1 -1
- data/sample/disk_usage_report.rb +6 -15
- data/sample/issue-119.rb +2 -2
- data/sample/losample.rb +1 -1
- data/sample/minimal-testcase.rb +2 -2
- data/sample/notify_wait.rb +1 -1
- data/sample/pg_statistics.rb +6 -15
- data/sample/replication_monitor.rb +9 -18
- data/sample/test_binary_values.rb +1 -1
- data/sample/wal_shipper.rb +2 -2
- data/sample/warehouse_partitions.rb +8 -17
- data.tar.gz.sig +0 -0
- metadata +74 -216
- metadata.gz.sig +0 -0
- data/ChangeLog +0 -5545
- data/lib/pg/basic_type_mapping.rb +0 -399
- data/spec/data/expected_trace.out +0 -26
- data/spec/data/random_binary_data +0 -0
- data/spec/helpers.rb +0 -355
- data/spec/pg/basic_type_mapping_spec.rb +0 -251
- data/spec/pg/connection_spec.rb +0 -1535
- data/spec/pg/result_spec.rb +0 -449
- data/spec/pg/type_map_by_class_spec.rb +0 -138
- data/spec/pg/type_map_by_column_spec.rb +0 -222
- data/spec/pg/type_map_by_mri_type_spec.rb +0 -136
- data/spec/pg/type_map_by_oid_spec.rb +0 -149
- data/spec/pg/type_map_in_ruby_spec.rb +0 -164
- data/spec/pg/type_map_spec.rb +0 -22
- data/spec/pg/type_spec.rb +0 -688
- data/spec/pg_spec.rb +0 -50
data/README.rdoc
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
= pg
|
|
2
2
|
|
|
3
|
-
home :: https://
|
|
4
|
-
mirror :: https://github.com/ged/ruby-pg
|
|
3
|
+
home :: https://github.com/ged/ruby-pg
|
|
5
4
|
docs :: http://deveiate.org/code/pg
|
|
5
|
+
clog :: link:/History.rdoc
|
|
6
|
+
|
|
7
|
+
{<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/ged/ruby-pg">}[https://gitter.im/ged/ruby-pg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
== Description
|
|
9
11
|
|
|
10
12
|
Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
|
|
11
13
|
|
|
12
|
-
It works with {PostgreSQL
|
|
14
|
+
It works with {PostgreSQL 9.3 and later}[http://www.postgresql.org/support/versioning/].
|
|
13
15
|
|
|
14
16
|
A small example usage:
|
|
15
17
|
|
|
@@ -21,26 +23,38 @@ A small example usage:
|
|
|
21
23
|
conn = PG.connect( dbname: 'sales' )
|
|
22
24
|
conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
|
|
23
25
|
puts " PID | User | Query"
|
|
24
|
-
|
|
26
|
+
result.each do |row|
|
|
25
27
|
puts " %7d | %-16s | %s " %
|
|
26
|
-
row.values_at('
|
|
28
|
+
row.values_at('pid', 'usename', 'query')
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
== Build Status
|
|
31
33
|
|
|
32
|
-
{<img src="https://
|
|
33
|
-
|
|
34
|
+
{<img src="https://github.com/ged/ruby-pg/actions/workflows/source-gem.yml/badge.svg?branch=master" alt="Build Status Github Actions" />}[https://github.com/ged/ruby-pg/actions/workflows/source-gem.yml]
|
|
35
|
+
{<img src="https://ci.appveyor.com/api/projects/status/gjx5axouf3b1wicp?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg-9j8l3]
|
|
36
|
+
{<img src="https://app.travis-ci.com/larskanis/ruby-pg.svg?branch=master" alt="Build Status" />}[https://app.travis-ci.com/larskanis/ruby-pg]
|
|
34
37
|
|
|
35
38
|
== Requirements
|
|
36
39
|
|
|
37
|
-
* Ruby
|
|
38
|
-
* PostgreSQL
|
|
40
|
+
* Ruby 2.4 or newer
|
|
41
|
+
* PostgreSQL 9.3.x or later (with headers, -dev packages, etc).
|
|
39
42
|
|
|
40
|
-
It
|
|
43
|
+
It usually works with earlier versions of Ruby/PostgreSQL as well, but those are
|
|
41
44
|
not regularly tested.
|
|
42
45
|
|
|
43
46
|
|
|
47
|
+
== Versioning
|
|
48
|
+
|
|
49
|
+
We tag and release gems according to the {Semantic Versioning}[http://semver.org/] principle.
|
|
50
|
+
|
|
51
|
+
As a result of this policy, you can (and should) specify a dependency on this gem using the {Pessimistic Version Constraint}[http://guides.rubygems.org/patterns/#pessimistic-version-constraint] with two digits of precision.
|
|
52
|
+
|
|
53
|
+
For example:
|
|
54
|
+
|
|
55
|
+
spec.add_dependency 'pg', '~> 1.0'
|
|
56
|
+
|
|
57
|
+
|
|
44
58
|
== How To Install
|
|
45
59
|
|
|
46
60
|
Install via RubyGems:
|
|
@@ -63,6 +77,10 @@ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
|
|
|
63
77
|
{mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
|
|
64
78
|
want to chat about something.
|
|
65
79
|
|
|
80
|
+
If you want to install as a signed gem, the public certs of the gem signers
|
|
81
|
+
can be found in {the `certs` directory}[https://github.com/ged/ruby-pg/tree/master/certs]
|
|
82
|
+
of the repository.
|
|
83
|
+
|
|
66
84
|
|
|
67
85
|
== Type Casts
|
|
68
86
|
|
|
@@ -100,6 +118,30 @@ to build composite types by assigning an element encoder/decoder.
|
|
|
100
118
|
PG::Coder objects can be used to set up a PG::TypeMap or alternatively
|
|
101
119
|
to convert single values to/from their string representation.
|
|
102
120
|
|
|
121
|
+
The following PostgreSQL column types are supported by ruby-pg (TE = Text Encoder, TD = Text Decoder, BE = Binary Encoder, BD = Binary Decoder):
|
|
122
|
+
* 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] 💡
|
|
123
|
+
* BE: {Int2}[rdoc-ref:PG::BinaryEncoder::Int2], {Int4}[rdoc-ref:PG::BinaryEncoder::Int4], {Int8}[rdoc-ref:PG::BinaryEncoder::Int8]
|
|
124
|
+
* Float: {TE}[rdoc-ref:PG::TextEncoder::Float], {TD}[rdoc-ref:PG::TextDecoder::Float], {BD}[rdoc-ref:PG::BinaryDecoder::Float]
|
|
125
|
+
* Numeric: {TE}[rdoc-ref:PG::TextEncoder::Numeric], {TD}[rdoc-ref:PG::TextDecoder::Numeric]
|
|
126
|
+
* Boolean: {TE}[rdoc-ref:PG::TextEncoder::Boolean], {TD}[rdoc-ref:PG::TextDecoder::Boolean], {BE}[rdoc-ref:PG::BinaryEncoder::Boolean], {BD}[rdoc-ref:PG::BinaryDecoder::Boolean]
|
|
127
|
+
* String: {TE}[rdoc-ref:PG::TextEncoder::String], {TD}[rdoc-ref:PG::TextDecoder::String], {BE}[rdoc-ref:PG::BinaryEncoder::String], {BD}[rdoc-ref:PG::BinaryDecoder::String]
|
|
128
|
+
* Bytea: {TE}[rdoc-ref:PG::TextEncoder::Bytea], {TD}[rdoc-ref:PG::TextDecoder::Bytea], {BE}[rdoc-ref:PG::BinaryEncoder::Bytea], {BD}[rdoc-ref:PG::BinaryDecoder::Bytea]
|
|
129
|
+
* Base64: {TE}[rdoc-ref:PG::TextEncoder::ToBase64], {TD}[rdoc-ref:PG::TextDecoder::FromBase64], {BE}[rdoc-ref:PG::BinaryEncoder::FromBase64], {BD}[rdoc-ref:PG::BinaryDecoder::ToBase64]
|
|
130
|
+
* Timestamp:
|
|
131
|
+
* TE: {local}[rdoc-ref:PG::TextEncoder::TimestampWithoutTimeZone], {UTC}[rdoc-ref:PG::TextEncoder::TimestampUtc], {with-TZ}[rdoc-ref:PG::TextEncoder::TimestampWithTimeZone]
|
|
132
|
+
* TD: {local}[rdoc-ref:PG::TextDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::TextDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::TextDecoder::TimestampUtcToLocal]
|
|
133
|
+
* BD: {local}[rdoc-ref:PG::BinaryDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::BinaryDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::BinaryDecoder::TimestampUtcToLocal]
|
|
134
|
+
* Date: {TE}[rdoc-ref:PG::TextEncoder::Date], {TD}[rdoc-ref:PG::TextDecoder::Date]
|
|
135
|
+
* JSON and JSONB: {TE}[rdoc-ref:PG::TextEncoder::JSON], {TD}[rdoc-ref:PG::TextDecoder::JSON]
|
|
136
|
+
* Inet: {TE}[rdoc-ref:PG::TextEncoder::Inet], {TD}[rdoc-ref:PG::TextDecoder::Inet]
|
|
137
|
+
* Array: {TE}[rdoc-ref:PG::TextEncoder::Array], {TD}[rdoc-ref:PG::TextDecoder::Array]
|
|
138
|
+
* Composite Type (also called "Row" or "Record"): {TE}[rdoc-ref:PG::TextEncoder::Record], {TD}[rdoc-ref:PG::TextDecoder::Record]
|
|
139
|
+
|
|
140
|
+
The following text formats can also be encoded although they are not used as column type:
|
|
141
|
+
* COPY input and output data: {TE}[rdoc-ref:PG::TextEncoder::CopyRow], {TD}[rdoc-ref:PG::TextDecoder::CopyRow]
|
|
142
|
+
* Literal for insertion into SQL string: {TE}[rdoc-ref:PG::TextEncoder::QuotedLiteral]
|
|
143
|
+
* SQL-Identifier: {TE}[rdoc-ref:PG::TextEncoder::Identifier], {TD}[rdoc-ref:PG::TextDecoder::Identifier]
|
|
144
|
+
|
|
103
145
|
=== PG::TypeMap and derivations (ext/pg_type_map*.c, lib/pg/type_map*.rb)
|
|
104
146
|
|
|
105
147
|
A TypeMap defines which value will be converted by which encoder/decoder.
|
|
@@ -109,20 +151,51 @@ needs for type casting. The default type map is PG::TypeMapAllStrings.
|
|
|
109
151
|
|
|
110
152
|
A type map can be assigned per connection or per query respectively per
|
|
111
153
|
result set. Type maps can also be used for COPY in and out data streaming.
|
|
154
|
+
See PG::Connection#copy_data .
|
|
155
|
+
|
|
156
|
+
The following base type maps are available:
|
|
157
|
+
* PG::TypeMapAllStrings - encodes and decodes all values to and from strings (default)
|
|
158
|
+
* PG::TypeMapByClass - selects encoder based on the class of the value to be sent
|
|
159
|
+
* PG::TypeMapByColumn - selects encoder and decoder by column order
|
|
160
|
+
* PG::TypeMapByOid - selects decoder by PostgreSQL type OID
|
|
161
|
+
* PG::TypeMapInRuby - define a custom type map in ruby
|
|
162
|
+
|
|
163
|
+
The following type maps are prefilled with type mappings from the PG::BasicTypeRegistry :
|
|
164
|
+
* PG::BasicTypeMapForResults - a PG::TypeMapByOid prefilled with decoders for common PostgreSQL column types
|
|
165
|
+
* PG::BasicTypeMapBasedOnResult - a PG::TypeMapByOid prefilled with encoders for common PostgreSQL column types
|
|
166
|
+
* PG::BasicTypeMapForQueries - a PG::TypeMapByClass prefilled with encoders for common Ruby value classes
|
|
112
167
|
|
|
113
168
|
|
|
114
169
|
== Contributing
|
|
115
170
|
|
|
116
|
-
To report bugs, suggest features, or check out the source with
|
|
117
|
-
{check out the project page}[
|
|
118
|
-
Git, there's also a {Github mirror}[https://github.com/ged/ruby-pg].
|
|
171
|
+
To report bugs, suggest features, or check out the source with Git,
|
|
172
|
+
{check out the project page}[https://github.com/ged/ruby-pg].
|
|
119
173
|
|
|
120
|
-
After checking out the source,
|
|
174
|
+
After checking out the source, install all dependencies:
|
|
121
175
|
|
|
122
|
-
$
|
|
176
|
+
$ bundle install
|
|
123
177
|
|
|
124
|
-
|
|
125
|
-
|
|
178
|
+
Cleanup extension files, packaging files, test databases:
|
|
179
|
+
|
|
180
|
+
$ rake clean
|
|
181
|
+
|
|
182
|
+
Compile extension:
|
|
183
|
+
|
|
184
|
+
$ rake compile
|
|
185
|
+
|
|
186
|
+
Run tests/specs with PostgreSQL tools like `initdb` in the path:
|
|
187
|
+
|
|
188
|
+
$ PATH=$PATH:/usr/lib/postgresql/14/bin rake test
|
|
189
|
+
|
|
190
|
+
Or run a specific test with the line number:
|
|
191
|
+
|
|
192
|
+
$ PATH=$PATH:/usr/lib/postgresql/14/bin rspec -Ilib -fd spec/pg/connection_spec.rb:455
|
|
193
|
+
|
|
194
|
+
Generate the API documentation:
|
|
195
|
+
|
|
196
|
+
$ rake docs
|
|
197
|
+
|
|
198
|
+
Make sure, that all bugs and new features are verified by tests.
|
|
126
199
|
|
|
127
200
|
The current maintainers are Michael Granger <ged@FaerieMUD.org> and
|
|
128
201
|
Lars Kanis <lars@greiz-reinsdorf.de>.
|
|
@@ -130,7 +203,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
|
|
|
130
203
|
|
|
131
204
|
== Copying
|
|
132
205
|
|
|
133
|
-
Copyright (c) 1997-
|
|
206
|
+
Copyright (c) 1997-2022 by the authors.
|
|
134
207
|
|
|
135
208
|
* Jeff Davis <ruby-pg@j-davis.com>
|
|
136
209
|
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
|
@@ -142,7 +215,7 @@ Copyright (c) 1997-2015 by the authors.
|
|
|
142
215
|
* Noboru Saitou <noborus@netlab.jp>
|
|
143
216
|
|
|
144
217
|
You may redistribute this software under the same terms as Ruby itself; see
|
|
145
|
-
|
|
218
|
+
https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
|
|
146
219
|
for details.
|
|
147
220
|
|
|
148
221
|
Portions of the code are from the PostgreSQL project, and are distributed
|
|
@@ -158,4 +231,3 @@ to this library over the years.
|
|
|
158
231
|
|
|
159
232
|
We are thankful to the people at the ruby-list and ruby-dev mailing lists.
|
|
160
233
|
And to the people who developed PostgreSQL.
|
|
161
|
-
|
data/Rakefile
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
# -*- rake -*-
|
|
2
2
|
|
|
3
3
|
require 'rbconfig'
|
|
4
4
|
require 'pathname'
|
|
5
5
|
require 'tmpdir'
|
|
6
|
-
|
|
7
|
-
begin
|
|
8
|
-
require 'rake/extensiontask'
|
|
9
|
-
rescue LoadError
|
|
10
|
-
abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
begin
|
|
14
|
-
require 'hoe'
|
|
15
|
-
rescue LoadError
|
|
16
|
-
abort "This Rakefile requires hoe (gem install hoe)"
|
|
17
|
-
end
|
|
18
|
-
|
|
6
|
+
require 'rake/extensiontask'
|
|
19
7
|
require 'rake/clean'
|
|
8
|
+
require 'rspec/core/rake_task'
|
|
9
|
+
require 'bundler'
|
|
10
|
+
require 'bundler/gem_helper'
|
|
20
11
|
|
|
21
12
|
# Build directory constants
|
|
22
13
|
BASEDIR = Pathname( __FILE__ ).dirname
|
|
@@ -25,102 +16,38 @@ LIBDIR = BASEDIR + 'lib'
|
|
|
25
16
|
EXTDIR = BASEDIR + 'ext'
|
|
26
17
|
PKGDIR = BASEDIR + 'pkg'
|
|
27
18
|
TMPDIR = BASEDIR + 'tmp'
|
|
19
|
+
TESTDIR = BASEDIR + "tmp_test_*"
|
|
28
20
|
|
|
29
21
|
DLEXT = RbConfig::CONFIG['DLEXT']
|
|
30
22
|
EXT = LIBDIR + "pg_ext.#{DLEXT}"
|
|
31
23
|
|
|
32
24
|
GEMSPEC = 'pg.gemspec'
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
CLOBBER.include( TEST_DIRECTORY.to_s )
|
|
26
|
+
CLEAN.include( TESTDIR.to_s )
|
|
37
27
|
CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Hoe.plugin :signing
|
|
42
|
-
Hoe.plugin :deveiate
|
|
43
|
-
Hoe.plugin :bundler
|
|
44
|
-
|
|
45
|
-
Hoe.plugins.delete :rubyforge
|
|
46
|
-
Hoe.plugins.delete :compiler
|
|
28
|
+
CLEAN.include "lib/*/libpq.dll"
|
|
29
|
+
CLEAN.include "lib/pg_ext.*"
|
|
30
|
+
CLEAN.include "lib/pg/postgresql_lib_path.rb"
|
|
47
31
|
|
|
48
32
|
load 'Rakefile.cross'
|
|
49
33
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
$hoespec = Hoe.spec 'pg' do
|
|
53
|
-
self.readme_file = 'README.rdoc'
|
|
54
|
-
self.history_file = 'History.rdoc'
|
|
55
|
-
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
|
|
56
|
-
self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
|
|
57
|
-
self.extra_rdoc_files.include( 'ext/*.c' )
|
|
58
|
-
self.license :BSD
|
|
59
|
-
|
|
60
|
-
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
|
61
|
-
self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
|
|
62
|
-
|
|
63
|
-
self.dependency 'rake-compiler', '~> 0.9', :developer
|
|
64
|
-
self.dependency 'hoe', '~> 3.12', :developer
|
|
65
|
-
self.dependency 'hoe-deveiate', '~> 0.6', :developer
|
|
66
|
-
self.dependency 'hoe-bundler', '~> 1.0', :developer
|
|
67
|
-
self.dependency 'rspec', '~> 3.0', :developer
|
|
68
|
-
|
|
69
|
-
self.spec_extras[:licenses] = ['BSD', 'Ruby', 'GPL']
|
|
70
|
-
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
|
|
71
|
-
|
|
72
|
-
self.require_ruby_version( '>= 1.9.3' )
|
|
73
|
-
|
|
74
|
-
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
|
75
|
-
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
|
76
|
-
self.spec_extras[:rdoc_options] = [
|
|
77
|
-
'-f', 'fivefish',
|
|
78
|
-
'-t', 'pg: The Ruby Interface to PostgreSQL',
|
|
79
|
-
'-m', 'README.rdoc',
|
|
80
|
-
]
|
|
81
|
-
|
|
82
|
-
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
ENV['VERSION'] ||= $hoespec.spec.version.to_s
|
|
86
|
-
|
|
87
|
-
# Tests should pass before checking in
|
|
88
|
-
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
|
89
|
-
|
|
90
|
-
# Support for 'rvm specs'
|
|
91
|
-
task :specs => :spec
|
|
92
|
-
|
|
93
|
-
# Compile before testing
|
|
94
|
-
task :spec => :compile
|
|
95
|
-
|
|
96
|
-
# gem-testers support
|
|
97
|
-
task :test do
|
|
98
|
-
# rake-compiler always wants to copy the compiled extension into lib/, but
|
|
99
|
-
# we don't want testers to have to re-compile, especially since that
|
|
100
|
-
# often fails because they can't (and shouldn't have to) write to tmp/ in
|
|
101
|
-
# the installed gem dir. So we clear the task rake-compiler set up
|
|
102
|
-
# to break the dependency between :spec and :compile when running under
|
|
103
|
-
# rubygems-test, and then run :spec.
|
|
104
|
-
Rake::Task[ EXT.to_s ].clear
|
|
105
|
-
Rake::Task[ :spec ].execute
|
|
106
|
-
end
|
|
34
|
+
Bundler::GemHelper.install_tasks
|
|
35
|
+
$gem_spec = Bundler.load_gemspec(GEMSPEC)
|
|
107
36
|
|
|
108
37
|
desc "Turn on warnings and debugging in the build."
|
|
109
38
|
task :maint do
|
|
110
39
|
ENV['MAINTAINER_MODE'] = 'yes'
|
|
111
40
|
end
|
|
112
41
|
|
|
113
|
-
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2:2.0.0'
|
|
114
|
-
|
|
115
42
|
# Rake-compiler task
|
|
116
43
|
Rake::ExtensionTask.new do |ext|
|
|
117
44
|
ext.name = 'pg_ext'
|
|
118
|
-
ext.gem_spec = $
|
|
45
|
+
ext.gem_spec = $gem_spec
|
|
119
46
|
ext.ext_dir = 'ext'
|
|
120
47
|
ext.lib_dir = 'lib'
|
|
121
48
|
ext.source_pattern = "*.{c,h}"
|
|
122
49
|
ext.cross_compile = true
|
|
123
|
-
ext.cross_platform = CrossLibraries.map
|
|
50
|
+
ext.cross_platform = CrossLibraries.map(&:for_platform)
|
|
124
51
|
|
|
125
52
|
ext.cross_config_options += CrossLibraries.map do |lib|
|
|
126
53
|
{
|
|
@@ -136,52 +63,40 @@ Rake::ExtensionTask.new do |ext|
|
|
|
136
63
|
|
|
137
64
|
# Add libpq.dll to windows binary gemspec
|
|
138
65
|
ext.cross_compiling do |spec|
|
|
139
|
-
|
|
140
|
-
spec.files << "lib/#{spec.platform.to_s.gsub(/^x86-/, "i386-")}/libpq.dll"
|
|
66
|
+
spec.files << "lib/#{spec.platform}/libpq.dll"
|
|
141
67
|
end
|
|
142
68
|
end
|
|
143
69
|
|
|
70
|
+
RSpec::Core::RakeTask.new(:spec).rspec_opts = "--profile -cfdoc"
|
|
71
|
+
task :test => :spec
|
|
144
72
|
|
|
145
|
-
#
|
|
146
|
-
|
|
147
|
-
warn "WARNING: You need the Mercurial repo to update the ChangeLog"
|
|
148
|
-
end
|
|
149
|
-
file 'ChangeLog' do |task|
|
|
150
|
-
if File.exist?('.hg/branch')
|
|
151
|
-
$stderr.puts "Updating the changelog..."
|
|
152
|
-
begin
|
|
153
|
-
content = make_changelog()
|
|
154
|
-
rescue NameError
|
|
155
|
-
abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
|
|
156
|
-
end
|
|
157
|
-
File.open( task.name, 'w', 0644 ) do |fh|
|
|
158
|
-
fh.print( content )
|
|
159
|
-
end
|
|
160
|
-
else
|
|
161
|
-
touch 'ChangeLog'
|
|
162
|
-
end
|
|
163
|
-
end
|
|
73
|
+
# Use the fivefish formatter for docs generated from development checkout
|
|
74
|
+
require 'rdoc/task'
|
|
164
75
|
|
|
165
|
-
|
|
166
|
-
|
|
76
|
+
RDoc::Task.new( 'docs' ) do |rdoc|
|
|
77
|
+
rdoc.main = "README.rdoc"
|
|
78
|
+
rdoc.rdoc_files.include( "*.rdoc", "lib/**/*.rb", 'ext/**/*.{c,h}' )
|
|
79
|
+
rdoc.generator = :fivefish
|
|
80
|
+
rdoc.title = "PG: The Ruby PostgreSQL Driver"
|
|
81
|
+
rdoc.rdoc_dir = 'doc'
|
|
82
|
+
end
|
|
167
83
|
|
|
84
|
+
desc "Build the source gem #{$gem_spec.full_name}.gem into the pkg directory"
|
|
85
|
+
task :gem => :build
|
|
168
86
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
Rake::Task[:clean].invoke
|
|
87
|
+
task :clobber do
|
|
88
|
+
puts "Stop any Postmaster instances that remain after testing."
|
|
89
|
+
require_relative 'spec/helpers'
|
|
90
|
+
PG::TestingHelpers.stop_existing_postmasters()
|
|
174
91
|
end
|
|
175
92
|
|
|
176
93
|
desc "Update list of server error codes"
|
|
177
94
|
task :update_error_codes do
|
|
178
|
-
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=
|
|
95
|
+
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_15_0"
|
|
179
96
|
|
|
180
97
|
ERRORCODES_TXT = "ext/errorcodes.txt"
|
|
181
98
|
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
|
182
|
-
end
|
|
183
99
|
|
|
184
|
-
file 'ext/errorcodes.def' => ['ext/errorcodes.rb', 'ext/errorcodes.txt'] do
|
|
185
100
|
ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', 'ext/errorcodes.def'
|
|
186
101
|
end
|
|
187
102
|
|
|
@@ -189,18 +104,3 @@ file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
|
|
|
189
104
|
# trigger compilation of changed errorcodes.def
|
|
190
105
|
touch 'ext/pg_errors.c'
|
|
191
106
|
end
|
|
192
|
-
|
|
193
|
-
task :gemspec => GEMSPEC
|
|
194
|
-
file GEMSPEC => __FILE__
|
|
195
|
-
task GEMSPEC do |task|
|
|
196
|
-
spec = $hoespec.spec
|
|
197
|
-
spec.files.delete( '.gemtest' )
|
|
198
|
-
spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
|
199
|
-
File.open( task.name, 'w' ) do |fh|
|
|
200
|
-
fh.write( spec.to_ruby )
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
CLOBBER.include( GEMSPEC.to_s )
|
|
205
|
-
task :default => :gemspec
|
|
206
|
-
|