module Acclimate::Output
Public Class Methods
included( base )
click to toggle source
# File lib/acclimate/output.rb, line 6 def self.included( base ) base.send( :include, Thor::Shell ) end
Public Instance Methods
confirm( msg, color=:white, &block )
click to toggle source
# File lib/acclimate/output.rb, line 38 def confirm( msg, color=:white, &block ) write "#{msg}... ", color block.call say_ok rescue Acclimate::ConfirmationError => e say_error say_stderr( e.message, :red ) e.finish raise Acclimate::Error.new( nil, handled: true, exit_code: e.exit_code ) rescue say_error raise end
header( msg )
click to toggle source
# File lib/acclimate/output.rb, line 22 def header( msg ) say msg, :cyan end
say( msg, color=:white )
click to toggle source
# File lib/acclimate/output.rb, line 14 def say( msg, color=:white ) $stdout.puts( Rainbow( msg ).color( color )) end
say_error()
click to toggle source
# File lib/acclimate/output.rb, line 30 def say_error say_stderr 'ERROR', :red end
say_ok()
click to toggle source
# File lib/acclimate/output.rb, line 26 def say_ok say 'OK', :green end
say_skipping()
click to toggle source
# File lib/acclimate/output.rb, line 34 def say_skipping say 'SKIPPING', :yellow end
say_stderr( msg, color=:white )
click to toggle source
# File lib/acclimate/output.rb, line 18 def say_stderr( msg, color=:white ) $stdout.puts( Rainbow( msg ).color( color )) end
write( msg, color=:white )
click to toggle source
# File lib/acclimate/output.rb, line 10 def write( msg, color=:white ) $stdout.write( Rainbow( msg ).color( color )) end