Skip to content

Commit

Permalink
Lazily load YAML
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
deivid-rodriguez committed Dec 4, 2024
1 parent 3178667 commit fd3673a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/thor/runner.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require_relative "../thor"
require_relative "group"

require "yaml"
require "digest/sha2"
require "pathname"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd3673a

Please sign in to comment.