Class: DPL::Provider::Deis
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
apt_get, #commit_msg, context, #create_key, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #setup_git_credentials, #sha, shell, #uncleanup, #user_agent, #warn
Constructor Details
This class inherits a constructor from DPL::Provider
Instance Method Details
#check_app ⇒ Object
20
21
22
23
24
|
# File 'lib/dpl/provider/deis.rb', line 20
def check_app
unless context.shell "./deis apps:info --app=#{option(:app)}"
error 'Application could not be verified.'
end
end
|
#check_auth ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/dpl/provider/deis.rb', line 12
def check_auth
unless context.shell "./deis login #{option(:controller)}" \
" --username=#{option(:username)}" \
" --password=#{option(:password)}"
error 'Login failed.'
end
end
|
#cleanup ⇒ Object
67
68
69
70
71
72
|
# File 'lib/dpl/provider/deis.rb', line 67
def cleanup
return if options[:skip_cleanup]
context.shell "mv deis ~/deis"
super
context.shell "mv ~/deis deis"
end
|
#install_deploy_dependencies ⇒ Object
4
5
6
|
# File 'lib/dpl/provider/deis.rb', line 4
def install_deploy_dependencies
context.shell "curl -sSL http://deis.io/deis-cli/install.sh | sh -s #{option(:cli_version)}"
end
|
#needs_key? ⇒ Boolean
8
9
10
|
# File 'lib/dpl/provider/deis.rb', line 8
def needs_key?
true
end
|
#push_app ⇒ Object
55
56
57
58
59
|
# File 'lib/dpl/provider/deis.rb', line 55
def push_app
unless context.shell "git push #{verbose_flag} deis HEAD:refs/heads/master -f"
error 'Deploying application failed.'
end
end
|
#remove_key ⇒ Object
49
50
51
52
53
|
# File 'lib/dpl/provider/deis.rb', line 49
def remove_key
unless context.shell "./deis keys:remove #{option(:key_name)}"
error 'Removing keys failed.'
end
end
|
#run(command) ⇒ Object
61
62
63
64
65
|
# File 'lib/dpl/provider/deis.rb', line 61
def run(command)
unless context.shell "deis run -- #{command}"
error 'Running command failed.'
end
end
|
#setup_git_ssh(path, key_path) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/dpl/provider/deis.rb', line 32
def setup_git_ssh(path, key_path)
key_path = File.expand_path(key_path)
path = File.expand_path(path)
File.open(path, 'w') do |file|
file.write "#!/bin/sh\n"
file.write "exec ssh #{verbose_flag} -o StrictHostKeychecking=no -o CheckHostIP=no -o UserKnownHostsFile=/dev/null -i #{key_path} \"$@\"\n"
end
chmod(0740, path)
context.env['GIT_SSH'] = path
unless context.shell "./deis git:remote --app=#{option(:app)}"
error 'Adding git remote failed.'
end
end
|
#setup_key(file) ⇒ Object
26
27
28
29
30
|
# File 'lib/dpl/provider/deis.rb', line 26
def setup_key(file)
unless context.shell "./deis keys:add #{file}"
error 'Adding keys failed.'
end
end
|
#verbose_flag ⇒ Object
74
75
76
|
# File 'lib/dpl/provider/deis.rb', line 74
def verbose_flag
'-v' if options[:verbose]
end
|