summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xyarp/templates/template.rb8
1 files changed, 7 insertions, 1 deletions
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(".")