dpl-connect 1.8.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.travis.yml +36 -0
- data/Gemfile +100 -0
- data/LICENSE +22 -0
- data/README.md +934 -0
- data/Rakefile +1 -0
- data/TESTING.md +29 -0
- data/bin/dpl +5 -0
- data/dpl.gemspec +32 -0
- data/lib/dpl/cli.rb +66 -0
- data/lib/dpl/error.rb +3 -0
- data/lib/dpl/provider.rb +264 -0
- data/lib/dpl/provider/anynines.rb +13 -0
- data/lib/dpl/provider/appfog.rb +21 -0
- data/lib/dpl/provider/atlas.rb +108 -0
- data/lib/dpl/provider/azure_webapps.rb +48 -0
- data/lib/dpl/provider/bintray.rb +509 -0
- data/lib/dpl/provider/bitballoon.rb +22 -0
- data/lib/dpl/provider/bluemix_cloud_foundry.rb +23 -0
- data/lib/dpl/provider/boxfuse.rb +57 -0
- data/lib/dpl/provider/catalyze.rb +49 -0
- data/lib/dpl/provider/chef_supermarket.rb +85 -0
- data/lib/dpl/provider/cloud66.rb +38 -0
- data/lib/dpl/provider/cloud_files.rb +38 -0
- data/lib/dpl/provider/cloud_foundry.rb +43 -0
- data/lib/dpl/provider/code_deploy.rb +123 -0
- data/lib/dpl/provider/deis.rb +119 -0
- data/lib/dpl/provider/divshot.rb +23 -0
- data/lib/dpl/provider/elastic_beanstalk.rb +195 -0
- data/lib/dpl/provider/engine_yard.rb +90 -0
- data/lib/dpl/provider/firebase.rb +27 -0
- data/lib/dpl/provider/gae.rb +97 -0
- data/lib/dpl/provider/gcs.rb +59 -0
- data/lib/dpl/provider/hackage.rb +29 -0
- data/lib/dpl/provider/heroku.rb +18 -0
- data/lib/dpl/provider/heroku/api.rb +98 -0
- data/lib/dpl/provider/heroku/generic.rb +94 -0
- data/lib/dpl/provider/heroku/git.rb +28 -0
- data/lib/dpl/provider/lambda.rb +236 -0
- data/lib/dpl/provider/launchpad.rb +48 -0
- data/lib/dpl/provider/modulus.rb +23 -0
- data/lib/dpl/provider/npm.rb +64 -0
- data/lib/dpl/provider/openshift.rb +59 -0
- data/lib/dpl/provider/ops_works.rb +132 -0
- data/lib/dpl/provider/packagecloud.rb +144 -0
- data/lib/dpl/provider/pages.rb +79 -0
- data/lib/dpl/provider/puppet_forge.rb +43 -0
- data/lib/dpl/provider/pypi.rb +111 -0
- data/lib/dpl/provider/releases.rb +139 -0
- data/lib/dpl/provider/rubygems.rb +51 -0
- data/lib/dpl/provider/s3.rb +123 -0
- data/lib/dpl/provider/scalingo.rb +97 -0
- data/lib/dpl/provider/script.rb +29 -0
- data/lib/dpl/provider/surge.rb +33 -0
- data/lib/dpl/provider/testfairy.rb +190 -0
- data/lib/dpl/provider/transifex.rb +45 -0
- data/lib/dpl/version.rb +3 -0
- data/notes/engine_yard.md +1 -0
- data/notes/heroku.md +3 -0
- data/spec/cli_spec.rb +36 -0
- data/spec/provider/anynines_spec.rb +20 -0
- data/spec/provider/appfog_spec.rb +35 -0
- data/spec/provider/atlas_spec.rb +99 -0
- data/spec/provider/azure_webapps_spec.rb +95 -0
- data/spec/provider/bintray_spec.rb +259 -0
- data/spec/provider/bitballoon_spec.rb +32 -0
- data/spec/provider/bluemixcloudfoundry_spec.rb +23 -0
- data/spec/provider/boxfuse_spec.rb +16 -0
- data/spec/provider/catalyze_spec.rb +39 -0
- data/spec/provider/chef_supermarket_spec.rb +51 -0
- data/spec/provider/cloud66_spec.rb +44 -0
- data/spec/provider/cloud_files_spec.rb +88 -0
- data/spec/provider/cloudfoundry_spec.rb +71 -0
- data/spec/provider/code_deploy_spec.rb +360 -0
- data/spec/provider/deis_spec.rb +116 -0
- data/spec/provider/divshot_spec.rb +28 -0
- data/spec/provider/elastic_beanstalk_spec.rb +209 -0
- data/spec/provider/firebase_spec.rb +40 -0
- data/spec/provider/gae_spec.rb +26 -0
- data/spec/provider/gcs_spec.rb +115 -0
- data/spec/provider/hackage_spec.rb +47 -0
- data/spec/provider/heroku_spec.rb +357 -0
- data/spec/provider/lambda_spec.rb +432 -0
- data/spec/provider/launchpad_spec.rb +33 -0
- data/spec/provider/modulus_spec.rb +29 -0
- data/spec/provider/npm_spec.rb +95 -0
- data/spec/provider/openshift_spec.rb +91 -0
- data/spec/provider/ops_works_spec.rb +127 -0
- data/spec/provider/packagecloud_spec.rb +56 -0
- data/spec/provider/puppet_forge_spec.rb +60 -0
- data/spec/provider/pypi_spec.rb +103 -0
- data/spec/provider/releases_spec.rb +303 -0
- data/spec/provider/rubygems_spec.rb +106 -0
- data/spec/provider/s3_spec.rb +174 -0
- data/spec/provider/scalingo_spec.rb +64 -0
- data/spec/provider/script_spec.rb +26 -0
- data/spec/provider/surge_spec.rb +15 -0
- data/spec/provider/testfairy_spec.rb +86 -0
- data/spec/provider/transifex_spec.rb +110 -0
- data/spec/provider_spec.rb +210 -0
- data/spec/spec_helper.rb +20 -0
- metadata +279 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dpl/provider/anynines'
|
3
|
+
|
4
|
+
describe DPL::Provider::Anynines do
|
5
|
+
subject :provider do
|
6
|
+
described_class.new(DummyContext.new, username: 'mallomar',
|
7
|
+
password: 'myreallyawesomepassword',
|
8
|
+
organization: 'myorg',
|
9
|
+
space: 'outer')
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#check_auth" do
|
13
|
+
example do
|
14
|
+
expect(provider.context).to receive(:shell).with('test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz')
|
15
|
+
expect(provider.context).to receive(:shell).with('./cf api https://api.aws.ie.a9s.eu')
|
16
|
+
expect(provider.context).to receive(:shell).with('./cf login -u mallomar -p myreallyawesomepassword -o myorg -s outer')
|
17
|
+
provider.check_auth
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dpl/provider/appfog'
|
3
|
+
|
4
|
+
describe DPL::Provider::Appfog do
|
5
|
+
subject :provider do
|
6
|
+
described_class.new(DummyContext.new, :email => 'blah@foo.com', :password => 'bar')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#check_auth" do
|
10
|
+
example do
|
11
|
+
expect(provider.context).to receive(:shell).with("af login --email=blah@foo.com --password=bar")
|
12
|
+
provider.check_auth
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#needs_key?" do
|
17
|
+
example do
|
18
|
+
expect(provider.needs_key?).to eq(false)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#push_app" do
|
23
|
+
example "Without :app" do
|
24
|
+
expect(provider.context).to receive(:shell).with("af update #{File.basename(Dir.getwd)}")
|
25
|
+
expect(provider.context).to receive(:shell).with("af logout")
|
26
|
+
provider.push_app
|
27
|
+
end
|
28
|
+
example "With :app" do
|
29
|
+
provider.options.update(:app => 'test')
|
30
|
+
expect(provider.context).to receive(:shell).with("af update test")
|
31
|
+
expect(provider.context).to receive(:shell).with("af logout")
|
32
|
+
provider.push_app
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'dpl/provider/atlas'
|
5
|
+
|
6
|
+
describe DPL::Provider::Atlas do
|
7
|
+
before :all do
|
8
|
+
@origwd = Dir.pwd
|
9
|
+
@tmpdir = Dir.mktmpdir
|
10
|
+
@home = ENV['HOME']
|
11
|
+
ENV['HOME'] = @tmpdir
|
12
|
+
Dir.chdir(@tmpdir)
|
13
|
+
end
|
14
|
+
|
15
|
+
after :all do
|
16
|
+
FileUtils.rm_rf(@tmpdir) if @tmpdir
|
17
|
+
Dir.chdir(@origwd) if @origwd
|
18
|
+
ENV['HOME'] = @home
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:context) { DummyContext.new }
|
22
|
+
let(:options) { { token: SecureRandom.hex(16), include: 'bin/*', exclude: 'tmp/*' } }
|
23
|
+
|
24
|
+
subject(:provider) { described_class.new(context, options) }
|
25
|
+
|
26
|
+
describe '#check_auth' do
|
27
|
+
specify 'without ATLAS_TOKEN' do
|
28
|
+
provider.options.delete(:token)
|
29
|
+
expect { provider.check_auth }.to raise_error(DPL::Error)
|
30
|
+
end
|
31
|
+
|
32
|
+
specify 'with ATLAS_TOKEN' do
|
33
|
+
provider.options.update(token: SecureRandom.hex(16))
|
34
|
+
expect { provider.check_auth }.to_not raise_error
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#needs_key?' do
|
39
|
+
it { expect(provider.needs_key?).to eq(false) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#deploy' do
|
43
|
+
specify 'without :app aborts' do
|
44
|
+
provider.options.delete(:app)
|
45
|
+
expect { provider.deploy }.to raise_error(DPL::Error)
|
46
|
+
end
|
47
|
+
|
48
|
+
specify 'with :app does not abort' do
|
49
|
+
provider.options.update(app: 'dpl/testapp')
|
50
|
+
expect { provider.deploy }.to_not raise_error
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'building atlas-upload args' do
|
55
|
+
context 'when full args are provided' do
|
56
|
+
let(:options) { { args: '-whatever' } }
|
57
|
+
|
58
|
+
it 'returns full args directly' do
|
59
|
+
expect(provider.send(:atlas_upload_args)).to eql('-whatever')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when no arg keys are provided' do
|
64
|
+
let(:options) { {} }
|
65
|
+
|
66
|
+
it 'returns empty args' do
|
67
|
+
expect(provider.send(:atlas_upload_args)).to eql('')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
[
|
72
|
+
{
|
73
|
+
options: { wat: true, debug: true },
|
74
|
+
args: '-debug'
|
75
|
+
},
|
76
|
+
{
|
77
|
+
options: { vcs: nil },
|
78
|
+
args: '-vcs'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
options: { include: ['build/*', 'bin/*'], exclude: '*.log' },
|
82
|
+
args: '-exclude="*.log" -include="build/*" -include="bin/*"'
|
83
|
+
},
|
84
|
+
{
|
85
|
+
options: {
|
86
|
+
include: 'bin/*',
|
87
|
+
exclude: ['*.log', '*.out'],
|
88
|
+
metadata: ['foo=bar', 'whatever=else']
|
89
|
+
},
|
90
|
+
args: '-exclude="*.log" -exclude="*.out" -include="bin/*" -metadata="foo=bar" -metadata="whatever=else"'
|
91
|
+
}
|
92
|
+
].each_with_index do |example, i|
|
93
|
+
context "with options #{example[:options].inspect}" do
|
94
|
+
let(:options) { example[:options] }
|
95
|
+
it { expect(provider.send(:atlas_upload_args)).to eql(example[:args]) }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dpl/provider/azure_webapps'
|
3
|
+
|
4
|
+
|
5
|
+
describe DPL::Provider::AzureWebApps do
|
6
|
+
subject :provider do
|
7
|
+
described_class.new(DummyContext.new,
|
8
|
+
:username => 'myUsername',
|
9
|
+
:password => 'myPassword',
|
10
|
+
:site => 'myWebsite',
|
11
|
+
:slot => 'mySlot')
|
12
|
+
end
|
13
|
+
|
14
|
+
subject :provider_without_slot do
|
15
|
+
described_class.new(DummyContext.new,
|
16
|
+
:username => 'myUsername',
|
17
|
+
:password => 'myPassword',
|
18
|
+
:site => 'myWebsite')
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
describe "#git_target" do
|
23
|
+
example "With slot" do
|
24
|
+
expect(provider.git_target).to eq('https://myUsername:myPassword@mySlot.scm.azurewebsites.net:443/myWebsite.git')
|
25
|
+
end
|
26
|
+
|
27
|
+
example "Without slot" do
|
28
|
+
expect(provider_without_slot.git_target).to eq('https://myUsername:myPassword@myWebsite.scm.azurewebsites.net:443/myWebsite.git')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#needs_key?" do
|
33
|
+
example do
|
34
|
+
expect(provider.needs_key?).to eq(false)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#check_auth" do
|
39
|
+
example "Without credentials" do
|
40
|
+
provider.options.update(:username => nil)
|
41
|
+
provider.options.update(:password => nil)
|
42
|
+
provider.options.update(:site => nil)
|
43
|
+
expect{provider.check_auth}.to raise_error(DPL::Error, 'missing Azure Git Deployment username')
|
44
|
+
end
|
45
|
+
|
46
|
+
example "Without username" do
|
47
|
+
provider.options.update(:username => nil)
|
48
|
+
expect{provider.check_auth}.to raise_error(DPL::Error, 'missing Azure Git Deployment username')
|
49
|
+
end
|
50
|
+
|
51
|
+
example "Without password" do
|
52
|
+
provider.options.update(:password => nil)
|
53
|
+
expect{provider.check_auth}.to raise_error(DPL::Error, 'missing Azure Git Deployment password')
|
54
|
+
end
|
55
|
+
|
56
|
+
example "Without WebApp name" do
|
57
|
+
provider.options.update(:site => nil)
|
58
|
+
expect{provider.check_auth}.to raise_error(DPL::Error, 'missing Azure Web App name')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "push_app" do
|
63
|
+
example "skip cleanup" do
|
64
|
+
provider.options.update(:skip_cleanup => true)
|
65
|
+
provider.options.update(:verbose => false)
|
66
|
+
expect(provider.context).to receive(:shell).with('git checkout HEAD')
|
67
|
+
expect(provider.context).to receive(:shell).with('git add . --all --force')
|
68
|
+
expect(provider.context).to receive(:shell).with('git commit -m "Skip Cleanup Commit"')
|
69
|
+
expect(provider.context).to receive(:shell).with('git push --force --quiet https://myUsername:myPassword@mySlot.scm.azurewebsites.net:443/myWebsite.git HEAD:refs/heads/master > /dev/null 2>&1')
|
70
|
+
provider.push_app
|
71
|
+
end
|
72
|
+
|
73
|
+
example "Dont skip cleanup" do
|
74
|
+
provider.options.update(:skip_cleanup => false)
|
75
|
+
provider.options.update(:verbose => false)
|
76
|
+
expect(provider.context).to receive(:shell).with('git push --force --quiet https://myUsername:myPassword@mySlot.scm.azurewebsites.net:443/myWebsite.git HEAD:refs/heads/master > /dev/null 2>&1')
|
77
|
+
provider.push_app
|
78
|
+
end
|
79
|
+
|
80
|
+
example "Verbose" do
|
81
|
+
provider.options.update(:skip_cleanup => false)
|
82
|
+
provider.options.update(:verbose => true)
|
83
|
+
expect(provider.context).to receive(:shell).with('git push --force --quiet https://myUsername:myPassword@mySlot.scm.azurewebsites.net:443/myWebsite.git HEAD:refs/heads/master')
|
84
|
+
provider.push_app
|
85
|
+
end
|
86
|
+
|
87
|
+
example "Not verbose" do
|
88
|
+
provider.options.update(:skip_cleanup => false)
|
89
|
+
provider.options.update(:verbose => false)
|
90
|
+
expect(provider.context).to receive(:shell).with('git push --force --quiet https://myUsername:myPassword@mySlot.scm.azurewebsites.net:443/myWebsite.git HEAD:refs/heads/master > /dev/null 2>&1')
|
91
|
+
provider.push_app
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -0,0 +1,259 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dpl/provider/bintray'
|
3
|
+
|
4
|
+
describe DPL::Provider::Bintray do
|
5
|
+
|
6
|
+
subject :provider do
|
7
|
+
described_class.new(DummyContext.new,
|
8
|
+
:user => 'user',
|
9
|
+
:key => 'key',
|
10
|
+
:file => 'file',
|
11
|
+
:dry_run => 'true')
|
12
|
+
end
|
13
|
+
|
14
|
+
subject :provider_with_passphrase do
|
15
|
+
described_class.new(DummyContext.new,
|
16
|
+
:user => 'user',
|
17
|
+
:key => 'key',
|
18
|
+
:file => 'file',
|
19
|
+
:dry_run => 'true',
|
20
|
+
:passphrase => 'passphrase')
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "package_exists?" do
|
24
|
+
example do
|
25
|
+
descriptor = JSON.parse(descriptor_content)
|
26
|
+
package = descriptor["package"]
|
27
|
+
package_name = package["name"]
|
28
|
+
subject = package["subject"]
|
29
|
+
repo = package["repo"]
|
30
|
+
|
31
|
+
init_provider(provider)
|
32
|
+
expect(provider.package_exists_path).to eq("/packages/#{subject}/#{repo}/#{package_name}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "version_exists?" do
|
37
|
+
example do
|
38
|
+
descriptor = JSON.parse(descriptor_content)
|
39
|
+
package = descriptor["package"]
|
40
|
+
package_name = package["name"]
|
41
|
+
subject = package["subject"]
|
42
|
+
repo = package["repo"]
|
43
|
+
version_name = descriptor["version"]["name"]
|
44
|
+
|
45
|
+
init_provider(provider)
|
46
|
+
expect(provider.version_exists_path).to eq("/packages/#{subject}/#{repo}/#{package_name}/versions/#{version_name}")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "create_package" do
|
51
|
+
example do
|
52
|
+
descriptor = JSON.parse(descriptor_content)
|
53
|
+
package = descriptor["package"]
|
54
|
+
subject = package["subject"]
|
55
|
+
repo = package["repo"]
|
56
|
+
|
57
|
+
init_provider(provider)
|
58
|
+
request_details = provider.create_package
|
59
|
+
expect(request_details.path).to eq("/packages/#{subject}/#{repo}")
|
60
|
+
|
61
|
+
body = {
|
62
|
+
'name' => package["name"],
|
63
|
+
'desc' => package["desc"],
|
64
|
+
'licenses' => package["licenses"],
|
65
|
+
'labels' => package["labels"],
|
66
|
+
'vcs_url' => package["vcs_url"],
|
67
|
+
'website_url' => package["website_url"],
|
68
|
+
'issue_tracker_url' => package["issue_tracker_url"],
|
69
|
+
'public_download_numbers' => package["public_download_numbers"],
|
70
|
+
'public_stats' => package["public_stats"]
|
71
|
+
}
|
72
|
+
expect(request_details.body).to eq(body)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "create_version" do
|
77
|
+
example do
|
78
|
+
descriptor = JSON.parse(descriptor_content)
|
79
|
+
package = descriptor["package"]
|
80
|
+
package_name = package["name"]
|
81
|
+
subject = package["subject"]
|
82
|
+
repo = package["repo"]
|
83
|
+
|
84
|
+
init_provider(provider)
|
85
|
+
request_details = provider.create_version
|
86
|
+
expect(request_details.path).to eq("/packages/#{subject}/#{repo}/#{package_name}/versions")
|
87
|
+
|
88
|
+
version = descriptor["version"]
|
89
|
+
body = {
|
90
|
+
'name' => version["name"],
|
91
|
+
'desc' => version["desc"],
|
92
|
+
'released' => version["released"],
|
93
|
+
'vcs_tag' => version["vcs_tag"],
|
94
|
+
'attributes' => version["attributes"]
|
95
|
+
}
|
96
|
+
expect(request_details.body).to eq(body)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "add_package_attributes" do
|
101
|
+
example do
|
102
|
+
descriptor = JSON.parse(descriptor_content)
|
103
|
+
package = descriptor["package"]
|
104
|
+
package_name = package["name"]
|
105
|
+
subject = package["subject"]
|
106
|
+
repo = package["repo"]
|
107
|
+
|
108
|
+
init_provider(provider)
|
109
|
+
request_details = provider.add_package_attributes
|
110
|
+
expect(request_details.path).to eq("/packages/#{subject}/#{repo}/#{package_name}/attributes")
|
111
|
+
|
112
|
+
body = package["attributes"]
|
113
|
+
expect(request_details.body).to eq(body)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "add_version_attributes" do
|
118
|
+
example do
|
119
|
+
descriptor = JSON.parse(descriptor_content)
|
120
|
+
package = descriptor["package"]
|
121
|
+
package_name = package["name"]
|
122
|
+
subject = package["subject"]
|
123
|
+
repo = package["repo"]
|
124
|
+
version_name = descriptor["version"]["name"]
|
125
|
+
|
126
|
+
init_provider(provider)
|
127
|
+
request_details = provider.add_version_attributes
|
128
|
+
expect(request_details.path).to eq("/packages/#{subject}/#{repo}/#{package_name}/versions/#{version_name}/attributes")
|
129
|
+
|
130
|
+
descriptor = JSON.parse(descriptor_content)
|
131
|
+
version = descriptor["version"]
|
132
|
+
body = version["attributes"]
|
133
|
+
expect(request_details.body).to eq(body)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe "publish_version" do
|
138
|
+
example do
|
139
|
+
descriptor = JSON.parse(descriptor_content)
|
140
|
+
package = descriptor["package"]
|
141
|
+
package_name = package["name"]
|
142
|
+
subject = package["subject"]
|
143
|
+
repo = package["repo"]
|
144
|
+
version_name = descriptor["version"]["name"]
|
145
|
+
|
146
|
+
init_provider(provider)
|
147
|
+
request_details = provider.publish_version
|
148
|
+
expect(request_details.path).to eq("/content/#{subject}/#{repo}/#{package_name}/#{version_name}/publish")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "gpg_sign_version_without_passphrase" do
|
153
|
+
example do
|
154
|
+
descriptor = JSON.parse(descriptor_content)
|
155
|
+
package = descriptor["package"]
|
156
|
+
package_name = package["name"]
|
157
|
+
subject = package["subject"]
|
158
|
+
repo = package["repo"]
|
159
|
+
version_name = descriptor["version"]["name"]
|
160
|
+
|
161
|
+
init_provider(provider)
|
162
|
+
request_details = provider.gpg_sign_version
|
163
|
+
expect(request_details.path).to eq("/gpg/#{subject}/#{repo}/#{package_name}/versions/#{version_name}")
|
164
|
+
expect(request_details.body).to eq(nil)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "gpg_sign_version_with_passphrase" do
|
169
|
+
example do
|
170
|
+
descriptor = JSON.parse(descriptor_content)
|
171
|
+
package = descriptor["package"]
|
172
|
+
package_name = package["name"]
|
173
|
+
subject = package["subject"]
|
174
|
+
repo = package["repo"]
|
175
|
+
version_name = descriptor["version"]["name"]
|
176
|
+
|
177
|
+
init_provider(provider_with_passphrase)
|
178
|
+
request_details = provider_with_passphrase.gpg_sign_version
|
179
|
+
expect(request_details.path).to eq("/gpg/#{subject}/#{repo}/#{package_name}/versions/#{version_name}")
|
180
|
+
|
181
|
+
body = {
|
182
|
+
'passphrase' => 'passphrase'
|
183
|
+
}
|
184
|
+
expect(request_details.body).to eq(body)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe "upload_files" do
|
189
|
+
example do
|
190
|
+
init_provider(provider)
|
191
|
+
files_to_upload = Hash.new()
|
192
|
+
matrix_params = {
|
193
|
+
'p1' => 'a',
|
194
|
+
'p2' => 'b'
|
195
|
+
}
|
196
|
+
|
197
|
+
provider.add_if_matches(files_to_upload, 'build/files/a.gem', 'build/files/(.*.gem)', 'exclude', 'a/b/$1', nil)
|
198
|
+
provider.add_if_matches(files_to_upload, 'build/files/b.gem', 'build/files/(.*.gem)', nil, 'a/b/$1', matrix_params)
|
199
|
+
provider.add_if_matches(files_to_upload, 'build/files/c.gem', 'build/files/(.*.gem)', '.*files.*', 'a/b/$1', nil)
|
200
|
+
provider.add_if_matches(files_to_upload, 'build/files/c.txt', 'build/files/(.*.gem)', 'exclude', 'a/b/$1', nil)
|
201
|
+
|
202
|
+
expect(files_to_upload["build/files/a.gem"]).not_to eq(nil)
|
203
|
+
expect(files_to_upload["build/files/a.gem"].upload_path).to eq('a/b/a.gem')
|
204
|
+
expect(files_to_upload["build/files/a.gem"].matrix_params).to eq(nil)
|
205
|
+
|
206
|
+
expect(files_to_upload["build/files/b.gem"]).not_to eq(nil)
|
207
|
+
expect(files_to_upload["build/files/b.gem"].upload_path).to eq('a/b/b.gem')
|
208
|
+
expect(files_to_upload["build/files/b.gem"].matrix_params).to eq(matrix_params)
|
209
|
+
|
210
|
+
expect(files_to_upload["build/files/c.gem"]).to eq(nil)
|
211
|
+
expect(files_to_upload["build/files/c.txt"]).to eq(nil)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def init_provider(bintray)
|
216
|
+
bintray.descriptor=descriptor_content
|
217
|
+
bintray.test_mode = true
|
218
|
+
end
|
219
|
+
|
220
|
+
def descriptor_content
|
221
|
+
return """ {
|
222
|
+
\"package\": {
|
223
|
+
\"name\": \"auto-upload\",
|
224
|
+
\"repo\": \"myRepo\",
|
225
|
+
\"subject\": \"myBintrayUser\",
|
226
|
+
\"desc\": \"I was pushed completely automatically\",
|
227
|
+
\"website_url\": \"www.jfrog.com\",
|
228
|
+
\"issue_tracker_url\": \"https://github.com/bintray/bintray-client-java/issues\",
|
229
|
+
\"vcs_url\": \"https://github.com/bintray/bintray-client-java.git\",
|
230
|
+
\"github_use_tag_release_notes\": true,
|
231
|
+
\"github_release_notes_file\": \"RELEASE.txt\",
|
232
|
+
\"licenses\": [\"MIT\"],
|
233
|
+
\"labels\": [\"cool\", \"awesome\", \"gorilla\"],
|
234
|
+
\"public_download_numbers\": false,
|
235
|
+
\"public_stats\": false,
|
236
|
+
\"attributes\": [{\"name\": \"att1\", \"values\" : [\"val1\"], \"type\": \"string\"},
|
237
|
+
{\"name\": \"att2\", \"values\" : [1, 2.2, 4], \"type\": \"number\"},
|
238
|
+
{\"name\": \"att5\", \"values\" : [\"2014-12-28T19:43:37+0100\"], \"type\": \"date\"}]
|
239
|
+
},
|
240
|
+
\"version\": {
|
241
|
+
\"name\": \"0.5\",
|
242
|
+
\"desc\": \"This is a version\",
|
243
|
+
\"released\": \"2015-01-04\",
|
244
|
+
\"vcs_tag\": \"0.5\",
|
245
|
+
\"attributes\": [{\"name\": \"VerAtt1\", \"values\" : [\"VerVal1\"], \"type\": \"string\"},
|
246
|
+
{\"name\": \"VerAtt2\", \"values\" : [1, 3.3, 5], \"type\": \"number\"},
|
247
|
+
{\"name\": \"VerAtt3\", \"values\" : [\"2015-01-01T19:43:37+0100\"], \"type\": \"date\"}],
|
248
|
+
\"gpgSign\": true
|
249
|
+
},
|
250
|
+
\"files\":
|
251
|
+
[
|
252
|
+
{\"includePattern\": \"build/bin/(*.gem)\", \"excludePattern\": \".*/do-not-deploy/.*\", \"uploadPattern\": \"gems/$1\"},
|
253
|
+
{\"includePattern\": \"build/docs/(.*)\", \"uploadPattern\": \"docs/$1\"}
|
254
|
+
],
|
255
|
+
\"publish\": true
|
256
|
+
}
|
257
|
+
"""
|
258
|
+
end
|
259
|
+
end
|