From d45f7c4fbb4dc7a6f183d67e0d532220c06e7eba Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:08:07 +0900 Subject: [PATCH 01/41] Perform monkey-patching after establishing connections As of ActiveRecord 5.0 monkey-patchings initiated by ActiveUUID::Patches.apply! do not modify Mysql2Adapter and/or SQLite3Adapter of ActiveRecord because they are not loaded by the time the apply! method is invoked. To load patches properly on loading time, we override ActiveRecord::Base.establish_connection method to load the patches immediately after connections are established. --- lib/activeuuid/patches.rb | 36 ++++++++++++++++++++++++++---------- spec/spec_helper.rb | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index dfb7903..d6fed33 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -1,7 +1,8 @@ require 'active_record' require 'active_support/concern' -if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2 +if (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2) || + (ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0) module ActiveRecord module Type class UUID < Binary # :nodoc: @@ -9,6 +10,11 @@ def type :uuid end + def serialize(value) + return if value.nil? + UUIDTools::UUID.serialize(value) + end + def cast_value(value) UUIDTools::UUID.serialize(value) end @@ -165,15 +171,23 @@ def native_database_types_with_pguuid end module AbstractAdapter - extend ActiveSupport::Concern + def initialize_type_map(m) + super - included do - def initialize_type_map_with_uuid(m) - initialize_type_map_without_uuid(m) - register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID - end + register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID + end + + def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil) + type.to_s == 'uuid' ? 'binary(16)' : super + end + end + + module ConnectionHandling + def establish_connection(_ = nil) + super - alias_method_chain :initialize_type_map, :uuid + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter + ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter end end @@ -181,8 +195,10 @@ def self.apply! ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition - if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2 - ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter + if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0 + ActiveRecord::Base.singleton_class.prepend ConnectionHandling + elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2 + ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter else ActiveRecord::ConnectionAdapters::Column.send :include, Column diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2754d95..acdb8fd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,10 +8,10 @@ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") ActiveRecord::Base.configurations = YAML::load(File.read(File.dirname(__FILE__) + "/support/database.yml")) -ActiveRecord::Base.establish_connection((ENV["DB"] || "sqlite3").to_sym) require 'activeuuid' +ActiveRecord::Base.establish_connection((ENV["DB"] || "sqlite3").to_sym) ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + "/support/migrate") ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, STDOUT) From 173e3ac1404043d6c331f5f71a16534012b61fe5 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:08:27 +0900 Subject: [PATCH 02/41] Add Travis test environments for Rails 5 --- .travis.yml | 15 ++++++++++++++- gemfiles/Gemfile.rails-5-0 | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gemfiles/Gemfile.rails-5-0 diff --git a/.travis.yml b/.travis.yml index 98e8060..d0728cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ rvm: - 2.0.0 - 2.1.5 - 2.2.0 + - 2.3.1 - rbx-2 - jruby @@ -17,6 +18,7 @@ gemfile: - gemfiles/Gemfile.rails-4-0 - gemfiles/Gemfile.rails-4-1 - gemfiles/Gemfile.rails-4-2 + - gemfiles/Gemfile.rails-5-0 - gemfiles/Gemfile.rails-head env: @@ -30,8 +32,12 @@ matrix: exclude: - rvm: 2.2.0 gemfile: gemfiles/Gemfile.rails-3-1 + - rvm: 2.3.1 + gemfile: gemfiles/Gemfile.rails-3-1 - rvm: 2.2.0 gemfile: gemfiles/Gemfile.rails-3-2 + - rvm: 2.3.1 + gemfile: gemfiles/Gemfile.rails-3-2 - rvm: jruby gemfile: gemfiles/Gemfile.rails-3-1 env: DB=postgresql @@ -44,4 +50,11 @@ matrix: - rvm: jruby gemfile: gemfiles/Gemfile.rails-4-1 env: DB=postgresql - + - rvm: jruby + gemfile: gemfiles/Gemfile.rails-5-0 + env: DB=postgresql + - rvm: 1.9.3 + gemfile: gemfiles/Gemfile.rails-5-0 + - rvm: jruby + gemfile: gemfiles/Gemfile.rails-5-0 + env: DB=postgresql diff --git a/gemfiles/Gemfile.rails-5-0 b/gemfiles/Gemfile.rails-5-0 new file mode 100644 index 0000000..79c197c --- /dev/null +++ b/gemfiles/Gemfile.rails-5-0 @@ -0,0 +1,5 @@ +source "http://rubygems.org" + +gemspec path: '../' + +gem 'activerecord', '~> 5.0.0' From 3888d66254226f39682075137d4691c760c575ab Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:08:50 +0900 Subject: [PATCH 03/41] Remove deprecation warnings from table_exists? --- spec/lib/activerecord_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/lib/activerecord_spec.rb b/spec/lib/activerecord_spec.rb index 7d74e72..11ba0ca 100644 --- a/spec/lib/activerecord_spec.rb +++ b/spec/lib/activerecord_spec.rb @@ -6,7 +6,7 @@ let(:table_name) { :test_uuid_field_creation } before do - connection.drop_table(table_name) if connection.table_exists?(table_name) + connection.drop_table(table_name) if connection.data_source_exists?(table_name) connection.create_table(table_name) end @@ -14,7 +14,7 @@ connection.drop_table table_name end - specify { connection.table_exists?(table_name).should be_truthy } + specify { connection.data_source_exists?(table_name).should be_truthy } context '#add_column' do let(:column_name) { :uuid_column } @@ -218,4 +218,3 @@ its(:id) { should == uuid } end end - From d58de849471ec77afa8243e98ac11f79aa3fe233 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:37:50 +0900 Subject: [PATCH 04/41] Override type_to_sql only of Mysql adapter --- lib/activeuuid/patches.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index d6fed33..69cffa9 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -170,13 +170,15 @@ def native_database_types_with_pguuid end end - module AbstractAdapter + module TypeMapOverride def initialize_type_map(m) super register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID end + end + module MysqlTypeToSqlOverride def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil) type.to_s == 'uuid' ? 'binary(16)' : super end @@ -186,8 +188,12 @@ module ConnectionHandling def establish_connection(_ = nil) super - ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter - ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend TypeMapOverride + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend MysqlTypeToSqlOverride + end + + ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter end end @@ -198,8 +204,8 @@ def self.apply! if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0 ActiveRecord::Base.singleton_class.prepend ConnectionHandling elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2 - ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter - ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter + ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter else ActiveRecord::ConnectionAdapters::Column.send :include, Column ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn From 4b4d15e43a3a9aeecc132e61b9cf57bc11a0c827 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:39:46 +0900 Subject: [PATCH 05/41] Remove deprecation warning of alias_method_chain --- lib/activeuuid/uuid.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/activeuuid/uuid.rb b/lib/activeuuid/uuid.rb index 48feaa7..e8ede90 100644 --- a/lib/activeuuid/uuid.rb +++ b/lib/activeuuid/uuid.rb @@ -103,7 +103,7 @@ module UUID class_attribute :_uuid_generator, instance_writer: false self._uuid_generator = :random - singleton_class.alias_method_chain :instantiate, :uuid + singleton_class.prepend Instantiation before_create :generate_uuids_if_needed end @@ -128,15 +128,18 @@ def uuids(*attributes) EOS end - def instantiate_with_uuid(record, record_models = nil) + def uuid_columns + @uuid_columns ||= columns.select { |c| c.type == :uuid }.map(&:name) + end + end + + module Instantiation + def instantiate(record, record_models = nil) uuid_columns.each do |uuid_column| record[uuid_column] = UUIDTools::UUID.serialize(record[uuid_column]).to_s if record[uuid_column] end - instantiate_without_uuid(record) - end - def uuid_columns - @uuid_columns ||= columns.select { |c| c.type == :uuid }.map(&:name) + super(record) end end From 93cfd6d0317e142317a6d4bea29c007ded65821d Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:42:42 +0900 Subject: [PATCH 06/41] Discontinue supporting ruby 1.9.3 --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d0728cd..e693584 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ before_script: - psql -c 'create database activeuuid_test;' -U postgres rvm: - - 1.9.3 - 2.0.0 - 2.1.5 - 2.2.0 @@ -53,8 +52,6 @@ matrix: - rvm: jruby gemfile: gemfiles/Gemfile.rails-5-0 env: DB=postgresql - - rvm: 1.9.3 - gemfile: gemfiles/Gemfile.rails-5-0 - rvm: jruby gemfile: gemfiles/Gemfile.rails-5-0 env: DB=postgresql From 631c9e7a74f4cf0e4a4d6404cd126c2489f44ba6 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 8 Oct 2016 20:44:01 +0900 Subject: [PATCH 07/41] Remove a duplicate entry --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e693584..1f50db7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,6 +52,3 @@ matrix: - rvm: jruby gemfile: gemfiles/Gemfile.rails-5-0 env: DB=postgresql - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-5-0 - env: DB=postgresql From 9d998598aae86971cea24e771386efe0bbca37f1 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sun, 9 Oct 2016 12:03:22 +0900 Subject: [PATCH 08/41] Perform all monkey-patching on connection establishments As loading order of activeuuid and connection establishment in spec_helper has been switched. --- lib/activeuuid/patches.rb | 43 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index 69cffa9..dc3e71b 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -188,34 +188,33 @@ module ConnectionHandling def establish_connection(_ = nil) super - if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter - ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend TypeMapOverride - ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend MysqlTypeToSqlOverride + ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table + ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition + + if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0 + if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend TypeMapOverride + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend MysqlTypeToSqlOverride + end + + ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2 + ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter + ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + else + ActiveRecord::ConnectionAdapters::Column.send :include, Column + ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn end - ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + ActiveRecord::ConnectionAdapters::MysqlAdapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter + 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 end end def self.apply! - ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table - ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition - - if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0 - ActiveRecord::Base.singleton_class.prepend ConnectionHandling - elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2 - ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter - ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter - else - ActiveRecord::ConnectionAdapters::Column.send :include, Column - ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn - end - ArJdbc::MySQL::Column.send :include, MysqlJdbcColumn if defined? ArJdbc::MySQL::Column - - ActiveRecord::ConnectionAdapters::MysqlAdapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter - 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 + ActiveRecord::Base.singleton_class.prepend ConnectionHandling end end end From c99796af98a3d639606b8abae7262de0ed3e5ebf Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 21:46:21 +0900 Subject: [PATCH 09/41] Refine Travis test environments --- .travis.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f50db7..a89681d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ before_script: rvm: - 2.0.0 - - 2.1.5 - - 2.2.0 + - 2.1.10 + - 2.2.5 - 2.3.1 - rbx-2 - jruby @@ -29,17 +29,21 @@ matrix: allow_failures: - gemfile: gemfiles/Gemfile.rails-head exclude: - - rvm: 2.2.0 + - rvm: 2.0.0 + gemfile: Gemfile + - rvm: 2.1.10 + gemfile: Gemfile + - rvm: 2.2.5 gemfile: gemfiles/Gemfile.rails-3-1 - rvm: 2.3.1 gemfile: gemfiles/Gemfile.rails-3-1 - - rvm: 2.2.0 - gemfile: gemfiles/Gemfile.rails-3-2 - - rvm: 2.3.1 - gemfile: gemfiles/Gemfile.rails-3-2 - rvm: jruby gemfile: gemfiles/Gemfile.rails-3-1 env: DB=postgresql + - rvm: 2.2.5 + gemfile: gemfiles/Gemfile.rails-3-2 + - rvm: 2.3.1 + gemfile: gemfiles/Gemfile.rails-3-2 - rvm: jruby gemfile: gemfiles/Gemfile.rails-3-2 env: DB=postgresql @@ -49,6 +53,10 @@ matrix: - rvm: jruby gemfile: gemfiles/Gemfile.rails-4-1 env: DB=postgresql + - rvm: 2.0.0 + gemfile: gemfiles/Gemfile.rails-5-0 + - rvm: 2.1.10 + gemfile: gemfiles/Gemfile.rails-5-0 - rvm: jruby gemfile: gemfiles/Gemfile.rails-5-0 env: DB=postgresql From 5db82730324ee02b63f6f04e4d14beecb70af374 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 22:58:21 +0900 Subject: [PATCH 10/41] Resolve double serialization issue in rails 4.2-postgresql --- lib/activeuuid/patches.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index dc3e71b..36bf06f 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -30,7 +30,6 @@ class Uuid < Type::Value # :nodoc: def type_cast_from_user(value) UUIDTools::UUID.serialize(value) if value end - alias_method :type_cast_from_database, :type_cast_from_user end end end From 30a754957d71bb777b04b67c38e838cad6d94bcc Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 22:58:55 +0900 Subject: [PATCH 11/41] Override postgresql type casting scheme in Rails 5 --- lib/activeuuid/patches.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index 36bf06f..a29b363 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -169,6 +169,14 @@ def native_database_types_with_pguuid end end + module PostgresqlTypeOverride + def deserialize(value) + UUIDTools::UUID.serialize(value) if value + end + + alias_method :cast, :deserialize + end + module TypeMapOverride def initialize_type_map(m) super @@ -197,6 +205,7 @@ def establish_connection(_ = nil) end ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid.prepend PostgresqlTypeOverride if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2 ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter From 33b94fef3f066fed137dba85c7987c65d2fca2c9 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 23:08:12 +0900 Subject: [PATCH 12/41] Support rails <= 4.1 where #data_source_exists? does not exist --- spec/lib/activerecord_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/lib/activerecord_spec.rb b/spec/lib/activerecord_spec.rb index 11ba0ca..67754e5 100644 --- a/spec/lib/activerecord_spec.rb +++ b/spec/lib/activerecord_spec.rb @@ -2,11 +2,17 @@ describe ActiveRecord::Base do context '.connection' do + def table_exists?(connection, table_name) + connection.respond_to?(:data_source_exists?) ? + connection.data_source_exists?(table_name) : + connection.table_exists?(table_name) + end + let!(:connection) { ActiveRecord::Base.connection } let(:table_name) { :test_uuid_field_creation } before do - connection.drop_table(table_name) if connection.data_source_exists?(table_name) + connection.drop_table(table_name) if table_exists?(connection, table_name) connection.create_table(table_name) end @@ -14,7 +20,7 @@ connection.drop_table table_name end - specify { connection.data_source_exists?(table_name).should be_truthy } + specify { table_exists?(connection, table_name).should be_truthy } context '#add_column' do let(:column_name) { :uuid_column } From 529a0d1fa3d022c8bf3a3146fcbb80300f4cd455 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 23:30:42 +0900 Subject: [PATCH 13/41] Resolve activerecord-mysql2 version conflict --- gemfiles/Gemfile.rails-3-1 | 1 + gemfiles/Gemfile.rails-3-2 | 1 + gemfiles/Gemfile.rails-4-0 | 1 + gemfiles/Gemfile.rails-4-1 | 1 + 4 files changed, 4 insertions(+) diff --git a/gemfiles/Gemfile.rails-3-1 b/gemfiles/Gemfile.rails-3-1 index 07f13bd..d2ebaed 100644 --- a/gemfiles/Gemfile.rails-3-1 +++ b/gemfiles/Gemfile.rails-3-1 @@ -2,4 +2,5 @@ source "http://rubygems.org" gemspec path: '../' +gem 'mysql2', '~> 0.3.21' gem 'activerecord', '~> 3.1.0' diff --git a/gemfiles/Gemfile.rails-3-2 b/gemfiles/Gemfile.rails-3-2 index bf6b722..0bc0fb7 100644 --- a/gemfiles/Gemfile.rails-3-2 +++ b/gemfiles/Gemfile.rails-3-2 @@ -2,4 +2,5 @@ source "http://rubygems.org" gemspec path: '../' +gem 'mysql2', '~> 0.3.21' gem 'activerecord', '~> 3.2.0' diff --git a/gemfiles/Gemfile.rails-4-0 b/gemfiles/Gemfile.rails-4-0 index 1e2870c..b6812df 100644 --- a/gemfiles/Gemfile.rails-4-0 +++ b/gemfiles/Gemfile.rails-4-0 @@ -2,4 +2,5 @@ source "http://rubygems.org" gemspec path: '../' +gem 'mysql2', '~> 0.3.21' gem 'activerecord', '~> 4.0.0' diff --git a/gemfiles/Gemfile.rails-4-1 b/gemfiles/Gemfile.rails-4-1 index 4d380fd..5beb06f 100644 --- a/gemfiles/Gemfile.rails-4-1 +++ b/gemfiles/Gemfile.rails-4-1 @@ -2,4 +2,5 @@ source "http://rubygems.org" gemspec path: '../' +gem 'mysql2', '~> 0.3.21' gem 'activerecord', '~> 4.1.0' From 2ba2f83ba39fd8b07bb3387ba5d46d76627114b2 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 23:30:57 +0900 Subject: [PATCH 14/41] Skip unnecessary tests against rails-head --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index a89681d..c9c94c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,3 +60,10 @@ matrix: - rvm: jruby gemfile: gemfiles/Gemfile.rails-5-0 env: DB=postgresql + - rvm: 2.0.0 + gemfile: gemfiles/Gemfile.rails-head + - rvm: 2.1.10 + gemfile: gemfiles/Gemfile.rails-head + - rvm: jruby + gemfile: gemfiles/Gemfile.rails-head + env: DB=postgresql From ac823000c7a9027185beecd3934f11fbb6f9a30f Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Mon, 10 Oct 2016 23:38:36 +0900 Subject: [PATCH 15/41] Resolve primary key constraint issue on mysql >= 5.7 Refer: https://github.com/rails/rails/pull/13247 --- spec/spec_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index acdb8fd..5def763 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,6 +12,19 @@ require 'activeuuid' ActiveRecord::Base.establish_connection((ENV["DB"] || "sqlite3").to_sym) + +if ENV['DB'] == 'mysql' + if ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR <= 1 + class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter + NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY" + end + elsif ActiveRecord::VERSION::MAJOR == 3 + class ActiveRecord::ConnectionAdapters::Mysql2Adapter + NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY" + end + end +end + ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + "/support/migrate") ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, STDOUT) From fcc7e29ecdee44e04488484ff8740bd5bd8e9719 Mon Sep 17 00:00:00 2001 From: Justin Sookikian Date: Tue, 10 Jan 2017 17:36:11 -0800 Subject: [PATCH 16/41] removing alias_method_chain in favor of prepend --- lib/activeuuid/patches.rb | 91 ++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index dfb7903..54839cf 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -47,32 +47,35 @@ def uuid(*column_names) module Column extend ActiveSupport::Concern - included do + def self.prepended(klass) def type_cast_with_uuid(value) return UUIDTools::UUID.serialize(value) if type == :uuid - type_cast_without_uuid(value) + super + #type_cast_without_uuid(value) end def type_cast_code_with_uuid(var_name) return "UUIDTools::UUID.serialize(#{var_name})" if type == :uuid - type_cast_code_without_uuid(var_name) + super + #type_cast_code_without_uuid(var_name) end def simplified_type_with_uuid(field_type) return :uuid if field_type == 'binary(16)' || field_type == 'binary(16,0)' - simplified_type_without_uuid(field_type) + super + #simplified_type_without_uuid(field_type) end - alias_method_chain :type_cast, :uuid - alias_method_chain :type_cast_code, :uuid if ActiveRecord::VERSION::MAJOR < 4 - alias_method_chain :simplified_type, :uuid +# alias_method_chain :type_cast, :uuid +# alias_method_chain :type_cast_code, :uuid if ActiveRecord::VERSION::MAJOR < 4 +# alias_method_chain :simplified_type, :uuid end end module MysqlJdbcColumn extend ActiveSupport::Concern - included do + def self.prepended(klass) # This is a really hacky solution, but it's the only way to support the # MySql JDBC adapter without breaking backwards compatibility. # It would be a lot easier if AR had support for custom defined types. @@ -85,11 +88,12 @@ module MysqlJdbcColumn # (5) Since it's no a uuid (see step 3), simplified_type_without_uuid is called, # which maps to AR::ConnectionAdapters::Column.simplified_type (which has no super call, so we're good) # - alias_method :original_simplified_type, :simplified_type + # alias_method :original_simplified_type, :simplified_type def simplified_type(field_type) return :uuid if field_type == 'binary(16)' || field_type == 'binary(16,0)' - original_simplified_type(field_type) + super +# original_simplified_type(field_type) end end end @@ -98,102 +102,109 @@ def simplified_type(field_type) module PostgreSQLColumn extend ActiveSupport::Concern - included do + def self.prepended(klass) def type_cast_with_uuid(value) return UUIDTools::UUID.serialize(value) if type == :uuid - type_cast_without_uuid(value) + super + #type_cast_without_uuid(value) end alias_method_chain :type_cast, :uuid if ActiveRecord::VERSION::MAJOR >= 4 def simplified_type_with_pguuid(field_type) return :uuid if field_type == 'uuid' - simplified_type_without_pguuid(field_type) + super + #simplified_type_without_pguuid(field_type) end - alias_method_chain :simplified_type, :pguuid + #alias_method_chain :simplified_type, :pguuid end end module Quoting extend ActiveSupport::Concern - included do + def self.prepended(klass) def quote_with_visiting(value, column = nil) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid - quote_without_visiting(value, column) + super + #quote_without_visiting(value, column) end def type_cast_with_visiting(value, column = nil) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid - type_cast_without_visiting(value, column) + super + #type_cast_without_visiting(value, column) end def native_database_types_with_uuid @native_database_types ||= native_database_types_without_uuid.merge(uuid: { name: 'binary', limit: 16 }) end - alias_method_chain :quote, :visiting - alias_method_chain :type_cast, :visiting - alias_method_chain :native_database_types, :uuid + #alias_method_chain :quote, :visiting + #alias_method_chain :type_cast, :visiting + #alias_method_chain :native_database_types, :uuid end end module PostgreSQLQuoting extend ActiveSupport::Concern - included do + def self.prepended(klass) def quote_with_visiting(value, column = nil) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid value = value.to_s if value.is_a? UUIDTools::UUID - quote_without_visiting(value, column) + super + #quote_without_visiting(value, column) end def type_cast_with_visiting(value, column = nil, *args) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid value = value.to_s if value.is_a? UUIDTools::UUID - type_cast_without_visiting(value, column, *args) + super + #type_cast_without_visiting(value, column, *args) end def native_database_types_with_pguuid @native_database_types ||= native_database_types_without_pguuid.merge(uuid: { name: 'uuid' }) end - alias_method_chain :quote, :visiting - alias_method_chain :type_cast, :visiting - alias_method_chain :native_database_types, :pguuid + #alias_method_chain :quote, :visiting + #alias_method_chain :type_cast, :visiting + #alias_method_chain :native_database_types, :pguuid end end module AbstractAdapter extend ActiveSupport::Concern - included do + def self.prepended(klass) def initialize_type_map_with_uuid(m) - initialize_type_map_without_uuid(m) + #initialize_type_map_without_uuid(m) + super register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID end - alias_method_chain :initialize_type_map, :uuid + #alias_method_chain :initialize_type_map, :uuid end end def self.apply! - ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table - ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition + ActiveRecord::ConnectionAdapters::Table.send :prepend, Migrations if defined? ActiveRecord::ConnectionAdapters::Table + ActiveRecord::ConnectionAdapters::TableDefinition.send :prepend, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2 - ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter - ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :prepend, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter + ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :prepend, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter else - ActiveRecord::ConnectionAdapters::Column.send :include, Column - ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn + ActiveRecord::ConnectionAdapters::Column.send :prepend, Column + ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :prepend, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn end - ArJdbc::MySQL::Column.send :include, MysqlJdbcColumn if defined? ArJdbc::MySQL::Column + ArJdbc::MySQL::Column.send :prepend, MysqlJdbcColumn if defined? ArJdbc::MySQL::Column - ActiveRecord::ConnectionAdapters::MysqlAdapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter - 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 + ActiveRecord::ConnectionAdapters::MysqlAdapter.send :prepend, Quoting if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter + ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :prepend, Quoting if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter + ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :prepend, Quoting if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :prepend, PostgreSQLQuoting if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter end end end From 1c32cb765293e8347740b03b896f71c73c63c999 Mon Sep 17 00:00:00 2001 From: Justin Sookikian Date: Thu, 12 Jan 2017 17:21:02 -0800 Subject: [PATCH 17/41] Refactored alias_method_chain for deprecation purposes --- Gemfile | 4 +- lib/activeuuid/patches.rb | 110 ++++++++++++++++++++------------------ 2 files changed, 59 insertions(+), 55 deletions(-) diff --git a/Gemfile b/Gemfile index 5562177..9607a9c 100644 --- a/Gemfile +++ b/Gemfile @@ -2,5 +2,5 @@ source "http://rubygems.org" # Specify your gem's dependencies in activeuuid.gemspec gemspec - -gem "activerecord" +gem 'rake', '< 11.0' +gem "activerecord", "~>5.0" diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index 54839cf..84b1591 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -1,7 +1,8 @@ require 'active_record' require 'active_support/concern' -if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2 +if (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2) || + (ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0) module ActiveRecord module Type class UUID < Binary # :nodoc: @@ -9,6 +10,11 @@ def type :uuid end + def serialize(value) + return if value.nil? + UUIDTools::UUID.serialize(value) + end + def cast_value(value) UUIDTools::UUID.serialize(value) end @@ -24,7 +30,6 @@ class Uuid < Type::Value # :nodoc: def type_cast_from_user(value) UUIDTools::UUID.serialize(value) if value end - alias_method :type_cast_from_database, :type_cast_from_user end end end @@ -51,31 +56,24 @@ def self.prepended(klass) def type_cast_with_uuid(value) return UUIDTools::UUID.serialize(value) if type == :uuid super - #type_cast_without_uuid(value) end def type_cast_code_with_uuid(var_name) return "UUIDTools::UUID.serialize(#{var_name})" if type == :uuid super - #type_cast_code_without_uuid(var_name) end def simplified_type_with_uuid(field_type) return :uuid if field_type == 'binary(16)' || field_type == 'binary(16,0)' super - #simplified_type_without_uuid(field_type) end - -# alias_method_chain :type_cast, :uuid -# alias_method_chain :type_cast_code, :uuid if ActiveRecord::VERSION::MAJOR < 4 -# alias_method_chain :simplified_type, :uuid end end module MysqlJdbcColumn extend ActiveSupport::Concern - def self.prepended(klass) + included do # This is a really hacky solution, but it's the only way to support the # MySql JDBC adapter without breaking backwards compatibility. # It would be a lot easier if AR had support for custom defined types. @@ -88,12 +86,11 @@ def self.prepended(klass) # (5) Since it's no a uuid (see step 3), simplified_type_without_uuid is called, # which maps to AR::ConnectionAdapters::Column.simplified_type (which has no super call, so we're good) # - # alias_method :original_simplified_type, :simplified_type + alias_method :original_simplified_type, :simplified_type def simplified_type(field_type) return :uuid if field_type == 'binary(16)' || field_type == 'binary(16,0)' - super -# original_simplified_type(field_type) + original_simplified_type(field_type) end end end @@ -106,17 +103,13 @@ def self.prepended(klass) def type_cast_with_uuid(value) return UUIDTools::UUID.serialize(value) if type == :uuid super - #type_cast_without_uuid(value) end alias_method_chain :type_cast, :uuid if ActiveRecord::VERSION::MAJOR >= 4 def simplified_type_with_pguuid(field_type) return :uuid if field_type == 'uuid' super - #simplified_type_without_pguuid(field_type) end - - #alias_method_chain :simplified_type, :pguuid end end @@ -127,22 +120,16 @@ def self.prepended(klass) def quote_with_visiting(value, column = nil) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid super - #quote_without_visiting(value, column) end def type_cast_with_visiting(value, column = nil) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid super - #type_cast_without_visiting(value, column) end def native_database_types_with_uuid @native_database_types ||= native_database_types_without_uuid.merge(uuid: { name: 'binary', limit: 16 }) end - - #alias_method_chain :quote, :visiting - #alias_method_chain :type_cast, :visiting - #alias_method_chain :native_database_types, :uuid end end @@ -154,57 +141,74 @@ def quote_with_visiting(value, column = nil) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid value = value.to_s if value.is_a? UUIDTools::UUID super - #quote_without_visiting(value, column) end def type_cast_with_visiting(value, column = nil, *args) value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid value = value.to_s if value.is_a? UUIDTools::UUID super - #type_cast_without_visiting(value, column, *args) end def native_database_types_with_pguuid @native_database_types ||= native_database_types_without_pguuid.merge(uuid: { name: 'uuid' }) end + end + end - #alias_method_chain :quote, :visiting - #alias_method_chain :type_cast, :visiting - #alias_method_chain :native_database_types, :pguuid + module PostgresqlTypeOverride + def deserialize(value) + UUIDTools::UUID.serialize(value) if value end + + alias_method :cast, :deserialize end - module AbstractAdapter - extend ActiveSupport::Concern + module TypeMapOverride + def initialize_type_map(m) + super - def self.prepended(klass) - def initialize_type_map_with_uuid(m) - #initialize_type_map_without_uuid(m) - super - register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID - end + register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID + end + end - #alias_method_chain :initialize_type_map, :uuid + module MysqlTypeToSqlOverride + def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil) + type.to_s == 'uuid' ? 'binary(16)' : super end end - def self.apply! - ActiveRecord::ConnectionAdapters::Table.send :prepend, Migrations if defined? ActiveRecord::ConnectionAdapters::Table - ActiveRecord::ConnectionAdapters::TableDefinition.send :prepend, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition - - if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2 - ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :prepend, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter - ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :prepend, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter - else - ActiveRecord::ConnectionAdapters::Column.send :prepend, Column - ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :prepend, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn + module ConnectionHandling + def establish_connection(_ = nil) + super + + ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table + ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition + + if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0 + if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend TypeMapOverride + ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.prepend MysqlTypeToSqlOverride + end + + ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid.prepend PostgresqlTypeOverride if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter + elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2 + ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter + ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend TypeMapOverride if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter + else + ActiveRecord::ConnectionAdapters::Column.send :include, Column + ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn + end + + ActiveRecord::ConnectionAdapters::MysqlAdapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter + 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 end - ArJdbc::MySQL::Column.send :prepend, MysqlJdbcColumn if defined? ArJdbc::MySQL::Column + end - ActiveRecord::ConnectionAdapters::MysqlAdapter.send :prepend, Quoting if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter - ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :prepend, Quoting if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter - ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :prepend, Quoting if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter - ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :prepend, PostgreSQLQuoting if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter + def self.apply! + ActiveRecord::Base.singleton_class.prepend ConnectionHandling end end -end +end \ No newline at end of file From 19a492e042b462f188f18802e83d9f9f5d70c835 Mon Sep 17 00:00:00 2001 From: Justin Sookikian Date: Fri, 13 Jan 2017 11:03:16 -0800 Subject: [PATCH 18/41] Temporarily adding in last_comment method --- Rakefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Rakefile b/Rakefile index 5ed955d..3222e8e 100644 --- a/Rakefile +++ b/Rakefile @@ -3,6 +3,13 @@ require "bundler/gem_tasks" require 'rspec/core' require 'rspec/core/rake_task' +module TempFixForRakeLastComment + def last_comment + last_description + end +end +Rake::Application.send :include, TempFixForRakeLastComment + RSpec::Core::RakeTask.new(:spec) task :default => :spec From 72e170237dabe75e355dc6cb883c979f5e91579b Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:00:29 +0900 Subject: [PATCH 19/41] Update rbx to the latest version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c9c94c2..be28f38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ rvm: - 2.1.10 - 2.2.5 - 2.3.1 - - rbx-2 + - rbx-3.69 - jruby gemfile: From bf5a6c2deca8109a659e46689759db2e2f033b92 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:01:02 +0900 Subject: [PATCH 20/41] Remove EOL-ed ruby 2.0.0 --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index be28f38..3efcc94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ before_script: - psql -c 'create database activeuuid_test;' -U postgres rvm: - - 2.0.0 - 2.1.10 - 2.2.5 - 2.3.1 @@ -29,8 +28,6 @@ matrix: allow_failures: - gemfile: gemfiles/Gemfile.rails-head exclude: - - rvm: 2.0.0 - gemfile: Gemfile - rvm: 2.1.10 gemfile: Gemfile - rvm: 2.2.5 @@ -53,15 +50,11 @@ matrix: - rvm: jruby gemfile: gemfiles/Gemfile.rails-4-1 env: DB=postgresql - - rvm: 2.0.0 - gemfile: gemfiles/Gemfile.rails-5-0 - rvm: 2.1.10 gemfile: gemfiles/Gemfile.rails-5-0 - rvm: jruby gemfile: gemfiles/Gemfile.rails-5-0 env: DB=postgresql - - rvm: 2.0.0 - gemfile: gemfiles/Gemfile.rails-head - rvm: 2.1.10 gemfile: gemfiles/Gemfile.rails-head - rvm: jruby From c58699a6509654e4522c08b7ec83cb8970471b20 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:01:19 +0900 Subject: [PATCH 21/41] Remove EOL-ed rails 3.1 and 3.2 --- .travis.yml | 15 --------------- gemfiles/Gemfile.rails-3-1 | 6 ------ gemfiles/Gemfile.rails-3-2 | 6 ------ 3 files changed, 27 deletions(-) delete mode 100644 gemfiles/Gemfile.rails-3-1 delete mode 100644 gemfiles/Gemfile.rails-3-2 diff --git a/.travis.yml b/.travis.yml index 3efcc94..02dcb02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ rvm: gemfile: - Gemfile - - gemfiles/Gemfile.rails-3-1 - - gemfiles/Gemfile.rails-3-2 - gemfiles/Gemfile.rails-4-0 - gemfiles/Gemfile.rails-4-1 - gemfiles/Gemfile.rails-4-2 @@ -30,19 +28,6 @@ matrix: exclude: - rvm: 2.1.10 gemfile: Gemfile - - rvm: 2.2.5 - gemfile: gemfiles/Gemfile.rails-3-1 - - rvm: 2.3.1 - gemfile: gemfiles/Gemfile.rails-3-1 - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-3-1 - env: DB=postgresql - - rvm: 2.2.5 - gemfile: gemfiles/Gemfile.rails-3-2 - - rvm: 2.3.1 - gemfile: gemfiles/Gemfile.rails-3-2 - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-3-2 env: DB=postgresql - rvm: jruby gemfile: gemfiles/Gemfile.rails-4-0 diff --git a/gemfiles/Gemfile.rails-3-1 b/gemfiles/Gemfile.rails-3-1 deleted file mode 100644 index d2ebaed..0000000 --- a/gemfiles/Gemfile.rails-3-1 +++ /dev/null @@ -1,6 +0,0 @@ -source "http://rubygems.org" - -gemspec path: '../' - -gem 'mysql2', '~> 0.3.21' -gem 'activerecord', '~> 3.1.0' diff --git a/gemfiles/Gemfile.rails-3-2 b/gemfiles/Gemfile.rails-3-2 deleted file mode 100644 index 0bc0fb7..0000000 --- a/gemfiles/Gemfile.rails-3-2 +++ /dev/null @@ -1,6 +0,0 @@ -source "http://rubygems.org" - -gemspec path: '../' - -gem 'mysql2', '~> 0.3.21' -gem 'activerecord', '~> 3.2.0' From a99065162c4b654fd2b5b9caa312eb5086d11262 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:17:35 +0900 Subject: [PATCH 22/41] Bump up runtime activerecord dependency --- activeuuid.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activeuuid.gemspec b/activeuuid.gemspec index 29e7acf..ef854a6 100644 --- a/activeuuid.gemspec +++ b/activeuuid.gemspec @@ -35,5 +35,5 @@ Gem::Specification.new do |s| end s.add_runtime_dependency "uuidtools" - s.add_runtime_dependency "activerecord", '>= 3.1' + s.add_runtime_dependency "activerecord", '>= 4.0' end From c8f871b2f2e912f1656bd34d250cde23116d93bd Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:22:38 +0900 Subject: [PATCH 23/41] Refine jruby dependencies --- .travis.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 02dcb02..0f08beb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ rvm: - 2.2.5 - 2.3.1 - rbx-3.69 - - jruby + - jruby-9.1.7.0 gemfile: - Gemfile @@ -29,19 +29,11 @@ matrix: - rvm: 2.1.10 gemfile: Gemfile env: DB=postgresql - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-4-0 - env: DB=postgresql - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-4-1 - env: DB=postgresql - rvm: 2.1.10 gemfile: gemfiles/Gemfile.rails-5-0 - - rvm: jruby + - rvm: jruby-9.1.7.0 gemfile: gemfiles/Gemfile.rails-5-0 - env: DB=postgresql - rvm: 2.1.10 gemfile: gemfiles/Gemfile.rails-head - - rvm: jruby + - rvm: jruby-9.1.7.0 gemfile: gemfiles/Gemfile.rails-head - env: DB=postgresql From 3a3038d415471b39cc9e69111cc83c27d4e1a5af Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:24:51 +0900 Subject: [PATCH 24/41] Set rubies on CI to the latest releases --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f08beb..509e73e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ before_script: rvm: - 2.1.10 - - 2.2.5 - - 2.3.1 + - 2.2.6 + - 2.3.3 - rbx-3.69 - jruby-9.1.7.0 From 1ff86a781f2d4cd92b0c66629f01db926a5c0a48 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:25:12 +0900 Subject: [PATCH 25/41] Remove duplicate exclusion list --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 509e73e..8ea0226 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,3 @@ matrix: gemfile: gemfiles/Gemfile.rails-5-0 - rvm: jruby-9.1.7.0 gemfile: gemfiles/Gemfile.rails-5-0 - - rvm: 2.1.10 - gemfile: gemfiles/Gemfile.rails-head - - rvm: jruby-9.1.7.0 - gemfile: gemfiles/Gemfile.rails-head From d0fcd14bc6dc79252dec96eb66f0951c81a27f65 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:37:12 +0900 Subject: [PATCH 26/41] Update RSpec --- activeuuid.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activeuuid.gemspec b/activeuuid.gemspec index ef854a6..b0f2ae4 100644 --- a/activeuuid.gemspec +++ b/activeuuid.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.add_development_dependency "rake" - s.add_development_dependency "rspec", "~> 2.99.0" + s.add_development_dependency "rspec", "~> 3.5.0" s.add_development_dependency "rspec-its" s.add_development_dependency "activesupport" s.add_development_dependency "database_cleaner" From 4a3a1485e3a88794107dc3a6589914d8274ded24 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:44:43 +0900 Subject: [PATCH 27/41] Exclude all ruby-2.1.10 tests against the primary Gemfile --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ea0226..24aebb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ matrix: exclude: - rvm: 2.1.10 gemfile: Gemfile - env: DB=postgresql - rvm: 2.1.10 gemfile: gemfiles/Gemfile.rails-5-0 - rvm: jruby-9.1.7.0 From 3ff0a87117ce320aba5623314dc5f82baea1fa05 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:49:39 +0900 Subject: [PATCH 28/41] Fix specs to run again Previous spec failures were from changed behaviour of described_class on RSpec 3.x, which referenced the innermost `context' instead of `describe'. --- spec/lib/activerecord_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/activerecord_spec.rb b/spec/lib/activerecord_spec.rb index 67754e5..6fa67f2 100644 --- a/spec/lib/activerecord_spec.rb +++ b/spec/lib/activerecord_spec.rb @@ -111,7 +111,7 @@ def table_exists?(connection, table_name) describe UuidArticle do let!(:article) { Fabricate :uuid_article } let!(:id) { article.id } - let(:model) { described_class } + let(:model) { UuidArticle } subject { model } context 'model' do From 19b48e6bb43aa0bc91d8ed6bf88f8e841de7b6ce Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:56:44 +0900 Subject: [PATCH 29/41] Update rbx, jruby to travis-supported latest versions --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24aebb0..edac0da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ rvm: - 2.1.10 - 2.2.6 - 2.3.3 - - rbx-3.69 - - jruby-9.1.7.0 + - rbx-2.2.2 + - jruby-9.1.1.0 gemfile: - Gemfile From abf96506012fcfb29648f44e5a17f6f9d954faa4 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 10:56:54 +0900 Subject: [PATCH 30/41] Add ruby 2.4.0 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index edac0da..a1ceb75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ rvm: - 2.1.10 - 2.2.6 - 2.3.3 + - 2.4.0 - rbx-2.2.2 - jruby-9.1.1.0 From b8377cb4ec8fe2b39f4727eda1d781d1f2959b80 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 11:32:05 +0900 Subject: [PATCH 31/41] Change pending to skip and remove a commented out line --- spec/lib/activerecord_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/lib/activerecord_spec.rb b/spec/lib/activerecord_spec.rb index 6fa67f2..a1e78eb 100644 --- a/spec/lib/activerecord_spec.rb +++ b/spec/lib/activerecord_spec.rb @@ -49,7 +49,6 @@ def table_exists?(connection, table_name) spec_for_adapter do |adapters| adapters.sqlite3 { connection.change_column table_name, column_name, :uuid } adapters.mysql2 { connection.change_column table_name, column_name, :uuid } - # adapters.postgresql { connection.change_column table_name, column_name, :uuid } end end @@ -57,7 +56,7 @@ def table_exists?(connection, table_name) spec_for_adapter do |adapters| adapters.sqlite3 { column.sql_type.should == 'binary(16)' } adapters.mysql2 { column.sql_type.should == 'binary(16)' } - adapters.postgresql { pending('postgresql can`t change column type to uuid') } + adapters.postgresql { skip('postgresql can`t change column type to uuid') } end end end From b94e225dae670c8fdca69c28c1e83c484a81ebf1 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 11:59:13 +0900 Subject: [PATCH 32/41] Prepare active maintenance --- README.mkd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.mkd b/README.mkd index 4448040..d372749 100644 --- a/README.mkd +++ b/README.mkd @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/jashmenn/activeuuid.png)](http://travis-ci.org/jashmenn/activeuuid) +[![Build Status](https://travis-ci.org/inbeom/activeuuid.png)](http://travis-ci.org/inbeom/activeuuid) # activeuuid @@ -131,7 +131,7 @@ Add this to your `Gemfile` gem "activeuuid" -Or get the code here: https://github.com/jashmenn/activeuuid +Or get the code here: https://github.com/inbeom/activeuuid ## References From 8d5455d549c0332037f999a431df9042ba1360ed Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 12:03:03 +0900 Subject: [PATCH 33/41] Specify supported rails versions correctly --- README.mkd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.mkd b/README.mkd index 4448040..0855e18 100644 --- a/README.mkd +++ b/README.mkd @@ -144,7 +144,7 @@ Or get the code here: https://github.com/jashmenn/activeuuid * [7] http://tools.ietf.org/html/rfc4122.html#appendix-C ## Dependencies -Rails ~> 3.1.0 +Rails >= 4.0.0 ## Authors From 6312c414a3738e05f59cd4e066f13e88e979df1e Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 12:11:32 +0900 Subject: [PATCH 34/41] Avoid testing on ruby-2.4.0 against rails 4.x Issue on https://github.com/rails/rails/issues/25125 causes an infinite loop on rails < 5.0 --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index a1ceb75..6dcbe47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,5 +31,11 @@ matrix: gemfile: Gemfile - rvm: 2.1.10 gemfile: gemfiles/Gemfile.rails-5-0 + - rvm: 2.4.0 + gemfile: gemfiles/Gemfile.rails-4-0 + - rvm: 2.4.0 + gemfile: gemfiles/Gemfile.rails-4-1 + - rvm: 2.4.0 + gemfile: gemfiles/Gemfile.rails-4-2 - rvm: jruby-9.1.7.0 gemfile: gemfiles/Gemfile.rails-5-0 From a7b16d4b98a3546a3260ce826363d9255b7a62f3 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 12:32:54 +0900 Subject: [PATCH 35/41] Remove rbx and change jruby version --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6dcbe47..707eac4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,7 @@ rvm: - 2.2.6 - 2.3.3 - 2.4.0 - - rbx-2.2.2 - - jruby-9.1.1.0 + - jruby-9.1.5.0 gemfile: - Gemfile @@ -37,5 +36,5 @@ matrix: gemfile: gemfiles/Gemfile.rails-4-1 - rvm: 2.4.0 gemfile: gemfiles/Gemfile.rails-4-2 - - rvm: jruby-9.1.7.0 + - rvm: jruby-9.1.5.0 gemfile: gemfiles/Gemfile.rails-5-0 From 0be3404b38e663591c1839092f0a53af1acd5b85 Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 14:47:04 +0900 Subject: [PATCH 36/41] Specify ruby platforms for legacy mysql gems --- gemfiles/Gemfile.rails-4-0 | 2 +- gemfiles/Gemfile.rails-4-1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gemfiles/Gemfile.rails-4-0 b/gemfiles/Gemfile.rails-4-0 index b6812df..274eef5 100644 --- a/gemfiles/Gemfile.rails-4-0 +++ b/gemfiles/Gemfile.rails-4-0 @@ -2,5 +2,5 @@ source "http://rubygems.org" gemspec path: '../' -gem 'mysql2', '~> 0.3.21' +gem 'mysql2', '~> 0.3.21', '~> 0.3.21', platforms: [:mri, :rbx] gem 'activerecord', '~> 4.0.0' diff --git a/gemfiles/Gemfile.rails-4-1 b/gemfiles/Gemfile.rails-4-1 index 5beb06f..7e7e2d6 100644 --- a/gemfiles/Gemfile.rails-4-1 +++ b/gemfiles/Gemfile.rails-4-1 @@ -2,5 +2,5 @@ source "http://rubygems.org" gemspec path: '../' -gem 'mysql2', '~> 0.3.21' +gem 'mysql2', '~> 0.3.21', platforms: [:mri, :rbx] gem 'activerecord', '~> 4.1.0' From d5f68456fc9d32e3bce5783ff2e4574a33b12fef Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 14:47:29 +0900 Subject: [PATCH 37/41] Ignore the default Gemfile for JRuby --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 707eac4..b5b1127 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,5 +36,7 @@ matrix: gemfile: gemfiles/Gemfile.rails-4-1 - rvm: 2.4.0 gemfile: gemfiles/Gemfile.rails-4-2 + - rvm: jruby-9.1.5.0 + gemfile: Gemfile - rvm: jruby-9.1.5.0 gemfile: gemfiles/Gemfile.rails-5-0 From 07f7a8a94af499fc736d0187bf2476156050494a Mon Sep 17 00:00:00 2001 From: Inbeom Hwang Date: Sat, 14 Jan 2017 15:59:25 +0900 Subject: [PATCH 38/41] Allow CI failures w/ Rails 4.0 and 4.1 under JRuby --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index b5b1127..75a843b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,10 @@ env: matrix: allow_failures: - gemfile: gemfiles/Gemfile.rails-head + - rvm: jruby-9.1.5.0 + gemfile: gemfiles/Gemfile.rails-4-0 + - rvm: jruby-9.1.5.0 + gemfile: gemfiles/Gemfile.rails-4-1 exclude: - rvm: 2.1.10 gemfile: Gemfile From 915c2c05ea1929a0bc0f2f7f5101966393494cae Mon Sep 17 00:00:00 2001 From: Justin Sookikian Date: Wed, 18 Jan 2017 15:45:51 -0800 Subject: [PATCH 39/41] Update Rakefile --- Rakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 3222e8e..c14d4b0 100644 --- a/Rakefile +++ b/Rakefile @@ -3,12 +3,12 @@ require "bundler/gem_tasks" require 'rspec/core' require 'rspec/core/rake_task' -module TempFixForRakeLastComment - def last_comment - last_description - end -end -Rake::Application.send :include, TempFixForRakeLastComment +#module TempFixForRakeLastComment +# def last_comment +# last_description +# end +#end +#Rake::Application.send :include, TempFixForRakeLastComment RSpec::Core::RakeTask.new(:spec) From 39f1600cfba005883e9f0fa44db4b40a3d6871ec Mon Sep 17 00:00:00 2001 From: Justin Sookikian Date: Wed, 18 Jan 2017 15:54:40 -0800 Subject: [PATCH 40/41] Update .travis.yml --- .travis.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index c9c94c2..db20e07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,6 @@ rvm: gemfile: - Gemfile - - gemfiles/Gemfile.rails-3-1 - - gemfiles/Gemfile.rails-3-2 - gemfiles/Gemfile.rails-4-0 - gemfiles/Gemfile.rails-4-1 - gemfiles/Gemfile.rails-4-2 @@ -44,26 +42,3 @@ matrix: gemfile: gemfiles/Gemfile.rails-3-2 - rvm: 2.3.1 gemfile: gemfiles/Gemfile.rails-3-2 - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-3-2 - env: DB=postgresql - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-4-0 - env: DB=postgresql - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-4-1 - env: DB=postgresql - - rvm: 2.0.0 - gemfile: gemfiles/Gemfile.rails-5-0 - - rvm: 2.1.10 - gemfile: gemfiles/Gemfile.rails-5-0 - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-5-0 - env: DB=postgresql - - rvm: 2.0.0 - gemfile: gemfiles/Gemfile.rails-head - - rvm: 2.1.10 - gemfile: gemfiles/Gemfile.rails-head - - rvm: jruby - gemfile: gemfiles/Gemfile.rails-head - env: DB=postgresql From 0c9e5acf8fd89bf3fa60240e5edfde937cf693df Mon Sep 17 00:00:00 2001 From: Justin Sookikian Date: Wed, 18 Jan 2017 16:00:10 -0800 Subject: [PATCH 41/41] Update Rakefile --- Rakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index c14d4b0..3222e8e 100644 --- a/Rakefile +++ b/Rakefile @@ -3,12 +3,12 @@ require "bundler/gem_tasks" require 'rspec/core' require 'rspec/core/rake_task' -#module TempFixForRakeLastComment -# def last_comment -# last_description -# end -#end -#Rake::Application.send :include, TempFixForRakeLastComment +module TempFixForRakeLastComment + def last_comment + last_description + end +end +Rake::Application.send :include, TempFixForRakeLastComment RSpec::Core::RakeTask.new(:spec)