Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Travis and Gemspec to support Jruby #47

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rvm:
- 1.9.3
- 2.0.0
- rbx-2
- jruby

gemfile:
- Gemfile
Expand Down
14 changes: 11 additions & 3 deletions activeuuid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ Gem::Specification.new do |s|
s.add_development_dependency "database_cleaner"
s.add_development_dependency "forgery"
s.add_development_dependency "fabrication"
s.add_development_dependency "sqlite3"
s.add_development_dependency "pg"
s.add_development_dependency "mysql2"

if RUBY_PLATFORM == 'java'
s.add_development_dependency "activerecord-jdbc-adapter"
s.add_development_dependency "activerecord-jdbcmysql-adapter"
s.add_development_dependency "activerecord-jdbcpostgresql-adapter"
s.add_development_dependency "activerecord-jdbcsqlite3-adapter"
else
s.add_development_dependency "mysql2"
s.add_development_dependency "sqlite3"
s.add_development_dependency "pg"
end

s.add_runtime_dependency "uuidtools"
s.add_runtime_dependency "activerecord", '>= 3.1'
Expand Down
19 changes: 19 additions & 0 deletions lib/activeuuid/patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ def uuid(*column_names)
end
end

module JdbcMySQLSimplifiedType
extend ActiveSupport::Concern

included do
def simplified_type_with_mysqljdbc(field_type)
return :uuid if field_type == 'binary(16)'
simplified_type_without_mysqljdbc(field_type)
end

alias_method_chain :simplified_type, :mysqljdbc
end
end

module Column
extend ActiveSupport::Concern

Expand Down Expand Up @@ -118,6 +131,12 @@ def self.apply!
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter
ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :include, PostgreSQLQuoting if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter
ActiveRecord::ConnectionAdapters::MysqlAdapter.send :include, Quoting
ActiveRecord::ConnectionAdapters::MysqlAdapter::Column.send :include, Column
ArJdbc::MySQL::Column.send :include, JdbcMySQLSimplifiedType
end
end
end
end