Class: DPL::Provider::Anynines

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/anynines.rb

Instance Method Summary collapse

Instance Method Details

#app_nameObject



44
45
46
# File 'lib/dpl/provider/anynines.rb', line 44

def app_name
  options[:app_name].nil? ? "" : " '#{options[:app_name]}'"
end

#check_appObject



21
22
23
24
25
# File 'lib/dpl/provider/anynines.rb', line 21

def check_app
  if options[:manifest]
    error 'Application must have a manifest.yml for unattended deployment' unless File.exists? options[:manifest]
  end
end

#check_authObject



15
16
17
18
19
# File 'lib/dpl/provider/anynines.rb', line 15

def check_auth
  initial_go_tools_install
  context.shell "./cf api https://api.aws.ie.a9s.eu"
  context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}"
end

#cleanupObject



38
39
# File 'lib/dpl/provider/anynines.rb', line 38

def cleanup
end

#initial_go_tools_installObject

NOTE: Much of this class is duplicated from CloudFoundry. This is by design. By duplicating a manageable amount of code here, we prevent this provider and its gem ‘dpl-anynines` from having a dependency on `dpl-cloudfoundry`. Having less dependency is desirable when we install this gem from source.



11
12
13
# File 'lib/dpl/provider/anynines.rb', line 11

def initial_go_tools_install
  context.shell 'test $(uname) = "Linux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
end

#manifestObject



48
49
50
# File 'lib/dpl/provider/anynines.rb', line 48

def manifest
  options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
end

#needs_key?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/dpl/provider/anynines.rb', line 27

def needs_key?
  false
end

#push_appObject



31
32
33
34
35
36
# File 'lib/dpl/provider/anynines.rb', line 31

def push_app
  error 'Failed to push app' unless context.shell("./cf push#{app_name}#{manifest}")

ensure
  context.shell "./cf logout"
end

#uncleanupObject



41
42
# File 'lib/dpl/provider/anynines.rb', line 41

def uncleanup
end