Class: Ufo::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ufo/cli.rb,
lib/ufo/cli/help.rb

Defined Under Namespace

Classes: Help

Instance Method Summary collapse

Instance Method Details

#destroy(service) ⇒ Object



126
127
128
129
# File 'lib/ufo/cli.rb', line 126

def destroy(service)
  task_definition = options[:task] || service # convention
  Destroy.new(service, options).bye
end

#initObject



82
83
84
# File 'lib/ufo/cli.rb', line 82

def init
  Init.new(options).setup
end

#scale(service, count) ⇒ Object



133
134
135
# File 'lib/ufo/cli.rb', line 133

def scale(service, count)
  Scale.new(service, count, options).update
end

#ship(service) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/ufo/cli.rb', line 97

def ship(service)
  builder = DockerBuilder.new(options) # outside if because it need docker.full_image_name
  if options[:docker]
    builder.build
    builder.push
  end

  # task definition and deploy logic are coupled in the Ship class.
  # Example: We need to know if the task defintion is a web service to see if we need to
  # add the elb target group.  The web service information is in the TasksBuilder
  # and the elb target group gets set in the Ship class.
  # So we always call these together.
  TasksBuilder.new(options).build
  TasksRegister.register(service, options)
  task_definition = options[:task] || service # convention
  ship = Ship.new(service, task_definition, options)

  return if ENV['TEST'] # to allow me to quickly test most of the ship CLI portion only
  ship.deploy
  if options[:docker]
    DockerCleaner.new(builder.image_name, options).cleanup
    EcrCleaner.new(builder.image_name, options).cleanup
  end
  puts "Docker image shipped: #{builder.full_image_name.green}"
end