Class: DPL::Provider::CloudFoundry

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

Direct Known Subclasses

Anynines, BluemixCloudFoundry

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, #deploy, deprecated, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#check_appObject



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

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



9
10
11
12
13
# File 'lib/dpl/provider/cloud_foundry.rb', line 9

def check_auth
  initial_go_tools_install
  context.shell "./cf api #{option(:api)} #{'--skip-ssl-validation' if options[:skip_ssl_validation]}"
  context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}"
end

#cleanupObject



32
33
# File 'lib/dpl/provider/cloud_foundry.rb', line 32

def cleanup
end

#initial_go_tools_installObject



5
6
7
# File 'lib/dpl/provider/cloud_foundry.rb', line 5

def initial_go_tools_install
  context.shell 'test x$TRAVIS_OS_NAME = "xlinux" && 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



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

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

#needs_key?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/dpl/provider/cloud_foundry.rb', line 21

def needs_key?
  false
end

#push_appObject



25
26
27
28
29
30
# File 'lib/dpl/provider/cloud_foundry.rb', line 25

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

ensure
  context.shell "./cf logout"
end

#uncleanupObject



35
36
# File 'lib/dpl/provider/cloud_foundry.rb', line 35

def uncleanup
end