From 477500008ef798845ba13c5cc580d6e6a4b2b2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mar=C3=ADa=20a=2E=20matienzo?= Date: Wed, 23 Jul 2025 16:29:46 -0700 Subject: [PATCH 1/6] update ruby, rubocop, and add cop changes --- .rubocop.yml | 178 ++++++++++++++++++++++++++++++- .ruby-version | 2 +- Dockerfile | 7 +- berkeley_library-logging.gemspec | 20 ++-- rakelib/.rubocop.yml | 3 + spec/.rubocop.yml | 13 ++- 6 files changed, 203 insertions(+), 20 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2b23a84..a8be8a2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,8 @@ AllCops: - 'out/**/*' # Exclude vendor files in GitHub build - 'vendor/**/*' + SuggestExtensions: + rubocop-rails: false # Allow one line around block body (Layout/EmptyLines will still disallow two or more) Layout/EmptyLinesAroundBlockBody: @@ -181,7 +183,7 @@ Lint/TripleQuotes: # (new in 1.9) Enabled: true Style/IfWithBooleanLiteralBranches: # (new in 1.9) Enabled: true -Gemspec/DateAssignment: # (new in 1.10) +Gemspec/DeprecatedAttributeAssignment: # (new in 1.10) Enabled: true Style/HashConversion: # (new in 1.10) Enabled: true @@ -234,3 +236,177 @@ Style/MapToHash: # new in 1.24 Style/NestedFileDirname: # new in 1.26 Enabled: true +Gemspec/AddRuntimeDependency: # new in 1.65 + Enabled: true +Gemspec/AttributeAssignment: # new in 1.77 + Enabled: true +Gemspec/DevelopmentDependencies: # new in 1.44 + Enabled: false +Layout/LineContinuationLeadingSpace: # new in 1.31 + Enabled: true +Layout/LineContinuationSpacing: # new in 1.31 + Enabled: true +Lint/ArrayLiteralInRegexp: # new in 1.71 + Enabled: true +Lint/ConstantOverwrittenInRescue: # new in 1.31 + Enabled: true +Lint/ConstantReassignment: # new in 1.70 + Enabled: true +Lint/CopDirectiveSyntax: # new in 1.72 + Enabled: true +Lint/DuplicateMagicComment: # new in 1.37 + Enabled: true +Lint/DuplicateMatchPattern: # new in 1.50 + Enabled: true +Lint/DuplicateSetElement: # new in 1.67 + Enabled: true +Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69 + Enabled: true +Lint/ItWithoutArgumentsInBlock: # new in 1.59 + Enabled: true +Lint/LiteralAssignmentInCondition: # new in 1.58 + Enabled: true +Lint/MixedCaseRange: # new in 1.53 + Enabled: true +Lint/NonAtomicFileOperation: # new in 1.31 + Enabled: true +Lint/NumericOperationWithConstantResult: # new in 1.69 + Enabled: true +Lint/RedundantRegexpQuantifiers: # new in 1.53 + Enabled: true +Lint/RedundantTypeConversion: # new in 1.72 + Enabled: true +Lint/RefinementImportMethods: # new in 1.27 + Enabled: true +Lint/RequireRangeParentheses: # new in 1.32 + Enabled: true +Lint/SharedMutableDefault: # new in 1.70 + Enabled: true +Lint/SuppressedExceptionInNumberConversion: # new in 1.72 + Enabled: true +Lint/UnescapedBracketInRegexp: # new in 1.68 + Enabled: true +Lint/UselessConstantScoping: # new in 1.72 + Enabled: true +Lint/UselessDefaultValueArgument: # new in 1.76 + Enabled: true +Lint/UselessDefined: # new in 1.69 + Enabled: true +Lint/UselessNumericOperation: # new in 1.66 + Enabled: true +Lint/UselessOr: # new in 1.76 + Enabled: true +Lint/UselessRescue: # new in 1.43 + Enabled: true +Metrics/CollectionLiteralLength: # new in 1.47 + Enabled: true +Naming/PredicateMethod: # new in 1.76 + Enabled: true +Security/CompoundHash: # new in 1.28 + Enabled: true +Style/AmbiguousEndlessMethodDefinition: # new in 1.68 + Enabled: true +Style/ArrayIntersect: # new in 1.40 + Enabled: true +Style/BitwisePredicate: # new in 1.68 + Enabled: true +Style/CollectionQuerying: # new in 1.77 + Enabled: true +Style/CombinableDefined: # new in 1.68 + Enabled: true +Style/ComparableBetween: # new in 1.74 + Enabled: true +Style/ComparableClamp: # new in 1.44 + Enabled: true +Style/ConcatArrayLiterals: # new in 1.41 + Enabled: true +Style/DataInheritance: # new in 1.49 + Enabled: true +Style/DigChain: # new in 1.69 + Enabled: true +Style/DirEmpty: # new in 1.48 + Enabled: true +Style/EmptyHeredoc: # new in 1.32 + Enabled: true +Style/EmptyStringInsideInterpolation: # new in 1.76 + Enabled: true +Style/EnvHome: # new in 1.29 + Enabled: true +Style/ExactRegexpMatch: # new in 1.51 + Enabled: true +Style/FetchEnvVar: # new in 1.28 + Enabled: true +Style/FileEmpty: # new in 1.48 + Enabled: true +Style/FileNull: # new in 1.69 + Enabled: true +Style/FileTouch: # new in 1.69 + Enabled: true +Style/HashFetchChain: # new in 1.75 + Enabled: true +Style/HashSlice: # new in 1.71 + Enabled: true +Style/ItAssignment: # new in 1.70 + Enabled: true +Style/ItBlockParameter: # new in 1.75 + Enabled: true +Style/KeywordArgumentsMerging: # new in 1.68 + Enabled: true +Style/MagicCommentFormat: # new in 1.35 + Enabled: true +Style/MapCompactWithConditionalBlock: # new in 1.30 + Enabled: true +Style/MapIntoArray: # new in 1.63 + Enabled: true +Style/MapToSet: # new in 1.42 + Enabled: true +Style/MinMaxComparison: # new in 1.42 + Enabled: true +Style/ObjectThen: # new in 1.28 + Enabled: true +Style/OperatorMethodCall: # new in 1.37 + Enabled: true +Style/RedundantArrayConstructor: # new in 1.52 + Enabled: true +Style/RedundantArrayFlatten: # new in 1.76 + Enabled: true +Style/RedundantConstantBase: # new in 1.40 + Enabled: true +Style/RedundantCurrentDirectoryInPath: # new in 1.53 + Enabled: true +Style/RedundantDoubleSplatHashBraces: # new in 1.41 + Enabled: true +Style/RedundantEach: # new in 1.38 + Enabled: true +Style/RedundantFilterChain: # new in 1.52 + Enabled: true +Style/RedundantFormat: # new in 1.72 + Enabled: true +Style/RedundantHeredocDelimiterQuotes: # new in 1.45 + Enabled: true +Style/RedundantInitialize: # new in 1.27 + Enabled: true +Style/RedundantInterpolationUnfreeze: # new in 1.66 + Enabled: true +Style/RedundantLineContinuation: # new in 1.49 + Enabled: true +Style/RedundantRegexpArgument: # new in 1.53 + Enabled: true +Style/RedundantRegexpConstructor: # new in 1.52 + Enabled: true +Style/RedundantStringEscape: # new in 1.37 + Enabled: true +Style/ReturnNilInPredicateMethodDefinition: # new in 1.53 + Enabled: true +Style/SafeNavigationChainLength: # new in 1.68 + Enabled: true +Style/SendWithLiteralMethodName: # new in 1.64 + Enabled: true +Style/SingleLineDoEndBlock: # new in 1.57 + Enabled: true +Style/SuperArguments: # new in 1.64 + Enabled: true +Style/SuperWithArgsParentheses: # new in 1.58 + Enabled: true +Style/YAMLFileRead: # new in 1.53 + Enabled: true diff --git a/.ruby-version b/.ruby-version index 1effb00..0ddaf4d 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7 +~> 3.3 diff --git a/Dockerfile b/Dockerfile index ab84d03..341d627 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # ============================================================================= # Target: base -FROM ruby:2.7-alpine AS base +FROM ruby:3.3-alpine AS base RUN apk --no-cache --update upgrade && \ apk --no-cache add \ @@ -12,6 +12,7 @@ RUN apk --no-cache --update upgrade && \ openssl \ tzdata \ xz-libs \ + yaml-dev \ && rm -rf /var/cache/apk/* WORKDIR /opt/app @@ -29,8 +30,8 @@ RUN apk --update --no-cache add \ git \ && rm -rf /var/cache/apk/* -# The base image ships bundler 1.17.2, but we want something more recent -RUN gem install bundler -v 2.1.4 +# The base image ships an older bundler, but we want something more recent +RUN gem install bundler -v 2.5.22 # Copy codebase to WORKDIR. Unlike application projects, for a gem project # we need to do this before running `bundle install`, in order for the gem diff --git a/berkeley_library-logging.gemspec b/berkeley_library-logging.gemspec index 5278a28..185e160 100644 --- a/berkeley_library-logging.gemspec +++ b/berkeley_library-logging.gemspec @@ -23,29 +23,29 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features|artifacts)/}) spec.require_paths = ['lib'] - spec.required_ruby_version = ">= #{ruby_version}" + spec.required_ruby_version = ruby_version rails_version = '>= 6' spec.add_dependency 'activesupport', rails_version spec.add_dependency 'amazing_print', '~> 1.1' - spec.add_dependency 'colorize', '~> 0.8.1' + spec.add_dependency 'colorize', '~> 1.0' spec.add_dependency 'lograge', '~> 0.11' - spec.add_dependency 'ougai', '~> 1.8' + spec.add_dependency 'ougai', '~> 2.0' spec.add_development_dependency 'brakeman', '~> 4.9' spec.add_development_dependency 'bundle-audit', '~> 0.1' spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0' spec.add_development_dependency 'dotenv', '~> 2.7' - spec.add_development_dependency 'irb', '~> 1.2' # workaroundfor https://github.com/bundler/bundler/issues/6929 - spec.add_development_dependency 'listen', '>= 3.0.5', '< 3.2' + spec.add_development_dependency 'listen', '~> 3.2' spec.add_development_dependency 'rails', rails_version spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rspec-support', '~> 3.9' - spec.add_development_dependency 'rubocop', '~> 1.26.0' - spec.add_development_dependency 'rubocop-rspec', '~> 2.4.0' - spec.add_development_dependency 'simplecov', '~> 0.21.1' - spec.add_development_dependency 'simplecov-console', '~> 0.9.1' + spec.add_development_dependency 'rspec', '~> 3.9' + spec.add_development_dependency 'rubocop', '~> 1.78.0' + spec.add_development_dependency 'rubocop-rake', '~> 0.7.1' + spec.add_development_dependency 'rubocop-rspec', '~> 3.6.0' + spec.add_development_dependency 'simplecov', '~> 0.21' + spec.add_development_dependency 'simplecov-console', '~> 0.9' spec.add_development_dependency 'simplecov-rcov', '~> 0.2' spec.metadata['rubygems_mfa_required'] = 'true' diff --git a/rakelib/.rubocop.yml b/rakelib/.rubocop.yml index dd94258..aad3004 100644 --- a/rakelib/.rubocop.yml +++ b/rakelib/.rubocop.yml @@ -1,4 +1,7 @@ inherit_from: ../.rubocop.yml +plugins: + - rubocop-rake + Metrics/BlockLength: Enabled: false diff --git a/spec/.rubocop.yml b/spec/.rubocop.yml index 43af3c3..e7ccbb0 100644 --- a/spec/.rubocop.yml +++ b/spec/.rubocop.yml @@ -1,6 +1,6 @@ inherit_from: ../.rubocop.yml -require: +plugins: - rubocop-rspec Style/ClassAndModuleChildren: @@ -57,9 +57,12 @@ RSpec/ExpectOutput: Enabled: false # your naming scheme is not in possession of all the facts -RSpec/FilePath: +RSpec/SpecFilePathFormat: Enabled: false +RSpec/SpecFilePathSuffix: + Enabled: true + # explicit >>> implicit RSpec/InstanceVariable: Enabled: false @@ -96,6 +99,9 @@ RSpec/StubbedMock: RSpec/VerifiedDoubles: Enabled: false +RSpec/RemoveConst: + Enabled: false + ############################################################ # rubocop-rspec @@ -103,6 +109,3 @@ RSpec/VerifiedDoubles: RSpec/IdenticalEqualityAssertion: # new in 2.4 Enabled: true - -RSpec/Rails/AvoidSetupHook: # new in 2.4 - Enabled: true From e50103a9779530ffa1b6c49b7e0c83c27341f963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mar=C3=ADa=20a=2E=20matienzo?= Date: Wed, 23 Jul 2025 16:30:11 -0700 Subject: [PATCH 2/6] fix broken rspec invocation --- rakelib/spec.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/spec.rake b/rakelib/spec.rake index 34af937..5fa18ce 100644 --- a/rakelib/spec.rake +++ b/rakelib/spec.rake @@ -14,7 +14,7 @@ namespace :spec do groups.each do |group| desc "Run specs in spec/#{group} directory" RSpec::Core::RakeTask.new(group) do |task| - task.rspec_opts = %w[--color --format documentation --order default] + task.rspec_opts = %w[--color --format documentation] task.pattern = "spec/#{group}/**/*_spec.rb" end end From 6469be7171255bffbd9b9239e9e03db09be5fc5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mar=C3=ADa=20a=2E=20matienzo?= Date: Wed, 23 Jul 2025 16:31:06 -0700 Subject: [PATCH 3/6] railtie spec: fix for rails >= 7 --- spec/rails/ucblit/logging/railtie_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rails/ucblit/logging/railtie_spec.rb b/spec/rails/ucblit/logging/railtie_spec.rb index 6bdb755..db5b491 100644 --- a/spec/rails/ucblit/logging/railtie_spec.rb +++ b/spec/rails/ucblit/logging/railtie_spec.rb @@ -38,7 +38,7 @@ module Logging logging_initializer.run(app) bootstrap_logger_initializer.run(app) - expect(Rails.logger).to be_a(BerkeleyLibrary::Logging::Logger) + expect(Rails.logger.broadcasts).to include(a_kind_of(BerkeleyLibrary::Logging::Logger)) end end end From dd9a1d23bb166802d05e6ca2173a2302c1075770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mar=C3=ADa=20a=2E=20matienzo?= Date: Wed, 23 Jul 2025 16:41:39 -0700 Subject: [PATCH 4/6] add rubocop fixes --- berkeley_library-logging.gemspec | 1 - lib/berkeley_library/logging.rb | 4 ++-- lib/berkeley_library/logging/env.rb | 2 +- lib/berkeley_library/logging/loggers.rb | 2 +- rakelib/coverage.rake | 2 ++ rakelib/spec.rake | 3 ++- spec/rails/ucblit/logging/configurator_spec.rb | 10 ++++------ spec/rails/ucblit/logging/env_spec.rb | 2 +- spec/standalone/ucblit/logging/configurator_spec.rb | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/berkeley_library-logging.gemspec b/berkeley_library-logging.gemspec index 185e160..090bee0 100644 --- a/berkeley_library-logging.gemspec +++ b/berkeley_library-logging.gemspec @@ -20,7 +20,6 @@ Gem::Specification.new do |spec| spec.homepage = BerkeleyLibrary::Logging::ModuleInfo::HOMEPAGE spec.files = `git ls-files -z`.split("\x0") - spec.test_files = spec.files.grep(%r{^(test|spec|features|artifacts)/}) spec.require_paths = ['lib'] spec.required_ruby_version = ruby_version diff --git a/lib/berkeley_library/logging.rb b/lib/berkeley_library/logging.rb index 4fc8e50..196e099 100644 --- a/lib/berkeley_library/logging.rb +++ b/lib/berkeley_library/logging.rb @@ -24,10 +24,10 @@ def logger=(v) @logger = (ensure_logger(v) unless v.nil?) end - private - LOG_METHODS = %i[debug info warn error].freeze + private + def ensure_logger(v) return v if (missing = LOG_METHODS.reject { |m| v.respond_to?(m) }).empty? diff --git a/lib/berkeley_library/logging/env.rb b/lib/berkeley_library/logging/env.rb index afc0319..1904103 100644 --- a/lib/berkeley_library/logging/env.rb +++ b/lib/berkeley_library/logging/env.rb @@ -13,7 +13,7 @@ def env @env ||= begin # NOTE: can't just self.env= b/c it returns the wrong value -- see # https://stackoverflow.com/q/65226532/27358 - env = (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || FALLBACK_ENV) + env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || FALLBACK_ENV ensure_rails_env_like(env) end end diff --git a/lib/berkeley_library/logging/loggers.rb b/lib/berkeley_library/logging/loggers.rb index b4f1ac3..c4c405d 100644 --- a/lib/berkeley_library/logging/loggers.rb +++ b/lib/berkeley_library/logging/loggers.rb @@ -63,7 +63,7 @@ def default_log_file_for(config) def ensure_log_directory File.join(workdir, FALLBACK_LOG_DIR).tap do |log_dir| - FileUtils.mkdir(log_dir) unless File.exist?(log_dir) + FileUtils.mkdir_p(log_dir) raise ArgumentError, "Not a directory: #{log_dir}" unless File.directory?(log_dir) end end diff --git a/rakelib/coverage.rake b/rakelib/coverage.rake index e0f7140..90519b8 100644 --- a/rakelib/coverage.rake +++ b/rakelib/coverage.rake @@ -1,6 +1,7 @@ require 'colorize' namespace :simplecov do + desc 'Run coverage analysis' task :check_coverage do ENV['COVERAGE'] ||= 'true' Rake::Task['spec'].invoke @@ -9,6 +10,7 @@ namespace :simplecov do raise end + desc 'Create the structured coverage report' task :report do require 'simplecov' require 'simplecov-rcov' diff --git a/rakelib/spec.rake b/rakelib/spec.rake index 5fa18ce..9ed7344 100644 --- a/rakelib/spec.rake +++ b/rakelib/spec.rake @@ -1,6 +1,7 @@ require 'rspec/core/rake_task' namespace :spec do + desc 'Prepare the specs for execution' task :prepare do if ENV['GENERATE_REPORTS'] ENV['CI_REPORTS'] = 'artifacts/rspec' @@ -26,6 +27,6 @@ desc 'Run all specs in spec directory' task spec: ['spec:prepare'] do Rake::Task['spec:all'].invoke ensure - reports_dir = ENV['CI_REPORTS'] + reports_dir = ENV.fetch('CI_REPORTS', nil) puts "JUnit-format XML test report written to #{reports_dir}" if reports_dir end diff --git a/spec/rails/ucblit/logging/configurator_spec.rb b/spec/rails/ucblit/logging/configurator_spec.rb index 8f2e0c9..74c45c8 100644 --- a/spec/rails/ucblit/logging/configurator_spec.rb +++ b/spec/rails/ucblit/logging/configurator_spec.rb @@ -32,7 +32,7 @@ module Logging it 'enables Lograge' do Configurator.configure(config) lograge = config.lograge - expect(lograge.enabled).to eq(true) + expect(lograge.enabled).to be(true) end context 'events' do @@ -86,10 +86,8 @@ module Logging allow(session).to receive(:to_hash).and_return(session_hash) @request = instance_double(ActionDispatch::Request) - allow(request).to receive(:origin).and_return('http://example.org:3000') - allow(request).to receive(:base_url).and_return('https://example.org:3443') - allow(request).to receive(:x_csrf_token).and_return('5551212') - allow(request).to receive(:session).and_return(session) + allow(request).to receive_messages(origin: 'http://example.org:3000', base_url: 'https://example.org:3443', x_csrf_token: '5551212', + session: session) @payload = { params: params, @@ -152,7 +150,7 @@ module Logging describe 'Webpacker' do it 'works if Webpacker is not present' do - expect(Object.const_defined?(:Webpacker)).to eq(false) # just to be sure + expect(Object.const_defined?(:Webpacker)).to be(false) # just to be sure expect { Configurator.configure(config) }.not_to raise_error end diff --git a/spec/rails/ucblit/logging/env_spec.rb b/spec/rails/ucblit/logging/env_spec.rb index 5f30968..db861d0 100644 --- a/spec/rails/ucblit/logging/env_spec.rb +++ b/spec/rails/ucblit/logging/env_spec.rb @@ -18,7 +18,7 @@ module BerkeleyLibrary expect(defined?(Rails)).to be_truthy # just to be sure Logging.env = 'elvis' expect(Rails.env).to eq('elvis') - expect(Rails.env.elvis?).to eq(true) + expect(Rails.env.elvis?).to be(true) end end end diff --git a/spec/standalone/ucblit/logging/configurator_spec.rb b/spec/standalone/ucblit/logging/configurator_spec.rb index e4f0d33..34d8db8 100644 --- a/spec/standalone/ucblit/logging/configurator_spec.rb +++ b/spec/standalone/ucblit/logging/configurator_spec.rb @@ -29,7 +29,7 @@ module Logging it 'enables Lograge' do Configurator.configure(config) lograge = config.lograge - expect(lograge.enabled).to eq(true) + expect(lograge.enabled).to be(true) end it 'extracts request info from log events' do @@ -79,7 +79,7 @@ module Logging describe 'Webpacker' do it 'works if Webpacker is not present' do - expect(Object.const_defined?(:Webpacker)).to eq(false) # just to be sure + expect(Object.const_defined?(:Webpacker)).to be(false) # just to be sure expect { Configurator.configure(config) }.not_to raise_error end From c8c58f2b4034d1834c08c3b8fb82c8a862e7c434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mar=C3=ADa=20a=2E=20matienzo?= Date: Wed, 23 Jul 2025 16:45:01 -0700 Subject: [PATCH 5/6] prepare for release of 0.3.0 --- CHANGES.md | 6 ++++-- berkeley_library-logging.gemspec | 6 +++--- lib/berkeley_library/logging/module_info.rb | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6d7d98e..3fb2e8c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ -# 0.2.8 (next) +# 0.3.0 (2025-07-23) -- Log `HTTP_USER_AGENT` +- Update to support Ruby 3.3+ and Rails 7+ exclusively. +- Update Rubocop & Style changes. +- Log `HTTP_USER_AGENT`. # 0.2.7 (2022-05-25) diff --git a/berkeley_library-logging.gemspec b/berkeley_library-logging.gemspec index 090bee0..9af4345 100644 --- a/berkeley_library-logging.gemspec +++ b/berkeley_library-logging.gemspec @@ -11,8 +11,8 @@ require 'berkeley_library/logging/module_info' Gem::Specification.new do |spec| spec.name = BerkeleyLibrary::Logging::ModuleInfo::NAME - spec.author = BerkeleyLibrary::Logging::ModuleInfo::AUTHOR - spec.email = BerkeleyLibrary::Logging::ModuleInfo::AUTHOR_EMAIL + spec.author = BerkeleyLibrary::Logging::ModuleInfo::AUTHORS + spec.email = BerkeleyLibrary::Logging::ModuleInfo::AUTHOR_EMAILS spec.summary = BerkeleyLibrary::Logging::ModuleInfo::SUMMARY spec.description = BerkeleyLibrary::Logging::ModuleInfo::DESCRIPTION spec.license = BerkeleyLibrary::Logging::ModuleInfo::LICENSE @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ruby_version - rails_version = '>= 6' + rails_version = '>= 7' spec.add_dependency 'activesupport', rails_version spec.add_dependency 'amazing_print', '~> 1.1' diff --git a/lib/berkeley_library/logging/module_info.rb b/lib/berkeley_library/logging/module_info.rb index 582786a..91a6855 100644 --- a/lib/berkeley_library/logging/module_info.rb +++ b/lib/berkeley_library/logging/module_info.rb @@ -2,12 +2,12 @@ module BerkeleyLibrary module Logging class ModuleInfo NAME = 'berkeley_library-logging'.freeze - AUTHOR = 'David Moles'.freeze - AUTHOR_EMAIL = 'dmoles@berkeley.edu'.freeze + AUTHORS = ['David Moles', 'marĂ­a a. matienzo'].freeze + AUTHOR_EMAILS = ['dmoles@berkeley.edu', 'matienzo@berkeley.edu'].freeze SUMMARY = 'Opinionated Ruby/Rails logging for UC Berkeley Library'.freeze DESCRIPTION = 'A gem providing shared logging code for UC Berkeley Library gems and Rails applications'.freeze LICENSE = 'MIT'.freeze - VERSION = '0.2.7'.freeze + VERSION = '0.3.0'.freeze HOMEPAGE = 'https://github.com/BerkeleyLibrary/logging'.freeze private_class_method :new From f03cba602341f963c20a500f7bc236fa88592562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mar=C3=ADa=20a=2E=20matienzo?= Date: Wed, 23 Jul 2025 16:47:08 -0700 Subject: [PATCH 6/6] update github actions workflows and add gem push workflow --- .github/workflows/build.yml | 22 +++++++++++++++++----- .github/workflows/gem-push.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/gem-push.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 707851f..57f80f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,18 +1,30 @@ name: Build -on: [ push, pull_request ] +on: [ push, pull_request, workflow_dispatch ] jobs: test: strategy: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest ] - ruby: [ '2.7', '3.0' ] + ruby: [ '3.3', '3.4' ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - run: bundle exec rake + + - name: Run checks + run: bundle exec rake + + - name: Upload artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: artifacts-${{ matrix.ruby }}-${{ matrix.os }} + path: artifacts/** diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml new file mode 100644 index 0000000..9e6341e --- /dev/null +++ b/.github/workflows/gem-push.yml @@ -0,0 +1,33 @@ +name: Ruby Gem + +on: + release: + types: [published] + +jobs: + build: + name: Build + Publish + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build *.gemspec + gem push *.gem + env: + GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"