From 3660d14de60ac4a2b420601db5b16c104a0c7858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 16 May 2020 14:45:08 +0200 Subject: [PATCH] [rubygems/rubygems] Make `rake package` log messages to stdout by default The logging to $stderr is only happening due to a bug in `FileUtils`. Logging messages are not errors. https://github.com/rubygems/rubygems/commit/4d1b6659e6 --- lib/rubygems/package_task.rb | 1 + test/rubygems/test_gem_package_task.rb | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/rubygems/package_task.rb b/lib/rubygems/package_task.rb index a11d09fb21..b355c2b5dd 100644 --- a/lib/rubygems/package_task.rb +++ b/lib/rubygems/package_task.rb @@ -88,6 +88,7 @@ class Gem::PackageTask < Rake::PackageTask super gem.full_name, :noversion @gem_spec = gem @package_files += gem_spec.files if gem_spec.files + @fileutils_output = $stdout end ## diff --git a/test/rubygems/test_gem_package_task.rb b/test/rubygems/test_gem_package_task.rb index 56d574d9a3..9d87db88ae 100644 --- a/test/rubygems/test_gem_package_task.rb +++ b/test/rubygems/test_gem_package_task.rb @@ -47,6 +47,34 @@ class TestGemPackageTask < Gem::TestCase end end + def test_gem_package_prints_to_stdout_by_default + gem = Gem::Specification.new do |g| + g.name = "pkgr" + g.version = "1.2.3" + + g.authors = %w[author] + g.files = %w[x] + g.summary = 'summary' + end + + pkg = Gem::PackageTask.new(gem) do |p| + p.package_files << "y" + end + + assert_equal %w[x y], pkg.package_files + + Dir.chdir @tempdir do + FileUtils.touch 'x' + FileUtils.touch 'y' + + _, err = capture_io do + Rake.application['package'].invoke + end + + assert_empty err + end + end + def test_gem_package_with_current_platform RakeFileUtils.verbose_flag = false