do_derby 0.10.0-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.
- data/HISTORY.markdown +6 -0
- data/LICENSE +19 -0
- data/Manifest.txt +16 -0
- data/README.markdown +4 -0
- data/Rakefile +15 -0
- data/lib/do_derby/version.rb +5 -0
- data/lib/do_derby.rb +33 -0
- data/spec/command_spec.rb +9 -0
- data/spec/connection_spec.rb +19 -0
- data/spec/encoding_spec.rb +8 -0
- data/spec/lib/rspec_immediate_feedback_formatter.rb +3 -0
- data/spec/reader_spec.rb +8 -0
- data/spec/result_spec.rb +16 -0
- data/spec/spec_helper.rb +201 -0
- data/spec/typecast/array_spec.rb +8 -0
- data/spec/typecast/bigdecimal_spec.rb +9 -0
- data/spec/typecast/boolean_spec.rb +10 -0
- data/spec/typecast/byte_array_spec.rb +9 -0
- data/spec/typecast/class_spec.rb +8 -0
- data/spec/typecast/date_spec.rb +9 -0
- data/spec/typecast/datetime_spec.rb +9 -0
- data/spec/typecast/float_spec.rb +9 -0
- data/spec/typecast/integer_spec.rb +8 -0
- data/spec/typecast/nil_spec.rb +10 -0
- data/spec/typecast/range_spec.rb +8 -0
- data/spec/typecast/string_spec.rb +8 -0
- data/spec/typecast/time_spec.rb +8 -0
- data/tasks/gem.rake +8 -0
- data/tasks/install.rake +15 -0
- data/tasks/native.rake +4 -0
- data/tasks/release.rake +75 -0
- data/tasks/spec.rake +19 -0
- metadata +145 -0
data/HISTORY.markdown
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2008-2009 Alex Coles, Ikonoklastik Productions
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
HISTORY.markdown
|
2
|
+
LICENSE
|
3
|
+
Manifest.txt
|
4
|
+
README.markdown
|
5
|
+
Rakefile
|
6
|
+
buildfile
|
7
|
+
ext-java/src/main/java/DoDerbyExtService.java
|
8
|
+
ext-java/src/main/java/do_derby/DerbyDriverDefinition.java
|
9
|
+
lib/do_derby.rb
|
10
|
+
lib/do_derby/version.rb
|
11
|
+
lib/do_derby_ext.jar
|
12
|
+
spec/integration/do_derby_spec.rb
|
13
|
+
spec/integration/logging_spec.rb
|
14
|
+
spec/spec.opts
|
15
|
+
spec/spec_helper.rb
|
16
|
+
spec/unit/do_derby_spec.rb
|
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
require 'pathname'
|
6
|
+
require 'lib/do_derby/version'
|
7
|
+
|
8
|
+
ROOT = Pathname(__FILE__).dirname.expand_path
|
9
|
+
JRUBY = RUBY_PLATFORM =~ /java/
|
10
|
+
WINDOWS = Gem.win_platform?
|
11
|
+
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
12
|
+
|
13
|
+
Dir['tasks/*.rake'].sort.each { |f| import f }
|
14
|
+
|
15
|
+
CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext-java/target ])
|
data/lib/do_derby.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'data_objects'
|
2
|
+
|
3
|
+
if RUBY_PLATFORM =~ /java/
|
4
|
+
require 'do_jdbc'
|
5
|
+
require 'java'
|
6
|
+
|
7
|
+
driver = 'org.apache.derby.jdbc.EmbeddedDriver'
|
8
|
+
begin
|
9
|
+
java.lang.Thread.currentThread.getContextClassLoader().loadClass(driver, true)
|
10
|
+
rescue
|
11
|
+
require 'jdbc/derby' # the JDBC driver, packaged as a gem
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'do_derby_ext' # the Java extension for this DO driver
|
15
|
+
|
16
|
+
# Another way of loading the JDBC Class. This seems to be more reliable
|
17
|
+
# than Class.forName() within the data_objects.Connection Java class,
|
18
|
+
# which is currently not working as expected.
|
19
|
+
java_import driver
|
20
|
+
|
21
|
+
module DataObjects
|
22
|
+
module Derby
|
23
|
+
class Connection
|
24
|
+
def self.pool_size
|
25
|
+
20
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
else
|
32
|
+
warn "do_derby is only for use with JRuby"
|
33
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
+
require 'data_objects/spec/command_spec'
|
5
|
+
|
6
|
+
describe DataObjects::Derby::Command do
|
7
|
+
it_should_behave_like 'a Command'
|
8
|
+
# it_should_behave_like 'a Command with async'
|
9
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
+
require 'data_objects/spec/connection_spec'
|
5
|
+
|
6
|
+
describe DataObjects::Derby::Connection do
|
7
|
+
|
8
|
+
before :all do
|
9
|
+
@driver = 'derby'
|
10
|
+
@user = ''
|
11
|
+
@password = ''
|
12
|
+
@host = ''
|
13
|
+
@port = ''
|
14
|
+
@database = "#{File.expand_path(File.dirname(__FILE__))}/test.db;create=true"
|
15
|
+
end
|
16
|
+
|
17
|
+
it_should_behave_like 'a Connection'
|
18
|
+
#it_should_behave_like 'a Connection with authentication support'
|
19
|
+
end
|
data/spec/reader_spec.rb
ADDED
data/spec/result_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
+
require 'data_objects/spec/result_spec'
|
5
|
+
|
6
|
+
# splitting the descibe into two separate declaration avoids
|
7
|
+
# concurrent execution of the "it_should_behave_like ....."
|
8
|
+
# needed by some databases (sqlite3)
|
9
|
+
|
10
|
+
describe DataObjects::Derby::Result do
|
11
|
+
it_should_behave_like 'a Result'
|
12
|
+
end
|
13
|
+
|
14
|
+
describe DataObjects::Derby::Result do
|
15
|
+
it_should_behave_like 'a Result which returns inserted keys'
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
$TESTING=true
|
2
|
+
JRUBY = true
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
|
6
|
+
gem 'rspec', '>1.1.12'
|
7
|
+
require 'spec'
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'ostruct'
|
11
|
+
require 'pathname'
|
12
|
+
require 'fileutils'
|
13
|
+
|
14
|
+
dir = File.dirname(__FILE__)
|
15
|
+
lib_path = File.expand_path("#{dir}/../lib")
|
16
|
+
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
|
17
|
+
# put data_objects from repository in the load path
|
18
|
+
# DO NOT USE installed gem of data_objects!
|
19
|
+
do_lib_path = File.expand_path("#{dir}/../../data_objects/lib")
|
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'
|
26
|
+
end
|
27
|
+
|
28
|
+
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 }
|
32
|
+
|
33
|
+
require 'do_derby'
|
34
|
+
|
35
|
+
log_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'log', 'do.log'))
|
36
|
+
FileUtils.mkdir_p(File.dirname(log_path))
|
37
|
+
|
38
|
+
DataObjects::Derby.logger = DataObjects::Logger.new(log_path, :debug)
|
39
|
+
|
40
|
+
at_exit { DataObjects.logger.flush }
|
41
|
+
|
42
|
+
Spec::Runner.configure do |config|
|
43
|
+
config.include(DataObjects::Spec::PendingHelpers)
|
44
|
+
end
|
45
|
+
|
46
|
+
CONFIG = OpenStruct.new
|
47
|
+
# CONFIG.scheme = 'derby'
|
48
|
+
# CONFIG.user = ENV['DO_DERBY_USER'] || 'derby'
|
49
|
+
# CONFIG.pass = ENV['DO_DERBY_PASS'] || ''
|
50
|
+
# CONFIG.host = ENV['DO_DERBY_HOST'] || ''
|
51
|
+
# CONFIG.port = ENV['DO_DERBY_PORT'] || ''
|
52
|
+
# CONFIG.database = ENV['DO_DERBY_DATABASE'] || "#{File.expand_path(File.dirname(__FILE__))}/testdb"
|
53
|
+
|
54
|
+
CONFIG.uri = ENV["DO_DERBY_SPEC_URI"] || "jdbc:derby:testdb;create=true"
|
55
|
+
|
56
|
+
module DataObjectsSpecHelpers
|
57
|
+
|
58
|
+
def setup_test_environment
|
59
|
+
conn = DataObjects::Connection.new(CONFIG.uri)
|
60
|
+
|
61
|
+
# Derby does not support DROP TABLE IF EXISTS
|
62
|
+
begin
|
63
|
+
conn.create_command(<<-EOF).execute_non_query
|
64
|
+
DROP TABLE invoices
|
65
|
+
EOF
|
66
|
+
rescue DerbyError
|
67
|
+
end
|
68
|
+
|
69
|
+
begin
|
70
|
+
conn.create_command(<<-EOF).execute_non_query
|
71
|
+
DROP TABLE users
|
72
|
+
EOF
|
73
|
+
rescue DerbyError
|
74
|
+
end
|
75
|
+
|
76
|
+
begin
|
77
|
+
conn.create_command(<<-EOF).execute_non_query
|
78
|
+
DROP TABLE widgets
|
79
|
+
EOF
|
80
|
+
rescue DerbyError
|
81
|
+
end
|
82
|
+
|
83
|
+
conn.create_command(<<-EOF).execute_non_query
|
84
|
+
CREATE TABLE users (
|
85
|
+
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
86
|
+
name VARCHAR(200) default 'Billy',
|
87
|
+
fired_at TIMESTAMP
|
88
|
+
)
|
89
|
+
EOF
|
90
|
+
|
91
|
+
conn.create_command(<<-EOF).execute_non_query
|
92
|
+
CREATE TABLE invoices (
|
93
|
+
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
94
|
+
invoice_number VARCHAR(50) NOT NULL
|
95
|
+
)
|
96
|
+
EOF
|
97
|
+
|
98
|
+
# FIXME:
|
99
|
+
# description, ad_description and whitepaper_text should be LONG VARCHAR and
|
100
|
+
# not VARCHAR(500). However, the specs are failing with the following error
|
101
|
+
# when the LONG VARCHAR type is used: Comparisons between 'LONG VARCHAR
|
102
|
+
# (UCS_BASIC)' and 'LONG VARCHAR (UCS_BASIC)' are not supported. Types must
|
103
|
+
# be comparable. String types must also have matching collation. If
|
104
|
+
# collation does not match, a possible solution is to cast operands to force
|
105
|
+
# them to the default collation (e.g. select tablename from sys.systables
|
106
|
+
# where CAST(tablename as VARCHAR(128)) = 'T1')
|
107
|
+
# Error Code: 30000
|
108
|
+
# SQL State: 42818
|
109
|
+
conn.create_command(<<-EOF).execute_non_query
|
110
|
+
CREATE TABLE widgets (
|
111
|
+
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
112
|
+
code CHAR(8) DEFAULT 'A14',
|
113
|
+
name VARCHAR(200) DEFAULT 'Super Widget',
|
114
|
+
shelf_location VARCHAR(50),
|
115
|
+
description VARCHAR(500),
|
116
|
+
image_data BLOB,
|
117
|
+
ad_description VARCHAR(500),
|
118
|
+
ad_image BLOB,
|
119
|
+
whitepaper_text VARCHAR(500),
|
120
|
+
cad_drawing BLOB,
|
121
|
+
flags SMALLINT DEFAULT 0,
|
122
|
+
number_in_stock SMALLINT DEFAULT 500,
|
123
|
+
number_sold INTEGER DEFAULT 0,
|
124
|
+
super_number BIGINT DEFAULT 9223372036854775807,
|
125
|
+
weight REAL DEFAULT 10.23,
|
126
|
+
cost1 DOUBLE DEFAULT 10.23,
|
127
|
+
cost2 DECIMAL(8,2) DEFAULT 50.23,
|
128
|
+
release_date DATE DEFAULT '2008-02-14',
|
129
|
+
release_datetime TIMESTAMP DEFAULT '2008-02-14 00:31:12',
|
130
|
+
release_timestamp TIMESTAMP DEFAULT '2008-02-14 00:31:31'
|
131
|
+
)
|
132
|
+
EOF
|
133
|
+
|
134
|
+
# XXX: Derby has no ENUM
|
135
|
+
# status` enum('active','out of stock') NOT NULL default 'active'
|
136
|
+
|
137
|
+
1.upto(16) do |n|
|
138
|
+
conn.create_command(<<-EOF).execute_non_query
|
139
|
+
INSERT INTO widgets(
|
140
|
+
code,
|
141
|
+
name,
|
142
|
+
shelf_location,
|
143
|
+
description,
|
144
|
+
ad_description,
|
145
|
+
whitepaper_text,
|
146
|
+
super_number,
|
147
|
+
weight)
|
148
|
+
VALUES (
|
149
|
+
'W#{n.to_s.rjust(7,"0")}',
|
150
|
+
'Widget #{n}',
|
151
|
+
'A14',
|
152
|
+
'This is a description',
|
153
|
+
'Buy this product now!',
|
154
|
+
'String',
|
155
|
+
1234,
|
156
|
+
13.4)
|
157
|
+
EOF
|
158
|
+
|
159
|
+
# Removed
|
160
|
+
# image_data,
|
161
|
+
# ad_image,
|
162
|
+
# cad_drawing,
|
163
|
+
# XXX: figure out how to insert BLOBS
|
164
|
+
|
165
|
+
conn.create_command(<<-EOF).execute_non_query
|
166
|
+
update widgets set flags = 1 where id = 2
|
167
|
+
EOF
|
168
|
+
|
169
|
+
conn.create_command(<<-EOF).execute_non_query
|
170
|
+
update widgets set ad_description = NULL where id = 3
|
171
|
+
EOF
|
172
|
+
|
173
|
+
conn.create_command(<<-EOF).execute_non_query
|
174
|
+
update widgets set flags = NULL where id = 4
|
175
|
+
EOF
|
176
|
+
|
177
|
+
conn.create_command(<<-EOF).execute_non_query
|
178
|
+
update widgets set cost1 = NULL where id = 5
|
179
|
+
EOF
|
180
|
+
|
181
|
+
conn.create_command(<<-EOF).execute_non_query
|
182
|
+
update widgets set cost2 = NULL where id = 6
|
183
|
+
EOF
|
184
|
+
|
185
|
+
conn.create_command(<<-EOF).execute_non_query
|
186
|
+
update widgets set release_date = NULL where id = 7
|
187
|
+
EOF
|
188
|
+
|
189
|
+
conn.create_command(<<-EOF).execute_non_query
|
190
|
+
update widgets set release_datetime = NULL where id = 8
|
191
|
+
EOF
|
192
|
+
|
193
|
+
conn.create_command(<<-EOF).execute_non_query
|
194
|
+
update widgets set release_timestamp = NULL where id = 9
|
195
|
+
EOF
|
196
|
+
|
197
|
+
conn.close
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/bigdecimal_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with BigDecimal' do
|
7
|
+
it_should_behave_like 'supporting BigDecimal'
|
8
|
+
it_should_behave_like 'supporting BigDecimal autocasting'
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/boolean_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with Boolean' do
|
7
|
+
it_should_behave_like 'supporting Boolean'
|
8
|
+
# TODO should we map smallint to boolean for derby ??
|
9
|
+
# it_should_behave_like 'supporting Boolean autocasting'
|
10
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/byte_array_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with ByteArray' do
|
7
|
+
# We need to switch to using parameter binding for this to work with Derby
|
8
|
+
# it_should_behave_like 'supporting ByteArray'
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/date_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with Date' do
|
7
|
+
it_should_behave_like 'supporting Date'
|
8
|
+
it_should_behave_like 'supporting Date autocasting'
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/datetime_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with DateTime' do
|
7
|
+
it_should_behave_like 'supporting DateTime'
|
8
|
+
it_should_behave_like 'supporting DateTime autocasting'
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/float_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with Float' do
|
7
|
+
it_should_behave_like 'supporting Float'
|
8
|
+
it_should_behave_like 'supporting Float autocasting'
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/nil_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Derby with Nil' do
|
7
|
+
it_should_behave_like 'supporting Nil'
|
8
|
+
it_should_behave_like 'supporting writing an Nil'
|
9
|
+
it_should_behave_like 'supporting Nil autocasting'
|
10
|
+
end
|
data/tasks/gem.rake
ADDED
data/tasks/install.rake
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
def sudo_gem(cmd)
|
2
|
+
sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
|
3
|
+
end
|
4
|
+
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
desc "Install #{GEM_SPEC.name} #{GEM_SPEC.version}"
|
8
|
+
task :install => [ :package ] do
|
9
|
+
sudo_gem "install pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version} --no-update-sources"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Uninstall #{GEM_SPEC.name} #{GEM_SPEC.version}"
|
13
|
+
task :uninstall => [ :clean ] do
|
14
|
+
sudo_gem "uninstall #{GEM_SPEC.name} -v#{GEM_SPEC.version} -I -x"
|
15
|
+
end
|
data/tasks/native.rake
ADDED
data/tasks/release.rake
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rubyforge', '~> 1.0.1'
|
3
|
+
require 'rubyforge'
|
4
|
+
rescue Exception
|
5
|
+
nil
|
6
|
+
end
|
7
|
+
|
8
|
+
if defined?(RubyForge) then
|
9
|
+
if defined?(GEM_SPEC) then
|
10
|
+
desc 'Package and upload to RubyForge'
|
11
|
+
task :release do |t|
|
12
|
+
ver = ENV['VERSION'] or fail "Must supply VERSION (rake release VERSION=x.y.z)."
|
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."
|
72
|
+
end
|
73
|
+
else
|
74
|
+
warn "rubyforge gem is required to generate releases, please install it (gem install rubyforge)."
|
75
|
+
end
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Specs
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
desc 'Run specifications'
|
5
|
+
Spec::Rake::SpecTask.new(:spec => [ :clean, :compile ]) do |t|
|
6
|
+
t.spec_opts << '--options' << ROOT + 'spec/spec.opts'
|
7
|
+
t.spec_files = Pathname.glob(ENV['FILES'] || 'spec/**/*_spec.rb').map { |f| f.to_s }
|
8
|
+
t.libs << 'lib'
|
9
|
+
|
10
|
+
begin
|
11
|
+
# RCov is run by default, except on the JRuby platform
|
12
|
+
t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
|
13
|
+
t.rcov_opts << '--exclude' << 'spec'
|
14
|
+
t.rcov_opts << '--text-summary'
|
15
|
+
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
16
|
+
rescue Exception
|
17
|
+
# rcov not installed
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
extensions: []
|
3
|
+
|
4
|
+
homepage: http://github.com/datamapper/do
|
5
|
+
executables: []
|
6
|
+
|
7
|
+
version: !ruby/object:Gem::Version
|
8
|
+
version: 0.10.0
|
9
|
+
post_install_message:
|
10
|
+
date: 2009-09-16 00:00:00 Z
|
11
|
+
files:
|
12
|
+
- lib/do_derby.rb
|
13
|
+
- lib/do_derby/version.rb
|
14
|
+
- spec/command_spec.rb
|
15
|
+
- spec/connection_spec.rb
|
16
|
+
- spec/encoding_spec.rb
|
17
|
+
- spec/reader_spec.rb
|
18
|
+
- spec/result_spec.rb
|
19
|
+
- spec/spec_helper.rb
|
20
|
+
- spec/lib/rspec_immediate_feedback_formatter.rb
|
21
|
+
- spec/typecast/array_spec.rb
|
22
|
+
- spec/typecast/bigdecimal_spec.rb
|
23
|
+
- spec/typecast/boolean_spec.rb
|
24
|
+
- spec/typecast/byte_array_spec.rb
|
25
|
+
- spec/typecast/class_spec.rb
|
26
|
+
- spec/typecast/date_spec.rb
|
27
|
+
- spec/typecast/datetime_spec.rb
|
28
|
+
- spec/typecast/float_spec.rb
|
29
|
+
- spec/typecast/integer_spec.rb
|
30
|
+
- spec/typecast/nil_spec.rb
|
31
|
+
- spec/typecast/range_spec.rb
|
32
|
+
- spec/typecast/string_spec.rb
|
33
|
+
- spec/typecast/time_spec.rb
|
34
|
+
- tasks/gem.rake
|
35
|
+
- tasks/install.rake
|
36
|
+
- tasks/native.rake
|
37
|
+
- tasks/release.rake
|
38
|
+
- tasks/spec.rake
|
39
|
+
- LICENSE
|
40
|
+
- Rakefile
|
41
|
+
- HISTORY.markdown
|
42
|
+
- README.markdown
|
43
|
+
- Manifest.txt
|
44
|
+
rubygems_version: 1.3.4
|
45
|
+
rdoc_options: []
|
46
|
+
|
47
|
+
signing_key:
|
48
|
+
cert_chain: []
|
49
|
+
|
50
|
+
name: do_derby
|
51
|
+
has_rdoc: false
|
52
|
+
platform: java
|
53
|
+
summary: DataObjects Derby Driver
|
54
|
+
default_executable:
|
55
|
+
bindir: bin
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
version:
|
60
|
+
requirements:
|
61
|
+
- - '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
version:
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
specification_version: 3
|
73
|
+
test_files: []
|
74
|
+
|
75
|
+
dependencies:
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
type: :runtime
|
78
|
+
name: addressable
|
79
|
+
version_requirement:
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
version:
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "2.0"
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
type: :runtime
|
88
|
+
name: extlib
|
89
|
+
version_requirement:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
version:
|
92
|
+
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.9.12
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
type: :runtime
|
98
|
+
name: data_objects
|
99
|
+
version_requirement:
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
version:
|
102
|
+
requirements:
|
103
|
+
- - "="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.10.0
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
type: :runtime
|
108
|
+
name: jdbc-derby
|
109
|
+
version_requirement:
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
version:
|
112
|
+
requirements:
|
113
|
+
- - ~>
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 10.4.2.0
|
116
|
+
- !ruby/object:Gem::Dependency
|
117
|
+
type: :runtime
|
118
|
+
name: do_jdbc
|
119
|
+
version_requirement:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
version:
|
122
|
+
requirements:
|
123
|
+
- - "="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.10.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
type: :development
|
128
|
+
name: rspec
|
129
|
+
version_requirement:
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
version:
|
132
|
+
requirements:
|
133
|
+
- - ~>
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 1.2.0
|
136
|
+
description: Implements the DataObjects API for Derby
|
137
|
+
email: alex@alexcolesportfolio.com
|
138
|
+
authors:
|
139
|
+
- Alex Coles
|
140
|
+
extra_rdoc_files: []
|
141
|
+
|
142
|
+
requirements: []
|
143
|
+
|
144
|
+
rubyforge_project: dorb
|
145
|
+
autorequire:
|