ruby-changes:61576
From: David <ko1@a...>
Date: Fri, 5 Jun 2020 11:50:21 +0900 (JST)
Subject: [ruby-changes:61576] cd3d035e8a (master): [ruby/psych] Remove unnecessary version guard from versions.rb
https://git.ruby-lang.org/ruby.git/commit/?id=cd3d035e8a From cd3d035e8a0d8555748f564f10ea00458a60355c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Fri, 14 Feb 2020 00:26:37 +0100 Subject: [ruby/psych] Remove unnecessary version guard from versions.rb Removing it triggers the following warnings when running `bundle` under jruby from the root of the `psych` repo prints the following warnings: ``` /path/to/jruby-9.2.9.0/lib/ruby/gems/shared/gems/psych-3.1.0-java/lib/psych/versions.rb:7: warning: already initialized constant VERSION /path/to//jruby-9.2.9.0/lib/ruby/gems/shared/gems/psych-3.1.0-java/lib/psych/versions.rb:10: warning: already initialized constant DEFAULT_SNAKEYAML_VERSION ``` This is because bundler loads the versions file relatively from the local gemspec, and then internally loads the psych gem, causing the redefinition warnings. Instead, we modify the $LOAD_PATH so that when working locally on the `psych` repo, the local version of `psych` gets used. https://github.com/ruby/psych/commit/a3fc8191a7 diff --git a/ext/psych/lib/psych/versions.rb b/ext/psych/lib/psych/versions.rb index 731ba95..dfa1917 100644 --- a/ext/psych/lib/psych/versions.rb +++ b/ext/psych/lib/psych/versions.rb @@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/versions.rb#L2 # frozen_string_literal: true module Psych # The version of Psych you are using - VERSION = '3.1.0' unless defined?(::Psych::VERSION) + VERSION = '3.1.0' if RUBY_ENGINE == 'jruby' DEFAULT_SNAKEYAML_VERSION = '1.23'.freeze diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec index 0990098..f55cd2a 100644 --- a/ext/psych/psych.gemspec +++ b/ext/psych/psych.gemspec @@ -1,12 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L1 # -*- encoding: utf-8 -*- # frozen_string_literal: true -begin - require_relative 'lib/psych/versions' -rescue LoadError - # for Ruby core repository - require_relative 'versions' -end +lib_path = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift lib_path if File.exist?(lib_path) + +require 'psych/versions' Gem::Specification.new do |s| s.name = "psych" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/