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