dpl 1.8.15.travis.1385.4 → 1.8.15.travis.1386.4
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/README.md +0 -40
- data/lib/dpl/provider.rb +0 -3
- data/spec/provider/launchpad_spec.rb +1 -1
- metadata +1 -8
- data/lib/dpl/provider/cloudcontrol.rb +0 -96
- data/lib/dpl/provider/dot_cloud.rb +0 -29
- data/lib/dpl/provider/exoscale.rb +0 -26
- data/notes/dotcloud.md +0 -8
- data/spec/provider/cloudcontrol_spec.rb +0 -191
- data/spec/provider/dotcloud_spec.rb +0 -42
- data/spec/provider/exoscale_spec.rb +0 -191
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
NzE5MjU3M2NjNTYxNDg2YWI0M2VhODkwZjgzNjg4ZDQ3NjY2MmJlMQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
Yzg5OGUxMzEzNTFkNWZkZDBkNjUyZTk2MDVmMTBjNjM1MWQ4ZTRlNg==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MzcxMmI1OGI0NTY4NWFkOGRlMzc2M2JkMWM4M2Q1YjZiZWMzNmVkMGUzMzA3
|
|
10
|
+
YmYwZmI3NzVhZmIwODk3YmRhYWEyZDFmNzNjMGQ4YWJkNjJlNWNkZDU3N2Nh
|
|
11
|
+
ZGYzYWRhYmRkODQwNDhiNGI4YmE4YzZlZmZhMjNlMDBkMTAxMTE=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
Y2RlNGY4Njc2NDM1NTgyNTZjYzMyNTI4YzhlZDJhYjIyZTMxNzExNjgyMjA1
|
|
14
|
+
MGExOTQ1NjhiNzBkODkzOGIxNDEzODUxZTMwZjAyNjI0OTNkNGEyYjE5Yzg1
|
|
15
|
+
MDBjYTE4ZjQyZDBkODk3YjM1MDQ3OTMzNzZlZDgzN2M1ZjJhNzQ=
|
data/README.md
CHANGED
|
@@ -19,13 +19,10 @@ Dpl supports the following providers:
|
|
|
19
19
|
* [Chef Supermarket](#chef-supermarket)
|
|
20
20
|
* [Cloud 66](#cloud-66)
|
|
21
21
|
* [Cloud Foundry](#cloud-foundry)
|
|
22
|
-
* [cloudControl](#cloudcontrol)
|
|
23
22
|
* [Deis](#deis)
|
|
24
23
|
* [Divshot.io](#divshotio)
|
|
25
|
-
* [dotCloud (experimental)](#dotcloud)
|
|
26
24
|
* [Elastic Beanstalk](#elastic-beanstalk)
|
|
27
25
|
* [Engine Yard](#engine-yard)
|
|
28
|
-
* [ExoScale](#exoscale)
|
|
29
26
|
* [Firebase](#firebase)
|
|
30
27
|
* [Github Releases](#github-releases)
|
|
31
28
|
* [Google App Engine (experimental)](#google-app-engine)
|
|
@@ -264,18 +261,6 @@ For authentication you can also use Travis CI secure environment variable:
|
|
|
264
261
|
dpl --provider=openshift --user=<username> --password=<password> --domain=<domain>
|
|
265
262
|
dpl --provider=openshift --user=<username> --password=<password> --domain=<domain> --app=<app>
|
|
266
263
|
|
|
267
|
-
### cloudControl:
|
|
268
|
-
|
|
269
|
-
#### Options:
|
|
270
|
-
|
|
271
|
-
* **email**: cloudControl email.
|
|
272
|
-
* **password**: cloudControl password.
|
|
273
|
-
* **deployment**: cloudControl Deployment. Follows the format "APP_NAME/DEP_NAME".
|
|
274
|
-
|
|
275
|
-
#### Examples:
|
|
276
|
-
|
|
277
|
-
dpl --provider=cloudcontrol --email=<email> --password<password> --deployment=`APP_NAME/DEP_NAME`
|
|
278
|
-
|
|
279
264
|
### RubyGems:
|
|
280
265
|
|
|
281
266
|
#### Options:
|
|
@@ -476,19 +461,6 @@ You first need to create an [Atlas account](https://atlas.hashicorp.com/account/
|
|
|
476
461
|
|
|
477
462
|
dpl --provider=cloudfoundry --username=<username> --password=<password> --organization=<organization> --api=<api> --space=<space> --skip-ssl-validation
|
|
478
463
|
|
|
479
|
-
### dotCloud:
|
|
480
|
-
|
|
481
|
-
#### Options:
|
|
482
|
-
|
|
483
|
-
* **api_key**: dotCloud api key.
|
|
484
|
-
* **app**: dotcloud app.
|
|
485
|
-
* **service**: dotcloud service to run commands on. Defaults to 'www'.
|
|
486
|
-
|
|
487
|
-
#### Examples:
|
|
488
|
-
|
|
489
|
-
dpl --provider=dotcloud --api_key=<api_key> --app=<app>
|
|
490
|
-
dpl --provider=dotcloud --api_key=<api_key> --app=<app> --service=<service>
|
|
491
|
-
|
|
492
464
|
### Rackspace Cloud Files:
|
|
493
465
|
|
|
494
466
|
#### Options:
|
|
@@ -745,18 +717,6 @@ and your testers can start testing your app.
|
|
|
745
717
|
|
|
746
718
|
dpl --provider=testfairy --api-key=<api-key> --app-file="out/Sample.apk" --keystore-file="out/keystore" --storepass=<storepass> --alias=<alias>
|
|
747
719
|
|
|
748
|
-
### ExoScale:
|
|
749
|
-
|
|
750
|
-
#### Options:
|
|
751
|
-
|
|
752
|
-
* **email**: ExoScale email or Organization ID.
|
|
753
|
-
* **password**: ExoScale password.
|
|
754
|
-
* **deployment**: ExoScale Deployment. Follows the format "APP_NAME/DEP_NAME".
|
|
755
|
-
|
|
756
|
-
#### Examples:
|
|
757
|
-
|
|
758
|
-
dpl --provider=exoscale --email=<email> --password<password> --deployment=`APP_NAME/DEP_NAME`
|
|
759
|
-
|
|
760
720
|
### AWS CodeDeploy:
|
|
761
721
|
|
|
762
722
|
#### Options:
|
data/lib/dpl/provider.rb
CHANGED
|
@@ -15,16 +15,13 @@ module DPL
|
|
|
15
15
|
autoload :Boxfuse, 'dpl/provider/boxfuse'
|
|
16
16
|
autoload :ChefSupermarket, 'dpl/provider/chef_supermarket'
|
|
17
17
|
autoload :Cloud66, 'dpl/provider/cloud66'
|
|
18
|
-
autoload :CloudControl, 'dpl/provider/cloudcontrol'
|
|
19
18
|
autoload :CloudFiles, 'dpl/provider/cloud_files'
|
|
20
19
|
autoload :CloudFoundry, 'dpl/provider/cloud_foundry'
|
|
21
20
|
autoload :CodeDeploy, 'dpl/provider/code_deploy'
|
|
22
21
|
autoload :Deis, 'dpl/provider/deis'
|
|
23
22
|
autoload :Divshot, 'dpl/provider/divshot'
|
|
24
|
-
autoload :DotCloud, 'dpl/provider/dot_cloud'
|
|
25
23
|
autoload :ElasticBeanstalk, 'dpl/provider/elastic_beanstalk'
|
|
26
24
|
autoload :EngineYard, 'dpl/provider/engine_yard'
|
|
27
|
-
autoload :ExoScale, 'dpl/provider/exoscale'
|
|
28
25
|
autoload :Firebase, 'dpl/provider/firebase'
|
|
29
26
|
autoload :GAE, 'dpl/provider/gae'
|
|
30
27
|
autoload :GCS, 'dpl/provider/gcs'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dpl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.8.15.travis.
|
|
4
|
+
version: 1.8.15.travis.1386.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Haase
|
|
@@ -126,14 +126,11 @@ files:
|
|
|
126
126
|
- lib/dpl/provider/cloud66.rb
|
|
127
127
|
- lib/dpl/provider/cloud_files.rb
|
|
128
128
|
- lib/dpl/provider/cloud_foundry.rb
|
|
129
|
-
- lib/dpl/provider/cloudcontrol.rb
|
|
130
129
|
- lib/dpl/provider/code_deploy.rb
|
|
131
130
|
- lib/dpl/provider/deis.rb
|
|
132
131
|
- lib/dpl/provider/divshot.rb
|
|
133
|
-
- lib/dpl/provider/dot_cloud.rb
|
|
134
132
|
- lib/dpl/provider/elastic_beanstalk.rb
|
|
135
133
|
- lib/dpl/provider/engine_yard.rb
|
|
136
|
-
- lib/dpl/provider/exoscale.rb
|
|
137
134
|
- lib/dpl/provider/firebase.rb
|
|
138
135
|
- lib/dpl/provider/gae.rb
|
|
139
136
|
- lib/dpl/provider/gcs.rb
|
|
@@ -164,7 +161,6 @@ files:
|
|
|
164
161
|
- lib/dpl/provider/testfairy.rb
|
|
165
162
|
- lib/dpl/provider/transifex.rb
|
|
166
163
|
- lib/dpl/version.rb
|
|
167
|
-
- notes/dotcloud.md
|
|
168
164
|
- notes/engine_yard.md
|
|
169
165
|
- notes/heroku.md
|
|
170
166
|
- spec/cli_spec.rb
|
|
@@ -177,14 +173,11 @@ files:
|
|
|
177
173
|
- spec/provider/chef_supermarket_spec.rb
|
|
178
174
|
- spec/provider/cloud66_spec.rb
|
|
179
175
|
- spec/provider/cloud_files_spec.rb
|
|
180
|
-
- spec/provider/cloudcontrol_spec.rb
|
|
181
176
|
- spec/provider/cloudfoundry_spec.rb
|
|
182
177
|
- spec/provider/code_deploy_spec.rb
|
|
183
178
|
- spec/provider/deis_spec.rb
|
|
184
179
|
- spec/provider/divshot_spec.rb
|
|
185
|
-
- spec/provider/dotcloud_spec.rb
|
|
186
180
|
- spec/provider/elastic_beanstalk_spec.rb
|
|
187
|
-
- spec/provider/exoscale_spec.rb
|
|
188
181
|
- spec/provider/firebase_spec.rb
|
|
189
182
|
- spec/provider/gae_spec.rb
|
|
190
183
|
- spec/provider/gcs_spec.rb
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
require 'net/http'
|
|
3
|
-
require 'net/https'
|
|
4
|
-
|
|
5
|
-
module DPL
|
|
6
|
-
class Provider
|
|
7
|
-
class CloudControl < Provider
|
|
8
|
-
attr_accessor :app_name
|
|
9
|
-
attr_accessor :dep_name
|
|
10
|
-
|
|
11
|
-
def initialize(context, options)
|
|
12
|
-
super
|
|
13
|
-
option(:email) && option(:password) && option(:deployment)
|
|
14
|
-
@app_name, @dep_name = options[:deployment].split('/')
|
|
15
|
-
|
|
16
|
-
@http = Net::HTTP.new('api.cloudcontrol.com', 443)
|
|
17
|
-
@http.use_ssl = true
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def check_auth
|
|
21
|
-
headers_with_token
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def check_app
|
|
25
|
-
response = api_call('GET', "/app/#{ app_name }/deployment/#{ dep_name }")
|
|
26
|
-
error('application check failed') if response.code != '200'
|
|
27
|
-
@repository = JSON.parse(response.body)["branch"]
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def setup_key(file)
|
|
31
|
-
data = { 'key' => File.read(file).chomp }
|
|
32
|
-
response = api_call('POST', "/user/#{ user['username'] }/key", JSON.dump(data))
|
|
33
|
-
error('adding key failed') if response.code != '200'
|
|
34
|
-
key = JSON.parse response.body
|
|
35
|
-
@ssh_key_id = key['key_id']
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def remove_key
|
|
39
|
-
response = api_call('DELETE', "/user/#{ user['username']}/key/#{ @ssh_key_id }")
|
|
40
|
-
error('key removal failed') if response.code != '204'
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def push_app
|
|
44
|
-
branch = (dep_name == 'default') ? 'master' : dep_name
|
|
45
|
-
context.shell "git push #{ @repository } HEAD:#{ branch } -f"
|
|
46
|
-
deploy_app
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
def get_token
|
|
52
|
-
request = Net::HTTP::Post.new '/token/'
|
|
53
|
-
request.basic_auth options[:email], options[:password]
|
|
54
|
-
response = @http.request(request)
|
|
55
|
-
error('authorization failed') if response.code != '200'
|
|
56
|
-
return JSON.parse response.body
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def headers_with_token(options = {})
|
|
60
|
-
@token = get_token if options[:new_token] || @token.nil?
|
|
61
|
-
return {
|
|
62
|
-
'Authorization' => %Q|cc_auth_token="#{ @token['token'] }"|,
|
|
63
|
-
'Content-Type' => 'application/json'
|
|
64
|
-
}
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def get_headers
|
|
68
|
-
headers = headers_with_token
|
|
69
|
-
response = api_call('GET', '/user/', nil, headers)
|
|
70
|
-
return headers if response.code == '200'
|
|
71
|
-
|
|
72
|
-
return headers_with_token :new_token => true
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def api_call(method, path, data = nil, headers = nil)
|
|
76
|
-
return @http.send_request(method, path, data, headers || get_headers)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def deploy_app
|
|
80
|
-
data = {'version' => -1}
|
|
81
|
-
response = api_call('PUT', "/app/#{ app_name }/deployment/#{ dep_name }", JSON.dump(data))
|
|
82
|
-
error('deployment failed - the deployment is already deploying') if response.code != '200'
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def user
|
|
86
|
-
if @user.nil?
|
|
87
|
-
response = api_call('GET', '/user/')
|
|
88
|
-
error('can not find the user') if response.code != '200'
|
|
89
|
-
users = JSON.parse response.body
|
|
90
|
-
@user = users[0]
|
|
91
|
-
end
|
|
92
|
-
return @user
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module DPL
|
|
2
|
-
class Provider
|
|
3
|
-
class DotCloud < Provider
|
|
4
|
-
experimental "dotCloud"
|
|
5
|
-
pip 'dotcloud'
|
|
6
|
-
|
|
7
|
-
def check_auth
|
|
8
|
-
context.shell "echo #{option(:api_key)} | dotcloud setup --api-key"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def check_app
|
|
12
|
-
context.shell "dotcloud connect #{option(:app)}"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def needs_key?
|
|
16
|
-
false
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def push_app
|
|
20
|
-
context.shell "dotcloud push #{option(:app)}"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def run(command)
|
|
24
|
-
service = options[:instance] || options[:service] || 'www'
|
|
25
|
-
context.shell "dotcloud -A #{option(:app)} #{service} #{command}"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
require 'net/http'
|
|
3
|
-
require 'net/https'
|
|
4
|
-
|
|
5
|
-
module DPL
|
|
6
|
-
class Provider
|
|
7
|
-
class ExoScale < CloudControl
|
|
8
|
-
def initialize(context, options)
|
|
9
|
-
super
|
|
10
|
-
@http = Net::HTTP.new('api.app.exo.io', 443)
|
|
11
|
-
@http.use_ssl = true
|
|
12
|
-
|
|
13
|
-
@tokenHttp = Net::HTTP.new('portal.exoscale.ch', 443)
|
|
14
|
-
@tokenHttp.use_ssl = true
|
|
15
|
-
end
|
|
16
|
-
private
|
|
17
|
-
def get_token
|
|
18
|
-
request = Net::HTTP::Post.new '/api/apps/token'
|
|
19
|
-
request.basic_auth options[:email], options[:password]
|
|
20
|
-
response = @tokenHttp.request(request)
|
|
21
|
-
error('authorization failed') if response.code != '200'
|
|
22
|
-
return JSON.parse response.body
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
data/notes/dotcloud.md
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'dpl/provider/cloudcontrol'
|
|
3
|
-
|
|
4
|
-
describe DPL::Provider::CloudControl do
|
|
5
|
-
subject :provider do
|
|
6
|
-
described_class.new(DummyContext.new, :deployment => 'foo_app/default', :email => 'foo@test.com', :password => 'password')
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
its(:app_name) { should == 'foo_app' }
|
|
10
|
-
its(:dep_name) { should == 'default' }
|
|
11
|
-
|
|
12
|
-
its(:needs_key?) { should be true }
|
|
13
|
-
|
|
14
|
-
describe 'constructor' do
|
|
15
|
-
it 'with wrong arguments' do
|
|
16
|
-
expect {
|
|
17
|
-
described_class.new(DummyContext.new, :foo_dep => 'foo_app/default', :email => 'foo@test.com', :password => 'password')
|
|
18
|
-
}.to raise_error(DPL::Error)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it '#check_auth should call #headers_with_token' do
|
|
23
|
-
expect(provider).to receive(:headers_with_token)
|
|
24
|
-
provider.check_auth
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe '#check_app' do
|
|
28
|
-
it 'on deployment found' do
|
|
29
|
-
expect(provider).to receive(:api_call).and_return double(
|
|
30
|
-
:code => '200',
|
|
31
|
-
:body => '{"branch":"foo_repo.git"}'
|
|
32
|
-
)
|
|
33
|
-
expect(provider.instance_variable_get(:@repository)).to be_nil
|
|
34
|
-
provider.check_app
|
|
35
|
-
expect(provider.instance_variable_get(:@repository)).to eq('foo_repo.git')
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'on deployment not found' do
|
|
39
|
-
expect(provider).to receive(:api_call).and_return double(:code => '410')
|
|
40
|
-
expect { provider.check_app }.to raise_error(DPL::Error)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe '#setup_key' do
|
|
45
|
-
before do
|
|
46
|
-
expect(File).to receive(:read).with('file').and_return('foo_key')
|
|
47
|
-
expect(provider).to receive(:user).and_return({ 'username' => 'foo_user' })
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it 'on api success' do
|
|
51
|
-
expect(provider).to receive(:api_call).with('POST', '/user/foo_user/key', '{"key":"foo_key"}').and_return double(
|
|
52
|
-
:code => '200',
|
|
53
|
-
:body => '{ "key": "foo_key", "key_id": "foo_key_id"}'
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
expect(provider.instance_variable_get(:@ssh_key_id)).to be_nil
|
|
57
|
-
provider.setup_key 'file'
|
|
58
|
-
expect(provider.instance_variable_get(:@ssh_key_id)).to eq('foo_key_id')
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'on api failure' do
|
|
62
|
-
expect(provider).to receive(:api_call).with('POST', '/user/foo_user/key', '{"key":"foo_key"}').and_return double(:code => '401')
|
|
63
|
-
|
|
64
|
-
expect { provider.setup_key 'file' }.to raise_error(DPL::Error)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
describe '#remove_key' do
|
|
69
|
-
before do
|
|
70
|
-
provider.instance_variable_set(:@ssh_key_id, 'foo_key_id')
|
|
71
|
-
expect(provider).to receive(:user).and_return({ 'username' => 'foo_user' })
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'on api success' do
|
|
75
|
-
expect(provider).to receive(:api_call).with('DELETE', '/user/foo_user/key/foo_key_id').and_return double(:code => '204')
|
|
76
|
-
provider.remove_key
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it 'on api failure' do
|
|
80
|
-
expect(provider).to receive(:api_call).with('DELETE', '/user/foo_user/key/foo_key_id').and_return double(:code => '410')
|
|
81
|
-
expect { provider.remove_key }.to raise_error(DPL::Error)
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it '#push_app shuld deploy the app' do
|
|
86
|
-
provider.instance_variable_set(:@repository, 'foo_repo.git')
|
|
87
|
-
context = double(:shell)
|
|
88
|
-
expect(context).to receive(:shell).with("git push foo_repo.git HEAD:master -f")
|
|
89
|
-
expect(provider).to receive(:context).and_return context
|
|
90
|
-
expect(provider).to receive(:deploy_app)
|
|
91
|
-
|
|
92
|
-
provider.push_app
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
describe 'private method' do
|
|
96
|
-
describe '#get_token' do
|
|
97
|
-
it 'on api success' do
|
|
98
|
-
request = double()
|
|
99
|
-
expect(request).to receive(:basic_auth).with('foo@test.com', 'password')
|
|
100
|
-
expect(Net::HTTP::Post).to receive(:new).with('/token/').and_return request
|
|
101
|
-
|
|
102
|
-
expect(provider.instance_variable_get(:@http)).to receive(:request).and_return double(
|
|
103
|
-
:code => '200',
|
|
104
|
-
:body => '{ "token": "foo_token"}'
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
expect(provider.instance_eval { get_token }).to eq({ 'token' => 'foo_token' })
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it 'on api failure' do
|
|
111
|
-
expect(provider.instance_variable_get(:@http)).to receive(:request).and_return double(:code => '401')
|
|
112
|
-
|
|
113
|
-
expect do
|
|
114
|
-
provider.instance_eval { get_token }
|
|
115
|
-
end.to raise_error(DPL::Error)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it '#headers_with_token should return headers' do
|
|
120
|
-
expect(provider).to receive(:get_token).and_return({ 'token' => 'foo_token' })
|
|
121
|
-
expected_return = {
|
|
122
|
-
'Authorization' => 'cc_auth_token="foo_token"',
|
|
123
|
-
'Content-Type' => 'application/json'
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
expect(provider.instance_eval { headers_with_token }).to eq(expected_return)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
describe '#get_headers' do
|
|
130
|
-
let(:expected_args) { [ 'GET', '/user/', nil, {'foo' => 'headers'} ] }
|
|
131
|
-
|
|
132
|
-
before do
|
|
133
|
-
expect(provider).to receive(:headers_with_token).and_return({ 'foo' => 'headers' })
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
it 'on token valid' do
|
|
137
|
-
expect(provider).to receive(:api_call).with(*expected_args).and_return double(:code => '200')
|
|
138
|
-
expect(provider.instance_eval { get_headers }).to eq({ 'foo' => 'headers' })
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
it 'on token expired' do
|
|
142
|
-
expect(provider).to receive(:api_call).with(*expected_args).and_return double(:code => '401')
|
|
143
|
-
expect(provider).to receive(:headers_with_token).with({ :new_token => true})
|
|
144
|
-
|
|
145
|
-
provider.instance_eval { get_headers }
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
it '#api_call should send request' do
|
|
150
|
-
expected_args = [ "foo_method", "foo_path", "\"foo\":\"data\"", {"foo"=>"headers"} ]
|
|
151
|
-
expect(provider.instance_variable_get(:@http)).to receive(:send_request).with(*expected_args)
|
|
152
|
-
|
|
153
|
-
provider.instance_eval do
|
|
154
|
-
api_call('foo_method', 'foo_path', '"foo":"data"', { 'foo' => 'headers'})
|
|
155
|
-
end
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
describe '#deploy_app' do
|
|
159
|
-
it 'on api success' do
|
|
160
|
-
expect(provider).to receive(:api_call).with('PUT', '/app/foo_app/deployment/default', '{"version":-1}').and_return double(:code => '200')
|
|
161
|
-
provider.instance_eval { deploy_app }
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
it 'on api failure' do
|
|
165
|
-
expect(provider).to receive(:api_call).with('PUT', '/app/foo_app/deployment/default', '{"version":-1}').and_return double(:code => '410')
|
|
166
|
-
expect do
|
|
167
|
-
provider.instance_eval { deploy_app }
|
|
168
|
-
end.to raise_error(DPL::Error)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
describe '#user' do
|
|
173
|
-
it 'on api success' do
|
|
174
|
-
expect(provider).to receive(:api_call).with('GET', '/user/').and_return double(
|
|
175
|
-
:code => '200',
|
|
176
|
-
:body => '["foo_user"]'
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
expect(provider.instance_eval { user }).to eq('foo_user')
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
it 'on api failure' do
|
|
183
|
-
expect(provider).to receive(:api_call).with('GET', '/user/').and_return double(:code => '410')
|
|
184
|
-
|
|
185
|
-
expect do
|
|
186
|
-
provider.instance_eval { user }
|
|
187
|
-
end.to raise_error(DPL::Error)
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'dpl/provider/dot_cloud'
|
|
3
|
-
|
|
4
|
-
describe DPL::Provider::DotCloud do
|
|
5
|
-
subject :provider do
|
|
6
|
-
described_class.new(DummyContext.new, :app => 'example', :api_key => 'foo')
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "#check_auth" do
|
|
10
|
-
example do
|
|
11
|
-
expect(provider.context).to receive(:shell).with("echo foo | dotcloud setup --api-key")
|
|
12
|
-
provider.check_auth
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe "#check_app" do
|
|
17
|
-
example do
|
|
18
|
-
expect(provider.context).to receive(:shell).with("dotcloud connect example")
|
|
19
|
-
provider.check_app
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe "#needs_key?" do
|
|
24
|
-
example do
|
|
25
|
-
expect(provider.needs_key?).to eq(false)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe "#push_app" do
|
|
30
|
-
example do
|
|
31
|
-
expect(provider.context).to receive(:shell).with("dotcloud push example")
|
|
32
|
-
provider.push_app
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe "#run" do
|
|
37
|
-
example do
|
|
38
|
-
expect(provider.context).to receive(:shell).with("dotcloud -A example www test")
|
|
39
|
-
provider.run("test")
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'dpl/provider/exoscale'
|
|
3
|
-
|
|
4
|
-
describe DPL::Provider::ExoScale do
|
|
5
|
-
subject :provider do
|
|
6
|
-
described_class.new(DummyContext.new, :deployment => 'foo_app/default', :email => 'foo@test.com', :password => 'password')
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
its(:app_name) { should == 'foo_app' }
|
|
10
|
-
its(:dep_name) { should == 'default' }
|
|
11
|
-
|
|
12
|
-
its(:needs_key?) { should be true }
|
|
13
|
-
|
|
14
|
-
describe 'constructor' do
|
|
15
|
-
it 'with wrong arguments' do
|
|
16
|
-
expect {
|
|
17
|
-
described_class.new(DummyContext.new, :foo_dep => 'foo_app/default', :email => 'foo@test.com', :password => 'password')
|
|
18
|
-
}.to raise_error(DPL::Error)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it '#check_auth should call #headers_with_token' do
|
|
23
|
-
expect(provider).to receive(:headers_with_token)
|
|
24
|
-
provider.check_auth
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe '#check_app' do
|
|
28
|
-
it 'on deployment found' do
|
|
29
|
-
expect(provider).to receive(:api_call).and_return double(
|
|
30
|
-
:code => '200',
|
|
31
|
-
:body => '{"branch":"foo_repo.git"}'
|
|
32
|
-
)
|
|
33
|
-
expect(provider.instance_variable_get(:@repository)).to be_nil
|
|
34
|
-
provider.check_app
|
|
35
|
-
expect(provider.instance_variable_get(:@repository)).to eq('foo_repo.git')
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'on deployment not found' do
|
|
39
|
-
expect(provider).to receive(:api_call).and_return double(:code => '410')
|
|
40
|
-
expect { provider.check_app }.to raise_error(DPL::Error)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe '#setup_key' do
|
|
45
|
-
before do
|
|
46
|
-
expect(File).to receive(:read).with('file').and_return('foo_key')
|
|
47
|
-
expect(provider).to receive(:user).and_return({ 'username' => 'foo_user' })
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it 'on api success' do
|
|
51
|
-
expect(provider).to receive(:api_call).with('POST', '/user/foo_user/key', '{"key":"foo_key"}').and_return double(
|
|
52
|
-
:code => '200',
|
|
53
|
-
:body => '{ "key": "foo_key", "key_id": "foo_key_id"}'
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
expect(provider.instance_variable_get(:@ssh_key_id)).to be_nil
|
|
57
|
-
provider.setup_key 'file'
|
|
58
|
-
expect(provider.instance_variable_get(:@ssh_key_id)).to eq('foo_key_id')
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'on api failure' do
|
|
62
|
-
expect(provider).to receive(:api_call).with('POST', '/user/foo_user/key', '{"key":"foo_key"}').and_return double(:code => '401')
|
|
63
|
-
|
|
64
|
-
expect { provider.setup_key 'file' }.to raise_error(DPL::Error)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
describe '#remove_key' do
|
|
69
|
-
before do
|
|
70
|
-
provider.instance_variable_set(:@ssh_key_id, 'foo_key_id')
|
|
71
|
-
expect(provider).to receive(:user).and_return({ 'username' => 'foo_user' })
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'on api success' do
|
|
75
|
-
expect(provider).to receive(:api_call).with('DELETE', '/user/foo_user/key/foo_key_id').and_return double(:code => '204')
|
|
76
|
-
provider.remove_key
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it 'on api failure' do
|
|
80
|
-
expect(provider).to receive(:api_call).with('DELETE', '/user/foo_user/key/foo_key_id').and_return double(:code => '410')
|
|
81
|
-
expect { provider.remove_key }.to raise_error(DPL::Error)
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it '#push_app shuld deploy the app' do
|
|
86
|
-
provider.instance_variable_set(:@repository, 'foo_repo.git')
|
|
87
|
-
context = double(:shell)
|
|
88
|
-
expect(context).to receive(:shell).with("git push foo_repo.git HEAD:master -f")
|
|
89
|
-
expect(provider).to receive(:context).and_return context
|
|
90
|
-
expect(provider).to receive(:deploy_app)
|
|
91
|
-
|
|
92
|
-
provider.push_app
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
describe 'private method' do
|
|
96
|
-
describe '#get_token' do
|
|
97
|
-
it 'on api success' do
|
|
98
|
-
request = double()
|
|
99
|
-
expect(request).to receive(:basic_auth).with('foo@test.com', 'password')
|
|
100
|
-
expect(Net::HTTP::Post).to receive(:new).with('/api/apps/token').and_return request
|
|
101
|
-
|
|
102
|
-
expect(provider.instance_variable_get(:@tokenHttp)).to receive(:request).and_return double(
|
|
103
|
-
:code => '200',
|
|
104
|
-
:body => '{ "token": "foo_token"}'
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
expect(provider.instance_eval { get_token }).to eq({ 'token' => 'foo_token' })
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it 'on api failure' do
|
|
111
|
-
expect(provider.instance_variable_get(:@tokenHttp)).to receive(:request).and_return double(:code => '401')
|
|
112
|
-
|
|
113
|
-
expect do
|
|
114
|
-
provider.instance_eval { get_token }
|
|
115
|
-
end.to raise_error(DPL::Error)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it '#headers_with_token should return headers' do
|
|
120
|
-
expect(provider).to receive(:get_token).and_return({ 'token' => 'foo_token' })
|
|
121
|
-
expected_return = {
|
|
122
|
-
'Authorization' => 'cc_auth_token="foo_token"',
|
|
123
|
-
'Content-Type' => 'application/json'
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
expect(provider.instance_eval { headers_with_token }).to eq(expected_return)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
describe '#get_headers' do
|
|
130
|
-
let(:expected_args) { [ 'GET', '/user/', nil, {'foo' => 'headers'} ] }
|
|
131
|
-
|
|
132
|
-
before do
|
|
133
|
-
expect(provider).to receive(:headers_with_token).and_return({ 'foo' => 'headers' })
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
it 'on token valid' do
|
|
137
|
-
expect(provider).to receive(:api_call).with(*expected_args).and_return double(:code => '200')
|
|
138
|
-
expect(provider.instance_eval { get_headers }).to eq({ 'foo' => 'headers' })
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
it 'on token expired' do
|
|
142
|
-
expect(provider).to receive(:api_call).with(*expected_args).and_return double(:code => '401')
|
|
143
|
-
expect(provider).to receive(:headers_with_token).with({ :new_token => true})
|
|
144
|
-
|
|
145
|
-
provider.instance_eval { get_headers }
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
it '#api_call should send request' do
|
|
150
|
-
expected_args = [ "foo_method", "foo_path", "\"foo\":\"data\"", {"foo"=>"headers"} ]
|
|
151
|
-
expect(provider.instance_variable_get(:@http)).to receive(:send_request).with(*expected_args)
|
|
152
|
-
|
|
153
|
-
provider.instance_eval do
|
|
154
|
-
api_call('foo_method', 'foo_path', '"foo":"data"', { 'foo' => 'headers'})
|
|
155
|
-
end
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
describe '#deploy_app' do
|
|
159
|
-
it 'on api success' do
|
|
160
|
-
expect(provider).to receive(:api_call).with('PUT', '/app/foo_app/deployment/default', '{"version":-1}').and_return double(:code => '200')
|
|
161
|
-
provider.instance_eval { deploy_app }
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
it 'on api failure' do
|
|
165
|
-
expect(provider).to receive(:api_call).with('PUT', '/app/foo_app/deployment/default', '{"version":-1}').and_return double(:code => '410')
|
|
166
|
-
expect do
|
|
167
|
-
provider.instance_eval { deploy_app }
|
|
168
|
-
end.to raise_error(DPL::Error)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
describe '#user' do
|
|
173
|
-
it 'on api success' do
|
|
174
|
-
expect(provider).to receive(:api_call).with('GET', '/user/').and_return double(
|
|
175
|
-
:code => '200',
|
|
176
|
-
:body => '["foo_user"]'
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
expect(provider.instance_eval { user }).to eq('foo_user')
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
it 'on api failure' do
|
|
183
|
-
expect(provider).to receive(:api_call).with('GET', '/user/').and_return double(:code => '410')
|
|
184
|
-
|
|
185
|
-
expect do
|
|
186
|
-
provider.instance_eval { user }
|
|
187
|
-
end.to raise_error(DPL::Error)
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
end
|