Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeen authored Feb 27, 2024
2 parents 733524c + 61ea2c3 commit f0d1444
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 12 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
fail-fast: false
matrix:
ruby:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"
gemfile:
- Gemfile
- gemfiles/rails_5_2.gemfile
Expand All @@ -40,12 +41,13 @@ jobs:
- gemfiles/rails_5_2_graphiti_rails.gemfile
- gemfiles/rails_6_graphiti_rails.gemfile
- gemfiles/rails_7_graphiti_rails.gemfile
- gemfiles/rails_7_1_graphiti_rails.gemfile
appraisal:
- true
- false
include:
- ruby: ruby-head
gemfile: Gemfile
gemfile: gemfiles/rails_7_1.gemfile
appraisal: true
- ruby: ruby-head
gemfile: Gemfile
Expand All @@ -66,7 +68,9 @@ jobs:
appraisal: false
- gemfile: gemfiles/rails_7_graphiti_rails.gemfile
appraisal: false
# Rails 5 can't run on Ruby 3
- gemfile: gemfiles/rails_7_1_graphiti_rails.gemfile
appraisal: false
# Rails 5 can't run on Ruby 3
- gemfile: gemfiles/rails_5_2.gemfile
ruby: 3.0
- gemfile: gemfiles/rails_5_2_graphiti_rails.gemfile
Expand All @@ -75,11 +79,14 @@ jobs:
ruby: 3.1
- gemfile: gemfiles/rails_5_2_graphiti_rails.gemfile
ruby: 3.1
# Raise 7 can't run on 2.6
- gemfile: gemfiles/rails_7.gemfile
ruby: 2.6
- gemfile: gemfiles/rails_7_graphiti_rails.gemfile
ruby: 2.6
- gemfile: gemfiles/rails_5_2.gemfile
ruby: 3.2
- gemfile: gemfiles/rails_5_2_graphiti_rails.gemfile
ruby: 3.2
- gemfile: gemfiles/rails_5_2.gemfile
ruby: 3.3
- gemfile: gemfiles/rails_5_2_graphiti_rails.gemfile
ruby: 3.3
continue-on-error: ${{ matrix.ruby == 'ruby-head' }}
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
Expand Down
15 changes: 15 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ appraise "rails-7-graphiti-rails" do
gem "database_cleaner"
gem "graphiti-rails", "~> 0.4.0"
end

appraise "rails-7-1" do
gem "rails", "~> 7.1"
gem "rspec-rails"
gem "sqlite3", "~> 1.4.0"
gem "database_cleaner"
end

appraise "rails-7-1-graphiti-rails" do
gem "rails", "~> 7.1"
gem "rspec-rails"
gem "sqlite3", "~> 1.4.0"
gem "database_cleaner"
gem "graphiti-rails", "~> 0.4.0"
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "https://rubygems.org"
gemspec

group :test do
gem "database_cleaner"
gem "pry"
gem "pry-byebug", platform: [:mri]
gem "appraisal"
Expand Down
18 changes: 18 additions & 0 deletions gemfiles/rails_7_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 7.1"
gem "rspec-rails"
gem "sqlite3", "~> 1.4.0"
gem "database_cleaner"

group :test do
gem "pry"
gem "pry-byebug", platform: [:mri]
gem "appraisal"
gem "guard"
gem "guard-rspec"
end

gemspec path: "../"
19 changes: 19 additions & 0 deletions gemfiles/rails_7_1_graphiti_rails.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 7.1"
gem "rspec-rails"
gem "sqlite3", "~> 1.4.0"
gem "database_cleaner"
gem "graphiti-rails", "~> 0.4.0"

group :test do
gem "pry"
gem "pry-byebug", platform: [:mri]
gem "appraisal"
gem "guard"
gem "guard-rspec"
end

gemspec path: "../"
8 changes: 7 additions & 1 deletion lib/graphiti.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "json"
require "forwardable"
require "uri"
require "active_support/core_ext/string"
require "active_support/core_ext/enumerable"
require "active_support/core_ext/class/attribute"
Expand Down Expand Up @@ -83,7 +84,12 @@ def self.logger=(val)
end

def self.log(msg, color = :white, bold = false)
colored = ActiveSupport::LogSubscriber.new.send(:color, msg, color, bold)
colored = if ::ActiveSupport.version >= Gem::Version.new("7.1")
ActiveSupport::LogSubscriber.new.send(:color, msg, color, bold: bold)
else
ActiveSupport::LogSubscriber.new.send(:color, msg, color, bold)
end

logger.debug(colored)
end

Expand Down
1 change: 0 additions & 1 deletion lib/graphiti/debugger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def scrub_params(params)
params ||= {}
params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
params.reject! { |k, v| [:controller, :action, :format, :debug].include?(k.to_sym) }
params.reject! { |k, v| k.to_sym == :include }
params.deep_symbolize_keys
end

Expand Down
2 changes: 1 addition & 1 deletion lib/graphiti/resource_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def update
save(action: :update)
end

alias update_attributes update
alias update_attributes update # standard:disable Style/Alias

def include_hash
@include_hash ||= begin
Expand Down
2 changes: 1 addition & 1 deletion lib/graphiti/util/serializer_relationships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def validate_link_for_sideload!(sideload)
cache_key = :"#{@sideload.object_id}-#{action}"
return if self.class.validated_link_cache.include?(cache_key)
prc = Graphiti.config.context_for_endpoint
unless prc.call(sideload.resource.endpoint[:full_path], action)
unless prc.call(sideload.resource.endpoint[:full_path].to_s, action)
raise Errors::InvalidLink.new(@resource_class, sideload, action)
end
self.class.validated_link_cache << cache_key
Expand Down

0 comments on commit f0d1444

Please sign in to comment.