Class: DPL::Provider::EngineYard
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
#cleanup, context, #create_key, #error, experimental, #initialize, #log, #needs_key?, new, npm_g, #option, pip, requires, #setup_git_ssh, #sha, shell
Constructor Details
This class inherits a constructor from DPL::Provider
Instance Method Details
#api ⇒ Object
17
18
19
|
# File 'lib/dpl/provider/engine_yard.rb', line 17
def api
@api ||= EY::CloudClient.new(token, EY::CLI::UI.new)
end
|
#check_app ⇒ Object
25
26
27
28
29
|
# File 'lib/dpl/provider/engine_yard.rb', line 25
def check_app
@app = EY::CloudClient::App.all(api).detect do |app|
app.name == option(:app)
end
end
|
#check_auth ⇒ Object
21
22
23
|
# File 'lib/dpl/provider/engine_yard.rb', line 21
def check_auth
log "authenticated as %s" % api.current_user.email
end
|
#deploy ⇒ Object
62
63
64
65
66
|
# File 'lib/dpl/provider/engine_yard.rb', line 62
def deploy
super
rescue EY::Error => error
raise Error, error.message, error.backtrace
end
|
#deploy_args ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/dpl/provider/engine_yard.rb', line 47
def deploy_args
deploy_args = { :ref => `git log --format="%H" -1`.chop }
if options[:run]
deploy_args[:migrate] = true
deploy_args[:migrate_command] = Array(options[:run]).map { |c| "(#{c})" }.join(" && ")
elsif options.include? :migrate
deploy_args[:migrate] = options[:migrate]
end
deploy_args
end
|
#push_app ⇒ Object
42
43
44
45
|
# File 'lib/dpl/provider/engine_yard.rb', line 42
def push_app
fail
EY::CloudClient::Deployment.deploy(api, option(:environment), deploy_args)
end
|
#remove_key ⇒ Object
38
39
40
|
# File 'lib/dpl/provider/engine_yard.rb', line 38
def remove_key
@key.destroy if @key
end
|
#run(command) ⇒ Object
58
59
60
|
# File 'lib/dpl/provider/engine_yard.rb', line 58
def run(command)
end
|
#setup_key(file) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/dpl/provider/engine_yard.rb', line 31
def setup_key(file)
@key = EY::CloudClient::Keypair.create(api, {
"name" => option(:key_name),
"public_key" => File.read(file)
})
end
|
#token ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/dpl/provider/engine_yard.rb', line 9
def token
options[:api_key] ||= if options[:email] and options[:password]
EY::CloudClient.authenticate(options[:email], options[:password])
else
option(:api_key) end
end
|