Module: Orats::Commands::UI

Includes:
Thor::Shell
Included in:
Common
Defined in:
lib/orats/commands/ui.rb

Instance Method Summary collapse

Instance Method Details

#git_commit(message) ⇒ Object



42
43
44
# File 'lib/orats/commands/ui.rb', line 42

def git_commit(message)
  run_from @active_path, "git add -A && git commit -m '#{message}'"
end

#log_error(top_label, top_message, bottom_label, bottom_message, strip_newline = false) ⇒ Object



27
28
29
30
31
# File 'lib/orats/commands/ui.rb', line 27

def log_error(top_label, top_message, bottom_label, bottom_message, strip_newline = false)
  log_status_top top_label, "#{top_message}:", :red
  log_status_bottom bottom_label, bottom_message, :yellow, strip_newline
  yield if block_given?
end

#log_remote_info(top_label, top_message, bottom_label, bottom_message) ⇒ Object



33
34
35
36
# File 'lib/orats/commands/ui.rb', line 33

def log_remote_info(top_label, top_message, bottom_label, bottom_message)
  log_status_top top_label, "#{top_message}:", :blue
  log_status_bottom bottom_label, bottom_message, :cyan
end

#log_results(results, message) ⇒ Object



22
23
24
25
# File 'lib/orats/commands/ui.rb', line 22

def log_results(results, message)
  log_status_top 'results', "#{results}:", :magenta
  log_status_bottom 'message', message, :white
end

#log_status_bottom(type, message, color, strip_newline = false) ⇒ Object



17
18
19
20
# File 'lib/orats/commands/ui.rb', line 17

def log_status_bottom(type, message, color, strip_newline = false)
  say_status type, message, color
  puts unless strip_newline
end

#log_status_top(type, message, color) ⇒ Object



12
13
14
15
# File 'lib/orats/commands/ui.rb', line 12

def log_status_top(type, message, color)
  puts
  say_status type, set_color(message, :bold), color
end

#log_task(message) ⇒ Object



6
7
8
9
10
# File 'lib/orats/commands/ui.rb', line 6

def log_task(message)
  puts
  say_status 'task', "#{message}:", :yellow
  puts '-'*80, ''; sleep 0.25
end

#run_from(path, command) ⇒ Object



38
39
40
# File 'lib/orats/commands/ui.rb', line 38

def run_from(path, command)
  run "cd #{path} && #{command} && cd -"
end