Skip to content

Commit

Permalink
chore: Add docker-compose.yml (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros authored Nov 9, 2021
1 parent 5d86cce commit 8548529
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion acts-as-taggable-on.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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.3.7'
gem.required_ruby_version = '>= 2.5.0'

if File.exist?('UPGRADING.md')
gem.post_install_message = File.read('UPGRADING.md')
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.9'
services:
postgres:
image: postgres:10
environment:
POSTGRES_USER: postgres
POSTGRES_DB: acts_as_taggable_on
POSTGRES_PASSWORD: postgres
ports: ['5432:5432']
mysql:
image: mysql:8
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: acts_as_taggable_on
ports: ['3306:3306']
8 changes: 2 additions & 6 deletions lib/acts_as_taggable_on/taggable/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ def #{tag_type}_list=(new_tags)
parsed_new_list = ActsAsTaggableOn.default_parser.new(new_tags).parse
if self.class.preserve_tag_order? || (parsed_new_list.sort != #{tag_type}_list.sort)
if ActsAsTaggableOn::Utils.legacy_activerecord?
set_attribute_was("#{tag_type}_list", #{tag_type}_list)
else
unless #{tag_type}_list_changed?
@attributes["#{tag_type}_list"] = ActiveModel::Attribute.from_user("#{tag_type}_list", #{tag_type}_list, ActsAsTaggableOn::Taggable::TagListType.new)
end
unless #{tag_type}_list_changed?
@attributes["#{tag_type}_list"] = ActiveModel::Attribute.from_user("#{tag_type}_list", #{tag_type}_list, ActsAsTaggableOn::Taggable::TagListType.new)
end
write_attribute("#{tag_type}_list", parsed_new_list)
end
Expand Down
11 changes: 8 additions & 3 deletions spec/support/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@

if File.exist?(database_yml)

ActiveRecord::Migration.verbose = false
ActiveRecord::Base.default_timezone = :utc
ActiveRecord::Base.configurations = YAML.load_file(database_yml)
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), '../debug.log'))
ActiveRecord::Base.logger.level = ENV['TRAVIS'] ? ::Logger::ERROR : ::Logger::DEBUG
config = ActiveSupport::HashWithIndifferentAccess.new(ActiveRecord::Base.configurations[db_name])
ActiveRecord::Migration.verbose = false
if ActiveRecord.version >= Gem::Version.new('7.0.0.alpha2')
ActiveRecord.default_timezone = :utc
config = ActiveRecord::Base.configurations.configs_for(env_name: db_name)
else
ActiveRecord::Base.default_timezone = :utc
config = ActiveSupport::HashWithIndifferentAccess.new(ActiveRecord::Base.configurations[db_name])
end

begin
ActiveRecord::Base.establish_connection(db_name.to_sym)
Expand Down

0 comments on commit 8548529

Please sign in to comment.