Sha256: 4abd1c11b18f352f6908c8b65980203986f1ce62c176147067dc6444e8a284da
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true class Kraaken::Cli::App < Kraaken::Cli::Base include Thor::Actions class_option :server, aliases: "-s", desc: "server to run the command on", default: "app-1" class_option :app, aliases: "-a", desc: "app to run the command on" class_option :destination, aliases: "-d", desc: "destination environment", default: "production" desc "credentials", "opens the credentials file" 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 desc "deploy", "deploys the app" option :file, aliases: "-f", desc: "docker-compose file to deploy" 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 desc "destroy", "destroys the app" def destroy app.destroy end desc "logs", "shows the logs of the app" def logs app.logs rescue IOError # prevent error when terminating the cli end private def app @app ||= Kraaken::App.new(server: options[:server], name: options[:app].presence || File.basename(destination_root), config:, destination: options[:destination]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kraaken-0.0.1 | lib/kraaken/cli/app.rb |