do_sqlite3 0.9.12-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.
@@ -0,0 +1,14 @@
1
+ == 0.9.11 2009-01-19
2
+ * Improvements
3
+ * Ruby 1.9 support
4
+ * Fixes
5
+ * Fix Windows gem
6
+
7
+ == 0.9.9 2008-11-27
8
+ * Improvements
9
+ * Added cross compile rake tasks for Windows gems [Jonathan Stott, Luis Lavena]
10
+ * Added initial support for Ruby 1.9 [John Harrison]
11
+
12
+ * Bug Fixes
13
+ * Removed sqlite3.dll from source gem [Dan Kubb]
14
+ * Removed hard coded .bundle from source [Dirkjan Bussink]
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007, 2008, 2009 Yehuda Katz, Dirkjan Bussink
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ .gitignore
2
+ History.txt
3
+ LICENSE
4
+ Manifest.txt
5
+ README.txt
6
+ Rakefile
7
+ buildfile
8
+ ext-java/src/main/java/DoSqlite3ExtService.java
9
+ ext-java/src/main/java/do_sqlite3/Sqlite3DriverDefinition.java
10
+ ext/do_sqlite3_ext/do_sqlite3_ext.c
11
+ ext/do_sqlite3_ext/extconf.rb
12
+ lib/do_sqlite3.rb
13
+ lib/do_sqlite3/transaction.rb
14
+ lib/do_sqlite3/version.rb
15
+ spec/command_spec.rb
16
+ spec/connection_spec.rb
17
+ spec/reader_spec.rb
18
+ spec/result_spec.rb
19
+ spec/spec.opts
20
+ spec/spec_helper.rb
21
+ spec/typecast/bigdecimal_spec.rb
22
+ spec/typecast/boolean_spec.rb
23
+ spec/typecast/byte_array_spec.rb
24
+ spec/typecast/class_spec.rb
25
+ spec/typecast/date_spec.rb
26
+ spec/typecast/datetime_spec.rb
27
+ spec/typecast/float_spec.rb
28
+ spec/typecast/integer_spec.rb
29
+ spec/typecast/nil_spec.rb
30
+ spec/typecast/string_spec.rb
31
+ spec/typecast/time_spec.rb
@@ -0,0 +1,3 @@
1
+ = do_sqlite3
2
+
3
+ A DataObjects driver for SQLite3
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+
5
+ require 'pathname'
6
+ require 'lib/do_sqlite3/version'
7
+
8
+ ROOT = Pathname(__FILE__).dirname.expand_path
9
+ JRUBY = RUBY_PLATFORM =~ /java/
10
+ WINDOWS = Gem.win_platform?
11
+ SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS'])
12
+ BINARY_VERSION = '3_6_13'
13
+
14
+ Dir['tasks/*.rake'].each { |f| import f }
15
+
16
+ CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_sqlite3_ext/Makefile ext-java/target ])
@@ -0,0 +1,38 @@
1
+ # HACK: If running on Windows, then add the current directory to the PATH
2
+ # for the current process so it can find the bundled dlls before the require
3
+ # of the actual extension file.
4
+ if RUBY_PLATFORM.match(/mingw|mswin/i)
5
+ libdir = File.expand_path(File.dirname(__FILE__)).gsub(File::SEPARATOR, File::ALT_SEPARATOR)
6
+ ENV['PATH'] = "#{libdir};" + ENV['PATH']
7
+ end
8
+
9
+ require 'rubygems'
10
+ require 'data_objects'
11
+ if RUBY_PLATFORM =~ /java/
12
+ require 'do_jdbc'
13
+ require 'java'
14
+ gem 'jdbc-sqlite3'
15
+ require 'jdbc/sqlite3' # the JDBC driver, packaged as a gem
16
+ end
17
+
18
+ require 'do_sqlite3_ext'
19
+ require File.expand_path(File.join(File.dirname(__FILE__), 'do_sqlite3', 'version'))
20
+ require File.expand_path(File.join(File.dirname(__FILE__), 'do_sqlite3', 'transaction'))
21
+
22
+ if RUBY_PLATFORM =~ /java/
23
+ # Another way of loading the JDBC Class. This seems to be more reliable
24
+ # than Class.forName() within the data_objects.Connection Java class,
25
+ # which is currently not working as expected.
26
+ import 'org.sqlite.JDBC'
27
+
28
+ module DataObjects
29
+ module Sqlite3
30
+ class Connection
31
+ def self.pool_size
32
+ 20
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,36 @@
1
+
2
+ module DataObjects
3
+
4
+ module Sqlite3
5
+
6
+ class Transaction < DataObjects::Transaction
7
+
8
+ def begin
9
+ cmd = "BEGIN"
10
+ connection.create_command(cmd).execute_non_query
11
+ end
12
+
13
+ def commit
14
+ cmd = "COMMIT"
15
+ connection.create_command(cmd).execute_non_query
16
+ end
17
+
18
+ def rollback
19
+ cmd = "ROLLBACK"
20
+ connection.create_command(cmd).execute_non_query
21
+ end
22
+
23
+ def rollback_prepared
24
+ cmd = "ROLLBACK"
25
+ connection.create_command(cmd).execute_non_query
26
+ end
27
+
28
+ def prepare
29
+ # Eek, I don't know how to do this. Lets hope a commit arrives soon...
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,5 @@
1
+ module DataObjects
2
+ module Sqlite3
3
+ VERSION = "0.9.12"
4
+ end
5
+ end
Binary file
@@ -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/command_spec'
5
+
6
+ describe DataObjects::Sqlite3::Command do
7
+ it_should_behave_like 'a Command'
8
+ end
@@ -0,0 +1,18 @@
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::Sqlite3::Connection do
7
+
8
+ before :all do
9
+ @driver = CONFIG.scheme
10
+ @user = CONFIG.user
11
+ @password = CONFIG.pass
12
+ @host = CONFIG.host
13
+ @port = CONFIG.port
14
+ @database = CONFIG.database
15
+ end
16
+
17
+ it_should_behave_like 'a Connection'
18
+ end
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'data_objects', 'spec', 'lib', 'rspec_immediate_feedback_formatter'))
@@ -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/reader_spec'
5
+
6
+ describe DataObjects::Sqlite3::Reader do
7
+ it_should_behave_like 'a Reader'
8
+ 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/result_spec'
5
+
6
+ describe DataObjects::Sqlite3::Result do
7
+ it_should_behave_like 'a Result'
8
+ it_should_behave_like 'a Result which returns inserted keys'
9
+ end
@@ -0,0 +1,124 @@
1
+ $TESTING=true
2
+ JRUBY = RUBY_PLATFORM =~ /java/
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
+ # put data_objects from repository in the load path
15
+ # DO NOT USE installed gem of data_objects!
16
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'data_objects', 'lib'))
17
+ require 'data_objects'
18
+
19
+ DATAOBJECTS_SPEC_ROOT = Pathname(__FILE__).dirname.parent.parent + 'data_objects' + 'spec'
20
+ Pathname.glob((DATAOBJECTS_SPEC_ROOT + 'lib/**/*.rb').to_s).each { |f| require f }
21
+
22
+ if JRUBY
23
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'do_jdbc', 'lib'))
24
+ require 'do_jdbc'
25
+ end
26
+
27
+ # put the pre-compiled extension in the path to be found
28
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
29
+ require 'do_sqlite3'
30
+
31
+ log_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'log', 'do.log'))
32
+ FileUtils.mkdir_p(File.dirname(log_path))
33
+
34
+ DataObjects::Sqlite3.logger = DataObjects::Logger.new(log_path, :debug)
35
+
36
+ at_exit { DataObjects.logger.flush }
37
+
38
+ Spec::Runner.configure do |config|
39
+ config.include(DataObjects::Spec::PendingHelpers)
40
+ end
41
+
42
+ CONFIG = OpenStruct.new
43
+ CONFIG.scheme = 'sqlite3'
44
+ CONFIG.database = ENV['DO_SQLITE3_DATABASE'] || "#{File.expand_path(File.dirname(__FILE__))}/test.db"
45
+
46
+ CONFIG.uri = ENV["DO_SQLITE3_SPEC_URI"] || "#{CONFIG.scheme}://#{CONFIG.database}"
47
+
48
+ module DataObjectsSpecHelpers
49
+
50
+ def setup_test_environment
51
+ conn = DataObjects::Connection.new(CONFIG.uri)
52
+
53
+ conn.create_command(<<-EOF).execute_non_query
54
+ DROP TABLE IF EXISTS "invoices"
55
+ EOF
56
+
57
+ conn.create_command(<<-EOF).execute_non_query
58
+ DROP TABLE IF EXISTS "users"
59
+ EOF
60
+
61
+ conn.create_command(<<-EOF).execute_non_query
62
+ DROP TABLE IF EXISTS "widgets"
63
+ EOF
64
+
65
+ conn.create_command(<<-EOF).execute_non_query
66
+ CREATE TABLE "users" (
67
+ "id" SERIAL,
68
+ "name" VARCHAR(200) default 'Billy' NULL,
69
+ "fired_at" timestamp,
70
+ PRIMARY KEY ("id")
71
+ );
72
+ EOF
73
+
74
+ conn.create_command(<<-EOF).execute_non_query
75
+ CREATE TABLE "invoices" (
76
+ "id" SERIAL,
77
+ "invoice_number" varchar(50) NOT NULL,
78
+ PRIMARY KEY ("id")
79
+ );
80
+ EOF
81
+
82
+ conn.create_command(<<-EOF).execute_non_query
83
+ CREATE TABLE "widgets" (
84
+ "id" INTEGER PRIMARY KEY AUTOINCREMENT,
85
+ "code" char(8) default 'A14' NULL,
86
+ "name" varchar(200) default 'Super Widget' NULL,
87
+ "shelf_location" text NULL,
88
+ "description" text NULL,
89
+ "image_data" blob NULL,
90
+ "ad_description" text NULL,
91
+ "ad_image" blob NULL,
92
+ "whitepaper_text" text NULL,
93
+ "cad_drawing" blob,
94
+ "flags" char default 'f',
95
+ "number_in_stock" smallint default 500,
96
+ "number_sold" integer default 0,
97
+ "super_number" bigint default 9223372036854775807,
98
+ "weight" float default 1.23,
99
+ "cost1" double precision default 10.23,
100
+ "cost2" decimal(8,2) default 50.23,
101
+ "release_date" date default '2008-02-14',
102
+ "release_datetime" timestamp default '2008-02-14T00:31:12+00:00',
103
+ "release_timestamp" timestamp with time zone default '2008-02-14 00:31:31'
104
+ );
105
+ EOF
106
+
107
+ 1.upto(16) do |n|
108
+ conn.create_command(<<-EOF).execute_non_query
109
+ insert into widgets(code, name, shelf_location, description, image_data, ad_description, ad_image, whitepaper_text, cad_drawing, super_number, weight) VALUES ('W#{n.to_s.rjust(7,"0")}', 'Widget #{n}', 'A14', 'This is a description', 'IMAGE DATA', 'Buy this product now!', 'AD IMAGE DATA', 'String', 'CAD DRAWING', 1234, 13.4);
110
+ EOF
111
+ end
112
+
113
+ conn.create_command(<<-EOF).execute_non_query
114
+ update widgets set flags = 't' where id = 2
115
+ EOF
116
+
117
+ conn.create_command(<<-EOF).execute_non_query
118
+ update widgets set ad_description = NULL where id = 3
119
+ EOF
120
+
121
+ conn.close
122
+ end
123
+
124
+ 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/array_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Array' do
7
+ it_should_behave_like 'supporting Array'
8
+ 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/bigdecimal_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with BigDecimal' do
7
+ it_should_behave_like 'supporting BigDecimal'
8
+ 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/boolean_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Boolean' do
7
+ it_should_behave_like 'supporting Boolean'
8
+ 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::Sqlite3 with ByteArray' do
7
+ # We need to switch to using parameter binding for this to work with Sqlite3
8
+ # it_should_behave_like 'supporting ByteArray'
9
+ 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/class_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Class' do
7
+ it_should_behave_like 'supporting Class'
8
+ 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/date_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Date' do
7
+ it_should_behave_like 'supporting Date'
8
+ 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/datetime_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with DateTime' do
7
+ it_should_behave_like 'supporting DateTime'
8
+ 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/float_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Float' do
7
+ it_should_behave_like 'supporting Float'
8
+ 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/integer_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Integer' do
7
+ it_should_behave_like 'supporting Integer'
8
+ 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::Sqlite3 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
@@ -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/range_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Range' do
7
+ it_should_behave_like 'supporting Range'
8
+ 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/string_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with String' do
7
+ it_should_behave_like 'supporting String'
8
+ 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/time_spec'
5
+
6
+ describe 'DataObjects::Sqlite3 with Time' do
7
+ it_should_behave_like 'supporting Time'
8
+ end
@@ -0,0 +1,61 @@
1
+ require 'rubygems/package_task'
2
+
3
+ GEM_SPEC = Gem::Specification.new do |s|
4
+ # basic information
5
+ s.name = "do_sqlite3"
6
+ s.version = DataObjects::Sqlite3::VERSION
7
+
8
+ # description and details
9
+ s.summary = 'DataObjects Sqlite3 Driver'
10
+ s.description = "Implements the DataObjects API for Sqlite3"
11
+
12
+ # dependencies
13
+ s.add_dependency "addressable", "~>2.0.0"
14
+ s.add_dependency "extlib", "~>0.9.12"
15
+ s.add_dependency "data_objects", DataObjects::Sqlite3::VERSION
16
+
17
+ if JRUBY
18
+ s.add_dependency "jdbc-sqlite3", ">=3.5.8"
19
+ s.add_dependency "do_jdbc", DataObjects::Sqlite3::VERSION
20
+ s.platform = "java"
21
+ # components, files and paths
22
+ s.files = FileList["lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake",
23
+ "LICENSE", "Rakefile", "*.{rdoc,txt,yml}", "lib/*.jar"]
24
+ else
25
+ s.platform = Gem::Platform::RUBY
26
+ s.extensions << 'ext/do_sqlite3_ext/extconf.rb'
27
+ # components, files and paths
28
+ s.files = FileList["lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake", "ext/**/*.{rb,c}",
29
+ "LICENSE", "Rakefile", "*.{rdoc,txt,yml}"]
30
+ end
31
+
32
+ # development dependencies
33
+ s.add_development_dependency 'rspec', '~>1.2.0'
34
+
35
+
36
+ s.require_path = 'lib'
37
+
38
+ # documentation
39
+ s.has_rdoc = false
40
+
41
+ # project information
42
+ s.homepage = 'http://github.com/datamapper/do'
43
+ s.rubyforge_project = 'dorb'
44
+
45
+ # author and contributors
46
+ s.author = 'Dirkjan Bussink'
47
+ s.email = 'd.bussink@gmail.com'
48
+ end
49
+
50
+ gem_package = Gem::PackageTask.new(GEM_SPEC) do |pkg|
51
+ pkg.need_tar = false
52
+ pkg.need_zip = false
53
+ end
54
+
55
+ file "#{GEM_SPEC.name}.gemspec" => ['Rakefile', 'tasks/gem.rake'] do |t|
56
+ puts "Generating #{t.name}"
57
+ File.open(t.name, 'w') { |f| f.puts GEM_SPEC.to_yaml }
58
+ end
59
+
60
+ desc "Generate or update the standalone gemspec file for the project"
61
+ task :gemspec => ["#{GEM_SPEC.name}.gemspec"]
@@ -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
@@ -0,0 +1,35 @@
1
+ begin
2
+ gem('rake-compiler')
3
+ require 'rake/extensiontask'
4
+
5
+ # compile the extension
6
+ if JRUBY
7
+ # XXX: is it necessary to run this everytime?
8
+ Rake::Task['compile:jruby'].invoke
9
+ end
10
+
11
+ Rake::ExtensionTask.new('do_sqlite3_ext', GEM_SPEC) do |ext|
12
+
13
+ sqlite3_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'sqlite3'))
14
+
15
+ ext.cross_compile = true
16
+ ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
17
+ ext.cross_config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
18
+
19
+ # automatically add build options to avoid need of manual input
20
+ if RUBY_PLATFORM =~ /mswin|mingw/ then
21
+ ext.config_options << "--with-sqlite3-dir=#{sqlite3_lib}"
22
+ end
23
+
24
+ end
25
+ rescue LoadError
26
+ warn "To cross-compile, install rake-compiler (gem install rake-compiler)"
27
+
28
+ if (tasks_dir = ROOT.parent + 'tasks').directory?
29
+ require tasks_dir + 'ext_helper'
30
+ require tasks_dir + 'ext_helper_java'
31
+
32
+ setup_c_extension("#{GEM_SPEC.name}_ext", GEM_SPEC)
33
+ setup_java_extension("#{GEM_SPEC.name}_ext", GEM_SPEC)
34
+ end
35
+ end
@@ -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 => [:package] 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.rdoc")
30
+ r.split(/^(=+ .*)/)[1..4].join.strip
31
+ rescue
32
+ warn "Missing README.rdoc"
33
+ ''
34
+ end
35
+
36
+ # read changes
37
+ changes = begin
38
+ h = File.read("History.txt")
39
+ h.split(/^(==+ .*)/)[1..2].join.strip
40
+ rescue
41
+ warn "Missing History.txt"
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
@@ -0,0 +1,104 @@
1
+ begin
2
+ gem('rake-compiler')
3
+ require 'rake/clean'
4
+ require 'rake/extensioncompiler'
5
+
6
+ # download sqlite3 library and headers
7
+
8
+ # only on Windows or cross platform compilation
9
+ def dlltool(dllname, deffile, libfile)
10
+ # define if we are using GCC or not
11
+ if Rake::ExtensionCompiler.mingw_gcc_executable then
12
+ dir = File.dirname(Rake::ExtensionCompiler.mingw_gcc_executable)
13
+ tool = case RUBY_PLATFORM
14
+ when /mingw/
15
+ File.join(dir, 'dlltool.exe')
16
+ when /linux|darwin/
17
+ File.join(dir, "#{Rake::ExtensionCompiler.mingw_host}-dlltool")
18
+ end
19
+ return "#{tool} --dllname #{dllname} --def #{deffile} --output-lib #{libfile}"
20
+ else
21
+ if RUBY_PLATFORM =~ /mswin/ then
22
+ tool = 'lib.exe'
23
+ else
24
+ fail "Unsupported platform for cross-compilation (please, contribute some patches)."
25
+ end
26
+ return "#{tool} /DEF:#{deffile} /OUT:#{libfile}"
27
+ end
28
+ end
29
+
30
+ # required folder structure for --with-sqlite3-dir (include + lib)
31
+ directory "vendor/sqlite3/lib"
32
+ directory "vendor/sqlite3/include"
33
+
34
+ # download amalgamation BINARY_VERSION (for include files)
35
+ file "vendor/sqlite-amalgamation-#{BINARY_VERSION}.zip" => ['vendor'] do |t|
36
+ url = "http://www.sqlite.org/#{File.basename(t.name)}"
37
+ when_writing "downloading #{t.name}" do
38
+ cd File.dirname(t.name) do
39
+ system "wget -c #{url} || curl -C - -O #{url}"
40
+ end
41
+ end
42
+ end
43
+
44
+ # download dll binaries
45
+ file "vendor/sqlitedll-#{BINARY_VERSION}.zip" => ['vendor'] do |t|
46
+ url = "http://www.sqlite.org/#{File.basename(t.name)}"
47
+ when_writing "downloading #{t.name}" do
48
+ cd File.dirname(t.name) do
49
+ system "wget -c #{url} || curl -C - -O #{url}"
50
+ end
51
+ end
52
+ end
53
+
54
+ # extract header files into include folder
55
+ file "vendor/sqlite3/include/sqlite3.h" => ['vendor/sqlite3/include', "vendor/sqlite-amalgamation-#{BINARY_VERSION}.zip"] do |t|
56
+ full_file = File.expand_path(t.prerequisites.last)
57
+ when_writing "creating #{t.name}" do
58
+ cd File.dirname(t.name) do
59
+ sh "unzip #{full_file}"
60
+ # update file timestamp to avoid Rake perform this extraction again.
61
+ touch File.basename(t.name)
62
+ end
63
+ end
64
+ end
65
+
66
+ # extract dll files into lib folder
67
+ file "vendor/sqlite3/lib/sqlite3.dll" => ['vendor/sqlite3/lib', "vendor/sqlitedll-#{BINARY_VERSION}.zip"] do |t|
68
+ full_file = File.expand_path(t.prerequisites.last)
69
+ when_writing "creating #{t.name}" do
70
+ cd File.dirname(t.name) do
71
+ sh "unzip #{full_file}"
72
+ # update file timestamp to avoid Rake perform this extraction again.
73
+ touch File.basename(t.name)
74
+ end
75
+ end
76
+ end
77
+
78
+ # generate import library from definition and dll file
79
+ file "vendor/sqlite3/lib/sqlite3.lib" => ["vendor/sqlite3/lib/sqlite3.dll"] do |t|
80
+ libfile = t.name
81
+ dllname = libfile.ext('dll')
82
+ deffile = libfile.ext('def')
83
+
84
+ when_writing "creating #{t.name}" do
85
+ sh dlltool(dllname, deffile, libfile)
86
+ end
87
+ end
88
+
89
+ # clobber vendored packages
90
+ CLOBBER.include('vendor')
91
+
92
+ # vendor:sqlite3
93
+ task 'vendor:sqlite3' => ["vendor/sqlite3/lib/sqlite3.lib", "vendor/sqlite3/include/sqlite3.h"]
94
+
95
+ # hook into cross compilation vendored sqlite3 dependency
96
+ if RUBY_PLATFORM =~ /mingw|mswin/ then
97
+ Rake::Task['compile'].prerequisites.unshift 'vendor:sqlite3'
98
+ else
99
+ if Rake::Task.tasks.map {|t| t.name }.include? 'cross'
100
+ Rake::Task['cross'].prerequisites.unshift 'vendor:sqlite3'
101
+ end
102
+ end
103
+ rescue LoadError
104
+ end
@@ -0,0 +1,18 @@
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
+
9
+ begin
10
+ # RCov is run by default, except on the JRuby platform
11
+ t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
12
+ t.rcov_opts << '--exclude' << 'spec'
13
+ t.rcov_opts << '--text-summary'
14
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
15
+ rescue Exception
16
+ # rcov not installed
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ required_ruby_version: !ruby/object:Gem::Requirement
3
+ requirements:
4
+ - - '>='
5
+ - !ruby/object:Gem::Version
6
+ version: "0"
7
+ version:
8
+ email: d.bussink@gmail.com
9
+ cert_chain: []
10
+
11
+ summary: DataObjects Sqlite3 Driver
12
+ post_install_message:
13
+ extra_rdoc_files: []
14
+
15
+ homepage: http://github.com/datamapper/do
16
+ signing_key:
17
+ name: do_sqlite3
18
+ rdoc_options: []
19
+
20
+ rubyforge_project: dorb
21
+ autorequire:
22
+ licenses: []
23
+
24
+ executables: []
25
+
26
+ description: Implements the DataObjects API for Sqlite3
27
+ specification_version: 3
28
+ default_executable:
29
+ files:
30
+ - lib/do_sqlite3.rb
31
+ - lib/do_sqlite3/transaction.rb
32
+ - lib/do_sqlite3/version.rb
33
+ - spec/command_spec.rb
34
+ - spec/connection_spec.rb
35
+ - spec/reader_spec.rb
36
+ - spec/result_spec.rb
37
+ - spec/spec_helper.rb
38
+ - spec/lib/rspec_immediate_feedback_formatter.rb
39
+ - spec/typecast/array_spec.rb
40
+ - spec/typecast/bigdecimal_spec.rb
41
+ - spec/typecast/boolean_spec.rb
42
+ - spec/typecast/byte_array_spec.rb
43
+ - spec/typecast/class_spec.rb
44
+ - spec/typecast/date_spec.rb
45
+ - spec/typecast/datetime_spec.rb
46
+ - spec/typecast/float_spec.rb
47
+ - spec/typecast/integer_spec.rb
48
+ - spec/typecast/nil_spec.rb
49
+ - spec/typecast/range_spec.rb
50
+ - spec/typecast/string_spec.rb
51
+ - spec/typecast/time_spec.rb
52
+ - tasks/gem.rake
53
+ - tasks/install.rake
54
+ - tasks/native.rake
55
+ - tasks/release.rake
56
+ - tasks/retrieve.rake
57
+ - tasks/spec.rake
58
+ - LICENSE
59
+ - Rakefile
60
+ - History.txt
61
+ - Manifest.txt
62
+ - README.txt
63
+ - lib/do_sqlite3_ext.jar
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ version:
70
+ extensions: []
71
+
72
+ rubygems_version: 1.3.2
73
+ requirements: []
74
+
75
+ authors:
76
+ - Dirkjan Bussink
77
+ date: 2009-05-16 22:00:00 +00:00
78
+ platform: java
79
+ test_files: []
80
+
81
+ version: !ruby/object:Gem::Version
82
+ version: 0.9.12
83
+ require_paths:
84
+ - lib
85
+ dependencies:
86
+ - !ruby/object:Gem::Dependency
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ version: 2.0.0
92
+ version:
93
+ type: :runtime
94
+ version_requirement:
95
+ name: addressable
96
+ - !ruby/object:Gem::Dependency
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.9.12
102
+ version:
103
+ type: :runtime
104
+ version_requirement:
105
+ name: extlib
106
+ - !ruby/object:Gem::Dependency
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "="
110
+ - !ruby/object:Gem::Version
111
+ version: 0.9.12
112
+ version:
113
+ type: :runtime
114
+ version_requirement:
115
+ name: data_objects
116
+ - !ruby/object:Gem::Dependency
117
+ version_requirements: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - '>='
120
+ - !ruby/object:Gem::Version
121
+ version: 3.5.8
122
+ version:
123
+ type: :runtime
124
+ version_requirement:
125
+ name: jdbc-sqlite3
126
+ - !ruby/object:Gem::Dependency
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "="
130
+ - !ruby/object:Gem::Version
131
+ version: 0.9.12
132
+ version:
133
+ type: :runtime
134
+ version_requirement:
135
+ name: do_jdbc
136
+ - !ruby/object:Gem::Dependency
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 1.2.0
142
+ version:
143
+ type: :development
144
+ version_requirement:
145
+ name: rspec
146
+ bindir: bin
147
+ has_rdoc: false