Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDK-397) Log output of bundler commands at appropriate levels #243

Merged
merged 1 commit into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions lib/pdk/util/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def installed?
result = bundle_command(*argv).execute!

unless result[:exit_code].zero?
$stderr.puts result[:stdout]
$stderr.puts result[:stderr]
PDK.logger.debug(result.values_at(:stdout, :stderr).join("\n"))
end

result[:exit_code].zero?
Expand All @@ -97,8 +96,7 @@ def lock!
result = command.execute!

unless result[:exit_code].zero?
$stderr.puts result[:stdout]
$stderr.puts result[:stderr]
PDK.logger.fatal(result.values_at(:stdout, :stderr).join("\n"))
end

result[:exit_code].zero?
Expand All @@ -115,8 +113,7 @@ def install!
result = command.execute!

unless result[:exit_code].zero?
$stderr.puts result[:stdout]
$stderr.puts result[:stderr]
PDK.logger.fatal(result.values_at(:stdout, :stderr).join("\n"))
end

result[:exit_code].zero?
Expand All @@ -131,9 +128,7 @@ def binstubs!(gems)
result = command.execute!

unless result[:exit_code].zero?
PDK.logger.error(_('Failed to generate binstubs for %{gems}') % { gems: gems.join(' ') })
$stderr.puts result[:stdout]
$stderr.puts result[:stderr]
PDK.logger.fatal(_("Failed to generate binstubs for '%{gems}':\n%{output}") % { gems: gems.join(' '), output: result.values_at(:stdout, :stderr).join("\n") })
end

result[:exit_code].zero?
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/pdk/util/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def bundle_regex
end

it 'raises a fatal error' do
expect(logger).to receive(:error).with(a_string_matching(%r{failed to generate binstubs}i))
expect(logger).to receive(:fatal).with(a_string_matching(%r{failed to generate binstubs}i))

expect {
described_class.ensure_binstubs!(*gems)
Expand Down