class DPL::Provider::Openshift
Public Class Methods
new(context, options)
click to toggle source
Calls superclass method
DPL::Provider::new
# File lib/dpl/provider/openshift.rb, line 9 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 14 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 22 def app @app ||= api.find_application(option(:domain), option(:app)) end
check_app()
click to toggle source
# File lib/dpl/provider/openshift.rb, line 30 def check_app log "found app #{app.name}" end
check_auth()
click to toggle source
# File lib/dpl/provider/openshift.rb, line 26 def check_auth log "authenticated as %s" % user end
push_app()
click to toggle source
# File lib/dpl/provider/openshift.rb, line 43 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 39 def remove_key api.delete_key(option(:key_name)) end
restart()
click to toggle source
# File lib/dpl/provider/openshift.rb, line 53 def restart app.restart end
setup_key(file, type = nil)
click to toggle source
# File lib/dpl/provider/openshift.rb, line 34 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 18 def user @user ||= api.user.login end