Class: Kraaken::Cli::App

Inherits:
Base
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/kraaken/cli/app.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?

Instance Method Details

#credentialsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kraaken/cli/app.rb', line 11

def credentials
  old_content = new_content = app.environment.strip
  Tempfile.create(app.name) do |file|
    file.write old_content
    file.flush
    logger.info "Opening #{file.path}"
    run "code --wait #{file.path}"
    file.rewind
    new_content = file.read.strip
  end
  if new_content != old_content
    logger.info "Updating #{app.name} credentials"
    app.environment = new_content
  end
end

#deployObject



29
30
31
32
33
34
35
# File 'lib/kraaken/cli/app.rb', line 29

def deploy
  default_path = File.expand_path("config/deploy/docker-compose.yml", destination_root)
  file = File.new(options[:file]) if options[:file].present? && File.exist?(options[:file])
  file = File.new(default_path) if !file && File.exist?(default_path)
  logger.error "No docker-compose file found" and return unless file
  app.deploy(file)
end

#destroyObject



38
39
40
# File 'lib/kraaken/cli/app.rb', line 38

def destroy
  app.destroy
end

#logsObject



43
44
45
46
# File 'lib/kraaken/cli/app.rb', line 43

def logs
  app.logs
rescue IOError # prevent error when terminating the cli
end