Skip to content

Commit

Permalink
Drop support for old version of ActiveRecord and Ruby and prepare rel… (
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros authored May 15, 2017
1 parent 9073520 commit f5222d8
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 62 deletions.
16 changes: 2 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@ cache: bundler
rvm:
- 2.4.1
- 2.3.3
- 2.2.5
- 2.1
- 2.0.0
- 2.2.7

env:
- DB=sqlite3
- DB=mysql
- DB=postgresql

gemfile:
- gemfiles/activerecord_5.1.gemfile
- gemfiles/activerecord_5.0.gemfile
- gemfiles/activerecord_4.2.gemfile
- gemfiles/activerecord_4.1.gemfile
- gemfiles/activerecord_4.0.gemfile

sudo: false

Expand All @@ -29,13 +26,4 @@ before_install:
script: bundle exec rake

matrix:
exclude:
- rvm: 2.4.1
gemfile: gemfiles/activerecord_4.1.gemfile
- rvm: 2.4.1
gemfile: gemfiles/activerecord_4.0.gemfile
- rvm: 2.0.0
gemfile: gemfiles/activerecord_5.0.gemfile
- rvm: 2.1
gemfile: gemfiles/activerecord_5.0.gemfile
fast_finish: true
20 changes: 7 additions & 13 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
appraise 'activerecord-5.0' do
gem 'activerecord', "~> 5.0.0"
end

appraise "activerecord-4.2" do
gem "activerecord", "~> 4.2.0"
appraise 'activerecord-5.1' do
gem 'activerecord', "~> 5.1.1"
end

appraise "activerecord-4.1" do
gem "activerecord", "~> 4.1.0"
gem 'mysql2', '~> 0.3.21'
appraise 'activerecord-5.0' do
gem 'activerecord', "~> 5.0.3"
end

appraise "activerecord-4.0" do
gem "activerecord", "~> 4.0.0"
gem 'mysql2', '~> 0.3.21'
end
appraise "activerecord-4.2" do
gem "activerecord", "~> 4.2.8"
end
4 changes: 2 additions & 2 deletions acts-as-taggable-on.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Gem::Specification.new do |gem|
gem.files = `git ls-files`.split($/)
gem.test_files = gem.files.grep(%r{^spec/})
gem.require_paths = ['lib']
gem.required_ruby_version = '>= 2.0.0'
gem.required_ruby_version = '>= 2.2.7'

if File.exist?('UPGRADING.md')
gem.post_install_message = File.read('UPGRADING.md')
end

gem.add_runtime_dependency 'activerecord', ['>= 4.0']
gem.add_runtime_dependency 'activerecord', ['>= 4.2.8']

gem.add_development_dependency 'sqlite3'
gem.add_development_dependency 'mysql2', '~> 0.3'
Expand Down
7 changes: 6 additions & 1 deletion db/migrate/1_acts_as_taggable_on_migration.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class ActsAsTaggableOnMigration < ActiveRecord::Migration
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2]; end
else
class ActsAsTaggableOnMigration < ActiveRecord::Migration; end
end
ActsAsTaggableOnMigration.class_eval do
def self.up
create_table :tags do |t|
t.string :name
Expand Down
7 changes: 6 additions & 1 deletion db/migrate/2_add_missing_unique_indices.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class AddMissingUniqueIndices < ActiveRecord::Migration
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]; end
else
class AddMissingUniqueIndices < ActiveRecord::Migration; end
end
AddMissingUniqueIndices.class_eval do
def self.up
add_index :tags, :name, unique: true

Expand Down
7 changes: 6 additions & 1 deletion db/migrate/3_add_taggings_counter_cache_to_tags.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]; end
else
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration; end
end
AddTaggingsCounterCacheToTags.class_eval do
def self.up
add_column :tags, :taggings_count, :integer, default: 0

Expand Down
7 changes: 6 additions & 1 deletion db/migrate/4_add_missing_taggable_index.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class AddMissingTaggableIndex < ActiveRecord::Migration
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]; end
else
class AddMissingTaggableIndex < ActiveRecord::Migration; end
end
AddMissingTaggableIndex.class_eval do
def self.up
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
Expand Down
7 changes: 6 additions & 1 deletion db/migrate/5_change_collation_for_tag_names.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# This migration is added to circumvent issue #623 and have special characters
# work properly
class ChangeCollationForTagNames < ActiveRecord::Migration
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]; end
else
class ChangeCollationForTagNames < ActiveRecord::Migration; end
end
ChangeCollationForTagNames.class_eval do
def up
if ActsAsTaggableOn::Utils.using_mysql?
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
Expand Down
7 changes: 6 additions & 1 deletion db/migrate/6_add_missing_indexes_on_taggings.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class AddMissingIndexesOnTaggings < ActiveRecord::Migration
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
else
class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
end
AddMissingIndexesOnTaggings.class_eval do
def change
add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id
Expand Down
16 changes: 0 additions & 16 deletions gemfiles/activerecord_4.1.gemfile

This file was deleted.

6 changes: 3 additions & 3 deletions gemfiles/activerecord_4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

source "https://rubygems.org"

gem "activerecord", "~> 4.2.0"
gem "activerecord", "~> 4.2.8"

group :local_development do
gem "guard"
gem "guard-rspec"
gem "appraisal"
gem "rake"
gem "byebug", :platforms => [:mri_21, :mri_22, :mri_23]
gem "byebug", platforms: [:mri_21, :mri_22, :mri_23]
end

gemspec :path => "../"
gemspec path: "../"
6 changes: 3 additions & 3 deletions gemfiles/activerecord_5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

source "https://rubygems.org"

gem "activerecord", "~> 5.0.0"
gem "activerecord", "~> 5.0.3"

group :local_development do
gem "guard"
gem "guard-rspec"
gem "appraisal"
gem "rake"
gem "byebug", :platforms => [:mri_21, :mri_22, :mri_23]
gem "byebug", platforms: [:mri_21, :mri_22, :mri_23]
end

gemspec :path => "../"
gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

source "https://rubygems.org"

gem "activerecord", "~> 4.0.0"
gem "mysql2", "~> 0.3.21"
gem "activerecord", "~> 5.1.1"

group :local_development do
gem "guard"
gem "guard-rspec"
gem "appraisal"
gem "rake"
gem "byebug", :platforms => [:mri_21, :mri_22, :mri_23]
gem "byebug", platforms: [:mri_21, :mri_22, :mri_23]
end

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/acts_as_taggable_on/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ActsAsTaggableOn
VERSION = '4.0.0'
VERSION = '5.0.0'
end

0 comments on commit f5222d8

Please sign in to comment.