class Jack::Create

Public Class Methods

new(options={}) click to toggle source
# File lib/jack/create.rb, line 7
def initialize(options={})
  @options = options
  @root = options[:root] || '.'
  @env_name = options[:env_name]
  @app_name = options[:app] || app_name_convention(@env_name)
end

Public Instance Methods

app_exist?() click to toggle source
# File lib/jack/create.rb, line 26
def app_exist?
  return true if @options[:noop]
  r = eb.describe_applications
  r.applications.collect(&:application_name).include?(@app_name)
end
build_command() click to toggle source
# File lib/jack/create.rb, line 37
def build_command
  @cfg = upload_cfg
  flags = settings.create_flags
  "#{eb_bin} create#{eb_base_flags} --sample --nohang #{flags} #{@cfg}#{cname}#{@env_name}"
end
cname() click to toggle source
# File lib/jack/create.rb, line 51
def cname
  "--cname #{@env_name} "
end
create_app() click to toggle source
# File lib/jack/create.rb, line 20
def create_app
  eb.create_application(
    application_name: @app_name
  ) unless app_exist?
end
create_env() click to toggle source
# File lib/jack/create.rb, line 32
def create_env
  command = build_command
  sh(command, @options)
end
run() click to toggle source
# File lib/jack/create.rb, line 14
def run
  prerequisites
  create_app
  create_env
end
upload_cfg() click to toggle source
# File lib/jack/create.rb, line 43
def upload_cfg
  @upload = Config::Apply.new(@options)
  if @upload.local_cfg_exist?
    @upload.upload
    cfg = "--cfg #{@upload.upload_name} "
  end
end