jruby-pg 0.1-java
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 +7 -0
- data/.gemtest +0 -0
- data/BSDL +22 -0
- data/ChangeLog +0 -0
- data/Contributors.rdoc +45 -0
- data/History.rdoc +270 -0
- data/LICENSE +56 -0
- data/Manifest.txt +44 -0
- data/POSTGRES +23 -0
- data/README-OS_X.rdoc +68 -0
- data/README-Windows.rdoc +67 -0
- data/README.ja.rdoc +14 -0
- data/README.rdoc +102 -0
- data/Rakefile +211 -0
- data/Rakefile.cross +273 -0
- data/ext/gvl_wrappers.c +13 -0
- data/ext/pg.c +545 -0
- data/ext/pg_connection.c +3643 -0
- data/ext/pg_errors.c +89 -0
- data/ext/pg_result.c +920 -0
- data/lib/pg.rb +52 -0
- data/lib/pg/connection.rb +179 -0
- data/lib/pg/constants.rb +11 -0
- data/lib/pg/exceptions.rb +11 -0
- data/lib/pg/result.rb +16 -0
- data/lib/pg_ext.jar +0 -0
- data/sample/array_insert.rb +20 -0
- data/sample/async_api.rb +106 -0
- data/sample/async_copyto.rb +39 -0
- data/sample/async_mixed.rb +56 -0
- data/sample/check_conn.rb +21 -0
- data/sample/copyfrom.rb +81 -0
- data/sample/copyto.rb +19 -0
- data/sample/cursor.rb +21 -0
- data/sample/disk_usage_report.rb +186 -0
- data/sample/issue-119.rb +94 -0
- data/sample/losample.rb +69 -0
- data/sample/minimal-testcase.rb +17 -0
- data/sample/notify_wait.rb +72 -0
- data/sample/pg_statistics.rb +294 -0
- data/sample/replication_monitor.rb +231 -0
- data/sample/test_binary_values.rb +33 -0
- data/sample/wal_shipper.rb +434 -0
- data/sample/warehouse_partitions.rb +320 -0
- data/spec/data/expected_trace.out +26 -0
- data/spec/data/random_binary_data +0 -0
- data/spec/lib/helpers.rb +350 -0
- data/spec/pg/connection_spec.rb +1276 -0
- data/spec/pg/result_spec.rb +345 -0
- data/spec/pg_spec.rb +44 -0
- metadata +190 -0
data/POSTGRES
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
PostgreSQL Database Management System
|
2
|
+
(formerly known as Postgres, then as Postgres95)
|
3
|
+
|
4
|
+
Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
5
|
+
|
6
|
+
Portions Copyright (c) 1994, The Regents of the University of California
|
7
|
+
|
8
|
+
Permission to use, copy, modify, and distribute this software and its
|
9
|
+
documentation for any purpose, without fee, and without a written agreement
|
10
|
+
is hereby granted, provided that the above copyright notice and this
|
11
|
+
paragraph and the following two paragraphs appear in all copies.
|
12
|
+
|
13
|
+
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
14
|
+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
|
15
|
+
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
|
16
|
+
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
|
17
|
+
POSSIBILITY OF SUCH DAMAGE.
|
18
|
+
|
19
|
+
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
20
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
+
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
22
|
+
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
|
23
|
+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
data/README-OS_X.rdoc
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
= Compiling on MacOS X
|
2
|
+
|
3
|
+
The EnterpriseDB packages are the recommended PostgreSQL installations to use
|
4
|
+
with MacOS X. They eliminate most or all of the issues with getting 'pg'
|
5
|
+
installed, linked correctly, and running.
|
6
|
+
|
7
|
+
== Segfaults and SSL Support
|
8
|
+
|
9
|
+
If you need a custom installation of PostgreSQL, you should ensure that you
|
10
|
+
either compile it against the same version of OpenSSL as the OpenSSL extension
|
11
|
+
of the Ruby you'll be using, or compile it without SSL support. If you fail to
|
12
|
+
do this, you will likely see segfaults when you use 'pg' and the 'openssl'
|
13
|
+
extension at the same time. You can see what library it's linked against using
|
14
|
+
'otool -L'; for example, on my 10.7 machine I use for 'pg' development:
|
15
|
+
|
16
|
+
$ otool -L /System/Library/Frameworks/Ruby.framework/Versions\
|
17
|
+
/1.8/usr/lib/ruby/1.8/universal-darwin11.0/openssl.bundle
|
18
|
+
|
19
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/\
|
20
|
+
lib/ruby/1.8/universal-darwin11.0/openssl.bundle:
|
21
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/\
|
22
|
+
usr/lib/libruby.1.dylib (compatibility version 1.8.0, \
|
23
|
+
current version 1.8.7)
|
24
|
+
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, \
|
25
|
+
current version 0.9.8)
|
26
|
+
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, \
|
27
|
+
current version 0.9.8)
|
28
|
+
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, \
|
29
|
+
current version 159.0.0)
|
30
|
+
|
31
|
+
|
32
|
+
== Dealing with Installation Problems
|
33
|
+
|
34
|
+
If you are building/installing pg on MacOS X, and the installation doesn't
|
35
|
+
work at first, here are a few things you can try.
|
36
|
+
|
37
|
+
=== pg_config
|
38
|
+
|
39
|
+
The first thing you should do is ensure that the 'pg_config' tool that comes
|
40
|
+
with Postgres is in your path. If it isn't, or the one that's first in your
|
41
|
+
path isn't the one that was installed with the Postgres you want to build
|
42
|
+
against, you can specify the path to it with the --with-pg-config option.
|
43
|
+
|
44
|
+
For example, if you're using the Ruby binary that comes with OSX, and
|
45
|
+
PostgreSQL 9.0.x installed from MacPorts, do:
|
46
|
+
|
47
|
+
gem install -- --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
|
48
|
+
|
49
|
+
=== ARCHFLAGS and Universal Binaries
|
50
|
+
|
51
|
+
OS X supports both architecture-specific binaries (e.g. i386), as well as
|
52
|
+
universal binaries (i.e. i386 & ppc). If Ruby is built as a universal binary
|
53
|
+
and PostgreSQL is not, you need to specify the path to the appropriate
|
54
|
+
pg_config binary or set the environment variable ARCHFLAGS appropriately.
|
55
|
+
|
56
|
+
Alternatively, if the build system can't figure out which architectures it
|
57
|
+
should include, you may need to set the 'ARCHFLAGS' environment variable
|
58
|
+
explicitly:
|
59
|
+
|
60
|
+
sudo env ARCHFLAGS='-arch x86_64' gem install pg
|
61
|
+
|
62
|
+
or, if you're building from source:
|
63
|
+
|
64
|
+
rake compile ARCHFLAGS="-arch x86_64"
|
65
|
+
|
66
|
+
Note that the recommended EnterpriseDB packages are correctly compiled as
|
67
|
+
universal binaries, and don't need any of these workarounds.
|
68
|
+
|
data/README-Windows.rdoc
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
= Compiling 'pg' on MS Windows
|
2
|
+
|
3
|
+
In order to build this extension on MS Windows you will need a couple things.
|
4
|
+
|
5
|
+
First, a compiler. For the one click installer this means you should either
|
6
|
+
use VC++ 6.0 or the compiler that comes with cygwin or mingw if you're
|
7
|
+
building on that platform.
|
8
|
+
|
9
|
+
If you've built Ruby yourself, you should use the same compiler to build
|
10
|
+
this library that you used to build Ruby.
|
11
|
+
|
12
|
+
Second, PostgreSQL. Be sure you installed it with the development header
|
13
|
+
files if you installed it using the standard PostgreSQL installer for
|
14
|
+
Windows. If you didn't, you can run the installer again, select "modify",
|
15
|
+
and then select the 'development headers' option to install them.
|
16
|
+
|
17
|
+
I recommend making sure that 'pg_config.exe' is in your PATH. The PostgreSQL
|
18
|
+
installer for Windows does not necessarily update your PATH when it installs
|
19
|
+
itself, so you may need to do this manually. This isn't strictly necessary,
|
20
|
+
however.
|
21
|
+
|
22
|
+
In order to build ruby-pg, just run 'rake'. If the pg_config.exe executable
|
23
|
+
is not in your PATH, you'll need to explicitly point ruby-pg to where your
|
24
|
+
PostgreSQL headers and libraries are with something like this:
|
25
|
+
|
26
|
+
rake --with-pg-dir=c:/progra~1/postgr~1/8.3
|
27
|
+
|
28
|
+
Adjust your path accordingly. BE SURE TO USE THE SHORT PATH NAMES! If you
|
29
|
+
try to use a path with spaces in it, the nmake.exe program will choke.
|
30
|
+
|
31
|
+
|
32
|
+
== Cross compiling for mswin32
|
33
|
+
|
34
|
+
Using rake-compiler a cross compiled pg gem can be build on a Linux or MacOS X
|
35
|
+
host for the win32 platform. The generated gem is statically linked against
|
36
|
+
libpq and libssl. OpenSSL and PostgreSQL are downloaded and compiled from the
|
37
|
+
sources. There are no runtime dependencies to any but the standard Windows
|
38
|
+
DLLs.
|
39
|
+
|
40
|
+
Install mingw32 using the instructions in rake-compiler's README.
|
41
|
+
For Debian/Ubuntu it is <tt>apt-get install gcc-mingw32</tt> .
|
42
|
+
Use ruby-1.8.7 for the following commands.
|
43
|
+
|
44
|
+
Download and cross compile ruby 1.8 and 1.9 for win32 with:
|
45
|
+
|
46
|
+
rake-compiler cross-ruby VERSION=1.8.7-p352
|
47
|
+
rake-compiler cross-ruby VERSION=1.9.2-p290
|
48
|
+
|
49
|
+
Download and cross compile pg for win32:
|
50
|
+
|
51
|
+
rake cross native gem
|
52
|
+
|
53
|
+
or with custom versions:
|
54
|
+
|
55
|
+
rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2 \
|
56
|
+
OPENSSL_VERSION=1.0.0e POSTGRESQL_VERSION=9.1.1
|
57
|
+
|
58
|
+
If everything works, there should be pg-VERSION-x86-mingw32.gem in the pkg
|
59
|
+
directory.
|
60
|
+
|
61
|
+
|
62
|
+
== Reporting Problems
|
63
|
+
|
64
|
+
If you have any problems you can submit them via
|
65
|
+
[the project's issue-tracker][bitbucket]. And submit questions, problems, or
|
66
|
+
solutions, so that it can be improved.
|
67
|
+
|
data/README.ja.rdoc
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
= pg
|
2
|
+
|
3
|
+
home :: https://bitbucket.org/ged/ruby-pg
|
4
|
+
mirror :: https://github.com/ged/ruby-pg
|
5
|
+
docs :: http://deveiate.org/code/pg
|
6
|
+
|
7
|
+
|
8
|
+
== Description
|
9
|
+
|
10
|
+
This file needs a translation of the English README. Pull requests, patches, or
|
11
|
+
volunteers gladly accepted.
|
12
|
+
|
13
|
+
Until such time, please accept my sincere apologies for not knowing Japanese.
|
14
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
= pg
|
2
|
+
|
3
|
+
This is a JRuby gem replacement for ruby-pg. The gem should be a
|
4
|
+
drop-in replacement for ruby-pg version 0.17.1. If you see any
|
5
|
+
inconsistency please open an issue
|
6
|
+
{here}[https://github.com/headius/jruby-pg/issues].
|
7
|
+
|
8
|
+
Another JRuby Postgres adapter is {jdbc-postgres}[https://github.com/jruby/activerecord-jdbc-adapter/tree/master/jdbc-postgres/]. jruby-pg provides a few interfaces that jdbc-postgres doesn't have. Most use cases don't require those interfaces, specially if you are using ActiveRecord. Extra APIs in the pg & jruby-pg gem include:
|
9
|
+
|
10
|
+
* Async API for querying
|
11
|
+
* Large objects API
|
12
|
+
* Bulk Copy API
|
13
|
+
* Notification API
|
14
|
+
|
15
|
+
= Documentation
|
16
|
+
|
17
|
+
For documentation please refair to the MRI pg gem docs which you can
|
18
|
+
find {here}[http://www.rubydoc.info/gems/pg/0.17.1/PG]. The original
|
19
|
+
ruby-pg project can be found {here on github}[https://github.com/ged/ruby-pg].
|
20
|
+
|
21
|
+
== Build Status
|
22
|
+
|
23
|
+
{<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ged/ruby-pg]
|
24
|
+
|
25
|
+
|
26
|
+
== Requirements
|
27
|
+
|
28
|
+
* JRuby 1.7.1 or later (due to https://github.com/jruby/jruby/issues/411)
|
29
|
+
* JRuby in 1.9 or 2.0 mode
|
30
|
+
* json gem 1.7.7 or later (see https://github.com/flori/json/pull/152 and
|
31
|
+
https://github.com/flori/json/pull/155)
|
32
|
+
* Postgresql 7.4 or higher
|
33
|
+
|
34
|
+
The gem has been tested with the following:
|
35
|
+
|
36
|
+
* JRuby 1.7.18
|
37
|
+
* PostgreSQL 9.3.6
|
38
|
+
|
39
|
+
It may work with earlier versions of Ruby/PostgreSQL as well, but those are
|
40
|
+
not regularly tested.
|
41
|
+
|
42
|
+
|
43
|
+
== How To Install
|
44
|
+
|
45
|
+
*NOTE*: if you are installing jruby-pg to use it with rails you'll
|
46
|
+
have to install it using bundler.
|
47
|
+
|
48
|
+
Install via RubyGems:
|
49
|
+
|
50
|
+
gem install pg_jruby
|
51
|
+
|
52
|
+
Install via Bundler, in your gemfile add the following:
|
53
|
+
|
54
|
+
# Please note that Bundler version 1.0 is necessary to let bundler do its dependency management,
|
55
|
+
# as there is no .gemspec in the source.
|
56
|
+
gem 'pg', '0.17.1', :platform => :jruby, :git => 'git://github.com/headius/jruby-pg.git', :branch => :master
|
57
|
+
|
58
|
+
# comment the activerecord-jdbcsqlite3-adapter line
|
59
|
+
# gem 'activerecord-jdbcsqlite3-adapter'
|
60
|
+
|
61
|
+
== Sample app
|
62
|
+
|
63
|
+
See {this app}[https://github.com/jvshahid/sample-jruby-pg] for a demonstration
|
64
|
+
of using jruby-pg with rails
|
65
|
+
|
66
|
+
== Copying
|
67
|
+
|
68
|
+
Copyright (c) 1997-2013 by the authors.
|
69
|
+
|
70
|
+
=== MRI contributors
|
71
|
+
|
72
|
+
* Jeff Davis <ruby-pg@j-davis.com>
|
73
|
+
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
74
|
+
* Michael Granger <ged@FaerieMUD.org>
|
75
|
+
* Lars Kanis <lars@greiz-reinsdorf.de>
|
76
|
+
* Dave Lee
|
77
|
+
* Eiji Matsumoto <usagi@ruby.club.or.jp>
|
78
|
+
* Yukihiro Matsumoto <matz@ruby-lang.org>
|
79
|
+
* Noboru Saitou <noborus@netlab.jp>
|
80
|
+
|
81
|
+
=== JRuby contributors
|
82
|
+
|
83
|
+
* John Shahid <jvshahid@gmail.com>
|
84
|
+
|
85
|
+
You may redistribute this software under the same terms as Ruby itself; see
|
86
|
+
http://www.ruby-lang.org/en/LICENSE.txt or the LICENSE file in the source
|
87
|
+
for details.
|
88
|
+
|
89
|
+
Portions of the code are from the PostgreSQL project, and are distributed
|
90
|
+
under the terms of the PostgreSQL license, included in the file POSTGRES.
|
91
|
+
|
92
|
+
Portions copyright LAIKA, Inc.
|
93
|
+
|
94
|
+
|
95
|
+
== Acknowledgments
|
96
|
+
|
97
|
+
See Contributors.rdoc for the many additional fine people that have contributed
|
98
|
+
to this library over the years.
|
99
|
+
|
100
|
+
We are thankful to the people at the ruby-list and ruby-dev mailing lists.
|
101
|
+
And to the people who developed PostgreSQL.
|
102
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
#-*- ruby -*-
|
3
|
+
|
4
|
+
require 'rbconfig'
|
5
|
+
require 'pathname'
|
6
|
+
require 'tmpdir'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'rake/extensiontask'
|
10
|
+
rescue LoadError
|
11
|
+
abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'hoe'
|
16
|
+
rescue LoadError
|
17
|
+
abort "This Rakefile requires hoe (gem install hoe)"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/clean'
|
21
|
+
|
22
|
+
# Build directory constants
|
23
|
+
BASEDIR = Pathname( __FILE__ ).dirname
|
24
|
+
SPECDIR = BASEDIR + 'spec'
|
25
|
+
LIBDIR = BASEDIR + 'lib'
|
26
|
+
EXTDIR = BASEDIR + 'ext'
|
27
|
+
PKGDIR = BASEDIR + 'pkg'
|
28
|
+
TMPDIR = BASEDIR + 'tmp'
|
29
|
+
|
30
|
+
DLEXT = RbConfig::CONFIG['DLEXT']
|
31
|
+
EXT = LIBDIR + "pg_ext.#{DLEXT}"
|
32
|
+
|
33
|
+
TEST_DIRECTORY = BASEDIR + "tmp_test_specs"
|
34
|
+
|
35
|
+
CLOBBER.include( TEST_DIRECTORY.to_s )
|
36
|
+
CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
|
37
|
+
|
38
|
+
# Set up Hoe plugins
|
39
|
+
#Hoe.plugin :mercurial
|
40
|
+
#Hoe.plugin :signing
|
41
|
+
#Hoe.plugin :deveiate
|
42
|
+
Hoe.plugin :bundler
|
43
|
+
|
44
|
+
Hoe.plugins.delete :rubyforge
|
45
|
+
Hoe.plugins.delete :compiler
|
46
|
+
|
47
|
+
def jruby?
|
48
|
+
RUBY_PLATFORM =~ /java/
|
49
|
+
end
|
50
|
+
|
51
|
+
# Hoe specification
|
52
|
+
$hoespec = Hoe.spec jruby? ? 'jruby-pg' : '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
|
+
|
59
|
+
self.developer 'Charles Nutter', 'headius@headius.com'
|
60
|
+
self.developer 'John Shahid', 'jvshahid@gmail.com'
|
61
|
+
|
62
|
+
self.dependency 'rake-compiler', '~> 0.9', :developer
|
63
|
+
self.dependency 'hoe', '~> 3.5.1', :developer
|
64
|
+
self.dependency 'hoe-deveiate', '~> 0.2', :developer
|
65
|
+
self.dependency 'hoe-bundler', '~> 1.0', :developer
|
66
|
+
|
67
|
+
self.spec_extras[:licenses] = ['BSD-2-Clause', 'Ruby']
|
68
|
+
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ] unless jruby?
|
69
|
+
|
70
|
+
self.license 'Ruby'
|
71
|
+
|
72
|
+
self.spec_extras[:files] = Proc.new do |f|
|
73
|
+
self.spec_extras[:files] = f << 'lib/pg_ext.jar'
|
74
|
+
end if jruby?
|
75
|
+
|
76
|
+
self.require_ruby_version( '>= 1.8.7' )
|
77
|
+
|
78
|
+
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
79
|
+
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
80
|
+
self.spec_extras[:rdoc_options] = [
|
81
|
+
'-f', 'fivefish',
|
82
|
+
'-t', 'pg: The Ruby Interface to PostgreSQL',
|
83
|
+
'-m', 'README.rdoc',
|
84
|
+
]
|
85
|
+
|
86
|
+
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
87
|
+
|
88
|
+
self.spec_extras[:platform] = 'java' if jruby?
|
89
|
+
self.version = '0.1' if jruby?
|
90
|
+
end
|
91
|
+
|
92
|
+
if jruby?
|
93
|
+
require "rake/javaextensiontask"
|
94
|
+
|
95
|
+
Rake::JavaExtensionTask.new("pg_ext", $hoespec.spec) do |ext|
|
96
|
+
ext.ext_dir = 'ext/java'
|
97
|
+
ext.lib_dir = 'lib'
|
98
|
+
end
|
99
|
+
else
|
100
|
+
load 'Rakefile.cross'
|
101
|
+
|
102
|
+
# Rake-compiler task
|
103
|
+
Rake::ExtensionTask.new do |ext|
|
104
|
+
ext.name = 'pg_ext'
|
105
|
+
ext.gem_spec = $hoespec.spec
|
106
|
+
ext.ext_dir = 'ext'
|
107
|
+
ext.lib_dir = 'lib'
|
108
|
+
ext.source_pattern = "*.{c,h}"
|
109
|
+
ext.cross_compile = true
|
110
|
+
ext.cross_platform = CrossLibraries.map &:for_platform
|
111
|
+
|
112
|
+
ext.cross_config_options += CrossLibraries.map do |lib|
|
113
|
+
{
|
114
|
+
lib.for_platform => [
|
115
|
+
"--with-pg-include=#{lib.static_postgresql_libdir}",
|
116
|
+
"--with-opt-include=#{lib.static_postgresql_incdir}",
|
117
|
+
"--with-pg-lib=#{lib.static_postgresql_libdir}",
|
118
|
+
"--with-opt-lib=#{lib.static_openssl_builddir}",
|
119
|
+
]
|
120
|
+
}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
ENV['VERSION'] ||= $hoespec.spec.version.to_s
|
126
|
+
|
127
|
+
# Tests should pass before checking in
|
128
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
129
|
+
|
130
|
+
# Support for 'rvm specs'
|
131
|
+
task :specs => :spec
|
132
|
+
|
133
|
+
# Compile before testing
|
134
|
+
task :spec => :compile
|
135
|
+
|
136
|
+
# gem-testers support
|
137
|
+
task :test do
|
138
|
+
# rake-compiler always wants to copy the compiled extension into lib/, but
|
139
|
+
# we don't want testers to have to re-compile, especially since that
|
140
|
+
# often fails because they can't (and shouldn't have to) write to tmp/ in
|
141
|
+
# the installed gem dir. So we clear the task rake-compiler set up
|
142
|
+
# to break the dependency between :spec and :compile when running under
|
143
|
+
# rubygems-test, and then run :spec.
|
144
|
+
Rake::Task[ EXT.to_s ].clear
|
145
|
+
Rake::Task[ :spec ].execute
|
146
|
+
end
|
147
|
+
|
148
|
+
desc "Turn on warnings and debugging in the build."
|
149
|
+
task :maint do
|
150
|
+
ENV['MAINTAINER_MODE'] = 'yes'
|
151
|
+
end
|
152
|
+
|
153
|
+
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2:2.0.0'
|
154
|
+
|
155
|
+
# Make the ChangeLog update if the repo has changed since it was last built
|
156
|
+
file '.hg/branch' do
|
157
|
+
warn "WARNING: You need the Mercurial repo to update the ChangeLog"
|
158
|
+
end
|
159
|
+
file 'ChangeLog' do |task|
|
160
|
+
if File.exist?('.hg/branch')
|
161
|
+
$stderr.puts "Updating the changelog..."
|
162
|
+
begin
|
163
|
+
content = make_changelog()
|
164
|
+
rescue NameError
|
165
|
+
abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
|
166
|
+
end
|
167
|
+
File.open( task.name, 'w', 0644 ) do |fh|
|
168
|
+
fh.print( content )
|
169
|
+
end
|
170
|
+
else
|
171
|
+
touch 'ChangeLog'
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Rebuild the ChangeLog immediately before release
|
176
|
+
task :prerelease => 'ChangeLog'
|
177
|
+
|
178
|
+
|
179
|
+
desc "Stop any Postmaster instances that remain after testing."
|
180
|
+
task :cleanup_testing_dbs do
|
181
|
+
require 'spec/lib/helpers'
|
182
|
+
PgTestingHelpers.stop_existing_postmasters()
|
183
|
+
Rake::Task[:clean].invoke
|
184
|
+
end
|
185
|
+
|
186
|
+
desc "Update list of server error codes"
|
187
|
+
task :update_error_codes do
|
188
|
+
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=HEAD"
|
189
|
+
|
190
|
+
ERRORCODES_TXT = "ext/errorcodes.txt"
|
191
|
+
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
192
|
+
end
|
193
|
+
|
194
|
+
def error_codes_file
|
195
|
+
if jruby?
|
196
|
+
return 'ext/java/Errors.java'
|
197
|
+
else
|
198
|
+
'ext/errorcodes.def'
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
file error_codes_file => ['ext/errorcodes.rb', 'ext/errorcodes.txt'] do
|
203
|
+
ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', error_codes_file
|
204
|
+
end
|
205
|
+
|
206
|
+
#file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
|
207
|
+
# # trigger compilation of changed errorcodes.def
|
208
|
+
# touch 'ext/pg_errors.c'
|
209
|
+
#end
|
210
|
+
|
211
|
+
file 'ext/java/PgExtService.java' => error_codes_file
|