diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58b2ffb..16ec60c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ["2.7", "3.0", "3.1"] + ruby-version: ["3.0", "3.1"] services: db: @@ -67,7 +67,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0 + ruby-version: "3.0" bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run rubocop run: bundle exec rubocop @@ -95,7 +95,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0 + ruby-version: "3.0" bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Prepare env: diff --git a/Gemfile.lock b/Gemfile.lock index 284a9bc..e5618cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,25 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (7.0.4) - actionpack (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activesupport (= 7.0.4) + actionmailer (7.0.4.3) + actionpack (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) + actionpack (7.0.4.3) + actionview (= 7.0.4.3) + activesupport (= 7.0.4.3) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (7.0.4) - activesupport (= 7.0.4) + actionview (7.0.4.3) + activesupport (= 7.0.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -29,15 +29,15 @@ GEM activemodel (>= 4.1, < 7.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.0.4) - activesupport (= 7.0.4) + activejob (7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.3.6) - activemodel (7.0.4) - activesupport (= 7.0.4) - activerecord (7.0.4) - activemodel (= 7.0.4) - activesupport (= 7.0.4) - activesupport (7.0.4) + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activerecord (7.0.4.3) + activemodel (= 7.0.4.3) + activesupport (= 7.0.4.3) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -45,11 +45,11 @@ GEM airbrussh (1.4.1) sshkit (>= 1.6.1, != 1.7.0) ast (2.4.2) - bootsnap (1.13.0) + bootsnap (1.16.0) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - capistrano (3.17.1) + capistrano (3.17.2) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -64,20 +64,21 @@ GEM case_transform (0.2) activesupport choice (0.2.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) crass (1.0.6) + date (3.3.3) docile (1.4.0) - erubi (1.11.0) + erubi (1.12.0) exception_notification (4.5.0) actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) - globalid (1.0.0) + globalid (1.1.0) activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) - json (2.6.2) + json (2.6.3) jsonapi-renderer (0.2.2) - jwt (2.5.0) + jwt (2.7.0) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -90,47 +91,51 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - loofah (2.19.0) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp method_source (1.0.0) mini_mime (1.1.2) - mini_portile2 (2.8.0) - minitest (5.16.3) + mini_portile2 (2.8.1) + minitest (5.18.0) mocha (2.0.2) ruby2_keywords (>= 0.0.5) - msgpack (1.6.0) + msgpack (1.7.0) multi_json (1.15.0) - net-imap (0.3.1) + net-imap (0.3.4) + date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.1) timeout net-scp (4.0.0) net-ssh (>= 2.6.5, < 8.0.0) net-smtp (0.3.3) net-protocol - net-ssh (7.0.1) + net-ssh (7.1.0) nio4r (2.5.8) - nokogiri (1.13.9) + nokogiri (1.14.2) mini_portile2 (~> 2.8.0) racc (~> 1.4) - nokogiri (1.13.9-x86_64-linux) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) parallel (1.22.1) - parser (3.1.2.1) + parser (3.2.1.1) ast (~> 2.4.1) pg (1.2.3) - puma (6.0.0) + puma (6.2.1) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.4) - rack-cors (1.1.1) + racc (1.6.2) + rack (2.2.6.4) + rack-cors (2.0.1) rack (>= 2.0.0) - rack-test (2.0.2) + rack-test (2.1.0) rack (>= 1.3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -140,68 +145,68 @@ GEM activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) rails-i18n (7.0.6) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + railties (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.6.0) + regexp_parser (2.7.0) rexml (3.2.5) - rubocop (1.38.0) + rubocop (1.48.1) json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.26.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - rubocop-performance (1.15.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.28.0) + parser (>= 3.2.1.0) + rubocop-performance (1.16.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.17.2) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) ruby-graphviz (1.2.5) rexml - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) - spring (4.1.0) - sqlite3 (1.5.3) + spring (4.1.1) + sqlite3 (1.6.2) mini_portile2 (~> 2.8.0) - sqlite3 (1.5.3-x86_64-linux) - sshkit (1.21.3) + sqlite3 (1.6.2-x86_64-linux) + sshkit (1.21.4) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) streamio-ffmpeg (3.0.2) multi_json (~> 1.8) swagger-blocks (3.0.0) thor (1.2.1) - timeout (0.3.0) - tzinfo (2.0.5) + timeout (0.3.2) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.3.0) - zeitwerk (2.6.6) + unicode-display_width (2.4.2) + zeitwerk (2.6.7) PLATFORMS ruby diff --git a/app/controllers/auth/jwt.rb b/app/controllers/auth/jwt.rb index bf7ebe4..fde042d 100644 --- a/app/controllers/auth/jwt.rb +++ b/app/controllers/auth/jwt.rb @@ -18,7 +18,7 @@ def encode(payload) end def decode(token) - HashWithIndifferentAccess.new(JWT.decode(token, secret)[0]) + ActiveSupport::HashWithIndifferentAccess.new(JWT.decode(token, secret)[0]) rescue StandardError nil end diff --git a/config.ru b/config.ru index 667e328..afd13e2 100644 --- a/config.ru +++ b/config.ru @@ -2,5 +2,5 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('config/environment', __dir__) +require File.expand_path('config/environment', __dir__) run Rails.application diff --git a/config/deploy.rb b/config/deploy.rb index ceca43b..e0329fd 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # config valid only for current version of Capistrano -lock '3.17.1' +lock '3.17.2' set :application, 'raar' set :repo_url, 'git@github.com:radiorabe/raar.git' diff --git a/config/environments/production.rb b/config/environments/production.rb index d60b35c..6387a29 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -40,7 +40,7 @@ config.log_tags = [:request_id] # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. case ENV['RAAR_LOG'].to_s.downcase.strip diff --git a/db/seeds/broadcast_seeder.rb b/db/seeds/broadcast_seeder.rb index ff8f605..20e8bfe 100644 --- a/db/seeds/broadcast_seeder.rb +++ b/db/seeds/broadcast_seeder.rb @@ -35,7 +35,7 @@ def parse_broadcasts def load_broadcasts input = File.read('db/seeds/broadcasts.txt') - input.split("\n").reject(&:blank?).map { |line| line.split("\t") } + input.split("\n").compact_blank.map { |line| line.split("\t") } end def make_time(day, time) diff --git a/test/services/downgrade/downgrader_test.rb b/test/services/downgrade/downgrader_test.rb index 25377db..dd3dd23 100644 --- a/test/services/downgrade/downgrader_test.rb +++ b/test/services/downgrade/downgrader_test.rb @@ -72,11 +72,10 @@ class DowngraderTest < ActiveSupport::TestCase assert_difference('AudioFile.count', -2) do [file1, file2, file3].shuffle.each { |file| downgrader.handle(file) } end - assert_not AudioFile.exists?(id: file1.id) - assert_not AudioFile.exists?(id: file2.id) - assert_not AudioFile.exists?(id: file3.id) lower = AudioFile.where(broadcast_id: b1.id, bitrate: 192, channels: 2).first assert_equal path, lower.path + old_ids = [file1, file2, file3].map(&:id) - [lower.id] + assert_not AudioFile.exists?(id: old_ids) end test 'just deletes higher-bitrate file when lower-bitrate already exists' do