-
Notifications
You must be signed in to change notification settings - Fork 10
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
add ruby 3.1 and 3.2 support, drop ruby 2.6 #355
Conversation
c68a2a8
to
b647c71
Compare
219f3cb
to
37cc50c
Compare
@@ -434,7 +434,8 @@ def no_template_format_error(manifest) | |||
|
|||
def valid_url?(value) | |||
uri = URI.parse(value) | |||
uri.is_a?(URI::HTTP) && !uri.host.nil? | |||
host_empty = uri.host.nil? || uri.host == '' | |||
uri.is_a?(URI::HTTP) && !host_empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In newer URI versions, host for "https://" is an empty string, not nil
.
@@ -18,7 +18,7 @@ def message | |||
|
|||
# if the error contains the word `_legacy` in the second sentence, let's | |||
# only use the first one. | |||
if [original, attempted].any? { |val| val =~ /_legacy/ } | |||
if [original, attempted].any? { |val| val.is_a?(String) && val =~ /_legacy/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=~
for non-strings has been removed from recent Ruby versions (and was deprecated—and often meaningless—before), so now we compare only strings to this regex.
@@ -300,7 +300,7 @@ def build_app_source_with_files(files) | |||
|
|||
it 'includes zh-cn in translations' do | |||
expected_translations = JSON.parse(File.read('spec/translations/zh-cn.json')) | |||
expect(package.send(:translations)['zh-cn'].except('custom1')).to eq(expected_translations) | |||
expect(I18n::Utils.except(package.send(:translations)['zh-cn'], 'custom1')).to eq(expected_translations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hash refinements are removed in recents i18n versions (ruby-i18n/i18n#573).
@@ -319,7 +319,7 @@ def build_app_source_with_files(files) | |||
|
|||
it 'removes zendesk-specific keys in translations' do | |||
expected_translations = JSON.parse(File.read('spec/translations/zh-cn.json')) | |||
expect(package.send(:translations)['zh-cn'].except('custom1')).to eq(expected_translations) | |||
expect(I18n::Utils.except(package.send(:translations)['zh-cn'], 'custom1')).to eq(expected_translations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hash refinements are removed in recents i18n versions (ruby-i18n/i18n#573).
Newer URI versions set host to an empty string (instead of nil) for URL like “https://”
37cc50c
to
847c967
Compare
@@ -18,7 +18,7 @@ def message | |||
|
|||
# if the error contains the word `_legacy` in the second sentence, let's | |||
# only use the first one. | |||
if [original, attempted].any? { |val| val =~ /_legacy/ } | |||
if [original, attempted].any? { |val| val.is_a?(String) && val =~ /_legacy/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the following work?
if [original, attempted].any? { |val| val.is_a?(String) && val =~ /_legacy/ } | |
if [original, attempted].any? { |val| /_legacy/.match?(val) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No: val
is sometimes (at least in tests) a Hash (of all things), so that also fails with TypeError: no implicit conversion of Hash into String
.
s.license = 'Apache License Version 2.0' | ||
s.authors = ['James A. Rosen', 'Likun Liu', 'Sean Caffery', 'Daniel Ribeiro'] | ||
s.email = ['[email protected]'] | ||
s.homepage = 'http://github.com/zendesk/zendesk_apps_support' | ||
s.summary = 'Support to help you develop Zendesk Apps.' | ||
s.description = s.summary | ||
|
||
s.required_ruby_version = Gem::Requirement.new('>= 2.6', '< 3.1') | ||
s.required_ruby_version = Gem::Requirement.new('>= 2.7') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop v2.7 support given it's past EOL now.
Description
Adds Ruby 3.1 and 3.2 to the test matrix, drops Ruby 2.6, updates tests dependencies (to versions with support for recent Ruby versions).
This required a couple of changes:
— keyword arguments in i18n’s
translate
method (because of that, I’ve added a lower limit for i18n’s version in the gemspec—this release);— Hash refinements are removed in recents i18n versions (ruby-i18n/i18n#573), so instead we use
I18n::Utils.except
in tests now;— In newer
URI
versions, host for "https://" is an empty string, not nil, so we check for both.I’ve also cleaned up tests workflow and added a
tests_successful
wrapper.Before merging this PR
Risks