From fd3673aaf201be43e4c0df219c8e8aa62cdffc89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 4 Dec 2024 13:53:21 +0100 Subject: [PATCH] Lazily load YAML This avoids errors when Bundler is activated _after_ thor, and a different version of YAML (or dependencies of it, like stringio) is included in the Gemfile/Gemfile.lock than the one that thor activates internally. --- lib/thor/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/thor/runner.rb b/lib/thor/runner.rb index e1a0f339..270c3371 100644 --- a/lib/thor/runner.rb +++ b/lib/thor/runner.rb @@ -1,7 +1,6 @@ require_relative "../thor" require_relative "group" -require "yaml" require "digest/sha2" require "pathname" @@ -195,6 +194,7 @@ def thor_root def thor_yaml @thor_yaml ||= begin yaml_file = File.join(thor_root, "thor.yml") + require "yaml" yaml = YAML.load_file(yaml_file) if File.exist?(yaml_file) yaml || {} end