class DPL::Provider::Atlas

Constants

ATLAS_UPLOAD_BOOL_ARGS
ATLAS_UPLOAD_CLI_GO_REMOTE
ATLAS_UPLOAD_INSTALL_SCRIPT
ATLAS_UPLOAD_KV_ARGS
ATLAS_UPLOAD_KV_MULTI_ARGS
GIMME_URL

Public Class Methods

new(context, options) click to toggle source
Calls superclass method
# File lib/dpl/provider/atlas.rb, line 33
def self.new(context, options)
  super(context, options.merge!({needs_git_http_user_agent: false}))
end

Public Instance Methods

check_auth() click to toggle source
# File lib/dpl/provider/atlas.rb, line 43
def check_auth
  ENV['ATLAS_TOKEN'] = options[:token] if options[:token]
  error 'Missing ATLAS_TOKEN' unless ENV['ATLAS_TOKEN']
end
deploy() click to toggle source
Calls superclass method
# File lib/dpl/provider/atlas.rb, line 37
def deploy
  assert_app_present!
  install_atlas_upload
  super
end
needs_key?() click to toggle source
# File lib/dpl/provider/atlas.rb, line 48
def needs_key?
  false
end
push_app() click to toggle source
# File lib/dpl/provider/atlas.rb, line 52
def push_app
  unless options[:paths]
    here = Dir.pwd
    warn "No paths specified.  Using #{here.inspect}."
    options[:paths] = here
  end

  Array(options[:paths]).each do |path|
    context.shell "atlas-upload #{atlas_upload_args} #{atlas_app} #{path}"
  end
end

Private Instance Methods

assert_app_present!() click to toggle source
# File lib/dpl/provider/atlas.rb, line 70
def assert_app_present!
  error 'Missing Atlas app name' unless options.key?(:app)
end
atlas_app() click to toggle source
# File lib/dpl/provider/atlas.rb, line 98
def atlas_app
  @atlas_app ||= options.fetch(:app).to_s
end
atlas_upload_args() click to toggle source
# File lib/dpl/provider/atlas.rb, line 74
def atlas_upload_args
  return options[:args] if options.key?(:args)
  return @atlas_upload_args if @atlas_upload_args

  args = []

  ATLAS_UPLOAD_BOOL_ARGS.each do |arg|
    args << "-#{arg}" if options.key?(arg)
  end

  ATLAS_UPLOAD_KV_ARGS.each do |arg|
    args << ["-#{arg}", options[arg].inspect].join('=') if options.key?(arg)
  end

  ATLAS_UPLOAD_KV_MULTI_ARGS.each do |arg|
    next unless options.key?(arg)
    Array(options[arg]).each do |arg_entry|
      args << ["-#{arg}", arg_entry.inspect].join('=')
    end
  end

  @atlas_upload_args = args.join(' ')
end
install_atlas_upload() click to toggle source
# File lib/dpl/provider/atlas.rb, line 66
def install_atlas_upload
  context.shell ATLAS_UPLOAD_INSTALL_SCRIPT
end