Class: DPL::Provider::Openshift

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

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

#cleanup, context, #create_key, #deploy, #error, experimental, #initialize, #log, #needs_key?, new, npm_g, #option, pip, requires, #run, #setup_git_ssh, #sha, shell, #uncleanup

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#apiObject



6
7
8
# File 'lib/dpl/provider/openshift.rb', line 6

def api
  @api ||= ::RHC::Rest::Client.new(:user => option(:user), :password => option(:password), :server => 'openshift.redhat.com')
end

#appObject



14
15
16
# File 'lib/dpl/provider/openshift.rb', line 14

def app
  @app ||= api.find_application(option(:domain), option(:app))
end

#check_appObject



22
23
24
# File 'lib/dpl/provider/openshift.rb', line 22

def check_app
  log "found app #{app.name}"
end

#check_authObject



18
19
20
# File 'lib/dpl/provider/openshift.rb', line 18

def check_auth
  log "authenticated as %s" % user
end

#push_appObject



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

def push_app
  context.shell "git push #{app.git_url} -f"
end

#remove_keyObject



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

def remove_key
  api.delete_key(option(:key_name))
end

#restartObject



39
40
41
# File 'lib/dpl/provider/openshift.rb', line 39

def restart
  app.restart
end

#setup_key(file, type = nil) ⇒ Object



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

def setup_key(file, type = nil)
  specified_type, content, comment = File.read(file).split
  api.add_key(option(:key_name), content, type || specified_type)
end

#userObject



10
11
12
# File 'lib/dpl/provider/openshift.rb', line 10

def user
  @user ||= api.user.
end