Skip to content

Commit fd3673a

Browse files
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.
1 parent 3178667 commit fd3673a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/thor/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require_relative "../thor"
22
require_relative "group"
33

4-
require "yaml"
54
require "digest/sha2"
65
require "pathname"
76

@@ -195,6 +194,7 @@ def thor_root
195194
def thor_yaml
196195
@thor_yaml ||= begin
197196
yaml_file = File.join(thor_root, "thor.yml")
197+
require "yaml"
198198
yaml = YAML.load_file(yaml_file) if File.exist?(yaml_file)
199199
yaml || {}
200200
end

0 commit comments

Comments
 (0)