Class: DPL::Provider::Openshift
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
apt_get, #cleanup, #commit_msg, context, #create_key, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #log, #needs_key?, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn
Constructor Details
#initialize(context, options) ⇒ Openshift
Returns a new instance of Openshift.
7
8
9
10
|
# File 'lib/dpl/provider/openshift.rb', line 7
def initialize(context, options)
super
@deployment_branch = options[:deployment_branch]
end
|
Instance Method Details
#api ⇒ Object
12
13
14
|
# File 'lib/dpl/provider/openshift.rb', line 12
def api
@api ||= ::RHC::Rest::Client.new(:user => option(:user), :password => option(:password), :server => 'openshift.redhat.com')
end
|
#app ⇒ Object
20
21
22
|
# File 'lib/dpl/provider/openshift.rb', line 20
def app
@app ||= api.find_application(option(:domain), option(:app))
end
|
#check_app ⇒ Object
28
29
30
|
# File 'lib/dpl/provider/openshift.rb', line 28
def check_app
log "found app #{app.name}"
end
|
#check_auth ⇒ Object
24
25
26
|
# File 'lib/dpl/provider/openshift.rb', line 24
def check_auth
log "authenticated as %s" % user
end
|
#push_app ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/dpl/provider/openshift.rb', line 41
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 ⇒ Object
37
38
39
|
# File 'lib/dpl/provider/openshift.rb', line 37
def remove_key
api.delete_key(option(:key_name))
end
|
#restart ⇒ Object
51
52
53
|
# File 'lib/dpl/provider/openshift.rb', line 51
def restart
app.restart
end
|
#setup_key(file, type = nil) ⇒ Object
32
33
34
35
|
# File 'lib/dpl/provider/openshift.rb', line 32
def setup_key(file, type = nil)
specified_type, content, = File.read(file).split
api.add_key(option(:key_name), content, type || specified_type)
end
|
#user ⇒ Object
16
17
18
|
# File 'lib/dpl/provider/openshift.rb', line 16
def user
@user ||= api.user.login
end
|