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 Instance Methods

check_auth() click to toggle source
# File lib/dpl/provider/atlas.rb, line 39
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 DPL::Provider#deploy
# File lib/dpl/provider/atlas.rb, line 33
def deploy
  assert_app_present!
  install_atlas_upload
  super
end
needs_key?() click to toggle source
# File lib/dpl/provider/atlas.rb, line 44
def needs_key?
  false
end
push_app() click to toggle source
# File lib/dpl/provider/atlas.rb, line 48
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 68
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 96
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 72
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 62
def install_atlas_upload
  without_git_http_user_agent do
    context.shell ATLAS_UPLOAD_INSTALL_SCRIPT
  end
end
without_git_http_user_agent() { || ... } click to toggle source
# File lib/dpl/provider/atlas.rb, line 100
def without_git_http_user_agent(&block)
  git_http_user_agent = ENV.delete("GIT_HTTP_USER_AGENT")
  yield
  ENV["GIT_HTTP_USER_AGENT"] = git_http_user_agent
end