Class: DPL::Provider::Atlas
Constant Summary
collapse
- GIMME_URL =
'https://raw.githubusercontent.com/meatballhat/gimme/master/gimme'
- ATLAS_UPLOAD_CLI_GO_REMOTE =
'github.com/hashicorp/atlas-upload-cli'
- ATLAS_UPLOAD_BOOL_ARGS =
%w(vcs debug).map(&:to_sym).freeze
- ATLAS_UPLOAD_KV_ARGS =
%w(address).map(&:to_sym).freeze
- ATLAS_UPLOAD_KV_MULTI_ARGS =
%w(exclude include metadata).map(&:to_sym).freeze
- ATLAS_UPLOAD_INSTALL_SCRIPT =
<<-EOF.gsub(/^ {8}/, '').strip
if ! command -v atlas-upload &>/dev/null ; then
mkdir -p $HOME/bin $HOME/gopath/src
export PATH="$HOME/bin:$PATH"
if ! command -v gimme &>/dev/null ; then
curl -sL -o $HOME/bin/gimme #{GIMME_URL}
chmod +x $HOME/bin/gimme
fi
if [ -z $GOPATH ]; then
export GOPATH="$HOME/gopath"
else
export GOPATH="$HOME/gopath:$GOPATH"
fi
eval "$(gimme 1.6)" &> /dev/null
go get #{ATLAS_UPLOAD_CLI_GO_REMOTE}
cp $HOME/gopath/bin/atlas-upload-cli $HOME/bin/atlas-upload
fi
EOF
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
apt_get, #check_app, #cleanup, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, deprecated, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn
Constructor Details
This class inherits a constructor from DPL::Provider
Instance Method Details
#check_auth ⇒ Object
39
40
41
42
|
# 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 ⇒ Object
33
34
35
36
37
|
# File 'lib/dpl/provider/atlas.rb', line 33
def deploy
assert_app_present!
install_atlas_upload
super
end
|
#needs_key? ⇒ Boolean
44
45
46
|
# File 'lib/dpl/provider/atlas.rb', line 44
def needs_key?
false
end
|
#push_app ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
|
# 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
|