Module: Output

Included in:
Ec2InstanceManager
Defined in:
lib/ec2-instance-manager/output.rb

Instance Method Summary collapse

Instance Method Details

#cancel_message(instances) ⇒ Object



14
15
16
17
# File 'lib/ec2-instance-manager/output.rb', line 14

def cancel_message(instances)
  puts red("Warning: Terminating all instances: #{instances.join(", ")}")
  puts red("Please press CTRL-C to cancel within the next 5 seconds if this isn't what you want...")
end

#green(str) ⇒ Object



19
20
21
# File 'lib/ec2-instance-manager/output.rb', line 19

def green(str)
  "\033[32m#{str}\033[0m" 
end

#output_running_state(running_state) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/ec2-instance-manager/output.rb', line 2

def output_running_state(running_state)
  if running_state == 'running'
    green(running_state)
  elsif running_state == 'terminated' or running_state == 'shutting-down'
    red(running_state)
  elsif running_state == 'pending'
    yellow(running_state)
  else
    running_state
  end
end

#red(str) ⇒ Object



23
24
25
# File 'lib/ec2-instance-manager/output.rb', line 23

def red(str)
  "\033[31m#{str}\033[0m"
end

#white(str) ⇒ Object



31
32
33
# File 'lib/ec2-instance-manager/output.rb', line 31

def white(str)
  "\033[1m#{str}\033[0m"
end

#yellow(str) ⇒ Object



27
28
29
# File 'lib/ec2-instance-manager/output.rb', line 27

def yellow(str)
  "\033[33m#{str}\033[0m"
end