class ExecutionContext
The context that commands get executed within. Used for defining and scoping helper methods.
Public Class Methods
new()
click to toggle source
# File lib/git-smart/execution_context.rb, line 4 def initialize require 'colorize' end
Public Instance Methods
big_message(msg)
click to toggle source
# File lib/git-smart/execution_context.rb, line 35 def big_message msg spacer_line = (" " + "-" * (msg.length + 20) + " ") [spacer_line, "|" + " " * 10 + msg + " " * 10 + "|", spacer_line].join("\n") end
failure(msg)
click to toggle source
# File lib/git-smart/execution_context.rb, line 30 def failure msg puts big_message(msg).red raise GitSmart::RunFailed end
note(msg)
click to toggle source
# File lib/git-smart/execution_context.rb, line 12 def note msg puts "* #{msg}" end
puts_with_done(msg, &blk)
click to toggle source
# File lib/git-smart/execution_context.rb, line 20 def puts_with_done msg, &blk print "#{msg}..." blk.call puts "done." end
start(msg)
click to toggle source
# File lib/git-smart/execution_context.rb, line 8 def start msg puts "- #{msg} -".green end
success(msg)
click to toggle source
# File lib/git-smart/execution_context.rb, line 26 def success msg puts big_message(msg).green end
warn(msg)
click to toggle source
# File lib/git-smart/execution_context.rb, line 16 def warn msg puts msg.red end