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



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

def apps
  Apps.new(options).list
end

#cancel(service = :current) ⇒ Object



115
116
117
118
# File 'lib/ufo/cli.rb', line 115

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

#completion(*params) ⇒ Object



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

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

#completion_scriptObject



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

def completion_script
  Completer::Script.generate
end

#currentObject



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

def current
  Current.new(options).run
end

#deploy(service = :current) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/ufo/cli.rb', line 50

def deploy(service=:current)
  service = service == :current ? Current.service! : service
  task_definition = options[:task] || service # convention
  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



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

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

#ps(service = :current) ⇒ Object



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

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

#releases(service = :current) ⇒ Object



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

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

#resources(service = :current) ⇒ Object



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

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

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



75
76
77
78
79
# File 'lib/ufo/cli.rb', line 75

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



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

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

#ship(service = :current) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ufo/cli.rb', line 61

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



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

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



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

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

#stop(service = :current) ⇒ Object



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

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

#task(task_definition) ⇒ Object



106
107
108
109
110
# File 'lib/ufo/cli.rb', line 106

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



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

def version
  puts VERSION
end