class Ebfly::App

Public Instance Methods

create(name) click to toggle source
# File lib/ebfly/command/app.rb, line 7
def create(name)
  puts "Create app: #{name} ..."
  opts = { application_name: name }
  opts.merge!(description: options[:d]) if options[:d]

  debug(opts)
  ret = run { eb.create_application(opts) }
  debug(ret)
  show_app_info(ret[:application])
end
delete(name) click to toggle source
# File lib/ebfly/command/app.rb, line 20
def delete(name)
  puts "Delete app: #{name} ..."
  opts = {
    application_name: name,
    terminate_env_by_force: options[:f]
  } 
  debug(opts)
  run { eb.delete_application(opts) }
  puts "Done"
end
info(name) click to toggle source
# File lib/ebfly/command/app.rb, line 32
def info(name)
  begin
    inf = app_info(name)
    debug inf
    show_app_info(inf)
  rescue => err
    style_err err
    exit 1
  end
end
list() click to toggle source
# File lib/ebfly/command/app.rb, line 44
def list
  ret = run { eb.describe_applications }
  puts ret[:applications].map { |app| app[:application_name] }
rescue => err
  style_err err
  exit 1
end
versions(name) click to toggle source
# File lib/ebfly/command/app.rb, line 53
def versions(name)
  opts = {
    application_name: name
  } 
  ret = run { eb.describe_application_versions(opts) }
  debug(ret)
  show_app_versions(ret[:application_versions])
end

Private Instance Methods

app_info(app) click to toggle source
# File lib/ebfly/command/app.rb, line 64
def app_info(app)
  opts = {
    application_names: [ app ]
  }
  ret = run { eb.describe_applications(opts) }
  raise "application named #{app} not found" unless ret[:applications][0]
  ret[:applications][0]
end
show_app_info(app) click to toggle source
# File lib/ebfly/command/app.rb, line 73
def show_app_info(app)
  puts ""
  puts "=== application info ==="
  puts "application name:\t#{app[:application_name]}"
  puts "description:\t\t#{app[:description]}"
  puts "created at:\t\t#{app[:date_created]}"
  puts "updated at:\t\tapplication name: #{app[:date_updated]}"
  puts "configuration_templates:"
  app[:configuration_templates].each do |t|
    puts "  #{t}"
  end
end
show_app_versions(versions) click to toggle source
# File lib/ebfly/command/app.rb, line 86
def show_app_versions(versions)
  len = versions.length
  puts ""
  puts "=== application versions ==="
  versions.each_with_index do |v, i|
    puts "#{len-i}. #{v[:version_label]}\t#{v[:date_updated]}"
  end
end