Skip to content
This repository has been archived by the owner on Nov 12, 2019. It is now read-only.

Drop support for ruby 1.9 and rails <4.1 #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
29 changes: 6 additions & 23 deletions lib/polyamorous.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,15 @@ module Polyamorous
require 'polyamorous/join'
require 'polyamorous/swapping_reflection_class'

ar_version = ::ActiveRecord::VERSION::STRING[0,3]
ar_version = '3_and_4.0' if ar_version < '4.1'

method, ruby_version =
if RUBY_VERSION >= '2.0' && ar_version >= '4.1'
# Ruby 2; we can use `prepend` to patch Active Record cleanly.
[:prepend, '2']
else
# Ruby 1.9; we must use `alias_method` to patch Active Record.
[:include, '1.9']
end

%w(join_association join_dependency).each do |file|
require "polyamorous/activerecord_#{ar_version}_ruby_#{ruby_version}/#{file}"
%w[join_association join_dependency].each do |file|
require "polyamorous/activerecord_#{::ActiveRecord::VERSION::STRING[0, 3]}_ruby_2/#{file}"
end

Polyamorous::JoinDependency.send(method, Polyamorous::JoinDependencyExtensions)
if method == :prepend
Polyamorous::JoinDependency.singleton_class
.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods)
end
Polyamorous::JoinAssociation.send(method, Polyamorous::JoinAssociationExtensions)
Polyamorous::JoinDependency.prepend(Polyamorous::JoinDependencyExtensions)
Polyamorous::JoinDependency.singleton_class.prepend(Polyamorous::JoinDependencyExtensions::ClassMethods)
Polyamorous::JoinAssociation.prepend(Polyamorous::JoinAssociationExtensions)

Polyamorous::JoinBase.class_eval do
if method_defined?(:active_record)
alias_method :base_klass, :active_record
end
alias_method :base_klass, :active_record if method_defined?(:active_record)
end
end

This file was deleted.

96 changes: 0 additions & 96 deletions lib/polyamorous/activerecord_3_and_4.0_ruby_1.9/join_dependency.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/polyamorous/activerecord_4.1_ruby_1.9/join_association.rb

This file was deleted.

4 changes: 0 additions & 4 deletions lib/polyamorous/activerecord_4.1_ruby_1.9/join_dependency.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/polyamorous/activerecord_4.1_ruby_2/join_association.rb

This file was deleted.

3 changes: 0 additions & 3 deletions lib/polyamorous/activerecord_4.1_ruby_2/join_dependency.rb

This file was deleted.

This file was deleted.

46 changes: 0 additions & 46 deletions lib/polyamorous/activerecord_4.2_ruby_1.9/join_association.rb

This file was deleted.

87 changes: 0 additions & 87 deletions lib/polyamorous/activerecord_4.2_ruby_1.9/join_dependency.rb

This file was deleted.

10 changes: 2 additions & 8 deletions polyamorous.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@ Gem::Specification.new do |s|

s.rubyforge_project = "polyamorous"

s.add_dependency 'activerecord', '>= 3.0'
s.add_dependency 'activerecord', '>= 4.2'
s.add_development_dependency 'rspec', '~> 3'
s.add_development_dependency 'machinist', '~> 1.0.6'
s.add_development_dependency 'faker', '~> 1.6.5'
s.add_development_dependency 'sqlite3', '~> 1.3.3'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem unrelated?

s.require_paths = ["lib"]

# specify any dependencies here; for example:
# s.add_development_dependency "rspec"
# s.add_runtime_dependency "rest-client"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps removing the old versions from .travis.yml and re-running the tests is a good idea? https://github.com/activerecord-hackery/polyamorous/blob/master/.travis.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean also dropping support for ruby 2.2 and ruby 2.3, or excluding those entries? In any case, tests are failing against Rails master, I guess the best solution for now would be to move the failing entries to allowed_failures.

end
Loading