Skip to content

Commit

Permalink
Fix Rake.verbose to return true/false even if unset
Browse files Browse the repository at this point in the history
Unset returns FileUtilsExt.verbose_flag which is set to Object.new by
default, which is truthy. Compare against DEFAULT and return
verbose_flag only if set.
  • Loading branch information
zenspider committed May 11, 2024
1 parent 1ad1a11 commit b329f98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rake/file_utils_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def verbose(value=nil)
FileUtilsExt.verbose_flag = oldvalue
end
end
FileUtilsExt.verbose_flag
FileUtilsExt.verbose_flag != DEFAULT && FileUtilsExt.verbose_flag
end

# Get/set the nowrite flag controlling output from the FileUtils
Expand Down
2 changes: 2 additions & 0 deletions test/test_rake_file_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def test_safe_ln_fails_on_script_error
end

def test_verbose
RakeFileUtils.verbose_flag = Rake::FileUtilsExt::DEFAULT
assert_equal false, verbose
verbose true
assert_equal true, verbose
verbose false
Expand Down

0 comments on commit b329f98

Please sign in to comment.