diff --git a/.travis.yml b/.travis.yml index 460cb23f3..adcbea1b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,12 +17,24 @@ gemfile: - gemfiles/Gemfile.rails-4.1.rb - gemfiles/Gemfile.rails-4.2.rb - gemfiles/Gemfile.rails-5.0.rb + - gemfiles/Gemfile.rails-5.1.rb + - gemfiles/Gemfile.rails-5.2.rb before_install: - gem update bundler matrix: exclude: + - rvm: 2.1.0 + gemfile: gemfiles/Gemfile.rails-5.2.rb + - rvm: 2.2.0 + gemfile: gemfiles/Gemfile.rails-5.2.rb + - rvm: jruby-9.1.13.0 + gemfile: gemfiles/Gemfile.rails-5.2.rb + - rvm: 2.1.0 + gemfile: gemfiles/Gemfile.rails-5.1.rb + - rvm: 2.2.0 + gemfile: gemfiles/Gemfile.rails-5.1.rb - rvm: 2.1.0 gemfile: gemfiles/Gemfile.rails-5.0.rb - rvm: 2.2.0 @@ -31,6 +43,11 @@ matrix: gemfile: gemfiles/Gemfile.rails-4.0.rb - rvm: 2.4.0 gemfile: gemfiles/Gemfile.rails-4.1.rb + allow_failures: + - rvm: jruby-9.1.13.0 + gemfile: gemfiles/Gemfile.rails-5.1.rb + - rvm: jruby-9.1.13.0 + gemfile: gemfiles/Gemfile.rails-5.0.rb sudo: false diff --git a/gemfiles/Gemfile.rails-4.0.rb b/gemfiles/Gemfile.rails-4.0.rb index ee7f0d638..f4294c0de 100644 --- a/gemfiles/Gemfile.rails-4.0.rb +++ b/gemfiles/Gemfile.rails-4.0.rb @@ -18,7 +18,7 @@ platforms :ruby, :rbx do gem 'sqlite3' gem 'mysql2', '~> 0.3.10' - gem 'pg' + gem 'pg', '~> 0.15' gem 'redcarpet' end diff --git a/gemfiles/Gemfile.rails-4.1.rb b/gemfiles/Gemfile.rails-4.1.rb index 9993a4daf..1bd362591 100644 --- a/gemfiles/Gemfile.rails-4.1.rb +++ b/gemfiles/Gemfile.rails-4.1.rb @@ -17,7 +17,7 @@ platforms :ruby, :rbx do gem 'sqlite3' gem 'mysql2', '~> 0.3.13' - gem 'pg' + gem 'pg', '~> 0.15' gem 'redcarpet' end diff --git a/gemfiles/Gemfile.rails-4.2.rb b/gemfiles/Gemfile.rails-4.2.rb index 409b3f462..846945439 100644 --- a/gemfiles/Gemfile.rails-4.2.rb +++ b/gemfiles/Gemfile.rails-4.2.rb @@ -16,8 +16,8 @@ platforms :ruby, :rbx do gem 'sqlite3' - gem 'mysql2' - gem 'pg' + gem 'mysql2', '~> 0.4.10' + gem 'pg', '~> 0.15' gem 'redcarpet' end diff --git a/gemfiles/Gemfile.rails-5.0.rb b/gemfiles/Gemfile.rails-5.0.rb index c47df9800..0a5c2a80a 100644 --- a/gemfiles/Gemfile.rails-5.0.rb +++ b/gemfiles/Gemfile.rails-5.0.rb @@ -9,8 +9,8 @@ # Database Configuration group :development, :test do platforms :jruby do - gem 'activerecord-jdbcmysql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter.git', branch: 'rails-5' - gem 'activerecord-jdbcpostgresql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter.git', branch: 'rails-5' + gem 'activerecord-jdbcmysql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: '50-stable' + gem 'activerecord-jdbcpostgresql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: '50-stable' gem 'kramdown' end diff --git a/gemfiles/Gemfile.rails-5.1.rb b/gemfiles/Gemfile.rails-5.1.rb new file mode 100644 index 000000000..5d3d60e0d --- /dev/null +++ b/gemfiles/Gemfile.rails-5.1.rb @@ -0,0 +1,27 @@ +source 'https://rubygems.org' + +gemspec path: '../' + +gem 'activerecord', '~> 5.1.0' +gem 'railties', '~> 5.1.0' + +# Database Configuration +group :development, :test do + platforms :jruby do + gem 'activerecord-jdbcmysql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: 'master' + gem 'activerecord-jdbcpostgresql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: 'master' + gem 'kramdown' + end + + platforms :ruby, :rbx do + gem 'sqlite3' + gem 'mysql2' + gem 'pg' + gem 'redcarpet' + end + + platforms :rbx do + gem 'rubysl', '~> 2.0' + gem 'rubinius-developer_tools' + end +end diff --git a/gemfiles/Gemfile.rails-5.2.rb b/gemfiles/Gemfile.rails-5.2.rb new file mode 100644 index 000000000..f269a6655 --- /dev/null +++ b/gemfiles/Gemfile.rails-5.2.rb @@ -0,0 +1,27 @@ +source 'https://rubygems.org' + +gemspec path: '../' + +gem 'activerecord', '~> 5.2.0' +gem 'railties', '~> 5.2.0' + +# Database Configuration +group :development, :test do + platforms :jruby do + gem 'activerecord-jdbcmysql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: 'master' + gem 'activerecord-jdbcpostgresql-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', branch: 'master' + gem 'kramdown' + end + + platforms :ruby, :rbx do + gem 'sqlite3' + gem 'mysql2' + gem 'pg' + gem 'redcarpet' + end + + platforms :rbx do + gem 'rubysl', '~> 2.0' + gem 'rubinius-developer_tools' + end +end diff --git a/lib/friendly_id.rb b/lib/friendly_id.rb index 7d61f9067..2e5ed5396 100644 --- a/lib/friendly_id.rb +++ b/lib/friendly_id.rb @@ -4,7 +4,6 @@ require "friendly_id/object_utils" require "friendly_id/configuration" require "friendly_id/finder_methods" -require 'friendly_id/railtie' if defined?(Rails) =begin diff --git a/lib/friendly_id/object_utils.rb b/lib/friendly_id/object_utils.rb index 36de46c64..8127e2716 100644 --- a/lib/friendly_id/object_utils.rb +++ b/lib/friendly_id/object_utils.rb @@ -70,3 +70,7 @@ def self.mark_as_unfriendly(klass) # one of its descendants. FriendlyId::UNFRIENDLY_CLASSES.each { |klass| FriendlyId.mark_as_unfriendly(klass) } + +ActiveSupport.on_load(:active_record) do + FriendlyId.mark_as_unfriendly(ActiveRecord::Base) +end diff --git a/lib/friendly_id/railtie.rb b/lib/friendly_id/railtie.rb deleted file mode 100644 index 831ddfd04..000000000 --- a/lib/friendly_id/railtie.rb +++ /dev/null @@ -1,9 +0,0 @@ -module FriendlyId - class Railtie < Rails::Railtie - initializer 'friendly_id.setup' do - ActiveSupport.on_load(:active_record) do - FriendlyId.mark_as_unfriendly(ActiveRecord::Base) - end - end - end -end