dpl 1.7.4.travis.600.1 → 1.7.4.travis.619.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/dpl/cli.rb +4 -0
- data/lib/dpl/provider.rb +11 -2
- data/lib/dpl/provider/code_deploy.rb +3 -3
- data/lib/dpl/provider/gae.rb +1 -1
- data/lib/dpl/provider/heroku.rb +5 -3
- data/lib/dpl/provider/heroku/anvil.rb +1 -5
- data/lib/dpl/provider/heroku/api.rb +3 -11
- data/lib/dpl/provider/heroku/generic.rb +63 -0
- data/lib/dpl/provider/heroku/git.rb +11 -48
- data/lib/dpl/provider/heroku/git_deploy_key.rb +2 -2
- data/lib/dpl/provider/heroku/git_ssh.rb +23 -0
- data/lib/dpl/provider/ops_works.rb +1 -1
- data/lib/dpl/provider/releases.rb +3 -3
- data/spec/provider/deis_spec.rb +1 -1
- data/spec/provider/gae_spec.rb +1 -1
- data/spec/provider/heroku_anvil_spec.rb +1 -1
- data/spec/provider/heroku_api_spec.rb +6 -2
- data/spec/provider/heroku_git_spec.rb +8 -4
- data/spec/provider/ops_works_spec.rb +1 -1
- data/spec/provider/releases_spec.rb +3 -3
- data/spec/provider_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZTdkMTFmMTFjMmQ4ZGJhYzI0M2NiN2EzYzk2MjVlZTQ1MjU1NGUxOQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MTg4YjllYzYzZjJmNjQ4YWY4YTdhMzVhNGM1Mzk1ZGY0ZWY2YWI1Yg==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
N2I3MGI2NDA1ZTE0ZjUwOTViOWE5ZDVhZTQwMjljOTZkYjE5ODEwNDViOTRj
|
|
10
|
+
ZTQ5M2ZiOWIwZDE1Y2ExZTU2MmEzNjY0YmM4YjhmY2Q3Mjc3YjM1YWJhOWVj
|
|
11
|
+
NjNkOWI2MzFmNDlkNjQzODQ3M2U4MjI5MzU4MDllMjYyM2RlYTE=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MzU3NjI4Y2Y3ZDdhNDliZmU5ZWEyYTUzYTQyM2Y2YzIzMDA1YjMxZTFkODMy
|
|
14
|
+
NjUyYTVlOGZiNzA1YzQ2ZWVmODYxZjUwYzk3NmYyM2FkZjkyOTRjMTdiZjg5
|
|
15
|
+
ZjQ0NTAyNTljZjViZDhlODU2NGI0MDMzMWRiMWE4MzNiYTQzNTA=
|
data/lib/dpl/cli.rb
CHANGED
data/lib/dpl/provider.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'dpl/error'
|
|
2
|
+
require 'dpl/version'
|
|
2
3
|
require 'fileutils'
|
|
3
4
|
|
|
4
5
|
module DPL
|
|
@@ -84,6 +85,14 @@ module DPL
|
|
|
84
85
|
|
|
85
86
|
def initialize(context, options)
|
|
86
87
|
@context, @options = context, options
|
|
88
|
+
context.env['GIT_HTTP_USER_AGENT'] = user_agent(git: `git --version`[/[\d\.]+/])
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def user_agent(*strings)
|
|
92
|
+
strings.unshift "dpl/#{DPL::VERSION}"
|
|
93
|
+
strings.unshift "travis/0.1.0" if context.env['TRAVIS']
|
|
94
|
+
strings = strings.flat_map { |e| Hash === e ? e.map { |k,v| "#{k}/#{v}" } : e }
|
|
95
|
+
strings.join(" ").gsub(/\s+/, " ").strip
|
|
87
96
|
end
|
|
88
97
|
|
|
89
98
|
def option(name, *alternatives)
|
|
@@ -127,7 +136,7 @@ module DPL
|
|
|
127
136
|
end
|
|
128
137
|
|
|
129
138
|
def sha
|
|
130
|
-
@sha ||=
|
|
139
|
+
@sha ||= context.env['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
|
131
140
|
end
|
|
132
141
|
|
|
133
142
|
def commit_msg
|
|
@@ -172,7 +181,7 @@ module DPL
|
|
|
172
181
|
end
|
|
173
182
|
|
|
174
183
|
chmod(0740, path)
|
|
175
|
-
|
|
184
|
+
context.env['GIT_SSH'] = path
|
|
176
185
|
end
|
|
177
186
|
|
|
178
187
|
def detect_encoding?
|
|
@@ -49,8 +49,8 @@ module DPL
|
|
|
49
49
|
{
|
|
50
50
|
revision_type: 'GitHub',
|
|
51
51
|
git_hub_location: {
|
|
52
|
-
commit_id: options[:commit_id] ||
|
|
53
|
-
repository: options[:repository] ||
|
|
52
|
+
commit_id: options[:commit_id] || context.env['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip,
|
|
53
|
+
repository: options[:repository] || context.env['TRAVIS_REPO_SLUG'] || option(:repository)
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
end
|
|
@@ -80,7 +80,7 @@ module DPL
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def default_description
|
|
83
|
-
"Deploy build #{
|
|
83
|
+
"Deploy build #{context.env['TRAVIS_BUILD_NUMBER']} via Travis CI"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def check_auth
|
data/lib/dpl/provider/gae.rb
CHANGED
data/lib/dpl/provider/heroku.rb
CHANGED
|
@@ -3,15 +3,17 @@ module DPL
|
|
|
3
3
|
module Heroku
|
|
4
4
|
autoload :Anvil, 'dpl/provider/heroku/anvil'
|
|
5
5
|
autoload :API, 'dpl/provider/heroku/api'
|
|
6
|
+
autoload :Generic, 'dpl/provider/heroku/generic'
|
|
6
7
|
autoload :Git, 'dpl/provider/heroku/git'
|
|
8
|
+
autoload :GitSSH, 'dpl/provider/heroku/git_ssh'
|
|
7
9
|
autoload :GitDeployKey, 'dpl/provider/heroku/git_deploy_key'
|
|
8
10
|
|
|
9
11
|
extend self
|
|
10
12
|
|
|
11
13
|
def new(context, options)
|
|
12
|
-
strategy = options[:strategy] || '
|
|
13
|
-
constant = constants.detect { |c| c.to_s.downcase == strategy }
|
|
14
|
-
raise Error, 'unknown strategy %p' % strategy unless constant
|
|
14
|
+
strategy = options[:strategy] || 'api'
|
|
15
|
+
constant = constants.detect { |c| c.to_s.downcase == strategy.downcase.gsub(/\W/, '') }
|
|
16
|
+
raise Error, 'unknown strategy %p' % strategy unless constant and constant != Generic
|
|
15
17
|
const_get(constant).new(context, options)
|
|
16
18
|
end
|
|
17
19
|
end
|
|
@@ -13,10 +13,6 @@ module DPL
|
|
|
13
13
|
super
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def needs_key?
|
|
17
|
-
false
|
|
18
|
-
end
|
|
19
|
-
|
|
20
16
|
def deploy
|
|
21
17
|
warn ''
|
|
22
18
|
if options[:strategy]
|
|
@@ -34,7 +30,7 @@ module DPL
|
|
|
34
30
|
end
|
|
35
31
|
|
|
36
32
|
def push_app
|
|
37
|
-
sha =
|
|
33
|
+
sha = context.env['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
|
38
34
|
response = Excon.post release_url,
|
|
39
35
|
:body => { "slug_url" => slug_url, "description" => "Deploy #{sha} via Travis CI" }.to_json,
|
|
40
36
|
:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
|
@@ -4,15 +4,7 @@ require 'shellwords'
|
|
|
4
4
|
module DPL
|
|
5
5
|
class Provider
|
|
6
6
|
module Heroku
|
|
7
|
-
class API <
|
|
8
|
-
def needs_key?
|
|
9
|
-
false
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def user
|
|
13
|
-
@user ||= api.get_user.body["email"]
|
|
14
|
-
end
|
|
15
|
-
|
|
7
|
+
class API < Generic
|
|
16
8
|
def push_app
|
|
17
9
|
pack_archive
|
|
18
10
|
upload_archive
|
|
@@ -20,7 +12,7 @@ module DPL
|
|
|
20
12
|
end
|
|
21
13
|
|
|
22
14
|
def archive_file
|
|
23
|
-
Shellwords.escape("#{
|
|
15
|
+
Shellwords.escape("#{context.env['HOME']}/.dpl.#{option(:app)}.tgz")
|
|
24
16
|
end
|
|
25
17
|
|
|
26
18
|
def pack_archive
|
|
@@ -53,7 +45,7 @@ module DPL
|
|
|
53
45
|
end
|
|
54
46
|
|
|
55
47
|
def version
|
|
56
|
-
@version ||= options[:version] ||
|
|
48
|
+
@version ||= options[:version] || context.env['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
|
57
49
|
end
|
|
58
50
|
|
|
59
51
|
def post(subpath, body = nil, options = {})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module DPL
|
|
2
|
+
class Provider
|
|
3
|
+
module Heroku
|
|
4
|
+
class Generic < Provider
|
|
5
|
+
requires 'heroku-api'
|
|
6
|
+
requires 'rendezvous'
|
|
7
|
+
|
|
8
|
+
def needs_key?
|
|
9
|
+
false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def api
|
|
13
|
+
@api ||= ::Heroku::API.new(api_options)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def api_options
|
|
17
|
+
api_options = { headers: { 'User-Agent' => user_agent(::Heroku::API::HEADERS.fetch('User-Agent')) } }
|
|
18
|
+
if options[:user] and options[:password]
|
|
19
|
+
api_options[:user] = options[:user]
|
|
20
|
+
api_options[:password] = options[:password]
|
|
21
|
+
else
|
|
22
|
+
api_options[:api_key] = option(:api_key)
|
|
23
|
+
end
|
|
24
|
+
api_options
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def user
|
|
28
|
+
@user ||= api.get_user.body["email"]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def check_auth
|
|
32
|
+
log "authenticated as %s" % user
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def check_app
|
|
36
|
+
log "checking for app '#{option(:app)}'"
|
|
37
|
+
info = api.get_app(option(:app)).body
|
|
38
|
+
log "found app '#{info['name']}'"
|
|
39
|
+
rescue ::Heroku::API::Errors::Forbidden => error
|
|
40
|
+
raise Error, "#{error.message} (does the app '#{option(:app)}' exist and does your account have access to it?)", error.backtrace
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def run(command)
|
|
44
|
+
data = api.post_ps(option(:app), command, :attach => true).body
|
|
45
|
+
rendezvous_url = data['rendezvous_url']
|
|
46
|
+
Rendezvous.start(:url => rendezvous_url) unless rendezvous_url.nil?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def restart
|
|
50
|
+
api.post_ps_restart option(:app)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def deploy
|
|
54
|
+
super
|
|
55
|
+
rescue ::Heroku::API::Errors::NotFound => error
|
|
56
|
+
raise Error, "#{error.message} (wrong app #{options[:app].inspect}?)", error.backtrace
|
|
57
|
+
rescue ::Heroku::API::Errors::Unauthorized => error
|
|
58
|
+
raise Error, "#{error.message} (wrong API key?)", error.backtrace
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -1,60 +1,23 @@
|
|
|
1
1
|
module DPL
|
|
2
2
|
class Provider
|
|
3
3
|
module Heroku
|
|
4
|
-
class Git <
|
|
5
|
-
|
|
6
|
-
requires 'rendezvous'
|
|
4
|
+
class Git < Generic
|
|
5
|
+
require 'netrc'
|
|
7
6
|
|
|
8
|
-
def
|
|
9
|
-
|
|
10
|
-
@api ||= ::Heroku::API.new(:user => options[:user], :password => options[:password])
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def user
|
|
14
|
-
@user ||= api.get_user.body["email"]
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def check_auth
|
|
18
|
-
log "authenticated as %s" % user
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def check_app
|
|
22
|
-
log "checking for app '#{option(:app)}'"
|
|
23
|
-
info = api.get_app(option(:app)).body
|
|
24
|
-
options[:git] ||= info['git_url']
|
|
25
|
-
log "found app '#{info['name']}'"
|
|
26
|
-
rescue ::Heroku::API::Errors::Forbidden => error
|
|
27
|
-
raise Error, "#{error.message} (does the app '#{option(:app)}' exist and does your account have access to it?)", error.backtrace
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def setup_key(file)
|
|
31
|
-
api.post_key File.read(file)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def remove_key
|
|
35
|
-
api.delete_key(option(:key_name))
|
|
7
|
+
def git_url
|
|
8
|
+
"https://git.heroku.com/#{option(:app)}.git"
|
|
36
9
|
end
|
|
37
10
|
|
|
38
11
|
def push_app
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def run(command)
|
|
43
|
-
data = api.post_ps(option(:app), command, :attach => true).body
|
|
44
|
-
rendezvous_url = data['rendezvous_url']
|
|
45
|
-
Rendezvous.start(:url => rendezvous_url) unless rendezvous_url.nil?
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def restart
|
|
49
|
-
api.post_ps_restart option(:app)
|
|
12
|
+
git_remote = options[:git] || git_url
|
|
13
|
+
write_netrc if git_remote.start_with?("https://")
|
|
14
|
+
context.shell "git push #{git_remote} HEAD:refs/heads/master -f"
|
|
50
15
|
end
|
|
51
16
|
|
|
52
|
-
def
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
rescue ::Heroku::API::Errors::Unauthorized => error
|
|
57
|
-
raise Error, "#{error.message} (wrong API key?)", error.backtrace
|
|
17
|
+
def write_netrc
|
|
18
|
+
n = Netrc.read
|
|
19
|
+
n['git.heroku.com'] = [user, option(:api_key)]
|
|
20
|
+
n.save
|
|
58
21
|
end
|
|
59
22
|
end
|
|
60
23
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module DPL
|
|
2
2
|
class Provider
|
|
3
3
|
module Heroku
|
|
4
|
-
class GitDeployKey <
|
|
4
|
+
class GitDeployKey < GitSSH
|
|
5
5
|
def needs_key?
|
|
6
6
|
false
|
|
7
7
|
end
|
|
@@ -20,7 +20,7 @@ module DPL
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
chmod(0740, path)
|
|
23
|
-
|
|
23
|
+
context.env['GIT_SSH'] = path
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module DPL
|
|
2
|
+
class Provider
|
|
3
|
+
module Heroku
|
|
4
|
+
class GitSSH < Git
|
|
5
|
+
def git_url
|
|
6
|
+
info['git_url']
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def needs_key?
|
|
10
|
+
true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def setup_key(file)
|
|
14
|
+
api.post_key File.read(file)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def remove_key
|
|
18
|
+
api.delete_key(option(:key_name))
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -8,10 +8,10 @@ module DPL
|
|
|
8
8
|
|
|
9
9
|
def travis_tag
|
|
10
10
|
# Check if $TRAVIS_TAG is unset or set but empty
|
|
11
|
-
if
|
|
11
|
+
if context.env.fetch('TRAVIS_TAG','') == ''
|
|
12
12
|
nil
|
|
13
13
|
else
|
|
14
|
-
|
|
14
|
+
context.env['TRAVIS_TAG']
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -32,7 +32,7 @@ module DPL
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def slug
|
|
35
|
-
options.fetch(:repo) {
|
|
35
|
+
options.fetch(:repo) { context.env['TRAVIS_REPO_SLUG'] }
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def releases
|
data/spec/provider/deis_spec.rb
CHANGED
|
@@ -51,7 +51,7 @@ describe DPL::Provider::Deis do
|
|
|
51
51
|
let(:ssh_config) { File.join(Dir.home, '.ssh', 'config') }
|
|
52
52
|
let(:identity_file) { File.join(Dir.pwd, 'key_file') }
|
|
53
53
|
let(:git_ssh) { File.join(Dir.pwd, 'foo') }
|
|
54
|
-
after { FileUtils.rm
|
|
54
|
+
after { FileUtils.rm provider.context.env.delete('GIT_SSH') }
|
|
55
55
|
|
|
56
56
|
example do
|
|
57
57
|
expect(File).to receive(:open).with(git_ssh, 'w').and_call_original
|
data/spec/provider/gae_spec.rb
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
# describe '#push_app' do
|
|
12
12
|
# example 'with default app_dir' do
|
|
13
|
-
#
|
|
13
|
+
# provider.context.env['TRAVIS_BUILD_DIR'] = Dir.pwd
|
|
14
14
|
# provider.options.update(:oauth_refresh_token => token)
|
|
15
15
|
# expect(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::APPCFG_BIN} --oauth2_refresh_token=#{token} update #{Dir.pwd}").and_return(true)
|
|
16
16
|
# provider.push_app
|
|
@@ -44,7 +44,7 @@ describe DPL::Provider::Heroku do
|
|
|
44
44
|
|
|
45
45
|
allow(provider).to receive_messages(:slug_url => "http://slug-url")
|
|
46
46
|
|
|
47
|
-
expect(
|
|
47
|
+
expect(provider.context.env).to receive(:[]).with('TRAVIS_COMMIT').and_return('123')
|
|
48
48
|
expect(::Excon).to receive(:post).with(provider.release_url,
|
|
49
49
|
:body => {"slug_url" => "http://slug-url", "description" => "Deploy 123 via Travis CI" }.to_json,
|
|
50
50
|
:headers => {"Content-Type" => 'application/json', 'Accept' => 'application/json'}).and_return(response)
|
|
@@ -7,6 +7,10 @@ describe DPL::Provider::Heroku do
|
|
|
7
7
|
described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "api")
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
let(:expected_headers) do
|
|
11
|
+
{ "User-Agent" => "dpl/#{DPL::VERSION} heroku-rb/#{Heroku::API::VERSION}" }
|
|
12
|
+
end
|
|
13
|
+
|
|
10
14
|
describe "#ssh" do
|
|
11
15
|
it "doesn't require an ssh key" do
|
|
12
16
|
expect(provider.needs_key?).to eq(false)
|
|
@@ -16,14 +20,14 @@ describe DPL::Provider::Heroku do
|
|
|
16
20
|
describe "#api" do
|
|
17
21
|
it 'accepts an api key' do
|
|
18
22
|
api = double(:api)
|
|
19
|
-
expect(::Heroku::API).to receive(:new).with(:api_key => "foo").and_return(api)
|
|
23
|
+
expect(::Heroku::API).to receive(:new).with(:api_key => "foo", :headers => expected_headers).and_return(api)
|
|
20
24
|
expect(provider.api).to eq(api)
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
it 'accepts a user and a password' do
|
|
24
28
|
api = double(:api)
|
|
25
29
|
provider.options.update(:user => "foo", :password => "bar")
|
|
26
|
-
expect(::Heroku::API).to receive(:new).with(:user => "foo", :password => "bar").and_return(api)
|
|
30
|
+
expect(::Heroku::API).to receive(:new).with(:user => "foo", :password => "bar", :headers => expected_headers).and_return(api)
|
|
27
31
|
expect(provider.api).to eq(api)
|
|
28
32
|
end
|
|
29
33
|
end
|
|
@@ -4,20 +4,24 @@ require 'dpl/provider/heroku'
|
|
|
4
4
|
|
|
5
5
|
describe DPL::Provider::Heroku do
|
|
6
6
|
subject :provider do
|
|
7
|
-
described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "git")
|
|
7
|
+
described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "git-ssh")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
let(:expected_headers) do
|
|
11
|
+
{ "User-Agent" => "dpl/#{DPL::VERSION} heroku-rb/#{Heroku::API::VERSION}" }
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
describe "#api" do
|
|
11
15
|
it 'accepts an api key' do
|
|
12
16
|
api = double(:api)
|
|
13
|
-
expect(::Heroku::API).to receive(:new).with(:api_key => "foo").and_return(api)
|
|
17
|
+
expect(::Heroku::API).to receive(:new).with(:api_key => "foo", :headers => expected_headers).and_return(api)
|
|
14
18
|
expect(provider.api).to eq(api)
|
|
15
19
|
end
|
|
16
20
|
|
|
17
21
|
it 'accepts a user and a password' do
|
|
18
22
|
api = double(:api)
|
|
19
23
|
provider.options.update(:user => "foo", :password => "bar")
|
|
20
|
-
expect(::Heroku::API).to receive(:new).with(:user => "foo", :password => "bar").and_return(api)
|
|
24
|
+
expect(::Heroku::API).to receive(:new).with(:user => "foo", :password => "bar", :headers => expected_headers).and_return(api)
|
|
21
25
|
expect(provider.api).to eq(api)
|
|
22
26
|
end
|
|
23
27
|
end
|
|
@@ -47,7 +51,6 @@ describe DPL::Provider::Heroku do
|
|
|
47
51
|
example do
|
|
48
52
|
expect(provider).to receive(:log).at_least(1).times.with(/example/)
|
|
49
53
|
provider.check_app
|
|
50
|
-
expect(provider.options[:git]).to eq("GIT URL")
|
|
51
54
|
end
|
|
52
55
|
end
|
|
53
56
|
|
|
@@ -71,6 +74,7 @@ describe DPL::Provider::Heroku do
|
|
|
71
74
|
provider.options[:git] = "git://something"
|
|
72
75
|
expect(provider.context).to receive(:shell).with("git push git://something HEAD:refs/heads/master -f")
|
|
73
76
|
provider.push_app
|
|
77
|
+
expect(provider.context.env['GIT_HTTP_USER_AGENT']).to include("dpl/#{DPL::VERSION}")
|
|
74
78
|
end
|
|
75
79
|
end
|
|
76
80
|
|
|
@@ -40,7 +40,7 @@ describe DPL::Provider::OpsWorks do
|
|
|
40
40
|
before do
|
|
41
41
|
expect(provider).to receive(:current_sha).and_return('sha')
|
|
42
42
|
expect(provider.api).to receive(:client).and_return(client)
|
|
43
|
-
expect(
|
|
43
|
+
expect(provider.context.env).to receive(:[]).with('TRAVIS_BUILD_NUMBER').and_return('123')
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
let(:custom_json) { "{\"deploy\":{\"app\":{\"migrate\":false,\"scm\":{\"revision\":\"sha\"}}}}" }
|
|
@@ -9,19 +9,19 @@ describe DPL::Provider::Releases do
|
|
|
9
9
|
|
|
10
10
|
describe "#travis_tag" do
|
|
11
11
|
example "When $TRAVIS_TAG is nil" do
|
|
12
|
-
|
|
12
|
+
provider.context.env['TRAVIS_TAG'] = nil
|
|
13
13
|
|
|
14
14
|
expect(provider.travis_tag).to eq(nil)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
example "When $TRAVIS_TAG if set but empty" do
|
|
18
|
-
|
|
18
|
+
provider.context.env['TRAVIS_TAG'] = nil
|
|
19
19
|
|
|
20
20
|
expect(provider.travis_tag).to eq(nil)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
example "When $TRAVIS_TAG if set" do
|
|
24
|
-
|
|
24
|
+
provider.context.env['TRAVIS_TAG'] = "foo"
|
|
25
25
|
|
|
26
26
|
expect(provider.travis_tag).to eq("foo")
|
|
27
27
|
end
|
data/spec/provider_spec.rb
CHANGED
|
@@ -118,11 +118,11 @@ describe DPL::Provider do
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
describe "#setup_git_ssh" do
|
|
121
|
-
after { FileUtils.rm
|
|
121
|
+
after { FileUtils.rm provider.context.env.delete('GIT_SSH') }
|
|
122
122
|
|
|
123
123
|
example do
|
|
124
124
|
provider.setup_git_ssh('foo', 'bar')
|
|
125
|
-
expect(
|
|
125
|
+
expect(provider.context.env['GIT_SSH']).to eq(File.expand_path('foo'))
|
|
126
126
|
end
|
|
127
127
|
end
|
|
128
128
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dpl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.4.travis.
|
|
4
|
+
version: 1.7.4.travis.619.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Haase
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-11-
|
|
11
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -119,8 +119,10 @@ files:
|
|
|
119
119
|
- lib/dpl/provider/heroku.rb
|
|
120
120
|
- lib/dpl/provider/heroku/anvil.rb
|
|
121
121
|
- lib/dpl/provider/heroku/api.rb
|
|
122
|
+
- lib/dpl/provider/heroku/generic.rb
|
|
122
123
|
- lib/dpl/provider/heroku/git.rb
|
|
123
124
|
- lib/dpl/provider/heroku/git_deploy_key.rb
|
|
125
|
+
- lib/dpl/provider/heroku/git_ssh.rb
|
|
124
126
|
- lib/dpl/provider/modulus.rb
|
|
125
127
|
- lib/dpl/provider/ninefold.rb
|
|
126
128
|
- lib/dpl/provider/nodejitsu.rb
|