pg 0.9.0.pre156 → 0.9.0.pre158
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -1
- data/Rakefile +342 -0
- data/Rakefile.local +4 -0
- data/spec/data/expected_trace.out +26 -0
- data/spec/data/random_binary_data +0 -0
- metadata +5 -8
data/ChangeLog
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
158[tip] 872063e42b12 2010-02-19 08:02 -0800 ged
|
2
|
+
Adding "fat gem" compatible loader, set the default RUBY_CC_VERSION.
|
3
|
+
|
4
|
+
157 ab525ca90531 2010-02-19 06:27 -0800 ged
|
5
|
+
Updated the Rakefile so it includes itself in gems. (closes #15) Thanks to flameeyes@bitbucket for
|
6
|
+
|
7
|
+
156 9c65eb905416 2010-02-18 06:52 -0800 ged
|
2
8
|
Applied patch for PGconn#async_exec to make it have the same semantics as PGconn#exec (closes #19). Thanks again to Lars Kanis for the patch.
|
3
9
|
|
4
10
|
155 b0017ac0ecb5 2010-02-17 15:30 -0800 ged
|
data/Rakefile
ADDED
@@ -0,0 +1,342 @@
|
|
1
|
+
#!rake -*- ruby -*-
|
2
|
+
#
|
3
|
+
# pg rakefile
|
4
|
+
#
|
5
|
+
# Based on various other Rakefiles, especially one by Ben Bleything
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007-2010 The FaerieMUD Consortium
|
8
|
+
#
|
9
|
+
# Authors:
|
10
|
+
# * Michael Granger <ged@FaerieMUD.org>
|
11
|
+
#
|
12
|
+
|
13
|
+
BEGIN {
|
14
|
+
require 'pathname'
|
15
|
+
basedir = Pathname.new( __FILE__ ).dirname
|
16
|
+
|
17
|
+
libdir = basedir + "lib"
|
18
|
+
extdir = basedir + "ext"
|
19
|
+
|
20
|
+
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
21
|
+
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
22
|
+
}
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'readline'
|
26
|
+
include Readline
|
27
|
+
rescue LoadError
|
28
|
+
# Fall back to a plain prompt
|
29
|
+
def readline( text )
|
30
|
+
$stderr.print( text.chomp )
|
31
|
+
return $stdin.gets
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
require 'rubygems'
|
37
|
+
rescue LoadError
|
38
|
+
module Gem
|
39
|
+
class Specification; end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
require 'rbconfig'
|
44
|
+
require 'rake'
|
45
|
+
require 'rake/testtask'
|
46
|
+
require 'rake/packagetask'
|
47
|
+
require 'rake/clean'
|
48
|
+
# require 'rake/191_compat.rb'
|
49
|
+
|
50
|
+
$dryrun = false
|
51
|
+
|
52
|
+
### Config constants
|
53
|
+
BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
|
54
|
+
BINDIR = BASEDIR + 'bin'
|
55
|
+
LIBDIR = BASEDIR + 'lib'
|
56
|
+
EXTDIR = BASEDIR + 'ext'
|
57
|
+
DOCSDIR = BASEDIR + 'docs'
|
58
|
+
PKGDIR = BASEDIR + 'pkg'
|
59
|
+
DATADIR = BASEDIR + 'data'
|
60
|
+
|
61
|
+
MANUALDIR = DOCSDIR + 'manual'
|
62
|
+
|
63
|
+
PROJECT_NAME = 'pg'
|
64
|
+
PKG_NAME = PROJECT_NAME.downcase
|
65
|
+
PKG_SUMMARY = 'A Ruby interface to the PostgreSQL RDBMS'
|
66
|
+
|
67
|
+
# Cruisecontrol stuff
|
68
|
+
CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
|
69
|
+
CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
|
70
|
+
|
71
|
+
VERSION_FILE = LIBDIR + '../ext/pg.c'
|
72
|
+
if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
|
73
|
+
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
|
74
|
+
elsif VERSION_FILE.exist?
|
75
|
+
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
|
76
|
+
end
|
77
|
+
|
78
|
+
PKG_VERSION ||= '0.0.0'
|
79
|
+
|
80
|
+
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
|
81
|
+
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
|
82
|
+
|
83
|
+
# Universal VCS constants
|
84
|
+
DEFAULT_EDITOR = 'vi'
|
85
|
+
COMMIT_MSG_FILE = 'commit-msg.txt'
|
86
|
+
FILE_INDENT = " " * 12
|
87
|
+
LOG_INDENT = " " * 3
|
88
|
+
|
89
|
+
EXTCONF = EXTDIR + 'extconf.rb'
|
90
|
+
|
91
|
+
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
92
|
+
|
93
|
+
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README LICENSE] )
|
94
|
+
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
|
95
|
+
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
|
96
|
+
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
|
97
|
+
DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
|
98
|
+
|
99
|
+
SPECDIR = BASEDIR + 'spec'
|
100
|
+
SPECLIBDIR = SPECDIR + 'lib'
|
101
|
+
SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
|
102
|
+
|
103
|
+
TESTDIR = BASEDIR + 'tests'
|
104
|
+
TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
|
105
|
+
|
106
|
+
RAKE_TASKDIR = BASEDIR + 'rake'
|
107
|
+
RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
|
108
|
+
PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
|
109
|
+
PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
|
110
|
+
|
111
|
+
RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
|
112
|
+
|
113
|
+
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
|
114
|
+
|
115
|
+
EXTRA_PKGFILES = Rake::FileList.new
|
116
|
+
EXTRA_PKGFILES.include( "#{BASEDIR}/README.*" )
|
117
|
+
EXTRA_PKGFILES.include( "#{BASEDIR}/GPL" )
|
118
|
+
EXTRA_PKGFILES.include( "#{BASEDIR}/BSD" )
|
119
|
+
EXTRA_PKGFILES.include( "#{BASEDIR}/Contributors" )
|
120
|
+
|
121
|
+
RELEASE_FILES = TEXT_FILES +
|
122
|
+
SPEC_FILES +
|
123
|
+
TEST_FILES +
|
124
|
+
BIN_FILES +
|
125
|
+
LIB_FILES +
|
126
|
+
EXT_FILES +
|
127
|
+
DATA_FILES +
|
128
|
+
RAKE_TASKLIBS +
|
129
|
+
EXTRA_PKGFILES
|
130
|
+
|
131
|
+
|
132
|
+
RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
|
133
|
+
|
134
|
+
RELEASE_ANNOUNCE_ADDRESSES = [
|
135
|
+
"Ruby-Talk List <ruby-talk@ruby-lang.org>",
|
136
|
+
]
|
137
|
+
|
138
|
+
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
|
139
|
+
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
|
140
|
+
RCOV_OPTS = [
|
141
|
+
'--exclude', RCOV_EXCLUDES,
|
142
|
+
'--xrefs',
|
143
|
+
'--save',
|
144
|
+
'--callsites',
|
145
|
+
#'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
|
146
|
+
]
|
147
|
+
|
148
|
+
|
149
|
+
### Load some task libraries that need to be loaded early
|
150
|
+
if !RAKE_TASKDIR.exist?
|
151
|
+
$stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
|
152
|
+
ans = readline( "for you? [y]" )
|
153
|
+
ans = 'y' if !ans.nil? && ans.empty?
|
154
|
+
|
155
|
+
if ans =~ /^y/i
|
156
|
+
$stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
|
157
|
+
system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
|
158
|
+
if ! $?.success?
|
159
|
+
fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
|
160
|
+
end
|
161
|
+
else
|
162
|
+
$stderr.puts "Then I'm afraid I can't continue. Best of luck."
|
163
|
+
fail "Rake tasklibs not present."
|
164
|
+
end
|
165
|
+
|
166
|
+
RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
|
167
|
+
end
|
168
|
+
|
169
|
+
require RAKE_TASKDIR + 'helpers.rb'
|
170
|
+
|
171
|
+
# Set the build ID if the mercurial executable is available
|
172
|
+
if hg = which( 'hg' )
|
173
|
+
id = IO.read('|-') or exec hg.to_s, 'id', '-n'
|
174
|
+
PKG_BUILD = 'pre' + (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
|
175
|
+
else
|
176
|
+
PKG_BUILD = 'pre0'
|
177
|
+
end
|
178
|
+
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
179
|
+
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
180
|
+
|
181
|
+
# Documentation constants
|
182
|
+
RDOCDIR = DOCSDIR + 'api'
|
183
|
+
RDOC_OPTIONS = [
|
184
|
+
'-w', '4',
|
185
|
+
'-HN',
|
186
|
+
'-i', '.',
|
187
|
+
'-m', 'README',
|
188
|
+
'-t', PKG_NAME,
|
189
|
+
'-W', 'http://bitbucket.org/ged/ruby-pg/browser/'
|
190
|
+
]
|
191
|
+
|
192
|
+
# Release constants
|
193
|
+
SMTP_HOST = "mail.faeriemud.org"
|
194
|
+
SMTP_PORT = 465 # SMTP + SSL
|
195
|
+
|
196
|
+
# Project constants
|
197
|
+
PROJECT_HOST = 'bitbucket.org'
|
198
|
+
PROJECT_PUBDIR = '/ged/ruby-pg/downloads/'
|
199
|
+
PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
200
|
+
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
201
|
+
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
202
|
+
|
203
|
+
# Gem dependencies: gemname => version
|
204
|
+
DEPENDENCIES = {
|
205
|
+
}
|
206
|
+
|
207
|
+
# Developer Gem dependencies: gemname => version
|
208
|
+
DEVELOPMENT_DEPENDENCIES = {
|
209
|
+
'rake' => '>= 0.8.7',
|
210
|
+
'rcodetools' => '>= 0.7.0.0',
|
211
|
+
'rcov' => '>= 0.8.1.2.0',
|
212
|
+
'rdoc' => '>= 2.4.3',
|
213
|
+
'RedCloth' => '>= 4.0.3',
|
214
|
+
'rspec' => '>= 1.2.6',
|
215
|
+
'termios' => '>= 0',
|
216
|
+
'text-format' => '>= 1.0.0',
|
217
|
+
'tmail' => '>= 1.2.3.1',
|
218
|
+
'diff-lcs' => '>= 1.1.2',
|
219
|
+
}
|
220
|
+
|
221
|
+
# Non-gem requirements: packagename => version
|
222
|
+
REQUIREMENTS = {
|
223
|
+
'PostgreSQL' => '>=7.4',
|
224
|
+
}
|
225
|
+
|
226
|
+
# RubyGem specification
|
227
|
+
GEMSPEC = Gem::Specification.new do |gem|
|
228
|
+
gem.name = PKG_NAME.downcase
|
229
|
+
gem.version = PKG_VERSION
|
230
|
+
|
231
|
+
gem.summary = PKG_SUMMARY
|
232
|
+
gem.description = [
|
233
|
+
"This is the extension library to access a PostgreSQL database from Ruby.",
|
234
|
+
"This library works with PostgreSQL 7.4 and later.",
|
235
|
+
].join( "\n" )
|
236
|
+
|
237
|
+
gem.authors = "Michael Granger"
|
238
|
+
gem.email = ["ged@FaerieMUD.org"]
|
239
|
+
gem.homepage = 'http://bitbucket.org/ged/ruby-pg/'
|
240
|
+
|
241
|
+
gem.has_rdoc = true
|
242
|
+
gem.rdoc_options = RDOC_OPTIONS
|
243
|
+
gem.extra_rdoc_files = %w[ChangeLog README LICENSE]
|
244
|
+
|
245
|
+
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
246
|
+
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
247
|
+
collect {|pn| File.basename(pn) }
|
248
|
+
gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
|
249
|
+
|
250
|
+
if EXTCONF.exist?
|
251
|
+
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
|
252
|
+
end
|
253
|
+
|
254
|
+
gem.files = RELEASE_FILES
|
255
|
+
gem.test_files = SPEC_FILES
|
256
|
+
|
257
|
+
DEPENDENCIES.each do |name, version|
|
258
|
+
version = '>= 0' if version.length.zero?
|
259
|
+
gem.add_runtime_dependency( name, version )
|
260
|
+
end
|
261
|
+
|
262
|
+
REQUIREMENTS.each do |name, version|
|
263
|
+
gem.requirements << [ name, version ].compact.join(' ')
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
$trace = Rake.application.options.trace ? true : false
|
268
|
+
$dryrun = Rake.application.options.dryrun ? true : false
|
269
|
+
$include_dev_dependencies = false
|
270
|
+
|
271
|
+
# Load any remaining task libraries
|
272
|
+
RAKE_TASKLIBS.each do |tasklib|
|
273
|
+
next if tasklib.to_s =~ %r{/helpers\.rb$}
|
274
|
+
begin
|
275
|
+
trace " loading tasklib %s" % [ tasklib ]
|
276
|
+
import tasklib
|
277
|
+
rescue ScriptError => err
|
278
|
+
fail "Task library '%s' failed to load: %s: %s" %
|
279
|
+
[ tasklib, err.class.name, err.message ]
|
280
|
+
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
281
|
+
rescue => err
|
282
|
+
log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
|
283
|
+
[ tasklib, err.class.name, err.message ]
|
284
|
+
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# Load any project-specific rules defined in 'Rakefile.local' if it exists
|
289
|
+
import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
|
290
|
+
|
291
|
+
|
292
|
+
#####################################################################
|
293
|
+
### T A S K S
|
294
|
+
#####################################################################
|
295
|
+
|
296
|
+
### Default task
|
297
|
+
task :default => [:clean, :local, :spec, :rdoc, :package]
|
298
|
+
|
299
|
+
### Task the local Rakefile can append to -- no-op by default
|
300
|
+
task :local
|
301
|
+
|
302
|
+
### Task: clean
|
303
|
+
CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
|
304
|
+
CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
|
305
|
+
|
306
|
+
### Task: changelog
|
307
|
+
file 'ChangeLog' do |task|
|
308
|
+
log "Updating #{task.name}"
|
309
|
+
|
310
|
+
changelog = make_changelog()
|
311
|
+
File.open( task.name, 'w' ) do |fh|
|
312
|
+
fh.print( changelog )
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
|
317
|
+
### Task: cruise (Cruisecontrol task)
|
318
|
+
desc "Cruisecontrol build"
|
319
|
+
task :cruise => [:clean, 'spec:quiet', :package] do |task|
|
320
|
+
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
|
321
|
+
artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
|
322
|
+
artifact_dir.mkpath
|
323
|
+
|
324
|
+
coverage = BASEDIR + 'coverage'
|
325
|
+
if coverage.exist? && coverage.directory?
|
326
|
+
$stderr.puts "Copying coverage stats..."
|
327
|
+
FileUtils.cp_r( 'coverage', artifact_dir )
|
328
|
+
end
|
329
|
+
|
330
|
+
$stderr.puts "Copying packages..."
|
331
|
+
FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
|
332
|
+
end
|
333
|
+
|
334
|
+
|
335
|
+
desc "Update the build system to the latest version"
|
336
|
+
task :update_build do
|
337
|
+
log "Updating the build system"
|
338
|
+
run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
|
339
|
+
log "Updating the Rakefile"
|
340
|
+
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
|
341
|
+
end
|
342
|
+
|
data/Rakefile.local
CHANGED
@@ -28,6 +28,10 @@ else
|
|
28
28
|
'i586-mingw32msvc'
|
29
29
|
end
|
30
30
|
|
31
|
+
# Make sure the spec data is packaged up with the gem
|
32
|
+
SPEC_DATA = Rake::FileList[ SPECDIR + 'data/*' ]
|
33
|
+
GEMSPEC.test_files += SPEC_DATA.to_a
|
34
|
+
|
31
35
|
|
32
36
|
#####################################################################
|
33
37
|
### T A S K S
|
@@ -0,0 +1,26 @@
|
|
1
|
+
To backend> Msg Q
|
2
|
+
To backend> "SELECT 1 AS one"
|
3
|
+
To backend> Msg complete, length 21
|
4
|
+
From backend> T
|
5
|
+
From backend (#4)> 28
|
6
|
+
From backend (#2)> 1
|
7
|
+
From backend> "one"
|
8
|
+
From backend (#4)> 0
|
9
|
+
From backend (#2)> 0
|
10
|
+
From backend (#4)> 23
|
11
|
+
From backend (#2)> 4
|
12
|
+
From backend (#4)> -1
|
13
|
+
From backend (#2)> 0
|
14
|
+
From backend> D
|
15
|
+
From backend (#4)> 11
|
16
|
+
From backend (#2)> 1
|
17
|
+
From backend (#4)> 1
|
18
|
+
From backend (1)> 1
|
19
|
+
From backend> C
|
20
|
+
From backend (#4)> 11
|
21
|
+
From backend> "SELECT"
|
22
|
+
From backend> Z
|
23
|
+
From backend (#4)> 5
|
24
|
+
From backend> Z
|
25
|
+
From backend (#4)> 5
|
26
|
+
From backend> T
|
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: 0.9.0.
|
4
|
+
version: 0.9.0.pre158
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-19 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -25,16 +25,11 @@ extensions:
|
|
25
25
|
extra_rdoc_files:
|
26
26
|
- ChangeLog
|
27
27
|
- README
|
28
|
-
- README.ja
|
29
|
-
- README.OS_X
|
30
|
-
- README.windows
|
31
28
|
- LICENSE
|
32
29
|
files:
|
30
|
+
- Rakefile
|
33
31
|
- ChangeLog
|
34
32
|
- README
|
35
|
-
- README.ja
|
36
|
-
- README.OS_X
|
37
|
-
- README.windows
|
38
33
|
- LICENSE
|
39
34
|
- spec/m17n_spec.rb
|
40
35
|
- spec/pgconn_spec.rb
|
@@ -109,3 +104,5 @@ test_files:
|
|
109
104
|
- spec/pgconn_spec.rb
|
110
105
|
- spec/pgresult_spec.rb
|
111
106
|
- spec/lib/helpers.rb
|
107
|
+
- spec/data/expected_trace.out
|
108
|
+
- spec/data/random_binary_data
|