diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9af0230ba6e6443eb812066f2a24b5dc0c8aaea..46c9b2279cc906c547d63b1e233afe00df7014fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,7 @@ before_script: - if [ -x "$(command -v apk)" ]; then apk add sqlite-dev; fi - export BUNDLE_PATH=$CI_PROJECT_DIR/.gems - bundle --jobs 2 --retry 3 - - bundle exec appraisal - - bundle --jobs 2 --retry 3 + - bundle exec appraisal install .ruby_25: &ruby_25 image: registry.roqua.nl/roqua/docker-base-images:ruby-2.5 @@ -22,10 +21,12 @@ before_script: paths: - .gems -rails_51_ruby_25: - <<: *ruby_25 - script: - - bundle exec appraisal rails51 bundle exec rspec +.ruby_27: &ruby_27 + image: registry.roqua.nl/roqua/docker-base-images:ruby-2.7-builder + cache: + key: ruby_27 + paths: + - .gems rails_52_ruby_25: <<: *ruby_25 @@ -37,6 +38,11 @@ rails_52_ruby_26: script: - bundle exec appraisal rails52 bundle exec rspec +rails_52_ruby_27: + <<: *ruby_27 + script: + - bundle exec appraisal rails52 bundle exec rspec + rails_60_ruby_25: <<: *ruby_25 script: @@ -46,3 +52,13 @@ rails_60_ruby_26: <<: *ruby_26 script: - bundle exec appraisal rails60 bundle exec rspec + +rails_60_ruby_27: + <<: *ruby_27 + script: + - bundle exec appraisal rails60 bundle exec rspec + +rails_61_ruby_27: + <<: *ruby_27 + script: + - bundle exec appraisal rails61 bundle exec rspec diff --git a/Appraisals b/Appraisals index 1438b61b30b4f32788651a40d2f94cc9226bc5b1..e1e5cf8b3d166f819fb5a72f55d0c590d628ea75 100644 --- a/Appraisals +++ b/Appraisals @@ -1,16 +1,15 @@ -appraise "rails51" do - gem "activesupport", "~> 5.1.0" - gem 'sqlite3', '~> 1.3.6' -end - appraise "rails52" do + gem "active_interaction", "~> 3.0" gem "activesupport", "~> 5.2.0" - gem 'sqlite3', '~> 1.4' gem 'appsignal', '~> 2.9.8' # test each minor versions we support end appraise "rails60" do gem "activesupport", "~> 6.0.0" - gem 'sqlite3', '~> 1.4' gem 'appsignal', '~> 2.10.6' end + +appraise "rails61" do + gem "activesupport", "~> 6.1.0" + gem 'appsignal', '~> 3.0.0' +end diff --git a/Gemfile b/Gemfile index 4dfd5990f41f8ed9ef6147f3cdb4639d373e2cba..15a7c3c2690da084ceef2ab8bddfe9806bab3ca9 100644 --- a/Gemfile +++ b/Gemfile @@ -7,8 +7,8 @@ gem 'appraisal' gem 'roqua_styleguide', git: 'https://gitlab.roqua.nl/roqua/styleguide.git' group :test do + gem 'sqlite3' gem 'actionpack', '>= 4.0' - gem 'active_interaction', '~> 3.0' gem 'climate_control' # For ENV modification in specs gem 'combustion', '~> 1.1.1' gem 'fakefs', require: 'fakefs/safe' @@ -17,4 +17,4 @@ group :test do gem 'rspec-instrumentation-matcher' gem 'rspec-rails' gem 'pry' -end \ No newline at end of file +end diff --git a/Gemfile.lock b/Gemfile.lock index c8fe020b15b3f345a660843b7efac353eec1d723..b8f15488a1a2e96c46f638d259b65d08cf7cc206 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,9 +10,9 @@ PATH remote: . specs: roqua-support (0.3.5) - active_interaction (~> 3.0) - activesupport (>= 5.1, < 6.1) - appsignal (>= 2.9, < 2.11) + active_interaction (>= 3.0, < 5.0) + activesupport (>= 5.2, < 6.2) + appsignal (>= 2.9, < 3.1) naught (~> 1.0) with_advisory_lock (~> 3.2) @@ -170,6 +170,7 @@ GEM rubocop (>= 0.72.0) ruby-progressbar (1.10.1) shellany (0.0.1) + sqlite3 (1.4.2) thor (1.0.1) thread_safe (0.3.6) timecop (0.9.1) @@ -201,6 +202,7 @@ DEPENDENCIES rspec (>= 2.12.0, < 4.0) rspec-instrumentation-matcher rspec-rails + sqlite3 timecop BUNDLED WITH diff --git a/gemfiles/rails52.gemfile b/gemfiles/rails52.gemfile index 72990957cb04c8ea95173cc47d7072376e43d4c1..4a3abdcbb1f660e7b609a32d5580a98d6a9928d2 100644 --- a/gemfiles/rails52.gemfile +++ b/gemfiles/rails52.gemfile @@ -4,13 +4,13 @@ source "https://rubygems.org" gem "appraisal" gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git" +gem "active_interaction", "~> 3.0" gem "activesupport", "~> 5.2.0" -gem "sqlite3", "~> 1.4" gem "appsignal", "~> 2.9.8" group :test do + gem "sqlite3" gem "actionpack", ">= 4.0" - gem "active_interaction", "~> 3.0" gem "climate_control" gem "combustion", "~> 1.1.1" gem "fakefs", require: "fakefs/safe" diff --git a/gemfiles/rails60.gemfile b/gemfiles/rails60.gemfile index 441fc367b2483b6a042ea1e0bca49f480e8e718d..0d4f4d599d06c78ef39d8952a403e9d2008cf607 100644 --- a/gemfiles/rails60.gemfile +++ b/gemfiles/rails60.gemfile @@ -5,12 +5,11 @@ source "https://rubygems.org" gem "appraisal" gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git" gem "activesupport", "~> 6.0.0" -gem "sqlite3", "~> 1.4" gem "appsignal", "~> 2.10.6" group :test do + gem "sqlite3" gem "actionpack", ">= 4.0" - gem "active_interaction", "~> 3.0" gem "climate_control" gem "combustion", "~> 1.1.1" gem "fakefs", require: "fakefs/safe" diff --git a/gemfiles/rails51.gemfile b/gemfiles/rails61.gemfile similarity index 82% rename from gemfiles/rails51.gemfile rename to gemfiles/rails61.gemfile index 8d854c24ce4551aaf5a99288416d7f73d3f9dbda..64efbef6966dac326da1555991df7951a9bfc9f1 100644 --- a/gemfiles/rails51.gemfile +++ b/gemfiles/rails61.gemfile @@ -4,12 +4,12 @@ source "https://rubygems.org" gem "appraisal" gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git" -gem "activesupport", "~> 5.1.0" -gem "sqlite3", "~> 1.3.6" +gem "activesupport", "~> 6.1.0" +gem "appsignal", "~> 3.0.0" group :test do + gem "sqlite3" gem "actionpack", ">= 4.0" - gem "active_interaction", "~> 3.0" gem "climate_control" gem "combustion", "~> 1.1.1" gem "fakefs", require: "fakefs/safe" diff --git a/lib/roqua/scheduling/scheduler.rb b/lib/roqua/scheduling/scheduler.rb index fc2e8bed034aeb38f6ffa0ffc576e969fe20fbee..c212dfc04a191366e70ec5e73ca8648095e96b18 100644 --- a/lib/roqua/scheduling/scheduler.rb +++ b/lib/roqua/scheduling/scheduler.rb @@ -29,7 +29,10 @@ class Roqua::Scheduling::Scheduler end def advisory_lock_name - "#{ActiveRecord::Base.connection_config[:database]}_cron_lock" + db_name = ActiveRecord::Base.respond_to?(:connection_db_config) \ + ? ActiveRecord::Base.connection_db_config.database + : ActiveRecord::Base.connection_config[:database] + "#{db_name}_cron_lock" end private diff --git a/lib/roqua/validators/subset_validator.rb b/lib/roqua/validators/subset_validator.rb index 27b3fb630b2e5357a86d381fe69ec44a57b2cb73..975474ac19a9659b1e41b18c28c5c08ef9bbfbe7 100644 --- a/lib/roqua/validators/subset_validator.rb +++ b/lib/roqua/validators/subset_validator.rb @@ -6,7 +6,7 @@ class SubsetValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return unless value unless value.all? { |element| options.fetch(:of).include? element } - record.errors[attribute] << (options[:message] || I18n.t('errors.messages.subset')) + record.errors.add attribute, (options[:message] || I18n.t('errors.messages.subset')) end end end diff --git a/roqua-support.gemspec b/roqua-support.gemspec index 826438dbf9bb8fc252012cb910751ebc19c98d89..91c27f1f2a552d0ed6af05f68e2f27394cd14e16 100644 --- a/roqua-support.gemspec +++ b/roqua-support.gemspec @@ -19,8 +19,8 @@ Gem::Specification.new do |gem| gem.require_paths = ["lib"] gem.required_ruby_version = '>= 2.5' - gem.add_dependency 'activesupport', '>= 5.1', '< 6.1' gem.add_dependency 'active_interaction', '>= 3.0', '< 5.0' + gem.add_dependency 'activesupport', '>= 5.2', '< 6.2' gem.add_dependency 'naught', '~> 1.0' gem.add_dependency 'with_advisory_lock', '~> 3.2' gem.add_dependency 'appsignal', '>= 2.9', '< 3.1' diff --git a/spec/roqua/scheduling/scheduler_spec.rb b/spec/roqua/scheduling/scheduler_spec.rb index 276984c3c7d944b5e11476275a576cf3499cf2f6..d6e776018b3f560eb1b04ceff2e15eff00251afa 100644 --- a/spec/roqua/scheduling/scheduler_spec.rb +++ b/spec/roqua/scheduling/scheduler_spec.rb @@ -51,7 +51,7 @@ describe Roqua::Scheduling::Scheduler do end it 'generates a database specific advisory lock name' do - expect(ActiveRecord::Base.connection_config[:database]).to eql(':memory:') + # expect(ActiveRecord::Base.connection_config[:database]).to eql(':memory:') expect(subject.advisory_lock_name).to eql ':memory:_cron_lock' end