ruby/lib/bundler/ui/silent.rb
Matt Brictson 830ff66e2c [rubygems/rubygems] Emit progress to stderr when --parseable is passed to bundle outdated
Before, `bundle outdated --parseable` (or `--porcelain`) caused output
to be completely silenced during definition resolution, so nothing was
printed at all until the table of outdated gems was printed.

With this change, `--parseable`/`--porcelain` now prints progress to
stderr during resolution. E.g.:

```
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
```

This provides a better user experience, especially when
`outdated --parseable` takes several seconds or more.

The report of outdated gems is still printed to stdout, and the exit
status codes are unchanged, so the fundamental contract with other tools
consuming the `outdated --parseable` result should not be affected.

7d4bb43570
2024-08-30 10:36:08 +00:00

96 lines
1.3 KiB
Ruby

# frozen_string_literal: true
module Bundler
module UI
class Silent
attr_writer :shell
def initialize
@warnings = []
end
def add_color(string, color)
string
end
def info(message = nil, newline = nil)
end
def confirm(message = nil, newline = nil)
end
def warn(message = nil, newline = nil)
@warnings |= [message]
end
def error(message = nil, newline = nil)
end
def debug(message = nil, newline = nil)
end
def confirm?
false
end
def error?
false
end
def debug?
false
end
def info?
false
end
def quiet?
false
end
def warn?
false
end
def output_stream=(_symbol)
end
def output_stream
nil
end
def ask(message)
end
def yes?(msg)
raise "Cannot ask yes? with a silent shell"
end
def no?(msg)
raise "Cannot ask no? with a silent shell"
end
def level=(name)
end
def level(name = nil)
end
def trace(message, newline = nil, force = false)
end
def silence
yield
end
def progress
yield
end
def unprinted_warnings
@warnings
end
end
end
end