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, website

Instance Method Details

#appsObject



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

def apps
  Apps.new(options).list_all
end

#cancel(service = :current) ⇒ Object



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

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

#completion(*params) ⇒ Object



192
193
194
# File 'lib/ufo/cli.rb', line 192

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

#completion_scriptObject



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

def completion_script
  Completer::Script.generate
end

#currentObject



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

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



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

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

#ps(service = :current) ⇒ Object



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

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

#releases(service = :current) ⇒ Object



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

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

#resources(service = :current) ⇒ Object



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

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

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



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

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



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

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



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

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



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

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

#stop(service = :current) ⇒ Object



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

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

#task(task_definition) ⇒ Object



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

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



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

def version
  puts VERSION
end