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
Open
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
4 changes: 4 additions & 0 deletions safe_yaml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

s.add_dependency("base64", ">= 0.1.0")
end
end