do_postgres 0.10.0-x86-mswin32-60 → 0.10.1-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +22 -0
- data/LICENSE +1 -1
- data/README.markdown +106 -3
- data/Rakefile +56 -9
- data/ext/do_postgres/compat.h +55 -0
- data/ext/{do_postgres_ext/do_postgres_ext.c → do_postgres/do_postgres.c} +42 -49
- data/ext/{do_postgres_ext → do_postgres}/error.h +0 -0
- data/ext/{do_postgres_ext → do_postgres}/extconf.rb +4 -3
- data/ext/{do_postgres_ext → do_postgres}/pg_config.h +0 -0
- data/lib/do_postgres/1.8/do_postgres.so +0 -0
- data/lib/do_postgres/1.9/do_postgres.so +0 -0
- data/lib/do_postgres/version.rb +1 -1
- data/lib/do_postgres.rb +12 -16
- data/spec/command_spec.rb +2 -2
- data/spec/connection_spec.rb +22 -7
- data/spec/encoding_spec.rb +2 -1
- data/spec/reader_spec.rb +1 -1
- data/spec/result_spec.rb +12 -13
- data/spec/spec_helper.rb +27 -36
- data/spec/typecast/array_spec.rb +1 -1
- data/spec/typecast/bigdecimal_spec.rb +2 -2
- data/spec/typecast/boolean_spec.rb +2 -2
- data/spec/typecast/byte_array_spec.rb +1 -1
- data/spec/typecast/class_spec.rb +1 -1
- data/spec/typecast/date_spec.rb +2 -2
- data/spec/typecast/datetime_spec.rb +2 -2
- data/spec/typecast/float_spec.rb +2 -2
- data/spec/typecast/integer_spec.rb +1 -1
- data/spec/typecast/nil_spec.rb +3 -3
- data/spec/typecast/other_spec.rb +8 -0
- data/spec/typecast/range_spec.rb +1 -1
- data/spec/typecast/string_spec.rb +1 -1
- data/spec/typecast/time_spec.rb +1 -1
- data/tasks/compile.rake +81 -0
- data/tasks/release.rake +12 -71
- data/tasks/retrieve.rake +5 -9
- data/tasks/spec.rake +19 -15
- metadata +76 -39
- data/HISTORY.markdown +0 -12
- data/Manifest.txt +0 -34
- data/lib/do_postgres_ext.so +0 -0
- data/spec/lib/rspec_immediate_feedback_formatter.rb +0 -3
- data/tasks/gem.rake +0 -8
- data/tasks/install.rake +0 -15
- data/tasks/native.rake +0 -35
data/spec/reader_spec.rb
CHANGED
data/spec/result_spec.rb
CHANGED
@@ -4,24 +4,24 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/result_spec'
|
5
5
|
|
6
6
|
describe DataObjects::Postgres::Result do
|
7
|
-
|
7
|
+
behaves_like 'a Result'
|
8
8
|
|
9
|
-
|
9
|
+
after do
|
10
10
|
setup_test_environment
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'without using RETURNING' do
|
14
14
|
|
15
|
-
before
|
15
|
+
before do
|
16
16
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
17
17
|
@result = @connection.create_command("INSERT INTO users (name) VALUES (?)").execute_non_query("monkey")
|
18
18
|
end
|
19
19
|
|
20
|
-
after
|
20
|
+
after do
|
21
21
|
@connection.close
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'should respond to #affected_rows' do @result.should.respond_to(:affected_rows) end
|
25
25
|
|
26
26
|
describe 'affected_rows' do
|
27
27
|
|
@@ -31,19 +31,18 @@ describe DataObjects::Postgres::Result do
|
|
31
31
|
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'should respond to #insert_id' do @result.should.respond_to(:insert_id) end
|
35
35
|
|
36
36
|
describe 'insert_id' do
|
37
37
|
|
38
38
|
it 'should return nil' do
|
39
|
-
@result.insert_id.should
|
39
|
+
@result.insert_id.should.be.nil
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should be retrievable through curr_val' do
|
43
|
-
# This is actually the 4th record inserted
|
44
43
|
reader = @connection.create_command("SELECT currval('users_id_seq')").execute_reader
|
45
44
|
reader.next!
|
46
|
-
reader.values.first.should ==
|
45
|
+
reader.values.first.should == 2
|
47
46
|
end
|
48
47
|
|
49
48
|
end
|
@@ -52,16 +51,16 @@ describe DataObjects::Postgres::Result do
|
|
52
51
|
|
53
52
|
describe 'when using RETURNING' do
|
54
53
|
|
55
|
-
before
|
54
|
+
before do
|
56
55
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
57
56
|
@result = @connection.create_command("INSERT INTO users (name) VALUES (?) RETURNING id").execute_non_query("monkey")
|
58
57
|
end
|
59
58
|
|
60
|
-
after
|
59
|
+
after do
|
61
60
|
@connection.close
|
62
61
|
end
|
63
62
|
|
64
|
-
it
|
63
|
+
it 'should respond to #affected_rows' do @result.should.respond_to(:affected_rows) end
|
65
64
|
|
66
65
|
describe 'affected_rows' do
|
67
66
|
|
@@ -71,7 +70,7 @@ describe DataObjects::Postgres::Result do
|
|
71
70
|
|
72
71
|
end
|
73
72
|
|
74
|
-
it
|
73
|
+
it 'should respond to #insert_id' do @result.should.respond_to(:insert_id) end
|
75
74
|
|
76
75
|
describe 'insert_id' do
|
77
76
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,55 +2,44 @@ $TESTING=true
|
|
2
2
|
JRUBY = RUBY_PLATFORM =~ /java/
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
-
|
6
|
-
gem 'rspec', '>1.1.12'
|
7
|
-
require 'spec'
|
8
|
-
|
9
5
|
require 'date'
|
10
6
|
require 'ostruct'
|
11
|
-
require 'pathname'
|
12
7
|
require 'fileutils'
|
8
|
+
require 'win32console' if RUBY_PLATFORM =~ /mingw|mswin/
|
9
|
+
|
10
|
+
driver_lib = File.expand_path('../../lib', __FILE__)
|
11
|
+
$LOAD_PATH.unshift(driver_lib) unless $LOAD_PATH.include?(driver_lib)
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
$LOAD_PATH.unshift do_lib_path unless $LOAD_PATH.include?(do_lib_path)
|
21
|
-
|
22
|
-
if JRUBY
|
23
|
-
jdbc_lib_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'do_jdbc', 'lib'))
|
24
|
-
$LOAD_PATH.unshift jdbc_lib_path unless $LOAD_PATH.include?(jdbc_lib_path)
|
25
|
-
require 'do_jdbc'
|
13
|
+
# Prepend data_objects/do_jdbc in the repository to the load path.
|
14
|
+
# DO NOT USE installed gems, except when running the specs from gem.
|
15
|
+
repo_root = File.expand_path('../../..', __FILE__)
|
16
|
+
(['data_objects'] << ('do_jdbc' if JRUBY)).compact.each do |lib|
|
17
|
+
lib_path = "#{repo_root}/#{lib}/lib"
|
18
|
+
$LOAD_PATH.unshift(lib_path) if File.directory?(lib_path) && !$LOAD_PATH.include?(lib_path)
|
26
19
|
end
|
27
20
|
|
28
21
|
require 'data_objects'
|
29
|
-
|
30
|
-
DATAOBJECTS_SPEC_ROOT = Pathname(__FILE__).dirname.parent.parent + 'data_objects' + 'spec'
|
31
|
-
Pathname.glob((DATAOBJECTS_SPEC_ROOT + 'lib/**/*.rb').to_s).each { |f| require f }
|
22
|
+
require 'data_objects/spec/bacon'
|
32
23
|
require 'do_postgres'
|
33
24
|
|
34
|
-
|
35
|
-
FileUtils.mkdir_p(File.dirname(log_path))
|
36
|
-
|
37
|
-
DataObjects::Postgres.logger = DataObjects::Logger.new(log_path, :debug)
|
38
|
-
|
25
|
+
DataObjects::Postgres.logger = DataObjects::Logger.new(STDOUT, :off)
|
39
26
|
at_exit { DataObjects.logger.flush }
|
40
27
|
|
41
|
-
|
42
|
-
|
28
|
+
CONFIG = OpenStruct.new
|
29
|
+
CONFIG.scheme = 'postgres'
|
30
|
+
CONFIG.user = ENV['DO_POSTGRES_USER'] || 'postgres'
|
31
|
+
CONFIG.pass = ENV['DO_POSTGRES_PASS'] || ''
|
32
|
+
CONFIG.user_info = unless CONFIG.pass.empty?
|
33
|
+
"#{CONFIG.user}:#{CONFIG.pass}@"
|
34
|
+
else
|
35
|
+
"#{CONFIG.user}@"
|
43
36
|
end
|
37
|
+
CONFIG.host = ENV['DO_POSTGRES_HOST'] || 'localhost'
|
38
|
+
CONFIG.port = ENV['DO_POSTGRES_PORT'] || '5432'
|
39
|
+
CONFIG.database = ENV['DO_POSTGRES_DATABASE'] || '/do_test'
|
44
40
|
|
45
|
-
CONFIG =
|
46
|
-
CONFIG.
|
47
|
-
CONFIG.user = ENV['DO_POSTGRES_USER'] || 'postgres'
|
48
|
-
CONFIG.pass = ENV['DO_POSTGRES_PASS'] || ''
|
49
|
-
CONFIG.host = ENV['DO_POSTGRES_HOST'] || 'localhost'
|
50
|
-
CONFIG.port = ENV['DO_POSTGRES_PORT'] || '5432'
|
51
|
-
CONFIG.database = ENV['DO_POSTGRES_DATABASE'] || '/do_test'
|
52
|
-
|
53
|
-
CONFIG.uri = ENV["DO_POSTGRES_SPEC_URI"] ||"#{CONFIG.scheme}://#{CONFIG.user}:#{CONFIG.pass}@#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
|
41
|
+
CONFIG.uri = ENV["DO_POSTGRES_SPEC_URI"] ||"#{CONFIG.scheme}://#{CONFIG.user_info}#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
|
42
|
+
CONFIG.jdbc_uri = CONFIG.uri.sub(/postgres/,"jdbc:postgresql")
|
54
43
|
CONFIG.sleep = "SELECT pg_sleep(1)"
|
55
44
|
|
56
45
|
module DataObjectsSpecHelpers
|
@@ -156,3 +145,5 @@ module DataObjectsSpecHelpers
|
|
156
145
|
end
|
157
146
|
|
158
147
|
end
|
148
|
+
|
149
|
+
include DataObjectsSpecHelpers
|
data/spec/typecast/array_spec.rb
CHANGED
@@ -4,6 +4,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/bigdecimal_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with BigDecimal' do
|
7
|
-
|
8
|
-
|
7
|
+
behaves_like 'supporting BigDecimal'
|
8
|
+
behaves_like 'supporting BigDecimal autocasting'
|
9
9
|
end
|
@@ -4,6 +4,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/boolean_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with Boolean' do
|
7
|
-
|
8
|
-
|
7
|
+
behaves_like 'supporting Boolean'
|
8
|
+
behaves_like 'supporting Boolean autocasting'
|
9
9
|
end
|
@@ -4,5 +4,5 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/byte_array_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with ByteArray' do
|
7
|
-
|
7
|
+
behaves_like 'supporting ByteArray'
|
8
8
|
end
|
data/spec/typecast/class_spec.rb
CHANGED
data/spec/typecast/date_spec.rb
CHANGED
@@ -4,6 +4,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/date_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with Date' do
|
7
|
-
|
8
|
-
|
7
|
+
behaves_like 'supporting Date'
|
8
|
+
behaves_like 'supporting Date autocasting'
|
9
9
|
end
|
@@ -4,6 +4,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/datetime_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with DateTime' do
|
7
|
-
|
8
|
-
|
7
|
+
behaves_like 'supporting DateTime'
|
8
|
+
behaves_like 'supporting DateTime autocasting'
|
9
9
|
end
|
data/spec/typecast/float_spec.rb
CHANGED
@@ -4,6 +4,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/float_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with Float' do
|
7
|
-
|
8
|
-
|
7
|
+
behaves_like 'supporting Float'
|
8
|
+
behaves_like 'supporting Float autocasting'
|
9
9
|
end
|
@@ -4,5 +4,5 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/integer_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with Integer' do
|
7
|
-
|
7
|
+
behaves_like 'supporting Integer'
|
8
8
|
end
|
data/spec/typecast/nil_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
4
4
|
require 'data_objects/spec/typecast/nil_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Postgres with Nil' do
|
7
|
-
|
8
|
-
#
|
9
|
-
|
7
|
+
behaves_like 'supporting Nil'
|
8
|
+
# behaves_like 'supporting writing an Nil'
|
9
|
+
behaves_like 'supporting Nil autocasting'
|
10
10
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/other_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::H2 with other (unknown) type' do
|
7
|
+
behaves_like 'supporting other (unknown) type'
|
8
|
+
end
|
data/spec/typecast/range_spec.rb
CHANGED
data/spec/typecast/time_spec.rb
CHANGED
data/tasks/compile.rake
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rake-compiler', '~>0.7'
|
3
|
+
require 'rake/extensiontask'
|
4
|
+
require 'rake/javaextensiontask'
|
5
|
+
|
6
|
+
# Hack to avoid "allocator undefined for Proc" issue when unpacking Gems:
|
7
|
+
# gemspec provided by Jeweler uses Rake::FileList for files, test_files and
|
8
|
+
# extra_rdoc_files, and procs cannot be marshalled.
|
9
|
+
def gemspec
|
10
|
+
@clean_gemspec ||= eval("#{Rake.application.jeweler.gemspec.to_ruby}") # $SAFE = 3\n
|
11
|
+
end
|
12
|
+
|
13
|
+
Rake::ExtensionTask.new('do_postgres', gemspec) do |ext|
|
14
|
+
|
15
|
+
postgres_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'pgsql'))
|
16
|
+
|
17
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
18
|
+
|
19
|
+
# automatically add build options to avoid need of manual input
|
20
|
+
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
21
|
+
ext.config_options << "--with-pgsql-server-include=#{postgres_lib}/include/server"
|
22
|
+
ext.config_options << "--with-pgsql-client-include=#{postgres_lib}/include"
|
23
|
+
ext.config_options << "--with-pgsql-win32-include=#{postgres_lib}/include/server/port/win32"
|
24
|
+
ext.config_options << "--with-pgsql-client-lib=#{postgres_lib}/lib"
|
25
|
+
else
|
26
|
+
ext.cross_compile = true
|
27
|
+
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
28
|
+
ext.cross_config_options << "--with-pgsql-server-include=#{postgres_lib}/include/server"
|
29
|
+
ext.cross_config_options << "--with-pgsql-client-include=#{postgres_lib}/include"
|
30
|
+
ext.cross_config_options << "--with-pgsql-win32-include=#{postgres_lib}/include/server/port/win32"
|
31
|
+
ext.cross_config_options << "--with-pgsql-client-lib=#{postgres_lib}/lib"
|
32
|
+
|
33
|
+
ext.cross_compiling do |gemspec|
|
34
|
+
gemspec.post_install_message = <<-POST_INSTALL_MESSAGE
|
35
|
+
|
36
|
+
======================================================================================================
|
37
|
+
|
38
|
+
You've installed the binary version of #{gemspec.name}.
|
39
|
+
It was built using PostgreSQL version #{BINARY_VERSION}.
|
40
|
+
It's recommended to use the exact same version to avoid potential issues.
|
41
|
+
|
42
|
+
At the time of building this gem, the necessary DLL files where available
|
43
|
+
in the following download:
|
44
|
+
|
45
|
+
http://wwwmaster.postgresql.org/redir/107/h/binary/v#{BINARY_VERSION}/win32/postgresql-#{BINARY_VERSION}-1-binaries-no-installer.zip
|
46
|
+
|
47
|
+
You can put the following files available in this package in your Ruby bin
|
48
|
+
directory, for example C:\\Ruby\\bin
|
49
|
+
|
50
|
+
- lib\\libpq.dll
|
51
|
+
- bin\\ssleay32.dll
|
52
|
+
- bin\\libeay32.dll
|
53
|
+
- bin\\libintl-8.dll
|
54
|
+
- bin\\libiconv-2.dll
|
55
|
+
- bin\\krb5_32.dll
|
56
|
+
- bin\\comerr32.dll
|
57
|
+
- bin\\k5sprt32.dll
|
58
|
+
- bin\\gssapi32.dll
|
59
|
+
|
60
|
+
======================================================================================================
|
61
|
+
|
62
|
+
POST_INSTALL_MESSAGE
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
Rake::JavaExtensionTask.new('do_postgres', gemspec) do |ext|
|
70
|
+
ext.ext_dir = 'ext-java/src/main/java'
|
71
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
72
|
+
ext.debug = ENV.has_key?('DO_JAVA_DEBUG') && ENV['DO_JAVA_DEBUG']
|
73
|
+
ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
|
74
|
+
ext.java_compiling do |gem|
|
75
|
+
gem.add_dependency 'jdbc-postgres', '>=8.2'
|
76
|
+
gem.add_dependency 'do_jdbc', '0.10.1'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
rescue LoadError
|
80
|
+
warn "To compile, install rake-compiler (gem install rake-compiler)"
|
81
|
+
end
|
data/tasks/release.rake
CHANGED
@@ -1,75 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
desc 'Builds all gems (native, binaries for JRuby and Windows)'
|
2
|
+
task :build_all do
|
3
|
+
`rake clean`
|
4
|
+
`rake build`
|
5
|
+
`rake java gem`
|
6
|
+
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
|
6
7
|
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# compare versions to avoid mistakes
|
15
|
-
unless ver == GEM_SPEC.version.to_s then
|
16
|
-
fail "Version mismatch (supplied and specification versions differ)."
|
17
|
-
end
|
18
|
-
|
19
|
-
# no rubyforge project? no release for you!
|
20
|
-
if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
|
21
|
-
fail "Must define rubyforge_project in your gem specification."
|
22
|
-
end
|
23
|
-
|
24
|
-
# instantiate a RubyForge object
|
25
|
-
rf = RubyForge.new
|
26
|
-
|
27
|
-
# read project info and overview
|
28
|
-
notes = begin
|
29
|
-
r = File.read("README.markdown")
|
30
|
-
r.split(/^(.*\n\-+)/)[1..4].join.strip
|
31
|
-
rescue
|
32
|
-
warn "Missing README.markdown"
|
33
|
-
''
|
34
|
-
end
|
35
|
-
|
36
|
-
# read changes
|
37
|
-
changes = begin
|
38
|
-
h = File.read("HISTORY.markdown")
|
39
|
-
h.split(/^(##+ .*)/)[1..2].join.strip
|
40
|
-
rescue
|
41
|
-
warn "Missing HISTORY.markdown"
|
42
|
-
''
|
43
|
-
end
|
44
|
-
|
45
|
-
# build the configuration for the release
|
46
|
-
config = Hash.new
|
47
|
-
config["release_notes"] = notes
|
48
|
-
config["release_changes"] = changes
|
49
|
-
config["preformatted"] = true
|
50
|
-
|
51
|
-
# prepare configuration
|
52
|
-
rf.configure config
|
53
|
-
|
54
|
-
files = FileList["pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version}*.*"].to_a
|
55
|
-
fail "No files found for the release." if files.empty?
|
56
|
-
|
57
|
-
puts "Logging in RubyForge..."
|
58
|
-
rf.login
|
59
|
-
|
60
|
-
puts "Files to upload:"
|
61
|
-
files.each do |f|
|
62
|
-
puts " * #{f}"
|
63
|
-
end
|
64
|
-
|
65
|
-
puts "Releasing #{GEM_SPEC.name} version #{GEM_SPEC.version}..."
|
66
|
-
rf.add_release GEM_SPEC.rubyforge_project, GEM_SPEC.name, GEM_SPEC.version, *files
|
67
|
-
puts "Done."
|
68
|
-
end
|
69
|
-
#Rake::Task['release'].prerequisites.unshift('clean', 'cross', 'native')
|
70
|
-
else
|
71
|
-
warn "no GEM_SPEC is found or defined. 'release' task cannot work without it."
|
9
|
+
desc 'Release all gems (native, binaries for JRuby and Windows)'
|
10
|
+
task :release_all => :build_all do
|
11
|
+
Dir["pkg/do_postgres-#{DataObjects::Postgres::VERSION}*.gem"].each do |gem_path|
|
12
|
+
command = "gem push #{gem_path}"
|
13
|
+
puts "Executing #{command.inspect}:"
|
14
|
+
sh command
|
72
15
|
end
|
73
|
-
else
|
74
|
-
warn "rubyforge gem is required to generate releases, please install it (gem install rubyforge)."
|
75
16
|
end
|
data/tasks/retrieve.rake
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
begin
|
2
|
-
gem
|
2
|
+
gem 'rake-compiler', '~>0.7'
|
3
3
|
require 'rake/clean'
|
4
4
|
require 'rake/extensioncompiler'
|
5
5
|
|
@@ -29,14 +29,10 @@ begin
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def copy(from, to)
|
32
|
-
|
33
|
-
from.gsub!(/\//, '\\')
|
34
|
-
to.gsub!(/\//, '\\')
|
35
|
-
end
|
36
|
-
sh "#{WINDOWS ? 'copy' : 'cp'} #{from} #{to}"
|
32
|
+
FileUtils.cp(from, to)
|
37
33
|
end
|
38
34
|
|
39
|
-
version =
|
35
|
+
version = BINARY_VERSION
|
40
36
|
file "vendor/postgresql-#{version}-1-binaries-no-installer.zip" => ['vendor'] do |t|
|
41
37
|
url = "http://wwwmaster.postgresql.org/redir/107/h/binary/v#{version}/win32/#{File.basename(t.name)}"
|
42
38
|
when_writing "downloading #{t.name}" do
|
@@ -52,8 +48,8 @@ begin
|
|
52
48
|
cd "vendor" do
|
53
49
|
sh "unzip #{full_file} pgsql/bin/** pgsql/include/** pgsql/lib/**"
|
54
50
|
end
|
55
|
-
copy "ext/
|
56
|
-
copy "ext/
|
51
|
+
copy "ext/do_postgres/pg_config.h", "vendor/pgsql/include/pg_config.h"
|
52
|
+
copy "ext/do_postgres/pg_config.h", "vendor/pgsql/include/server/pg_config.h"
|
57
53
|
|
58
54
|
# update file timestamp to avoid Rake perform this extraction again.
|
59
55
|
touch t.name
|
data/tasks/spec.rake
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
-
|
2
|
-
require 'spec/rake/spectask'
|
1
|
+
require 'rake/testtask'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
spec_defaults = lambda do |spec|
|
4
|
+
spec.libs << 'lib' << 'spec'
|
5
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
6
|
+
spec.verbose = true
|
7
|
+
end
|
8
|
+
|
9
|
+
Rake::TestTask.new(:spec => [ :clean, :compile ], &spec_defaults)
|
10
|
+
Rake::TestTask.new(:spec_no_compile, &spec_defaults)
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
begin
|
13
|
+
require 'rcov/rcovtask'
|
14
|
+
Rcov::RcovTask.new do |spec|
|
15
|
+
spec.libs << 'spec'
|
16
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
17
|
+
spec.verbose = true
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
task :rcov do
|
21
|
+
abort 'RCov is not available. In order to run rcov, you must: gem install rcov'
|
18
22
|
end
|
19
23
|
end
|