Skip to content

Commit 0667e34

Browse files
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.
1 parent 2731832 commit 0667e34

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/rubygems/package_task.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def init(gem)
8888
super gem.full_name, :noversion
8989
@gem_spec = gem
9090
@package_files += gem_spec.files if gem_spec.files
91+
@fileutils_output = $stdout
9192
end
9293

9394
##

test/rubygems/test_gem_package_task.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@ def test_gem_package
4848
end
4949
end
5050

51+
def test_gem_package_prints_to_stdout_by_default
52+
gem = Gem::Specification.new do |g|
53+
g.name = "pkgr"
54+
g.version = "1.2.3"
55+
56+
g.authors = %w[author]
57+
g.files = %w[x]
58+
g.summary = 'summary'
59+
end
60+
61+
pkg = Gem::PackageTask.new(gem) do |p|
62+
p.package_files << "y"
63+
end
64+
65+
assert_equal %w[x y], pkg.package_files
66+
67+
Dir.chdir @tempdir do
68+
FileUtils.touch 'x'
69+
FileUtils.touch 'y'
70+
71+
_, err = capture_io do
72+
Rake.application['package'].invoke
73+
end
74+
75+
assert_empty err
76+
end
77+
end
78+
5179
def test_gem_package_with_current_platform
5280
RakeFileUtils.verbose_flag = false
5381

0 commit comments

Comments
 (0)