class DPL::Provider::Openshift

Public Class Methods

new(context, options) click to toggle source
Calls superclass method
# File lib/dpl/provider/openshift.rb, line 8
def initialize(context, options)
  super
  @deployment_branch = options[:deployment_branch]
end

Public Instance Methods

api() click to toggle source
# File lib/dpl/provider/openshift.rb, line 13
def api
  @api ||= ::RHC::Rest::Client.new(:user => option(:user), :password => option(:password), :server => 'openshift.redhat.com')
end
app() click to toggle source
# File lib/dpl/provider/openshift.rb, line 21
def app
  @app ||= api.find_application(option(:domain), option(:app))
end
check_app() click to toggle source
# File lib/dpl/provider/openshift.rb, line 29
def check_app
  log "found app #{app.name}"
end
check_auth() click to toggle source
# File lib/dpl/provider/openshift.rb, line 25
def check_auth
  log "authenticated as %s" % user
end
push_app() click to toggle source
# File lib/dpl/provider/openshift.rb, line 42
def push_app
  if @deployment_branch
    log "deployment_branch detected: #{@deployment_branch}"
    app.deployment_branch = @deployment_branch
    context.shell "git push #{app.git_url} -f #{app.deployment_branch}"
  else
    context.shell "git push #{app.git_url} -f"
  end
end
remove_key() click to toggle source
# File lib/dpl/provider/openshift.rb, line 38
def remove_key
  api.delete_key(option(:key_name))
end
restart() click to toggle source
# File lib/dpl/provider/openshift.rb, line 52
def restart
  app.restart
end
setup_key(file, type = nil) click to toggle source
# File lib/dpl/provider/openshift.rb, line 33
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
user() click to toggle source
# File lib/dpl/provider/openshift.rb, line 17
def user
  @user ||= api.user.login
end