From d2392e1ce2b9fb113ca19cdcae2a2fe7f8a3c8ec Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 25 Aug 2023 15:43:04 -0400 Subject: [PATCH] [ruby/yarp] Fix relative require in template script https://github.com/ruby/yarp/commit/dea9eb5a12 --- yarp/templates/template.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/yarp/templates/template.rb b/yarp/templates/template.rb index 4216c68b95..59a779be1f 100755 --- a/yarp/templates/template.rb +++ b/yarp/templates/template.rb @@ -4,7 +4,13 @@ require "erb" require "fileutils" require "yaml" -require_relative "../lib/yarp/version" +if File.exist?(File.expand_path("../lib/yarp/version", __dir__)) + # Within the gem/local repository + require_relative "../lib/yarp/version" +else + # Within CRuby + require_relative "../../lib/yarp/version" +end YARP_VERSION = YARP::VERSION YARP_VERSION_MAJOR, YARP_VERSION_MINOR, YARP_VERSION_PATCH = YARP_VERSION.split(".")