Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-for-ruby-33
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon committed Apr 24, 2024
2 parents a5af8f9 + 93fed9e commit 5fa0c39
Show file tree
Hide file tree
Showing 33 changed files with 390 additions and 169 deletions.
37 changes: 15 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,29 @@ jobs:
fail-fast: false
matrix:
include:
- rails: 5.1
ruby: 2.5

- rails: 5.2
ruby: 2.5
- rails: 5.2
ruby: 2.6
- rails: 5.2
ruby: jruby-9.3

- rails: "6.0"
ruby: 2.6
- rails: "6.0"
ruby: 2.7
- rails: "6.0"
ruby: jruby
ruby: "2.7"

- rails: "6.1"
ruby: "2.7"
- rails: "6.1"
ruby: jruby

- rails: "7.0"
ruby: "3.0"
- rails: "6.1"
ruby: "3.1"
- rails: "6.1"
ruby: "3.2"

- rails: "7.0"
ruby: 3.1
- rails: "7.0"
ruby: 3.2
ruby: "3.1"
- rails: "7.0"
ruby: jruby
ruby: "3.2"

- rails: "7.1"
ruby: "3.1"
- rails: "7.1.1"
ruby: "3.2"
- rails: "7.1"
ruby: "3.2"

env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.log
pkg/
test/dummy/tmp/
test/dummy/db/test.sqlite3-*
test/dummy/.sass-cache
*.gem
/.idea
Expand All @@ -12,6 +13,5 @@ Gemfile.lock

*.sqlite3
.rakeTasks
*.sqlite3
TODO.md

27 changes: 14 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
AllCops:
TargetRubyVersion: 2.4
Exclude:
- '.git/**/*'
- '.github/**/*'
- 'gemfiles/**/*'
- ".git/**/*"
- "docs/**/*"
- "gemfiles/*"
NewCops: enable
TargetRubyVersion: 2.5

#
# RuboCop built-in settings.
Expand Down Expand Up @@ -31,7 +32,7 @@ Layout/HashAlignment:
Layout/LineLength:
Max: 128
Exclude:
- '**/test/**/*'
- "**/test/**/*"

# Match existing layout
Layout/SpaceInsideHashLiteralBraces:
Expand All @@ -44,17 +45,17 @@ Metrics/AbcSize:
# Support long block lengths for tests
Metrics/BlockLength:
Exclude:
- 'test/**/*'
- '**/*/cli.rb'
ExcludedMethods:
- 'aasm'
- 'included'
- "test/**/*"
- "**/*/cli.rb"
AllowedMethods:
- "aasm"
- "included"

# Soften limits
Metrics/ClassLength:
Max: 250
Exclude:
- 'test/**/*'
- "test/**/*"

# TODO: Soften Limits for phase 1 only
Metrics/CyclomaticComplexity:
Expand All @@ -77,15 +78,15 @@ Metrics/PerceivedComplexity:

# Initialization Vector abbreviation
Naming/MethodParameterName:
AllowedNames: ['iv', '_', 'io', 'ap']
AllowedNames: [ "iv", "_", "io", "ap", "id", "_id" ]

# Does not allow Symbols to load
Security/YAMLLoad:
AutoCorrect: false

# Needed for testing DateTime
Style/DateTime:
Exclude: ['test/**/*']
Exclude: [ "test/**/*" ]

# TODO: Soften Limits for phase 1 only
Style/Documentation:
Expand Down
29 changes: 10 additions & 19 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
appraise "rails_5.1" do
gem "rails", "~> 5.1.5"
gem "sqlite3", "~> 1.3.0", platform: :ruby
gem "activerecord-jdbcsqlite3-adapter", "~> 51.0", platform: :jruby
end

appraise "rails_5.2" do
gem "rails", "~> 5.2.0"
gem "sqlite3", "~> 1.3.0", platform: :ruby
gem "activerecord-jdbcsqlite3-adapter", "~> 52.0", platform: :jruby
end

appraise "rails_6.0" do
gem "rails", "~> 6.0.0"
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0", platform: :jruby
gem "sqlite3", "~> 1.4.0", platform: :ruby
end

appraise "rails_6.1" do
gem "rails", "~> 6.1.0"
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platform: :jruby
gem "sqlite3", "~> 1.4.0", platform: :ruby
end

appraise "rails_7.0" do
# Remove this deprecated gem once the following patch is released
# https://github.com/rails-api/active_model_serializers/pull/2428
gem "thread_safe", "~> 0.3.6"

gem "rails", "~> 7.0.0"
gem "activerecord-jdbcsqlite3-adapter", "~> 70.0", platform: :jruby
gem "sqlite3", "~> 1.4.0", platform: :ruby
end

appraise "rails_7.1.1" do
gem "rails", "7.1.1"
gem "sqlite3", "~> 1.4.0", platform: :ruby
end

appraise "rails_7.1" do
gem "rails", "~> 7.1.0"
gem "sqlite3", "~> 1.4.0", platform: :ruby
end
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem "minitest-rails"
gem "rake"
gem "sprockets", "< 4.0"

gem "rails", "~> 7.0.0"
gem "rails", "~> 7.1.0"
gem "sqlite3", "~> 1.4.0", platform: :ruby

gem "rubocop"
7 changes: 1 addition & 6 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ gem "minitest"
gem "minitest-rails"
gem "rake"
gem "sprockets", "< 4.0"
gem "semantic_logger", github: "reidmorrison/semantic_logger"
gem "rails", "~> 6.0.0"
gem "sqlite3", "~> 1.4.0", platform: :ruby
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0", platform: :jruby

group :development do
gem "rubocop"
end
gem "rubocop"

gemspec path: "../"
7 changes: 1 addition & 6 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ gem "minitest"
gem "minitest-rails"
gem "rake"
gem "sprockets", "< 4.0"
gem "semantic_logger", github: "reidmorrison/semantic_logger"
gem "rails", "~> 6.1.0"
gem "sqlite3", "~> 1.4.0", platform: :ruby
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platform: :jruby

group :development do
gem "rubocop"
end
gem "rubocop"

gemspec path: "../"
8 changes: 1 addition & 7 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ gem "minitest"
gem "minitest-rails"
gem "rake"
gem "sprockets", "< 4.0"
gem "semantic_logger", github: "reidmorrison/semantic_logger"
gem "rails", "~> 7.0.0"
gem "sqlite3", "~> 1.4.0", platform: :ruby
gem "thread_safe", "~> 0.3.6"
gem "activerecord-jdbcsqlite3-adapter", "~> 70.0", platform: :jruby

group :development do
gem "rubocop"
end
gem "rubocop"

gemspec path: "../"
11 changes: 3 additions & 8 deletions gemfiles/rails_5.1.gemfile → gemfiles/rails_7.1.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ gem "minitest"
gem "minitest-rails"
gem "rake"
gem "sprockets", "< 4.0"
gem "semantic_logger", github: "reidmorrison/semantic_logger"
gem "rails", "~> 5.1.5"
gem "sqlite3", "~> 1.3.0", platform: :ruby
gem "activerecord-jdbcsqlite3-adapter", "~> 51.0", platform: :jruby

group :development do
gem "rubocop"
end
gem "rails", "7.1.1"
gem "sqlite3", "~> 1.4.0", platform: :ruby
gem "rubocop"

gemspec path: "../"
11 changes: 3 additions & 8 deletions gemfiles/rails_5.2.gemfile → gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ gem "minitest"
gem "minitest-rails"
gem "rake"
gem "sprockets", "< 4.0"
gem "semantic_logger", github: "reidmorrison/semantic_logger"
gem "rails", "~> 5.2.0"
gem "sqlite3", "~> 1.3.0", platform: :ruby
gem "activerecord-jdbcsqlite3-adapter", "~> 52.0", platform: :jruby

group :development do
gem "rubocop"
end
gem "rails", "~> 7.1.0"
gem "sqlite3", "~> 1.4.0", platform: :ruby
gem "rubocop"

gemspec path: "../"
19 changes: 16 additions & 3 deletions lib/rails_semantic_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@ module RailsSemanticLogger
module ActionController
autoload :LogSubscriber, "rails_semantic_logger/action_controller/log_subscriber"
end

module ActionMailer
autoload :LogSubscriber, "rails_semantic_logger/action_mailer/log_subscriber"
end

module ActionView
autoload :LogSubscriber, "rails_semantic_logger/action_view/log_subscriber"
end

module ActiveJob
autoload :LogSubscriber, "rails_semantic_logger/active_job/log_subscriber"
end

module ActiveRecord
autoload :LogSubscriber, "rails_semantic_logger/active_record/log_subscriber"
end

module Rack
autoload :Logger, "rails_semantic_logger/rack/logger"
end

module DelayedJob
autoload :Plugin, "rails_semantic_logger/delayed_job/plugin"
end
Expand Down Expand Up @@ -48,14 +54,21 @@ def self.unattach(subscriber)
end

def self.subscriber_patterns(subscriber)
subscriber.patterns.respond_to?(:keys) ?
subscriber.patterns.keys :
if subscriber.patterns.respond_to?(:keys)
subscriber.patterns.keys
else
subscriber.patterns
end
end

private_class_method :subscriber_patterns, :unattach
end

require("rails_semantic_logger/extensions/mongoid/config") if defined?(Mongoid)
require("rails_semantic_logger/extensions/active_support/logger") if defined?(ActiveSupport::Logger)
require("rails_semantic_logger/extensions/rack/server") if defined?(Rack::Server)
require("rails_semantic_logger/extensions/active_support/log_subscriber") if defined?(ActiveSupport::LogSubscriber)
if defined?(Rackup::Server)
require("rails_semantic_logger/extensions/rackup/server")
elsif defined?(Rack::Server)
require("rails_semantic_logger/extensions/rack/server")
end
8 changes: 5 additions & 3 deletions lib/rails_semantic_logger/action_controller/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def process_action(event)

# Unused, but needed for Devise 401 status code monkey patch to still work.
::ActionController::Base.log_process_action(payload)

params = payload[:params]

if params.kind_of?(Hash) || params.kind_of?(::ActionController::Parameters)
if params.is_a?(Hash) || params.is_a?(::ActionController::Parameters)
# According to PR https://github.com/reidmorrison/rails_semantic_logger/pull/37/files
# params is not always a Hash.
payload[:params] = params.to_unsafe_h unless params.is_a?(Hash)
Expand Down Expand Up @@ -79,7 +79,9 @@ def redirect_to(event)
end

def send_data(event)
controller_logger(event).info(message: "Sent data", payload: {file_name: event.payload[:filename]}, duration: event.duration)
controller_logger(event).info(message: "Sent data",
payload: {file_name: event.payload[:filename]},
duration: event.duration)
end

def unpermitted_parameters(event)
Expand Down
Loading

0 comments on commit 5fa0c39

Please sign in to comment.