Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade to Ruby 3.1 #1548

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ruby 3.0.2
ruby 3.1.6
nodejs 18.15.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0.2-alpine3.13
FROM ruby:3.1.6-alpine

ENV LANG C.UTF-8
ARG BUNDLE_GITHUB__COM
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

ruby "3.0.2"
ruby "3.1.6"

gem "rails", "6.1.7.7"

Expand Down
48 changes: 31 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ GEM
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
console_color (0.0.6)
crack (0.4.5)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
css_parser (1.9.0)
Expand Down Expand Up @@ -231,7 +232,7 @@ GEM
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 5.1)
hashdiff (1.0.1)
hashdiff (1.1.2)
hashie (4.1.0)
html2haml (2.2.0)
erubis (~> 2.7.0)
Expand All @@ -253,6 +254,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.9.0)
jwt (2.2.3)
kaminari (1.2.1)
activesupport (>= 4.1.0)
Expand All @@ -270,6 +272,8 @@ GEM
rexml (>= 3.3.9)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand Down Expand Up @@ -443,20 +447,21 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
rubocop (1.14.0)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.5.0, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-performance (1.11.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
ruby_parser (3.15.1)
Expand Down Expand Up @@ -529,9 +534,18 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
standard (1.1.1)
rubocop (= 1.14.0)
rubocop-performance (= 1.11.2)
standard (1.42.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.68.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.5)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.5.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.22.0)
temple (0.8.2)
thor (1.3.2)
tilt (2.4.0)
Expand All @@ -546,8 +560,8 @@ GEM
uniform_notifier (1.16.0)
unleash (4.0.0)
murmurhash3 (~> 0.1.6)
webmock (3.12.2)
addressable (>= 2.3.6)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket (1.2.11)
Expand Down Expand Up @@ -625,7 +639,7 @@ DEPENDENCIES
yarjuf

RUBY VERSION
ruby 3.0.2p107
ruby 3.1.6p260

BUNDLED WITH
2.2.26
2 changes: 1 addition & 1 deletion app/graphql/resolvers/concerns/resolvers/submissionable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def external_submission_id
end

def compute_error
return IdsNotPassed unless ids_passed?
IdsNotPassed unless ids_passed?
end

def ids_passed?
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/resolvers/offer_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run
private

def compute_error
return BadArgumentError unless admin? || partner? || user?
BadArgumentError unless admin? || partner? || user?
end

def validate_user(offer)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/submissions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def formatted_minimum_price_for_email(submission)

def artist_supply_priority(is_p1: false, target_supply: false, **)
return "P1" if is_p1
return "P2" if target_supply
"P2" if target_supply
end

def assignable_admin?(user)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/utm_params_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module UtmParamsHelper
def utm_params(source:, campaign:, **args)
initial = {utm_campaign: campaign, utm_medium: "email", utm_source: source}
transformed_args = args.each_with_object({}) { |(key, value), obj| obj["utm_#{key}".to_sym] = value }
transformed_args = args.each_with_object({}) { |(key, value), obj| obj[:"utm_#{key}"] = value }
initial.merge(transformed_args)
end

Expand Down
24 changes: 12 additions & 12 deletions app/mailers/admin_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def submission(submission:, user:, artist:)
)

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(
to: Convection.config.admin_email_address,
subject: "Submission ##{@submission.id}"
Expand All @@ -33,9 +33,9 @@ def submission_approved(submission:, artist:)
assigned_admin = AdminUser.find_by(gravity_user_id: submission.assigned_to)

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}

mail(
to: assigned_admin.email,
Expand All @@ -51,9 +51,9 @@ def submission_resubmitted(submission:, artist:)
assigned_admin = AdminUser.find_by(gravity_user_id: submission.assigned_to)

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}

mail(
to: assigned_admin.email,
Expand All @@ -72,9 +72,9 @@ def artwork_updated(submission:, artwork_data:, changes: nil, image_added: nil)
@image_added = image_added

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}

mail(
to: assigned_admin.email,
Expand Down
6 changes: 3 additions & 3 deletions app/mailers/partner_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def submission_digest(
content: "sub-digest-auction"
)
smtpapi category: %w[submission_digest],
unique_args: {
partner_name: partner_name
}
unique_args: {
partner_name: partner_name
}

current_date = Time.now.utc.strftime("%B %-d")
mail(
Expand Down
56 changes: 28 additions & 28 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def submission_receipt(submission:, artist:)
)

smtpapi category: %w[submission_receipt],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(
to: submission.email,
subject: "Thank you for submitting your artwork to Artsy",
Expand All @@ -35,9 +35,9 @@ def first_upload_reminder(submission:)
)

smtpapi category: %w[first_upload_reminder],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail to: submission.email, subject: "You're Almost Done"
end

Expand All @@ -50,11 +50,11 @@ def second_upload_reminder(submission:)
)

smtpapi category: %w[second_upload_reminder],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail to: submission.email,
subject: "Artsy Consignments - complete your submission"
subject: "Artsy Consignments - complete your submission"
end

def submission_approved(submission:, artist:)
Expand All @@ -69,9 +69,9 @@ def submission_approved(submission:, artist:)
)

smtpapi category: %w[submission_approved],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(
to: submission.email,
subject: "Artsy Approved Submission | Next Steps"
Expand All @@ -90,9 +90,9 @@ def artist_submission_rejected(submission:, artist:)
)

smtpapi category: %w[artist_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "An update about your submission")
end

Expand All @@ -108,9 +108,9 @@ def fake_submission_rejected(submission:, artist:)
)

smtpapi category: %w[fake_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "Artsy Submission")
end

Expand All @@ -128,9 +128,9 @@ def nsv_bsv_submission_rejected(submission:, artist:, logged_in:)
)

smtpapi category: %w[nsv_bsv_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
title = submission.title || "Unknown"
artist_name = artist&.name
subject = "Update on \"#{title}\" #{artist_name ? "by #{artist_name}" : ""}"
Expand All @@ -150,9 +150,9 @@ def non_target_supply_artist_rejected(submission:, artist:)
)

smtpapi category: %w[non_target_supply_artist_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "An update about your submission")
end

Expand All @@ -168,9 +168,9 @@ def other_submission_rejected(submission:, artist:)
)

smtpapi category: %w[other_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "An update about your submission")
end

Expand Down
6 changes: 3 additions & 3 deletions app/models/concerns/percentize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ module Percentize
class_methods do
def percentize(*method_names)
method_names.each do |method_name|
attribute "#{method_name}_whole".to_sym
attribute :"#{method_name}_whole"

define_method "#{method_name}_whole" do
define_method :"#{method_name}_whole" do
return if self[method_name].blank?

(self[method_name] * 100).round(2)
end

define_method "#{method_name}_whole=" do |percent_whole|
define_method :"#{method_name}_whole=" do |percent_whole|
if percent_whole.blank?
self[method_name] = nil
else
Expand Down
2 changes: 1 addition & 1 deletion app/models/offer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def set_state

# defines methods sent?, accepted?, etc. for each possible offer state
STATES.each do |method|
define_method "#{method}?".to_sym do
define_method :"#{method}?" do
state == method
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def sale_state
end

def sorted_images
images.sort_by.with_index { |a, i| a == primary_image ? -1 : i }
images.sort_by.with_index { |a, i| (a == primary_image) ? -1 : i }
end

def as_json(options = {})
Expand Down Expand Up @@ -170,7 +170,7 @@ def thumbnail

# defines methods submitted?, approved?, etc. for each possible submission state
STATES.each do |method|
define_method "#{method}?".to_sym do
define_method :"#{method}?" do
state == method
end
end
Expand Down
Loading