class Object

Public Instance Methods

disable_highlight() click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 44
def disable_highlight
  CE.reset(:pickup)
end
enable_highlight(strings) click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 38
def enable_highlight(strings)
  strings.each do |string|
    CE.pickup(string, :h_red, nil, :bold)
  end
end
exception_handling() { || ... } click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 4
def exception_handling
  begin
    yield
  rescue SSHKit::Command::Failed => e
    error e
    e.inspect.each_line do |line|
      return line.chomp! if line =~ /stderr/
    end
  end
end
raise_error_with_usage(msg) click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 23
def raise_error_with_usage(msg)
  STDERR.puts(msg)
  usage
  exit 1
end
try_to_capture(cmd) click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 19
def try_to_capture(cmd)
  exception_handling { capture cmd }
end
try_to_execute(cmd) click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 15
def try_to_execute(cmd)
  exception_handling { execute cmd }
end
usage() click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 29
def usage
  puts '(e.g. bundle exec cap staging operator:apply operation=sample)'
end
warn_highlight() { || ... } click to toggle source
# File lib/capistrano/tasks/rake_helpers.rb, line 33
def warn_highlight
  CE.once.ch_fg(:red)
  yield
end