Control: tags 1019645 + patch Control: tags 1019645 + pending Dear maintainer,
I've prepared an NMU for ruby-otr-activerecord (versioned as 2.1.1-0.1) and uploaded it to DELAYED/14. Please feel free to tell me if I should cancel it. cu Adrian
diff -Nru ruby-otr-activerecord-2.0.3/CHANGELOG.md ruby-otr-activerecord-2.1.1/CHANGELOG.md --- ruby-otr-activerecord-2.0.3/CHANGELOG.md 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/CHANGELOG.md 2022-01-30 20:26:56.000000000 +0200 @@ -1,3 +1,9 @@ +### 2.1.0 (2022-01-30) +* Don't set logger - allows apps to do that - [PR #28](https://github.com/jhollinger/otr-activerecord/pull/28) - [anakinj](https://github.com/anakinj) + +### 2.0.4 (2022-01-20) +* Fix YAML loading on Ruby 3.1 - [PR #39](https://github.com/jhollinger/otr-activerecord/pull/39) - [scudelletti](https://github.com/scudelletti) + ### 2.0.3 (2021-10-22) * Preliminary support for ActiveRecord 7 (tested against 7.0.0.alpha2) diff -Nru ruby-otr-activerecord-2.0.3/debian/changelog ruby-otr-activerecord-2.1.1/debian/changelog --- ruby-otr-activerecord-2.0.3/debian/changelog 2021-12-02 20:00:23.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/debian/changelog 2022-11-20 10:21:15.000000000 +0200 @@ -1,3 +1,11 @@ +ruby-otr-activerecord (2.1.1-0.1) unstable; urgency=low + + * Non-maintainer upload. + * New upstream release. + - Fixes FTBFS with Ruby 3.1. (Closes: #1019645) + + -- Adrian Bunk <b...@debian.org> Sun, 20 Nov 2022 10:21:15 +0200 + ruby-otr-activerecord (2.0.3-3) unstable; urgency=medium * Team upload. diff -Nru ruby-otr-activerecord-2.0.3/debian/patches/Fix-tests-for-AR-6.0.patch ruby-otr-activerecord-2.1.1/debian/patches/Fix-tests-for-AR-6.0.patch --- ruby-otr-activerecord-2.0.3/debian/patches/Fix-tests-for-AR-6.0.patch 2021-12-02 20:00:23.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/debian/patches/Fix-tests-for-AR-6.0.patch 1970-01-01 02:00:00.000000000 +0200 @@ -1,49 +0,0 @@ -From: Jordan Hollinger <jordan.hollin...@wellsky.com> -Date: Wed, 1 Dec 2021 21:16:09 -0500 -Subject: Fix tests for AR 6.0 - -https://github.com/jhollinger/otr-activerecord/commit/95e85f1a5429553548609cd08401c46c880ab36f.patch -Bug: https://github.com/jhollinger/otr-activerecord/issues/38 -Forwarded: not-needed ---- - spec/otr-activerecord/activerecord_spec.rb | 20 ++++++++------------ - 1 file changed, 8 insertions(+), 12 deletions(-) - -diff --git a/spec/otr-activerecord/activerecord_spec.rb b/spec/otr-activerecord/activerecord_spec.rb -index a055f32..3005443 100644 ---- a/spec/otr-activerecord/activerecord_spec.rb -+++ b/spec/otr-activerecord/activerecord_spec.rb -@@ -7,12 +7,10 @@ RSpec.describe OTR::ActiveRecord do - - it 'configures active record' do - described_class.configure_from_file!(config) -- -- expect(::ActiveRecord::Base.configurations['test']).to eq( -- adapter: 'sqlite3', -- database: 'tmp/simple.sqlite3', -- migrations_paths: ['db/migrate'] -- ) -+ t = ::ActiveRecord::Base.configurations['test'].with_indifferent_access -+ expect(t[:adapter]).to eq 'sqlite3' -+ expect(t[:database]).to eq 'tmp/simple.sqlite3' -+ expect(t[:migrations_paths]).to eq ['db/migrate'] - end - end - -@@ -21,12 +19,10 @@ RSpec.describe OTR::ActiveRecord do - - it 'configures active record' do - described_class.configure_from_file!(config) -- -- expect(::ActiveRecord::Base.configurations['test']).to eq( -- adapter: 'sqlite3', -- database: 'tmp/multi.sqlite3', -- migrations_paths: ['db/migrate'] -- ) -+ t = ::ActiveRecord::Base.configurations['test'].with_indifferent_access -+ expect(t[:adapter]).to eq 'sqlite3' -+ expect(t[:database]).to eq 'tmp/multi.sqlite3' -+ expect(t[:migrations_paths]).to eq ['db/migrate'] - end - end - end diff -Nru ruby-otr-activerecord-2.0.3/debian/patches/series ruby-otr-activerecord-2.1.1/debian/patches/series --- ruby-otr-activerecord-2.0.3/debian/patches/series 2021-12-02 20:00:23.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/debian/patches/series 2022-11-20 10:21:15.000000000 +0200 @@ -1,2 +1 @@ Require-bundler-for-tests.patch -Fix-tests-for-AR-6.0.patch diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/config.ru ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/config.ru --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/config.ru 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/config.ru 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,15 @@ +require_relative 'environment' + +use OTR::ActiveRecord::ConnectionManagement +use OTR::ActiveRecord::QueryCache + +map '/' do + run ->(env) { + body = Widget.all + .map { |w| + {id: w.id, name: w.name} + } + .to_json + [200, {'Content-Type' => 'application/json', 'Content-Length' => body.size.to_s}, [body]] + } +end diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/db/config.yml ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/db/config.yml --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/db/config.yml 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/db/config.yml 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,20 @@ +development: + adapter: sqlite3 + encoding: utf8 + database: db/otr_example_70_dev.sqlite3 + pool: 5 + timeout: 5000 + +test: + adapter: sqlite3 + encoding: utf8 + database: db/otr_example_70_test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + encoding: utf8 + database: db/otr_example_70_prod.sqlite3 + pool: 5 + timeout: 5000 diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/db/schema.rb ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/db/schema.rb --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/db/schema.rb 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/db/schema.rb 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,34 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 2021_10_23_013351) do + + create_table "bars", force: :cascade do |t| + t.string "name", null: false + end + + create_table "foos", force: :cascade do |t| + t.string "name", null: false + end + + create_table "splines", force: :cascade do |t| + t.string "name", null: false + t.index ["name"], name: "index_splines_on_name", unique: true + end + + create_table "widgets", force: :cascade do |t| + t.string "name", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + +end diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/db/seeds.rb ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/db/seeds.rb --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/db/seeds.rb 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/db/seeds.rb 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,3 @@ +Widget.create! name: 'A' +Widget.create! name: 'B' +Widget.create! name: 'C' diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/environment.rb ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/environment.rb --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/environment.rb 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/environment.rb 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,10 @@ +require 'json' +require 'bundler' +Bundler.require(:default, ENV['OTR_ENV'] ? ENV['OTR_ENV'].to_sym : :development) + +OTR::ActiveRecord.configure_from_file! './db/config.yml' +OTR::ActiveRecord.establish_connection! + +class Widget < ActiveRecord::Base + validates_presence_of :name +end diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/Gemfile ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/Gemfile --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/Gemfile 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/Gemfile 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,11 @@ +source 'https://rubygems.org' + +gem 'rack', '~> 2.2' +gem 'activerecord', '~> 7.0.1', require: 'active_record' +gem 'otr-activerecord', path: '../../' +gem 'sqlite3' +gem 'rake' + +group :development do + gem 'shotgun' +end diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/Gemfile.lock ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/Gemfile.lock --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/Gemfile.lock 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/Gemfile.lock 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,48 @@ +PATH + remote: ../.. + specs: + otr-activerecord (2.1.0) + activerecord (>= 4.0, < 7.1) + hashie-forbidden_attributes (~> 0.1) + +GEM + remote: https://rubygems.org/ + specs: + activemodel (7.0.1) + activesupport (= 7.0.1) + activerecord (7.0.1) + activemodel (= 7.0.1) + activesupport (= 7.0.1) + activesupport (7.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + concurrent-ruby (1.1.9) + hashie (5.0.0) + hashie-forbidden_attributes (0.1.1) + hashie (>= 3.0) + i18n (1.9.1) + concurrent-ruby (~> 1.0) + minitest (5.15.0) + rack (2.2.3) + rake (13.0.6) + shotgun (0.9.2) + rack (>= 1.0) + sqlite3 (1.4.2) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + +PLATFORMS + ruby + +DEPENDENCIES + activerecord (~> 7.0.1) + otr-activerecord! + rack (~> 2.2) + rake + shotgun + sqlite3 + +BUNDLED WITH + 2.1.4 diff -Nru ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/Rakefile ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/Rakefile --- ruby-otr-activerecord-2.0.3/examples/rack-activerecord7.0/Rakefile 1970-01-01 02:00:00.000000000 +0200 +++ ruby-otr-activerecord-2.1.1/examples/rack-activerecord7.0/Rakefile 2022-01-30 20:26:56.000000000 +0200 @@ -0,0 +1,8 @@ +require 'bundler/setup' +load 'tasks/otr-activerecord.rake' + +namespace :db do + task :environment do + require_relative 'environment' + end +end diff -Nru ruby-otr-activerecord-2.0.3/examples/rakefile-activerecord7.0/Gemfile ruby-otr-activerecord-2.1.1/examples/rakefile-activerecord7.0/Gemfile --- ruby-otr-activerecord-2.0.3/examples/rakefile-activerecord7.0/Gemfile 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/examples/rakefile-activerecord7.0/Gemfile 2022-01-30 20:26:56.000000000 +0200 @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'activerecord', '7.0.0.alpha2', require: 'active_record' +gem 'activerecord', '7.0.1', require: 'active_record' gem 'otr-activerecord', path: '../../' gem 'sqlite3' gem 'rake' diff -Nru ruby-otr-activerecord-2.0.3/examples/rakefile-activerecord7.0/Gemfile.lock ruby-otr-activerecord-2.1.1/examples/rakefile-activerecord7.0/Gemfile.lock --- ruby-otr-activerecord-2.0.3/examples/rakefile-activerecord7.0/Gemfile.lock 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/examples/rakefile-activerecord7.0/Gemfile.lock 2022-01-30 20:26:56.000000000 +0200 @@ -1,30 +1,30 @@ PATH remote: ../.. specs: - otr-activerecord (2.0.2) + otr-activerecord (2.1.0) activerecord (>= 4.0, < 7.1) hashie-forbidden_attributes (~> 0.1) GEM remote: https://rubygems.org/ specs: - activemodel (7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) - activerecord (7.0.0.alpha2) - activemodel (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) - activesupport (7.0.0.alpha2) + activemodel (7.0.1) + activesupport (= 7.0.1) + activerecord (7.0.1) + activemodel (= 7.0.1) + activesupport (= 7.0.1) + activesupport (7.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) concurrent-ruby (1.1.9) - hashie (4.1.0) + hashie (5.0.0) hashie-forbidden_attributes (0.1.1) hashie (>= 3.0) - i18n (1.8.10) + i18n (1.8.11) concurrent-ruby (~> 1.0) - minitest (5.14.4) + minitest (5.15.0) rake (13.0.6) sqlite3 (1.4.2) tzinfo (2.0.4) @@ -34,7 +34,7 @@ ruby DEPENDENCIES - activerecord (= 7.0.0.alpha2) + activerecord (= 7.0.1) otr-activerecord! rake sqlite3 diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/activerecord.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/activerecord.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/activerecord.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/activerecord.rb 2022-01-30 20:26:56.000000000 +0200 @@ -58,7 +58,7 @@ # Connect to database with a yml file. Example: "config/database.yml" def self.configure_from_file!(path) raise "#{path} does not exist!" unless File.file? path - result =(YAML.safe_load(ERB.new(File.read(path)).result, [], [], true) || {}) + result = load_yaml(path) ::ActiveRecord::Base.configurations = begin result.each do |_env, config| if config.all? { |_, v| v.is_a?(Hash) } @@ -84,5 +84,20 @@ def self.rack_env (ENV['RACK_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV'] || ENV['OTR_ENV'] || 'development').to_sym end + + # Support old Psych versions + def self.load_yaml(path) + erb_result = ERB.new(File.read(path)).result + + result = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1') + YAML.safe_load(erb_result, aliases: true) + else + YAML.safe_load(erb_result, [], [], true) + end + + result || {} + end + + private_class_method :load_yaml end end diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_4.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_4.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_4.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_4.rb 2022-01-30 20:26:56.000000000 +0200 @@ -8,7 +8,6 @@ def initialize @major_version = 4 ::ActiveRecord::Base.default_timezone = :utc - ::ActiveRecord::Base.logger = Logger.new(STDOUT) end # All db migration dir paths diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_5.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_5.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_5.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_5.rb 2022-01-30 20:26:56.000000000 +0200 @@ -8,7 +8,6 @@ def initialize @major_version = 5 ::ActiveRecord::Base.default_timezone = :utc - ::ActiveRecord::Base.logger = Logger.new(STDOUT) end # All db migration dir paths diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_6.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_6.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_6.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_6.rb 2022-01-30 20:26:56.000000000 +0200 @@ -8,7 +8,6 @@ def initialize @major_version = 6 ::ActiveRecord::Base.default_timezone = :utc - ::ActiveRecord::Base.logger = Logger.new(STDOUT) end # All db migration dir paths diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_7.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_7.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/compatibility_7.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/compatibility_7.rb 2022-01-30 20:26:56.000000000 +0200 @@ -5,7 +5,6 @@ def initialize @major_version = 7 ::ActiveRecord.default_timezone = :utc - ::ActiveRecord::Base.logger = Logger.new(STDOUT) end end end diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/middleware/query_cache.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/middleware/query_cache.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/middleware/query_cache.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/middleware/query_cache.rb 2022-01-30 20:26:56.000000000 +0200 @@ -7,7 +7,7 @@ def initialize(app) @handler = case ::ActiveRecord::VERSION::MAJOR when 4 then ::ActiveRecord::QueryCache.new(app) - when 5, 6 then ActionDispatchHandler.new(app) + when 5, 6, 7 then ActionDispatchHandler.new(app) end end diff -Nru ruby-otr-activerecord-2.0.3/lib/otr-activerecord/version.rb ruby-otr-activerecord-2.1.1/lib/otr-activerecord/version.rb --- ruby-otr-activerecord-2.0.3/lib/otr-activerecord/version.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/lib/otr-activerecord/version.rb 2022-01-30 20:26:56.000000000 +0200 @@ -1,6 +1,6 @@ module OTR module ActiveRecord # Gem version - VERSION = '2.0.3' + VERSION = '2.1.1' end end diff -Nru ruby-otr-activerecord-2.0.3/otr-activerecord.gemspec ruby-otr-activerecord-2.1.1/otr-activerecord.gemspec --- ruby-otr-activerecord-2.0.3/otr-activerecord.gemspec 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/otr-activerecord.gemspec 2022-01-30 20:26:56.000000000 +0200 @@ -4,7 +4,7 @@ Gem::Specification.new do |gem| gem.name = 'otr-activerecord' gem.version = OTR::ActiveRecord::VERSION - gem.date = '2021-10-22' + gem.date = '2022-01-30' gem.description = 'Off The Rails ActiveRecord: Use ActiveRecord with Grape, Sinatra, Rack, or anything else! Formerly known as \'grape-activerecord\'.' gem.summary = 'Off The Rails: Use ActiveRecord with Grape, Sinatra, Rack, or anything else!' diff -Nru ruby-otr-activerecord-2.0.3/spec/otr-activerecord/activerecord_spec.rb ruby-otr-activerecord-2.1.1/spec/otr-activerecord/activerecord_spec.rb --- ruby-otr-activerecord-2.0.3/spec/otr-activerecord/activerecord_spec.rb 2021-10-23 04:51:04.000000000 +0300 +++ ruby-otr-activerecord-2.1.1/spec/otr-activerecord/activerecord_spec.rb 2022-01-30 20:26:56.000000000 +0200 @@ -5,12 +5,10 @@ it 'configures active record' do described_class.configure_from_file!(config) - - expect(::ActiveRecord::Base.configurations['test']).to eq( - adapter: 'sqlite3', - database: 'tmp/simple.sqlite3', - migrations_paths: ['db/migrate'] - ) + t = ::ActiveRecord::Base.configurations['test'].with_indifferent_access + expect(t[:adapter]).to eq 'sqlite3' + expect(t[:database]).to eq 'tmp/simple.sqlite3' + expect(t[:migrations_paths]).to eq ['db/migrate'] end end @@ -19,12 +17,10 @@ it 'configures active record' do described_class.configure_from_file!(config) - - expect(::ActiveRecord::Base.configurations['test']).to eq( - adapter: 'sqlite3', - database: 'tmp/multi.sqlite3', - migrations_paths: ['db/migrate'] - ) + t = ::ActiveRecord::Base.configurations['test'].with_indifferent_access + expect(t[:adapter]).to eq 'sqlite3' + expect(t[:database]).to eq 'tmp/multi.sqlite3' + expect(t[:migrations_paths]).to eq ['db/migrate'] end end end