pg 0.11.0-x86-mingw32 → 0.12.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/ChangeLog +1647 -462
- data/Contributors.rdoc +39 -0
- data/History.rdoc +61 -0
- data/Manifest.txt +43 -0
- data/README.OS_X.rdoc +68 -0
- data/README.ja.rdoc +7 -0
- data/{README → README.rdoc} +38 -18
- data/{README.windows → README.windows.rdoc} +23 -31
- data/Rakefile +104 -318
- data/Rakefile.cross +234 -0
- data/ext/compat.c +2 -2
- data/ext/extconf.rb +10 -2
- data/ext/pg.c +223 -43
- data/ext/vc/pg.sln +26 -0
- data/ext/vc/pg_18/pg.vcproj +216 -0
- data/ext/vc/pg_19/pg_19.vcproj +209 -0
- data/lib/1.8/pg_ext.so +0 -0
- data/lib/1.9/pg_ext.so +0 -0
- data/lib/pg.rb +5 -7
- data/misc/openssl-pg-segfault.rb +31 -0
- data/sample/async_api.rb +109 -0
- data/sample/async_copyto.rb +39 -0
- data/sample/copyfrom.rb +81 -0
- data/sample/copyto.rb +19 -0
- data/sample/cursor.rb +21 -0
- data/sample/losample.rb +69 -0
- data/sample/notify_wait.rb +43 -0
- data/sample/psql.rb +1181 -0
- data/sample/psqlHelp.rb +158 -0
- data/sample/test1.rb +60 -0
- data/sample/test2.rb +44 -0
- data/sample/test4.rb +71 -0
- data/sample/test_binary_values.rb +35 -0
- data/spec/lib/helpers.rb +6 -4
- data/spec/m17n_spec.rb +2 -2
- data/spec/pgconn_spec.rb +51 -6
- data/spec/pgresult_spec.rb +30 -4
- metadata +147 -86
- data.tar.gz.sig +0 -3
- data/Contributors +0 -32
- data/README.OS_X +0 -19
- data/README.ja +0 -183
- data/Rakefile.local +0 -312
- data/rake/191_compat.rb +0 -26
- data/rake/dependencies.rb +0 -76
- data/rake/documentation.rb +0 -123
- data/rake/helpers.rb +0 -502
- data/rake/hg.rb +0 -318
- data/rake/manual.rb +0 -787
- data/rake/packaging.rb +0 -129
- data/rake/publishing.rb +0 -341
- data/rake/style.rb +0 -62
- data/rake/svn.rb +0 -668
- data/rake/testing.rb +0 -152
- data/rake/verifytask.rb +0 -64
- metadata.gz.sig +0 -3
data/Rakefile.local
DELETED
@@ -1,312 +0,0 @@
|
|
1
|
-
#!rake
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'rbconfig'
|
6
|
-
|
7
|
-
MISCDIR = BASEDIR + 'misc'
|
8
|
-
|
9
|
-
EXT_MAKEFILE = EXTDIR + 'Makefile'
|
10
|
-
EXT_SOURCES = FileList[ EXTDIR + '*.c' ]
|
11
|
-
EXT_SO = EXTDIR + "pg_ext.#{CONFIG['DLEXT']}"
|
12
|
-
|
13
|
-
NUM_CPUS = if File.exist?('/proc/cpuinfo')
|
14
|
-
File.read('/proc/cpuinfo').scan('processor').length
|
15
|
-
elsif RUBY_PLATFORM.include?( 'darwin' )
|
16
|
-
`system_profiler SPHardwareDataType | grep 'Cores' | awk '{print $5}'`.chomp
|
17
|
-
else
|
18
|
-
1
|
19
|
-
end
|
20
|
-
|
21
|
-
# Cross-compilation constants
|
22
|
-
OPENSSL_VERSION = ENV['OPENSSL_VERSION'] || '1.0.0d'
|
23
|
-
POSTGRESQL_VERSION = ENV['POSTGRESQL_VERSION'] || '9.0.3'
|
24
|
-
|
25
|
-
COMPILE_HOME = Pathname( "~/.rake-compiler" ).expand_path
|
26
|
-
STATIC_SOURCESDIR = COMPILE_HOME + 'sources'
|
27
|
-
STATIC_BUILDDIR = COMPILE_HOME + 'builds'
|
28
|
-
|
29
|
-
# Static OpenSSL build vars
|
30
|
-
STATIC_OPENSSL_BUILDDIR = STATIC_BUILDDIR + "openssl-#{OPENSSL_VERSION}"
|
31
|
-
|
32
|
-
OPENSSL_SOURCE_URI =
|
33
|
-
URI( "http://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" )
|
34
|
-
OPENSSL_TARBALL = STATIC_SOURCESDIR + File.basename( OPENSSL_SOURCE_URI.path )
|
35
|
-
OPENSSL_MAKEFILE = STATIC_OPENSSL_BUILDDIR + 'Makefile'
|
36
|
-
|
37
|
-
LIBSSLEAY32 = STATIC_OPENSSL_BUILDDIR + 'libssleay32.a'
|
38
|
-
LIBEAY32 = STATIC_OPENSSL_BUILDDIR + 'libeay32.a'
|
39
|
-
|
40
|
-
OPENSSL_PATCHES = Rake::FileList[ MISCDIR + "openssl-#{OPENSSL_VERSION}.*.patch" ]
|
41
|
-
|
42
|
-
# Static PostgreSQL build vars
|
43
|
-
STATIC_POSTGRESQL_BUILDDIR = STATIC_BUILDDIR + "postgresql-#{POSTGRESQL_VERSION}"
|
44
|
-
POSTGRESQL_SOURCE_URI = begin
|
45
|
-
uristring = "http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/" +
|
46
|
-
"v%s/postgresql-%s.tar.gz" % [ POSTGRESQL_VERSION, POSTGRESQL_VERSION ]
|
47
|
-
URI( uristring )
|
48
|
-
end
|
49
|
-
POSTGRESQL_TARBALL = STATIC_SOURCESDIR + File.basename( POSTGRESQL_SOURCE_URI.path )
|
50
|
-
|
51
|
-
STATIC_POSTGRESQL_SRCDIR = STATIC_POSTGRESQL_BUILDDIR + 'src'
|
52
|
-
STATIC_POSTGRESQL_LIBDIR = STATIC_POSTGRESQL_SRCDIR + 'interfaces/libpq'
|
53
|
-
STATIC_POSTGRESQL_INCDIR = STATIC_POSTGRESQL_SRCDIR + 'include'
|
54
|
-
|
55
|
-
POSTGRESQL_GLOBAL_MAKEFILE = STATIC_POSTGRESQL_SRCDIR + 'Makefile.global'
|
56
|
-
POSTGRESQL_SHLIB_MAKEFILE = STATIC_POSTGRESQL_SRCDIR + 'Makefile.shlib'
|
57
|
-
POSTGRESQL_SHLIB_MF_ORIG = STATIC_POSTGRESQL_SRCDIR + 'Makefile.shlib.orig'
|
58
|
-
POSTGRESQL_LIB = STATIC_POSTGRESQL_LIBDIR + 'libpq.a'
|
59
|
-
|
60
|
-
CROSS_PREFIX = if RUBY_PLATFORM.include?( 'darwin' )
|
61
|
-
'i386-mingw32'
|
62
|
-
else
|
63
|
-
'i586-mingw32msvc'
|
64
|
-
end
|
65
|
-
|
66
|
-
# Make sure the spec data is packaged up with the gem
|
67
|
-
SPEC_DATA = Rake::FileList[ SPECDIR + 'data/*' ]
|
68
|
-
GEMSPEC.test_files += SPEC_DATA.to_a
|
69
|
-
|
70
|
-
# Clean up any testing database directories
|
71
|
-
TESTING_TMPDIRS = Rake::FileList[ "#{BASEDIR}/tmp_test_*" ]
|
72
|
-
CLOBBER.include( STATIC_SOURCESDIR.to_s, *TESTING_TMPDIRS )
|
73
|
-
|
74
|
-
# clean intermediate files and folders
|
75
|
-
CLEAN.include( STATIC_BUILDDIR.to_s )
|
76
|
-
|
77
|
-
|
78
|
-
#####################################################################
|
79
|
-
### T A S K S
|
80
|
-
#####################################################################
|
81
|
-
|
82
|
-
# Make both the default task and the spec task depend on building the extension
|
83
|
-
task :local => :compile
|
84
|
-
task :spec => :compile
|
85
|
-
namespace :spec do
|
86
|
-
task :doc => [ :compile ]
|
87
|
-
task :quiet => [ :compile ]
|
88
|
-
task :html => [ :compile ]
|
89
|
-
task :text => [ :compile ]
|
90
|
-
end
|
91
|
-
|
92
|
-
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2'
|
93
|
-
|
94
|
-
begin
|
95
|
-
require 'rake/clean'
|
96
|
-
require 'rake/extensiontask'
|
97
|
-
require 'rake/extensioncompiler'
|
98
|
-
|
99
|
-
Rake::ExtensionTask.new do |ext|
|
100
|
-
ext.name = 'pg_ext'
|
101
|
-
ext.gem_spec = GEMSPEC
|
102
|
-
ext.ext_dir = EXTDIR.to_s
|
103
|
-
ext.lib_dir = LIBDIR.to_s
|
104
|
-
ext.source_pattern = "*.{c,h}"
|
105
|
-
|
106
|
-
# If there's an explicit 'compile' argument, use everything after it as options.
|
107
|
-
if offset = ARGV.index( 'compile' )
|
108
|
-
trace "config options = %p" % [ ARGV[(offset + 1)..-1] ]
|
109
|
-
ext.config_options = ARGV[ (offset + 1)..-1 ]
|
110
|
-
# Otherwise, just grab everything from the first option onward
|
111
|
-
elsif offset = ARGV.index( ARGV.find {|arg| arg =~ /^--/ } )
|
112
|
-
trace "config options = %p" % [ ARGV[offset..-1] ]
|
113
|
-
ext.config_options = ARGV[ offset..-1 ]
|
114
|
-
else
|
115
|
-
trace "No config options (ARGV = %p)" % [ ARGV ]
|
116
|
-
end
|
117
|
-
|
118
|
-
ext.cross_compile = true
|
119
|
-
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
120
|
-
|
121
|
-
# configure options only for cross compile
|
122
|
-
ext.cross_config_options += [
|
123
|
-
"--with-pg-include=#{STATIC_POSTGRESQL_LIBDIR}",
|
124
|
-
"--with-opt-include=#{STATIC_POSTGRESQL_INCDIR}",
|
125
|
-
"--with-pg-lib=#{STATIC_POSTGRESQL_LIBDIR}",
|
126
|
-
"--with-opt-lib=#{STATIC_OPENSSL_BUILDDIR}",
|
127
|
-
"--enable-static-build",
|
128
|
-
]
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
#####################################################################
|
135
|
-
### C R O S S - C O M P I L A T I O N - T A S K S
|
136
|
-
#####################################################################
|
137
|
-
|
138
|
-
|
139
|
-
directory STATIC_SOURCESDIR.to_s
|
140
|
-
|
141
|
-
#
|
142
|
-
# Static OpenSSL build tasks
|
143
|
-
#
|
144
|
-
directory STATIC_OPENSSL_BUILDDIR.to_s
|
145
|
-
|
146
|
-
# openssl source file should be stored there
|
147
|
-
file OPENSSL_TARBALL => STATIC_SOURCESDIR do |t|
|
148
|
-
download( OPENSSL_SOURCE_URI, t.name )
|
149
|
-
end
|
150
|
-
|
151
|
-
# Extract the openssl builds
|
152
|
-
file STATIC_OPENSSL_BUILDDIR => OPENSSL_TARBALL do |t|
|
153
|
-
trace "extracting %s to %s" % [ OPENSSL_TARBALL, STATIC_OPENSSL_BUILDDIR.parent ]
|
154
|
-
STATIC_OPENSSL_BUILDDIR.mkpath
|
155
|
-
run 'tar', '-xzf', OPENSSL_TARBALL.to_s, '-C', STATIC_OPENSSL_BUILDDIR.parent.to_s
|
156
|
-
OPENSSL_MAKEFILE.unlink if OPENSSL_MAKEFILE.exist?
|
157
|
-
|
158
|
-
OPENSSL_PATCHES.each do |patchfile|
|
159
|
-
trace " applying patch #{patchfile}..."
|
160
|
-
run 'patch', '-Np1', '-d', STATIC_OPENSSL_BUILDDIR.to_s,
|
161
|
-
'-i', File.expand_path( patchfile, BASEDIR )
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
CMD_PRELUDE = [
|
166
|
-
'env',
|
167
|
-
"CC=#{CROSS_PREFIX}-gcc",
|
168
|
-
"CFLAGS=-DDSO_WIN32",
|
169
|
-
"AR=#{CROSS_PREFIX}-ar",
|
170
|
-
"RANLIB=#{CROSS_PREFIX}-ranlib"
|
171
|
-
]
|
172
|
-
|
173
|
-
|
174
|
-
# generate the makefile in a clean build location
|
175
|
-
file OPENSSL_MAKEFILE => STATIC_OPENSSL_BUILDDIR do |t|
|
176
|
-
Dir.chdir( STATIC_OPENSSL_BUILDDIR ) do
|
177
|
-
cmd = CMD_PRELUDE.dup
|
178
|
-
cmd << "./Configure" << 'mingw'
|
179
|
-
|
180
|
-
run( *cmd )
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
desc "compile static openssl libraries"
|
185
|
-
task :openssl_libs => [ LIBSSLEAY32, LIBEAY32 ]
|
186
|
-
|
187
|
-
task :compile_static_openssl => OPENSSL_MAKEFILE do |t|
|
188
|
-
Dir.chdir( STATIC_OPENSSL_BUILDDIR ) do
|
189
|
-
cmd = CMD_PRELUDE.dup
|
190
|
-
cmd << 'make' << "-j#{NUM_CPUS}" << 'build_libs'
|
191
|
-
|
192
|
-
run( *cmd )
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
desc "compile static #{LIBEAY32}"
|
197
|
-
file LIBEAY32 => :compile_static_openssl do |t|
|
198
|
-
FileUtils.cp( STATIC_OPENSSL_BUILDDIR + 'libcrypto.a', LIBEAY32.to_s )
|
199
|
-
end
|
200
|
-
|
201
|
-
desc "compile static #{LIBSSLEAY32}"
|
202
|
-
file LIBSSLEAY32 => :compile_static_openssl do |t|
|
203
|
-
FileUtils.cp( STATIC_OPENSSL_BUILDDIR + 'libssl.a', LIBSSLEAY32.to_s )
|
204
|
-
end
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
#
|
209
|
-
# Static PostgreSQL build tasks
|
210
|
-
#
|
211
|
-
directory STATIC_POSTGRESQL_BUILDDIR.to_s
|
212
|
-
|
213
|
-
|
214
|
-
# postgresql source file should be stored there
|
215
|
-
file POSTGRESQL_TARBALL => STATIC_SOURCESDIR do |t|
|
216
|
-
download( POSTGRESQL_SOURCE_URI, t.name )
|
217
|
-
end
|
218
|
-
|
219
|
-
# Extract the postgresql sources
|
220
|
-
file STATIC_POSTGRESQL_BUILDDIR => POSTGRESQL_TARBALL do |t|
|
221
|
-
trace "extracting %s to %s" % [ POSTGRESQL_TARBALL, STATIC_POSTGRESQL_BUILDDIR.parent ]
|
222
|
-
STATIC_POSTGRESQL_BUILDDIR.mkpath
|
223
|
-
run 'tar', '-xzf', POSTGRESQL_TARBALL.to_s, '-C', STATIC_POSTGRESQL_BUILDDIR.parent.to_s
|
224
|
-
mv POSTGRESQL_SHLIB_MAKEFILE, POSTGRESQL_SHLIB_MF_ORIG
|
225
|
-
end
|
226
|
-
|
227
|
-
# generate the makefile in a clean build location
|
228
|
-
file POSTGRESQL_GLOBAL_MAKEFILE => [ STATIC_POSTGRESQL_BUILDDIR, :openssl_libs ] do |t|
|
229
|
-
options = [
|
230
|
-
'--target=i386-mingw32',
|
231
|
-
"--host=#{Rake::ExtensionCompiler.mingw_host}",
|
232
|
-
'--with-openssl',
|
233
|
-
'--without-zlib',
|
234
|
-
'--disable-shared',
|
235
|
-
]
|
236
|
-
|
237
|
-
Dir.chdir( STATIC_POSTGRESQL_BUILDDIR ) do
|
238
|
-
configure_path = STATIC_POSTGRESQL_BUILDDIR + 'configure'
|
239
|
-
cmd = [ configure_path.to_s, *options ]
|
240
|
-
cmd << "CFLAGS=-L#{STATIC_OPENSSL_BUILDDIR}"
|
241
|
-
cmd << "LDFLAGS=-L#{STATIC_OPENSSL_BUILDDIR}"
|
242
|
-
cmd << "LDFLAGS_SL=-L#{STATIC_OPENSSL_BUILDDIR}"
|
243
|
-
cmd << "LIBS=-lwsock32 -lws2_32 -lgdi32"
|
244
|
-
cmd << "CPPFLAGS=-I#{STATIC_OPENSSL_BUILDDIR}/include"
|
245
|
-
|
246
|
-
run( *cmd )
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
|
251
|
-
# patch the Makefile.shlib -- depend on the build dir so it's only
|
252
|
-
# rewritten if the tarball is re-extracted.
|
253
|
-
file POSTGRESQL_SHLIB_MAKEFILE => POSTGRESQL_SHLIB_MF_ORIG do |t|
|
254
|
-
tf = Tempfile.new( POSTGRESQL_SHLIB_MAKEFILE.basename )
|
255
|
-
POSTGRESQL_SHLIB_MF_ORIG.open( File::RDONLY ) do |ifh|
|
256
|
-
ifh.each_line do |line|
|
257
|
-
tf.print( line.sub(/^(\s*haslibarule\s*=\s*yes)/, "# \\1 ") )
|
258
|
-
end
|
259
|
-
end
|
260
|
-
tf.close
|
261
|
-
|
262
|
-
FileUtils.mv( tf.path, t.name, :verbose => $trace )
|
263
|
-
end
|
264
|
-
|
265
|
-
|
266
|
-
# make libpq.a
|
267
|
-
task POSTGRESQL_LIB => [ POSTGRESQL_GLOBAL_MAKEFILE, POSTGRESQL_SHLIB_MAKEFILE ] do |t|
|
268
|
-
Dir.chdir( POSTGRESQL_LIB.dirname ) do
|
269
|
-
sh 'make', "-j#{NUM_CPUS}", POSTGRESQL_LIB.basename.to_s, 'PORTNAME=win32'
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
|
274
|
-
#desc 'compile static libpg.a'
|
275
|
-
task :static_libpq => POSTGRESQL_LIB
|
276
|
-
|
277
|
-
desc 'cross compile pg for win32'
|
278
|
-
task :cross do
|
279
|
-
ENV['CROSS_COMPILING'] = 'yes'
|
280
|
-
end
|
281
|
-
task :cross => [ :mingw32, :static_libpq ]
|
282
|
-
|
283
|
-
task :mingw32 do
|
284
|
-
# Use Rake::ExtensionCompiler helpers to find the proper host
|
285
|
-
unless Rake::ExtensionCompiler.mingw_host then
|
286
|
-
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
287
|
-
warn "Please refer to your distribution/package manager documentation about installation."
|
288
|
-
fail
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
rescue LoadError => err
|
293
|
-
task :no_rake_compiler do
|
294
|
-
log "You'll need to install rake-compiler to compile this."
|
295
|
-
fail
|
296
|
-
end
|
297
|
-
|
298
|
-
task :compile => :no_rake_compiler
|
299
|
-
task :cross => :no_rake_compiler
|
300
|
-
task :mingw32 => :no_rake_compiler
|
301
|
-
task :static_libpq => :no_rake_compiler
|
302
|
-
end
|
303
|
-
|
304
|
-
|
305
|
-
desc "Stop any Postmaster instances that remain after testing."
|
306
|
-
task :cleanup_testing_dbs do
|
307
|
-
require 'spec/lib/helpers'
|
308
|
-
PgTestingHelpers.stop_existing_postmasters()
|
309
|
-
Rake::Task[:clean].invoke
|
310
|
-
end
|
311
|
-
|
312
|
-
|
data/rake/191_compat.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# 1.9.1 fixes
|
2
|
-
|
3
|
-
|
4
|
-
# Make Pathname compatible with 1.8.7 Pathname.
|
5
|
-
unless Pathname.instance_methods.include?( :=~ )
|
6
|
-
class Pathname
|
7
|
-
def self::glob( *args ) # :yield: p
|
8
|
-
args = args.collect {|p| p.to_s }
|
9
|
-
if block_given?
|
10
|
-
Dir.glob(*args) {|f| yield self.new(f) }
|
11
|
-
else
|
12
|
-
Dir.glob(*args).map {|f| self.new(f) }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def =~( other )
|
17
|
-
self.to_s =~ other
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_str
|
21
|
-
self.to_s
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
|
data/rake/dependencies.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Dependency-checking and Installation Rake Tasks
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'rubygems/dependency_installer'
|
7
|
-
require 'rubygems/source_index'
|
8
|
-
require 'rubygems/requirement'
|
9
|
-
require 'rubygems/doc_manager'
|
10
|
-
|
11
|
-
### Install the specified +gems+ if they aren't already installed.
|
12
|
-
def install_gems( gems )
|
13
|
-
|
14
|
-
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
|
15
|
-
:generate_rdoc => true,
|
16
|
-
:generate_ri => true,
|
17
|
-
:install_dir => Gem.dir,
|
18
|
-
:format_executable => false,
|
19
|
-
:test => false,
|
20
|
-
:version => Gem::Requirement.default,
|
21
|
-
})
|
22
|
-
|
23
|
-
# Check for root
|
24
|
-
if Process.euid != 0
|
25
|
-
$stderr.puts "This probably won't work, as you aren't root, but I'll try anyway"
|
26
|
-
end
|
27
|
-
|
28
|
-
gemindex = Gem::SourceIndex.from_installed_gems
|
29
|
-
|
30
|
-
gems.each do |gemname, reqstring|
|
31
|
-
requirement = Gem::Requirement.new( reqstring )
|
32
|
-
trace "requirement is: %p" % [ requirement ]
|
33
|
-
|
34
|
-
trace "Searching for an installed #{gemname}..."
|
35
|
-
specs = gemindex.find_name( gemname )
|
36
|
-
trace "...found %d specs: %s" %
|
37
|
-
[ specs.length, specs.collect {|s| "%s %s" % [s.name, s.version] }.join(', ') ]
|
38
|
-
|
39
|
-
if spec = specs.find {|spec| requirement.satisfied_by?(spec.version) }
|
40
|
-
log "Version %s of %s is already installed (needs %s); skipping..." %
|
41
|
-
[ spec.version, spec.name, requirement ]
|
42
|
-
next
|
43
|
-
end
|
44
|
-
|
45
|
-
rgv = Gem::Version.new( Gem::RubyGemsVersion )
|
46
|
-
installer = nil
|
47
|
-
|
48
|
-
log "Trying to install #{gemname.inspect} #{requirement}..."
|
49
|
-
if rgv >= Gem::Version.new( '1.1.1' )
|
50
|
-
installer = Gem::DependencyInstaller.new
|
51
|
-
installer.install( gemname, requirement )
|
52
|
-
else
|
53
|
-
installer = Gem::DependencyInstaller.new( gemname )
|
54
|
-
installer.install
|
55
|
-
end
|
56
|
-
|
57
|
-
installer.installed_gems.each do |spec|
|
58
|
-
log "Installed: %s" % [ spec.full_name ]
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
### Task: install runtime dependencies
|
66
|
-
desc "Install runtime dependencies as gems"
|
67
|
-
task :install_dependencies do
|
68
|
-
install_gems( DEPENDENCIES )
|
69
|
-
end
|
70
|
-
|
71
|
-
### Task: install gems for development tasks
|
72
|
-
desc "Install development dependencies as gems"
|
73
|
-
task :install_dev_dependencies do
|
74
|
-
install_gems( DEVELOPMENT_DEPENDENCIES )
|
75
|
-
end
|
76
|
-
|
data/rake/documentation.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Documentation Rake tasks
|
3
|
-
#
|
4
|
-
|
5
|
-
require 'rake/clean'
|
6
|
-
|
7
|
-
|
8
|
-
# Append docs/lib to the load path if it exists for documentation
|
9
|
-
# helpers.
|
10
|
-
DOCSLIB = DOCSDIR + 'lib'
|
11
|
-
$LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
|
12
|
-
|
13
|
-
# Make relative string paths of all the stuff we need to generate docs for
|
14
|
-
DOCFILES = Rake::FileList[ LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files ]
|
15
|
-
|
16
|
-
# Documentation coverage constants
|
17
|
-
COVERAGE_DIR = BASEDIR + 'coverage'
|
18
|
-
COVERAGE_REPORT = COVERAGE_DIR + 'documentation.txt'
|
19
|
-
|
20
|
-
|
21
|
-
# Prefer YARD, fallback to RDoc
|
22
|
-
begin
|
23
|
-
require 'yard'
|
24
|
-
require 'yard/rake/yardoc_task'
|
25
|
-
|
26
|
-
# Undo the lazy-assed monkeypatch yard/globals.rb installs and
|
27
|
-
# re-install them as mixins as they should have been from the
|
28
|
-
# start
|
29
|
-
# <metamonkeypatch>
|
30
|
-
class Object
|
31
|
-
remove_method :log
|
32
|
-
remove_method :P
|
33
|
-
end
|
34
|
-
|
35
|
-
module YardGlobals
|
36
|
-
def P(namespace, name = nil)
|
37
|
-
namespace, name = nil, namespace if name.nil?
|
38
|
-
YARD::Registry.resolve(namespace, name, false, true)
|
39
|
-
end
|
40
|
-
|
41
|
-
def log
|
42
|
-
YARD::Logger.instance
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class YARD::CLI::Base; include YardGlobals; end
|
47
|
-
class YARD::CLI::Command; include YardGlobals; end
|
48
|
-
class YARD::Parser::SourceParser; extend YardGlobals; include YardGlobals; end
|
49
|
-
class YARD::Parser::CParser; include YardGlobals; end
|
50
|
-
class YARD::CodeObjects::Base; include YardGlobals; end
|
51
|
-
class YARD::Handlers::Base; include YardGlobals; end
|
52
|
-
class YARD::Handlers::Processor; include YardGlobals; end
|
53
|
-
class YARD::Serializers::Base; include YardGlobals; end
|
54
|
-
class YARD::RegistryStore; include YardGlobals; end
|
55
|
-
class YARD::Docstring; include YardGlobals; end
|
56
|
-
module YARD::Templates::Helpers::ModuleHelper; include YardGlobals; end
|
57
|
-
module YARD::Templates::Helpers::HtmlHelper; include YardGlobals; end
|
58
|
-
|
59
|
-
if vvec(RUBY_VERSION) >= vvec("1.9.1")
|
60
|
-
# Monkeypatched to allow more than two '#' characters at the beginning
|
61
|
-
# of the comment line.
|
62
|
-
# Patched from yard-0.5.8
|
63
|
-
require 'yard/parser/ruby/ruby_parser'
|
64
|
-
class YARD::Parser::Ruby::RipperParser < Ripper
|
65
|
-
def on_comment(comment)
|
66
|
-
visit_ns_token(:comment, comment)
|
67
|
-
case comment
|
68
|
-
when /\A# @group\s+(.+)\s*\Z/
|
69
|
-
@groups.unshift [lineno, $1]
|
70
|
-
return
|
71
|
-
when /\A# @endgroup\s*\Z/
|
72
|
-
@groups.unshift [lineno, nil]
|
73
|
-
return
|
74
|
-
end
|
75
|
-
|
76
|
-
comment = comment.gsub(/^\#+\s{0,1}/, '').chomp
|
77
|
-
append_comment = @comments[lineno - 1]
|
78
|
-
|
79
|
-
if append_comment && @comments_last_column == column
|
80
|
-
@comments.delete(lineno - 1)
|
81
|
-
comment = append_comment + "\n" + comment
|
82
|
-
end
|
83
|
-
|
84
|
-
@comments[lineno] = comment
|
85
|
-
@comments_last_column = column
|
86
|
-
end
|
87
|
-
end # class YARD::Parser::Ruby::RipperParser
|
88
|
-
end
|
89
|
-
|
90
|
-
# </metamonkeypatch>
|
91
|
-
|
92
|
-
YARD_OPTIONS = [] unless defined?( YARD_OPTIONS )
|
93
|
-
|
94
|
-
yardoctask = YARD::Rake::YardocTask.new( :apidocs ) do |task|
|
95
|
-
task.files = DOCFILES
|
96
|
-
task.options = YARD_OPTIONS
|
97
|
-
task.options << '--debug' << '--verbose' if $trace
|
98
|
-
end
|
99
|
-
yardoctask.before = lambda {
|
100
|
-
trace "Calling yardoc like:",
|
101
|
-
" yardoc %s" % [ quotelist(yardoctask.options + yardoctask.files).join(' ') ]
|
102
|
-
}
|
103
|
-
|
104
|
-
YARDOC_CACHE = BASEDIR + '.yardoc'
|
105
|
-
CLOBBER.include( YARDOC_CACHE.to_s )
|
106
|
-
|
107
|
-
rescue LoadError
|
108
|
-
require 'rdoc/task'
|
109
|
-
|
110
|
-
desc "Build API documentation in #{API_DOCSDIR}"
|
111
|
-
RDoc::Task.new( :apidocs ) do |task|
|
112
|
-
task.main = "README"
|
113
|
-
task.rdoc_files.include( DOCFILES )
|
114
|
-
task.rdoc_dir = API_DOCSDIR.to_s
|
115
|
-
task.options = RDOC_OPTIONS
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
# Need the DOCFILES to exist to build the API docs
|
120
|
-
task :apidocs => DOCFILES
|
121
|
-
|
122
|
-
CLEAN.include( API_DOCSDIR.to_s )
|
123
|
-
|