Class: DPL::Provider::Atlas
- Inherits:
-
DPL::Provider
- Object
- DPL::Provider
- DPL::Provider::Atlas
- Defined in:
- lib/dpl/provider/atlas.rb
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
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new(context, options) ⇒ Object
33 34 35 |
# File 'lib/dpl/provider/atlas.rb', line 33 def self.new(context, ) super(context, .merge!({needs_git_http_user_agent: false})) end |
Instance Method Details
#check_auth ⇒ Object
43 44 45 46 |
# File 'lib/dpl/provider/atlas.rb', line 43 def check_auth ENV['ATLAS_TOKEN'] = [:token] if [:token] error 'Missing ATLAS_TOKEN' unless ENV['ATLAS_TOKEN'] end |
#deploy ⇒ Object
37 38 39 40 41 |
# File 'lib/dpl/provider/atlas.rb', line 37 def deploy assert_app_present! install_atlas_upload super end |
#needs_key? ⇒ Boolean
48 49 50 |
# File 'lib/dpl/provider/atlas.rb', line 48 def needs_key? false end |
#push_app ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/dpl/provider/atlas.rb', line 52 def push_app unless [:paths] here = Dir.pwd warn "No paths specified. Using #{here.inspect}." [:paths] = here end Array([:paths]).each do |path| context.shell "atlas-upload #{atlas_upload_args} #{atlas_app} #{path}" end end |