diff --git a/.travis.yml b/.travis.yml index 183b527..13628a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rvm: - 2.1 - 2.2 - 2.3.1 + - jruby addons: code_climate: repo_token: 05e3e31164d59aa626b730b92eb9b7418326dbf23420a4b87eab2555840b39ef diff --git a/example/rails_app/Gemfile b/example/rails_app/Gemfile index 98aa6b9..2b7344d 100644 --- a/example/rails_app/Gemfile +++ b/example/rails_app/Gemfile @@ -2,7 +2,12 @@ source 'https://rubygems.org' gem 'rails', '3.2.22.4' -gem 'sqlite3' +# for CRuby, Rubinius, including Windows and RubyInstaller +gem "sqlite3", :platform => [:ruby, :mswin, :mingw] + +# for JRuby +# gem "jdbc-sqlite3", :platform => :jruby, :require => 'jdbc/sqlite3' +gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby gem 'suture', :path => '../..' @@ -12,4 +17,5 @@ gem 'minitest', :group => :test gem 'rake', '~> 10.0' gem 'i18n', '~> 0.6.0' gem 'rack-cache', '~> 1.2.0' +gem 'pry' diff --git a/example/rails_app/Gemfile.lock b/example/rails_app/Gemfile.lock index 81fa457..6c1acaf 100644 --- a/example/rails_app/Gemfile.lock +++ b/example/rails_app/Gemfile.lock @@ -1,10 +1,10 @@ PATH remote: ../.. specs: - suture (1.0.0) + suture (1.1.1) + activerecord-jdbcsqlite3-adapter backports bar-of-progress (>= 0.1.3) - sqlite3 GEM remote: https://rubygems.org/ @@ -30,6 +30,11 @@ GEM activesupport (= 3.2.22.4) arel (~> 3.0.2) tzinfo (~> 0.3.29) + activerecord-jdbc-adapter (1.3.21) + activerecord (>= 2.2) + activerecord-jdbcsqlite3-adapter (1.3.21) + activerecord-jdbc-adapter (~> 1.3.21) + jdbc-sqlite3 (>= 3.7.2, < 3.9) activeresource (3.2.22.4) activemodel (= 3.2.22.4) activesupport (= 3.2.22.4) @@ -40,18 +45,32 @@ GEM backports (3.6.8) bar-of-progress (0.1.3) builder (3.0.4) + coderay (1.1.1) erubis (2.7.0) + ffi (1.9.14-java) hike (1.2.3) i18n (0.6.11) + jdbc-sqlite3 (3.8.11.2) journey (1.0.4) json (1.8.3) + json (1.8.3-java) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) + method_source (0.8.2) mime-types (1.25.1) minitest (5.9.0) multi_json (1.12.1) polyglot (0.3.5) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry (0.10.4-java) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + spoon (~> 0.0) rack (1.4.7) rack-cache (1.2) rack (>= 0.4) @@ -77,6 +96,9 @@ GEM rake (10.5.0) rdoc (3.12.2) json (~> 1.4) + slop (3.6.0) + spoon (0.0.6) + ffi sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) @@ -91,11 +113,14 @@ GEM tzinfo (0.3.51) PLATFORMS + java ruby DEPENDENCIES + activerecord-jdbcsqlite3-adapter i18n (~> 0.6.0) minitest + pry rack-cache (~> 1.2.0) rails (= 3.2.22.4) rake (~> 10.0) @@ -103,4 +128,4 @@ DEPENDENCIES suture! BUNDLED WITH - 1.12.5 + 1.13.1 diff --git a/lib/suture/wrap/sqlite.rb b/lib/suture/wrap/sqlite.rb index 0804871..dfd9b01 100644 --- a/lib/suture/wrap/sqlite.rb +++ b/lib/suture/wrap/sqlite.rb @@ -1,5 +1,10 @@ require "fileutils" -require "sqlite3" +if defined?(JRUBY_VERSION) + require "jdbc/sqlite3" + Jdbc::SQLite3.load_driver +else + require "sqlite3" +end require "suture/error/schema_version" module Suture::Wrap diff --git a/suture.gemspec b/suture.gemspec index a8326c0..930778b 100644 --- a/suture.gemspec +++ b/suture.gemspec @@ -18,7 +18,13 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "sqlite3" + sqlite3 = if defined?(JRUBY_VERSION) + # "jdbc-sqlite3" + "activerecord-jdbcsqlite3-adapter" + else + "sqlite3" + end + spec.add_dependency sqlite3 spec.add_dependency "backports" spec.add_dependency "bar-of-progress", ">= 0.1.3"