Class: Ufo::CLI

Inherits:
Command show all
Defined in:
lib/ufo/cli.rb

Instance Method Summary collapse

Methods inherited from Command

alter_command_description, command_help, dispatch, exit_on_failure?, website

Instance Method Details

#appsObject



148
149
150
# File 'lib/ufo/cli.rb', line 148

def apps
  Apps.new(options).list_all
end

#cancel(service = :current) ⇒ Object



121
122
123
124
# File 'lib/ufo/cli.rb', line 121

def cancel(service=:current)
  task_definition = options[:task] || service # convention
  Cancel.new(service, options).run
end

#completion(*params) ⇒ Object



203
204
205
# File 'lib/ufo/cli.rb', line 203

def completion(*params)
  Completer.new(CLI, *params).run
end

#completion_scriptObject



209
210
211
# File 'lib/ufo/cli.rb', line 209

def completion_script
  Completer::Script.generate
end

#currentObject



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

def current
  Current.new(options).run
end

#deploy(service = :current) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/ufo/cli.rb', line 52

def deploy(service=:current)
  service = service == :current ? Current.service! : service
  task_definition = options[:task] || service # convention
  Tasks::Builder.build(options) if options[:build]
  Tasks::Register.register(task_definition, options) if options[:register]
  ship = Ship.new(service, options.merge(task_definition: task_definition))
  ship.deploy
end

#destroy(service = :current) ⇒ Object



140
141
142
143
# File 'lib/ufo/cli.rb', line 140

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

#logs(service = :current) ⇒ Object



197
198
199
# File 'lib/ufo/cli.rb', line 197

def logs(service=:current)
  Logs.new(service, options).run
end

#ps(service = :current) ⇒ Object



169
170
171
# File 'lib/ufo/cli.rb', line 169

def ps(service=:current)
  Ps.new(service, options).run
end

#releases(service = :current) ⇒ Object



175
176
177
# File 'lib/ufo/cli.rb', line 175

def releases(service=:current)
  Releases.new(service, options).list
end

#resources(service = :current) ⇒ Object



154
155
156
# File 'lib/ufo/cli.rb', line 154

def resources(service=:current)
  Info.new(service, options).run
end

#rollback(service = :current, version) ⇒ Object



79
80
81
82
83
# File 'lib/ufo/cli.rb', line 79

def rollback(service=:current, version)
  service = service == :current ? Current.service! : service
  rollback = Rollback.new(service, options.merge(version: version))
  rollback.deploy
end

#scale(service = :current, count) ⇒ Object



160
161
162
# File 'lib/ufo/cli.rb', line 160

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

#ship(service = :current) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ufo/cli.rb', line 64

def ship(service=:current)
  service = service == :current ? Current.service! : service
  builder = build_docker

  task_definition = options[:task] || service # convention
  Tasks::Builder.ship(task_definition, options)
  ship = Ship.new(service, options.merge(task_definition: task_definition))
  ship.deploy

  cleanup(builder.image_name)
end

#ships(*services) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/ufo/cli.rb', line 89

def ships(*services)
  builder = build_docker

  if services.empty? && !Current.services&.empty?
    services = Current.services
  end
  services.each_with_index do |service|
    service_name, task_definition_name = service.split(':')
    task_definition = task_definition_name || service_name # convention
    Tasks::Builder.ship(task_definition, options)
    ship = Ship.new(service, options.merge(task_definition: task_definition))
    ship.deploy
  end

  cleanup(builder.image_name)
end

#status(service = :current) ⇒ Object



187
188
189
# File 'lib/ufo/cli.rb', line 187

def status(service=:current)
  Status.new(service, options).run
end

#stop(service = :current) ⇒ Object



181
182
183
# File 'lib/ufo/cli.rb', line 181

def stop(service=:current)
  Stop.new(service, options).run
end

#task(task_definition) ⇒ Object



112
113
114
115
116
# File 'lib/ufo/cli.rb', line 112

def task(task_definition)
  Docker::Builder.build(options) unless @options[:task_only]
  Tasks::Builder.ship(task_definition, options) unless @options[:task_only]
  Task.new(task_definition, options).run
end

#versionObject



214
215
216
# File 'lib/ufo/cli.rb', line 214

def version
  puts VERSION
end