Module: RGitFlow::Printing
- Included in:
- CLI, Install, Tasks::Task
- Defined in:
- lib/rgitflow/printing.rb
Overview
Contains logic for printing messages to the console. Supports ANSI colors. Inspired by rubygems-tasks' printing.rb
Constant Summary collapse
- STATUS_PREFIX =
String to prepend to any status messages
if $stdout.tty? "#{ANSI::Constants::GREEN}#{ANSI::Constants::BRIGHT}>>>#{ANSI::Constants::CLEAR}" else '>>>' end
- DEBUG_PREFIX =
String to prepend to any debug messages
if $stderr.tty? "#{ANSI::Constants::YELLOW}#{ANSI::Constants::BRIGHT}>>>#{ANSI::Constants::CLEAR}" else '>>>' end
- ERROR_PREFIX =
String to prepend to any error messages
if $stderr.tty? "#{ANSI::Constants::RED}#{ANSI::Constants::BRIGHT}>>>#{ANSI::Constants::CLEAR}" else '>>>' end
- INPUT_PREFIX =
if $stderr.tty? "#{ANSI::Constants::BLUE}#{ANSI::Constants::BRIGHT}<<<#{ANSI::Constants::CLEAR}" else '<<<' end
Instance Method Summary collapse
-
#debug(message = '') ⇒ void
protected
Prints a debug message to the console.
-
#error(message = '') ⇒ void
protected
Prints an error message to the console.
-
#prompt(message = '') ⇒ void
protected
Prints a prompt message to the console.
-
#status(message = '') ⇒ void
protected
Prints a status message to the console.
Instance Method Details
#debug(message = '') ⇒ void (protected)
This method returns an undefined value.
Prints a debug message to the console
52 53 54 55 56 57 |
# File 'lib/rgitflow/printing.rb', line 52 def debug( = '') if Rake.verbose STDERR.puts "#{DEBUG_PREFIX} #{}" end nil end |
#error(message = '') ⇒ void (protected)
This method returns an undefined value.
Prints an error message to the console
62 63 64 65 |
# File 'lib/rgitflow/printing.rb', line 62 def error( = '') STDERR.puts "#{ERROR_PREFIX} #{}" nil end |
#prompt(message = '') ⇒ void (protected)
This method returns an undefined value.
Prints a prompt message to the console
70 71 72 73 74 |
# File 'lib/rgitflow/printing.rb', line 70 def prompt( = '') status STDOUT.print "#{INPUT_PREFIX} " nil end |
#status(message = '') ⇒ void (protected)
This method returns an undefined value.
Prints a status message to the console
42 43 44 45 46 47 |
# File 'lib/rgitflow/printing.rb', line 42 def status( = '') if Rake.verbose STDOUT.puts "#{STATUS_PREFIX} #{}" end nil end |