ruby-changes:69773
From: Yusuke <ko1@a...>
Date: Wed, 17 Nov 2021 15:10:38 +0900 (JST)
Subject: [ruby-changes:69773] d23b3d9b7d (master): Prevent "already initialized constant Digest::VERSION"
https://git.ruby-lang.org/ruby.git/commit/?id=d23b3d9b7d From d23b3d9b7dc2964da36dc9daf96718b1867adcae Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Wed, 17 Nov 2021 15:08:46 +0900 Subject: Prevent "already initialized constant Digest::VERSION" http://rubyci.s3.amazonaws.com/ubuntu1804/ruby-master/log/20211117T033003Z.log.html.gz ``` installing default gems from ext: /home/chkbuild/chkbuild/tmp/build/20211117T033003Z/lib/ruby/gems/3.1.0 /home/chkbuild/chkbuild/tmp/build/20211117T033003Z/ruby/ext/digest/lib/digest/version.rb:4: warning: already initialized constant Digest::VERSION /home/chkbuild/chkbuild/tmp/build/20211117T033003Z/ruby/.ext/common/digest/version.rb:4: warning: previous definition of VERSION was here ``` This hack is copied from ext/psych/psych.gemspec --- ext/digest/digest.gemspec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/digest/digest.gemspec b/ext/digest/digest.gemspec index d27d82148c1..f8dff1797a5 100644 --- a/ext/digest/digest.gemspec +++ b/ext/digest/digest.gemspec @@ -1,11 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.gemspec#L1 # coding: utf-8 # frozen_string_literal: true -require_relative 'lib/digest/version' +version_module = Module.new do + version_rb = File.join(__dir__, "lib/digest/version.rb") + module_eval(File.read(version_rb), version_rb) +end Gem::Specification.new do |spec| spec.name = "digest" - spec.version = Digest::VERSION + spec.version = version_module::Digest::VERSION spec.authors = ["Akinori MUSHA"] spec.email = ["knu@i..."] -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/