Class: DPL::Provider::Deis

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/deis.rb

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #cleanup, #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_appObject



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_authObject



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

#install_deploy_dependenciesObject



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(:client_version)}"
end

#needs_key?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/dpl/provider/deis.rb', line 8

def needs_key?
  true
end

#push_appObject



55
56
57
58
59
# File 'lib/dpl/provider/deis.rb', line 55

def push_app
  unless context.shell "git push deis HEAD:refs/heads/master -f"
    error 'Deploying application failed.'
  end
end

#remove_keyObject



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 -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