diff --git a/Gemfile b/Gemfile index 8ea5734..449a7e9 100644 --- a/Gemfile +++ b/Gemfile @@ -9,10 +9,17 @@ end group :test do # Database Adapters - gem "mysql", "~> 2.8.1" - gem "mysql2", "~> 0.2.4" - gem "pg", "~> 0.9.0" - gem "sqlite3-ruby", "~> 1.3.1" + platforms :ruby do + gem "mysql", "~> 2.8.1" + gem "mysql2", "~> 0.2.4" + gem "pg", "~> 0.9.0" + gem "sqlite3-ruby", "~> 1.3.1" + end + + platforms :jruby do + gem "jdbc-mysql" + gem "activerecord-jdbcmysql-adapter" + end # Support libs gem "factory_girl", "~> 1.3.3" @@ -20,7 +27,12 @@ group :test do # Debugging platforms :mri_18 do - gem "ruby-debug", "~> 0.9.3" + gem "ruby-debug", "= 0.10.4" + end + + platforms :jruby do + gem "ruby-debug-base", "= 0.10.4" + gem "ruby-debug", "= 0.10.4" end platforms :mri_19 do diff --git a/Gemfile.lock b/Gemfile.lock index bbe9f32..bde6fec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,49 @@ GEM remote: http://rubygems.org/ specs: - activemodel (3.0.1) - activesupport (= 3.0.1) + activemodel (3.0.6) + activesupport (= 3.0.6) builder (~> 2.1.2) - i18n (~> 0.4.1) - activerecord (3.0.1) - activemodel (= 3.0.1) - activesupport (= 3.0.1) - arel (~> 1.0.0) + i18n (~> 0.5.0) + activerecord (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) + arel (~> 2.0.2) tzinfo (~> 0.3.23) - activesupport (3.0.1) + activerecord-jdbc-adapter (1.1.1) + activerecord-jdbcmysql-adapter (1.1.1) + activerecord-jdbc-adapter (= 1.1.1) + jdbc-mysql (~> 5.1.0) + activesupport (3.0.6) archive-tar-minitar (0.5.2) - arel (1.0.1) - activesupport (~> 3.0.0) + arel (2.0.9) builder (2.1.2) chronic (0.3.0) - columnize (0.3.1) - delorean (0.2.0) + columnize (0.3.2) + delorean (0.2.1) chronic factory_girl (1.3.3) - gemcutter (0.6.1) git (1.2.5) - i18n (0.4.2) - jeweler (1.4.0) - gemcutter (>= 0.1.0) + i18n (0.5.0) + jdbc-mysql (5.1.13) + jeweler (1.5.2) + bundler (~> 1.0.0) git (>= 1.2.5) - rubyforge (>= 2.0.0) - json_pure (1.4.6) - linecache19 (0.5.11) + rake + linecache (0.43) + linecache19 (0.5.12) ruby_core_source (>= 0.1.4) mysql (2.8.1) - mysql2 (0.2.6) + mysql2 (0.2.7) pg (0.9.0) rake (0.8.7) - ruby-debug (0.9.3) - ruby-debug-base (= 0.9.3) - ruby-debug-base (0.9.3) - ruby-debug-base19 (0.11.24) + ruby-debug (0.10.4) + columnize (>= 0.1) + ruby-debug-base (~> 0.10.4.0) + ruby-debug-base (0.10.4) + linecache (>= 0.3) + ruby-debug-base (0.10.4-java) + ruby-debug-base19 (0.11.25) columnize (>= 0.3.1) linecache19 (>= 0.5.11) ruby_core_source (>= 0.1.4) @@ -45,25 +51,29 @@ GEM columnize (>= 0.3.1) linecache19 (>= 0.5.11) ruby-debug-base19 (>= 0.11.19) - ruby_core_source (0.1.4) + ruby_core_source (0.1.5) archive-tar-minitar (>= 0.5.2) - rubyforge (2.0.4) - json_pure (>= 1.1.7) - sqlite3-ruby (1.3.2) - tzinfo (0.3.23) + sqlite3 (1.3.3) + sqlite3-ruby (1.3.3) + sqlite3 (>= 1.3.3) + tzinfo (0.3.26) PLATFORMS + java ruby DEPENDENCIES activerecord (~> 3.0.0) + activerecord-jdbcmysql-adapter delorean (~> 0.2.0) factory_girl (~> 1.3.3) + jdbc-mysql jeweler (>= 1.4.0) mysql (~> 2.8.1) mysql2 (~> 0.2.4) pg (~> 0.9.0) rake - ruby-debug (~> 0.9.3) + ruby-debug (= 0.10.4) + ruby-debug-base (= 0.10.4) ruby-debug19 sqlite3-ruby (~> 1.3.1) diff --git a/Rakefile b/Rakefile index 8ef6cd7..4d09eeb 100644 --- a/Rakefile +++ b/Rakefile @@ -36,7 +36,7 @@ namespace :display do end task :default => ["display:notice"] -ADAPTERS = %w(mysql mysql2 postgresql sqlite3) +ADAPTERS = %w(mysql mysql2 jdbcmysql postgresql sqlite3) ADAPTERS.each do |adapter| namespace :test do desc "Runs #{adapter} database tests." diff --git a/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb b/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb new file mode 100644 index 0000000..14df303 --- /dev/null +++ b/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb @@ -0,0 +1,6 @@ +require "active_record/connection_adapters/mysql_adapter" +require "activerecord-import/adapters/mysql_adapter" + +class ActiveRecord::ConnectionAdapters::MysqlAdapter + include ActiveRecord::Import::MysqlAdapter::InstanceMethods +end diff --git a/test/adapters/jdbcmysql.rb b/test/adapters/jdbcmysql.rb new file mode 100644 index 0000000..9874c6f --- /dev/null +++ b/test/adapters/jdbcmysql.rb @@ -0,0 +1 @@ +ENV["ARE_DB"] = "jdbcmysql" diff --git a/test/jdbcmysql/import_test.rb b/test/jdbcmysql/import_test.rb new file mode 100644 index 0000000..feaff67 --- /dev/null +++ b/test/jdbcmysql/import_test.rb @@ -0,0 +1,6 @@ +require File.expand_path(File.dirname(__FILE__) + '/../test_helper') + +require File.expand_path(File.dirname(__FILE__) + '/../support/mysql/assertions') +require File.expand_path(File.dirname(__FILE__) + '/../support/mysql/import_examples') + +should_support_mysql_import_functionality \ No newline at end of file