Skip to content

Commit c8c7574

Browse files
committed
(maint) Fix with latest version of yard
Monkey patching libraries is a bad idea. Latest version of yard changed some internal details, which broke bolt. A workaround was proposed in #3349 but the root cause was not addressed. Detect if the version of YARD we are using provide the `YARD::Logger::Severity` class (part of the new interal API) and if so use its constants to set the log level, otherwise fallback to the previous way of setting the log level using a Symbol. While here, revert the workaround that was committed in #3349 and #3350. !no-release-note
1 parent ce9235a commit c8c7574

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

acceptance/setup/common/pre-suite/010_install_ruby.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
# public_suffix for win requires Ruby version >= 2.6
2828
# current Ruby 2.5.0 works with public_suffix version 4.0.7
2929
on(bolt, powershell('gem install public_suffix -v 4.0.7'))
30-
on(bolt, powershell('gem install yard -v 0.9.36'))
3130
# current Ruby 2.5.0 works with puppet-strings 2.9.0
3231
on(bolt, powershell('gem install puppet-strings -v 2.9.0'))
3332
# net-ssh 7.x no longer supports ruby 2.5
@@ -77,7 +76,6 @@
7776
on(bolt, 'gem install public_suffix -v 5.1.1 --no-document')
7877
on(bolt, 'gem install CFPropertyList -v 3.0.6 --no-document')
7978
on(bolt, 'gem install fast_gettext -v 2.4.0')
80-
on(bolt, 'gem install yard -v 0.9.36 --no-document')
8179
# System ruby for osx12 is 2.6, which can only manage puppet-strings 2.9.0
8280
on(bolt, 'gem install puppet-strings -v 2.9.0 --no-document')
8381
# semantic puppet no longer supports ruby < 2.7

lib/bolt/pal.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,12 @@ def get_plan_info(plan_name, with_mtime: false)
498498
require 'puppet-strings'
499499
require 'puppet-strings/yard'
500500
PuppetStrings::Yard.setup!
501-
YARD::Logger.instance.level = :error
501+
YARD::Logger.instance.level = if YARD::Logger.const_defined?(:Severity)
502+
YARD::Logger::Severity::ERROR
503+
else
504+
# Backward compatility for YARD < 0.9.37
505+
YARD::Logger.instance.level = :error
506+
end
502507
YARD.parse(pp_path)
503508

504509
plan = YARD::Registry.at("puppet_plans::#{plan_name}")

0 commit comments

Comments
 (0)