7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/aptible/cli/subcommands/logs.rb', line 7
def self.included(thor)
thor.class_eval do
include Helpers::Operation
include Helpers::App
include Helpers::Database
desc 'logs', 'Follows logs from a running app or database'
app_options
option :database
def logs
if options[:app] && options[:database]
m = 'You must specify only one of --app and --database'
raise Thor::Error, m
end
resource = \
if options[:database]
ensure_database(options.merge(db: options[:database]))
else
ensure_app(options)
end
unless resource.status == 'provisioned'
raise Thor::Error, 'Unable to retrieve logs. ' \
"Have you deployed #{resource.handle} yet?"
end
op = resource.create_operation!(type: 'logs', status: 'succeeded')
ENV['ACCESS_TOKEN'] = fetch_token
connect_to_ssh_portal(op, '-o', 'SendEnv=ACCESS_TOKEN', '-T')
end
end
end
|