Module: Bundler::Molinillo::UI
- Included in:
- Resolver
- Defined in:
- lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb
Overview
Conveys information about the resolution process to a user.
Instance Method Summary collapse
-
#after_resolution ⇒ void
Called after resolution ends (either successfully or with an error).
-
#before_resolution ⇒ void
Called before resolution begins.
-
#debug(depth = 0) ⇒ void
Conveys debug information to the user.
-
#debug? ⇒ Boolean
Whether or not debug messages should be printed.
-
#indicate_progress ⇒ void
Called roughly every #progress_rate, this method should convey progress to the user.
-
#output ⇒ IO
The IO object that should be used to print output.
-
#progress_rate ⇒ Float
How often progress should be conveyed to the user via #indicate_progress, in seconds.
Instance Method Details
#after_resolution ⇒ void
This method returns an undefined value.
Called after resolution ends (either successfully or with an error). By default, prints a newline.
38 39 40 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 38 def after_resolution output.puts end |
#before_resolution ⇒ void
This method returns an undefined value.
Called before resolution begins.
30 31 32 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 30 def before_resolution output.print 'Resolving dependencies...' end |
#debug(depth = 0) ⇒ void
This method returns an undefined value.
Conveys debug information to the user.
46 47 48 49 50 51 52 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 46 def debug(depth = 0) if debug? debug_info = yield debug_info = debug_info.inspect unless debug_info.is_a?(String) output.puts debug_info.split("\n").map { |s| ' ' * depth + s } end end |
#debug? ⇒ Boolean
Whether or not debug messages should be printed. By default, whether or not the ‘MOLINILLO_DEBUG` environment variable is set.
59 60 61 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 59 def debug? @debug_mode ||= ENV['MOLINILLO_DEBUG'] end |
#indicate_progress ⇒ void
This method returns an undefined value.
Called roughly every #progress_rate, this method should convey progress to the user.
15 16 17 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 15 def indicate_progress output.print '.' unless debug? end |
#output ⇒ IO
The IO object that should be used to print output. ‘STDOUT`, by default.
7 8 9 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 7 def output STDOUT end |
#progress_rate ⇒ Float
How often progress should be conveyed to the user via #indicate_progress, in seconds. A third of a second, by default.
23 24 25 |
# File 'lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb', line 23 def progress_rate 0.33 end |