Class: Homebrew::Livecheck::Progress Private
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Displays and clears progress without writing to the JSON output stream.
Instance Method Summary collapse
- #finish ⇒ void private
- #increment ⇒ void private
- #initialize(total:, enabled:) ⇒ void constructor private
Constructor Details
#initialize(total:, enabled:) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'livecheck/progress.rb', line 9 def initialize(total:, enabled:) return unless enabled Tty.with($stderr) do |stderr| stderr.puts Formatter.headline("Running checks", color: :blue) end require "ruby-progressbar" @bar = T.let(ProgressBar.create( total:, progress_mark: "#", remainder_mark: ".", format: " %t: [%B] %c/%C ", output: $stderr, ), T.nilable(ProgressBar::Base)) end |
Instance Method Details
#finish ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
32 33 34 35 36 37 38 39 40 41 |
# File 'livecheck/progress.rb', line 32 def finish = @bar return unless .finish Tty.with($stderr) do |stderr| erase = "#{Tty.up}#{Tty.erase_line}" * 2 stderr.print "#{Tty.begin_synchronized_update}#{erase}#{Tty.end_synchronized_update}" unless erase.empty? end end |
#increment ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
27 28 29 |
# File 'livecheck/progress.rb', line 27 def increment @bar&.increment end |