Class: Ufo::Base

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
Stack::Helper
Defined in:
lib/ufo/base.rb

Direct Known Subclasses

Cancel, Destroy, Info, Ps, Releases, Rollback, Scale, Ship, Status, Stop, Task

Instance Method Summary collapse

Methods included from Stack::Helper

#adjust_stack_name, #find_stack, #status

Methods included from Util

#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params

Methods included from AwsService

#cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb

Constructor Details

#initialize(service, options = {}) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
13
# File 'lib/ufo/base.rb', line 6

def initialize(service, options={})
  @service = switch_current(service)
  @options = options

  @pretty_service_name = Ufo.pretty_service_name(@service)
  @cluster = @options[:cluster] || default_cluster
  @stack_name = adjust_stack_name(@cluster, @service)
end

Instance Method Details

#infoObject



19
20
21
# File 'lib/ufo/base.rb', line 19

def info
  Info.new(@service, @options)
end

#no_service_messageObject



24
25
26
27
28
29
30
# File 'lib/ufo/base.rb', line 24

def no_service_message
  "No \#{@pretty_service_name.color(:green)} found.\nNo CloudFormation stack named \#{@stack_name} found.\nAre sure it exists?\n  EOL\nend\n"

#switch_current(service) ⇒ Object



15
16
17
# File 'lib/ufo/base.rb', line 15

def switch_current(service)
  Current.service!(service)
end