class Papa::Command::Base
Attributes
command[RW]
exit_status[RW]
silent[RW]
stderr[RW]
stdout[RW]
Public Class Methods
new(command, options = {})
click to toggle source
# File lib/papa/command/base.rb, line 9 def initialize(command, options = {}) @command = command @silent = options.has_key?(:silent) ? options[:silent] : false end
Public Instance Methods
cleanup()
click to toggle source
# File lib/papa/command/base.rb, line 29 def cleanup # Override me end
failed?()
click to toggle source
# File lib/papa/command/base.rb, line 37 def failed? exit_status != 0 end
failure_message()
click to toggle source
# File lib/papa/command/base.rb, line 22 def failure_message message = "Error while running #{command.bold}" Helper::Output.error message Helper::Output.error stderr message end
run()
click to toggle source
# File lib/papa/command/base.rb, line 14 def run return if command.nil? Helper::Output.stdout "Running #{command.bold}..." unless silent @stdout, @stderr, status = Open3.capture3(command) @exit_status = status.exitstatus self end
success?()
click to toggle source
# File lib/papa/command/base.rb, line 33 def success? !failed? end
Private Instance Methods
current_branch()
click to toggle source
# File lib/papa/command/base.rb, line 43 def current_branch @current_branch ||= `git symbolic-ref --short HEAD`.chomp end