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

add base64 dependancy when using ruby 3.3 or greater #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmenanno
Copy link

This is a reopening of the PR that I accidentally closed here #107

I now have it as a conditional based on the ruby version so that we only inject the dependency manually when on the ruby versions that require it.

@@ -16,4 +16,8 @@ Gem::Specification.new do |gem|
gem.executables = ["safe_yaml"]

gem.required_ruby_version = ">= 1.8.7"

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will not work, depending on the ruby version used to build/publish the gem it will either declare the dependency or not do that, for all ruby versions used to run it. I have my doubts about the possibility of a new release, just wanted to let you know.

Since the first released version of base64 is Ruby >= 2.3.0, it will also implicitly raise required_ruby_version

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm to you think it would make sense then for me to remove the condition and bump the required_ruby_version of this gem to >= 2.3.0? And then if we happen to be able to get another release of the gem that should fit the bill?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Alternatively, replace the one base64 call being done in this gem with the unpack equivalent and remove base64 requires:

# Equivalent to Base64.decode64
def self.base64_decode(input)
  # TODO: Condition can be droped if Ruby >= 2.4.0
  if input.respond_to?(:unpack1)
    input.unpack1('m')
  else
    input.unpack('m').first
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants