dpl 1.8.48.travis.2486.5 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.travis.yml +42 -21
  4. data/Gemfile +3 -98
  5. data/README.md +5 -16
  6. data/Rakefile +160 -1
  7. data/dpl-anynines.gemspec +3 -0
  8. data/dpl-atlas.gemspec +3 -0
  9. data/dpl-azure_webapps.gemspec +3 -0
  10. data/dpl-bintray.gemspec +3 -0
  11. data/dpl-bitballoon.gemspec +3 -0
  12. data/dpl-bluemix_cloud_foundry.gemspec +3 -0
  13. data/dpl-boxfuse.gemspec +3 -0
  14. data/dpl-catalyze.gemspec +3 -0
  15. data/dpl-chef_supermarket.gemspec +8 -0
  16. data/dpl-cloud66.gemspec +3 -0
  17. data/dpl-cloud_files.gemspec +3 -0
  18. data/dpl-cloud_foundry.gemspec +3 -0
  19. data/dpl-code_deploy.gemspec +3 -0
  20. data/dpl-deis.gemspec +3 -0
  21. data/dpl-divshot.gemspec +3 -0
  22. data/dpl-elastic_beanstalk.gemspec +3 -0
  23. data/dpl-engine_yard.gemspec +3 -0
  24. data/dpl-firebase.gemspec +3 -0
  25. data/dpl-gae.gemspec +3 -0
  26. data/dpl-gcs.gemspec +3 -0
  27. data/dpl-hackage.gemspec +3 -0
  28. data/dpl-heroku.gemspec +3 -0
  29. data/dpl-lambda.gemspec +3 -0
  30. data/dpl-launchpad.gemspec +3 -0
  31. data/dpl-modulus.gemspec +3 -0
  32. data/dpl-npm.gemspec +3 -0
  33. data/dpl-openshift.gemspec +3 -0
  34. data/dpl-ops_works.gemspec +3 -0
  35. data/dpl-packagecloud.gemspec +3 -0
  36. data/dpl-pages.gemspec +3 -0
  37. data/dpl-puppet_forge.gemspec +3 -0
  38. data/dpl-pypi.gemspec +3 -0
  39. data/dpl-releases.gemspec +3 -0
  40. data/dpl-rubygems.gemspec +3 -0
  41. data/dpl-s3.gemspec +3 -0
  42. data/dpl-scalingo.gemspec +3 -0
  43. data/dpl-script.gemspec +3 -0
  44. data/dpl-surge.gemspec +3 -0
  45. data/dpl-testfairy.gemspec +3 -0
  46. data/dpl-transifex.gemspec +3 -0
  47. data/dpl.gemspec +2 -31
  48. data/gemspec_helper.rb +49 -0
  49. data/lib/dpl/provider.rb +101 -58
  50. data/lib/dpl/version.rb +1 -1
  51. data/spec/provider_spec.rb +15 -34
  52. metadata +76 -107
  53. data/lib/dpl/provider/anynines.rb +0 -13
  54. data/lib/dpl/provider/appfog.rb +0 -21
  55. data/lib/dpl/provider/atlas.rb +0 -108
  56. data/lib/dpl/provider/azure_webapps.rb +0 -48
  57. data/lib/dpl/provider/bintray.rb +0 -509
  58. data/lib/dpl/provider/bitballoon.rb +0 -22
  59. data/lib/dpl/provider/bluemix_cloud_foundry.rb +0 -23
  60. data/lib/dpl/provider/boxfuse.rb +0 -57
  61. data/lib/dpl/provider/catalyze.rb +0 -49
  62. data/lib/dpl/provider/chef_supermarket.rb +0 -85
  63. data/lib/dpl/provider/cloud66.rb +0 -38
  64. data/lib/dpl/provider/cloud_files.rb +0 -38
  65. data/lib/dpl/provider/cloud_foundry.rb +0 -43
  66. data/lib/dpl/provider/code_deploy.rb +0 -154
  67. data/lib/dpl/provider/deis.rb +0 -128
  68. data/lib/dpl/provider/divshot.rb +0 -23
  69. data/lib/dpl/provider/elastic_beanstalk.rb +0 -195
  70. data/lib/dpl/provider/engine_yard.rb +0 -90
  71. data/lib/dpl/provider/firebase.rb +0 -27
  72. data/lib/dpl/provider/gae.rb +0 -97
  73. data/lib/dpl/provider/gcs.rb +0 -59
  74. data/lib/dpl/provider/hackage.rb +0 -29
  75. data/lib/dpl/provider/heroku.rb +0 -18
  76. data/lib/dpl/provider/heroku/api.rb +0 -98
  77. data/lib/dpl/provider/heroku/generic.rb +0 -94
  78. data/lib/dpl/provider/heroku/git.rb +0 -28
  79. data/lib/dpl/provider/lambda.rb +0 -236
  80. data/lib/dpl/provider/launchpad.rb +0 -48
  81. data/lib/dpl/provider/modulus.rb +0 -23
  82. data/lib/dpl/provider/npm.rb +0 -64
  83. data/lib/dpl/provider/openshift.rb +0 -59
  84. data/lib/dpl/provider/ops_works.rb +0 -132
  85. data/lib/dpl/provider/packagecloud.rb +0 -144
  86. data/lib/dpl/provider/pages.rb +0 -212
  87. data/lib/dpl/provider/puppet_forge.rb +0 -43
  88. data/lib/dpl/provider/pypi.rb +0 -103
  89. data/lib/dpl/provider/releases.rb +0 -139
  90. data/lib/dpl/provider/rubygems.rb +0 -51
  91. data/lib/dpl/provider/s3.rb +0 -123
  92. data/lib/dpl/provider/scalingo.rb +0 -97
  93. data/lib/dpl/provider/script.rb +0 -29
  94. data/lib/dpl/provider/surge.rb +0 -33
  95. data/lib/dpl/provider/testfairy.rb +0 -111
  96. data/lib/dpl/provider/transifex.rb +0 -45
  97. data/spec/provider/anynines_spec.rb +0 -20
  98. data/spec/provider/appfog_spec.rb +0 -35
  99. data/spec/provider/atlas_spec.rb +0 -99
  100. data/spec/provider/azure_webapps_spec.rb +0 -95
  101. data/spec/provider/bintray_spec.rb +0 -259
  102. data/spec/provider/bitballoon_spec.rb +0 -32
  103. data/spec/provider/bluemixcloudfoundry_spec.rb +0 -23
  104. data/spec/provider/boxfuse_spec.rb +0 -16
  105. data/spec/provider/catalyze_spec.rb +0 -39
  106. data/spec/provider/chef_supermarket_spec.rb +0 -51
  107. data/spec/provider/cloud66_spec.rb +0 -44
  108. data/spec/provider/cloud_files_spec.rb +0 -88
  109. data/spec/provider/cloudfoundry_spec.rb +0 -71
  110. data/spec/provider/code_deploy_spec.rb +0 -366
  111. data/spec/provider/deis_spec.rb +0 -116
  112. data/spec/provider/divshot_spec.rb +0 -28
  113. data/spec/provider/elastic_beanstalk_spec.rb +0 -209
  114. data/spec/provider/firebase_spec.rb +0 -40
  115. data/spec/provider/gae_spec.rb +0 -26
  116. data/spec/provider/gcs_spec.rb +0 -115
  117. data/spec/provider/hackage_spec.rb +0 -47
  118. data/spec/provider/heroku_spec.rb +0 -357
  119. data/spec/provider/lambda_spec.rb +0 -432
  120. data/spec/provider/launchpad_spec.rb +0 -33
  121. data/spec/provider/modulus_spec.rb +0 -29
  122. data/spec/provider/npm_spec.rb +0 -95
  123. data/spec/provider/openshift_spec.rb +0 -91
  124. data/spec/provider/ops_works_spec.rb +0 -127
  125. data/spec/provider/packagecloud_spec.rb +0 -56
  126. data/spec/provider/puppet_forge_spec.rb +0 -60
  127. data/spec/provider/pypi_spec.rb +0 -105
  128. data/spec/provider/releases_spec.rb +0 -303
  129. data/spec/provider/rubygems_spec.rb +0 -106
  130. data/spec/provider/s3_spec.rb +0 -174
  131. data/spec/provider/scalingo_spec.rb +0 -64
  132. data/spec/provider/script_spec.rb +0 -26
  133. data/spec/provider/surge_spec.rb +0 -15
  134. data/spec/provider/testfairy_spec.rb +0 -65
  135. data/spec/provider/transifex_spec.rb +0 -110
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
- require 'dpl/provider/launchpad'
3
-
4
- describe DPL::Provider::Launchpad do
5
- subject :provider do
6
- described_class.new(DummyContext.new, :slug => '~user/repo/branch', :oauth_token => 'uezinoosinmxkewhochq', :oauth_token_secret => 'dinb6fao4jh0kfdn5mich31cbikdkpjplkmadhi80h93kbbaableeeg41mm0jab9jif8ch7i2k9a80n5')
7
- end
8
-
9
- its(:needs_key?) { should be false }
10
-
11
- describe '#push_app' do
12
- it 'on api success' do
13
- expect(provider).to receive(:api_call).with('/1.0/~user/repo/branch/+code-import', {'ws.op' => 'requestImport'}).and_return Net::HTTPSuccess.new("HTTP/1.1", 200, "Ok")
14
- provider.push_app
15
- end
16
-
17
- it 'on api failure' do
18
- expect(provider).to receive(:api_call).with('/1.0/~user/repo/branch/+code-import', {'ws.op' => 'requestImport'}).and_return double("Net::HTTPUnauthorized", code: 401, body: "", class: Net::HTTPUnauthorized)
19
- expect { provider.push_app }.to raise_error(DPL::Error)
20
- end
21
- end
22
-
23
- describe 'private method' do
24
- describe '#authorization' do
25
- it 'should return correct oauth' do
26
- result = provider.instance_eval { authorization }
27
- expect(result).to include('oauth_token="uezinoosinmxkewhochq",')
28
- expect(result).to include('oauth_signature="%26dinb6fao4jh0kfdn5mich31cbikdkpjplkmadhi80h93kbbaableeeg41mm0jab9jif8ch7i2k9a80n5",')
29
- end
30
- end
31
- end
32
-
33
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- require 'dpl/provider/modulus'
3
-
4
- describe DPL::Provider::Modulus do
5
- subject :provider do
6
- described_class.new(DummyContext.new, :api_key => 'test-token', :project_name => 'test-project')
7
- end
8
-
9
- describe "#check_auth" do
10
- it 'should require an api key' do
11
- provider.options.update(:api_key => nil)
12
- expect{ provider.check_auth }.to raise_error("must supply an api key")
13
- end
14
- end
15
-
16
- describe "#check_app" do
17
- it 'should require a project name' do
18
- provider.options.update(:project_name => nil)
19
- expect{ provider.check_app }.to raise_error("must supply a project name")
20
- end
21
- end
22
-
23
- describe "#push_app" do
24
- it 'should include the api key and project name specified' do
25
- expect(provider.context).to receive(:shell).with("env MODULUS_TOKEN=test-token modulus deploy -p test-project")
26
- provider.push_app
27
- end
28
- end
29
- end
@@ -1,95 +0,0 @@
1
- require 'spec_helper'
2
- require 'dpl/provider/npm'
3
-
4
- describe DPL::Provider::NPM do
5
- before :each do
6
- allow(subject).to receive(:npm_version).and_return('2.11.3')
7
- end
8
-
9
- subject :provider do
10
- described_class.new(DummyContext.new, :email => 'foo@blah.com', :api_key => 'test')
11
- end
12
-
13
- describe "#check_auth" do
14
- example do
15
- expect(provider).to receive(:setup_auth)
16
- expect(provider).to receive(:log).with("Authenticated with email foo@blah.com")
17
- provider.check_auth
18
- end
19
- end
20
-
21
- describe "#push_app" do
22
- example do
23
- expect(provider.context).to receive(:shell).with("env NPM_API_KEY=test npm publish")
24
- expect(FileUtils).to receive(:rm).with(File.expand_path(DPL::Provider::NPM::NPMRC_FILE))
25
- provider.setup_auth
26
- provider.push_app
27
- end
28
- end
29
-
30
- describe "#setup_auth" do
31
- example do
32
- test_setup_auth
33
- end
34
- end
35
-
36
- context 'when NPM is version 1.x' do
37
- before :each do
38
- allow(subject).to receive(:npm_version).and_return('1.4.28')
39
- end
40
-
41
- describe "#setup_auth" do
42
- example do
43
- test_setup_auth(DPL::Provider::NPM::DEFAULT_NPM_REGISTRY, "_auth = ${NPM_API_KEY}\nemail = foo@blah.com")
44
- end
45
- end
46
- end
47
-
48
- context 'when package.json exists' do
49
- let(:host) { 'npm.example.com' }
50
- let(:custom_rpm_registry) { 'https://' + host }
51
- before :each do
52
- expect(File).to receive(:exists?).with('package.json').and_return(true)
53
- end
54
-
55
- context 'and it defines custom RPM registry' do
56
- before { expect(File).to receive(:read).with('package.json').and_return("{\"publishConfig\":{\"registry\":\"#{custom_rpm_registry}\"}}") }
57
-
58
- describe '#setup_auth' do
59
- example do
60
- test_setup_auth(host)
61
- end
62
- end
63
- end
64
-
65
- context 'and it defines custom RPM registry with trailing slash' do
66
- let(:host) { 'npm.example.com' }
67
- let(:custom_rpm_registry) { 'https://' + host + '/' }
68
- before { expect(File).to receive(:read).with('package.json').and_return("{\"publishConfig\":{\"registry\":\"#{custom_rpm_registry}\"}}") }
69
-
70
- describe '#setup_auth' do
71
- example do
72
- test_setup_auth(host)
73
- end
74
- end
75
- end
76
-
77
- context 'and it does not define custom RPM registry' do
78
- before { expect(File).to receive(:read).with('package.json').and_return("{}") }
79
-
80
- describe '#setup_auth' do
81
- example do
82
- test_setup_auth
83
- end
84
- end
85
- end
86
- end
87
- end
88
-
89
- def test_setup_auth(registry = DPL::Provider::NPM::DEFAULT_NPM_REGISTRY, content = "//#{registry}/:_authToken=${NPM_API_KEY}")
90
- f = double(:npmrc)
91
- expect(File).to receive(:open).with(File.expand_path(DPL::Provider::NPM::NPMRC_FILE), 'w').and_return(f)
92
- expect(f).to receive(:puts).with(content)
93
- allow(f).to receive(:flush)
94
- provider.setup_auth
95
- end
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
- require 'rhc'
3
- require 'dpl/provider/openshift'
4
-
5
- describe DPL::Provider::Openshift do
6
- subject :provider do
7
- described_class.new(DummyContext.new, :user => 'foo', :password => 'foo', :domain => 'foo', :app => 'example', :key_name => 'key')
8
- end
9
-
10
- describe "#api" do
11
- it 'accepts a user and a password' do
12
- api = double(:api)
13
- provider.options.update(:user => "foo", :password => "bar")
14
- expect(::RHC::Rest::Client).to receive(:new).with(:user => "foo", :password => "bar", :server => "openshift.redhat.com").and_return(api)
15
- expect(provider.api).to eq(api)
16
- end
17
- end
18
-
19
- context "with api" do
20
- let :api do
21
- double "api",
22
- :user => double(:login => "foo@bar.com"),
23
- :find_application => double(:name => "example", :git_url => "git://something"),
24
- :add_key => double
25
- end
26
- let :app do
27
- double "app",
28
- :restart => double
29
- end
30
-
31
- before do
32
- expect(::RHC::Rest::Client).to receive(:new).at_most(:once).and_return(api)
33
- provider.api
34
- end
35
-
36
- its(:api) {should be == api}
37
-
38
- describe "#check_auth" do
39
- example do
40
- expect(provider).to receive(:log).with("authenticated as foo@bar.com")
41
- provider.check_auth
42
- end
43
- end
44
-
45
- describe "#check_app" do
46
- example do
47
- expect(provider).to receive(:log).with("found app example")
48
- provider.check_app
49
- end
50
- end
51
-
52
- describe "#setup_key" do
53
- example do
54
- expect(File).to receive(:read).with("the file").and_return("ssh-rsa\nfoo")
55
- expect(api).to receive(:add_key).with("key", "foo", "ssh-rsa")
56
- provider.setup_key("the file")
57
- end
58
- end
59
-
60
- describe "#remove_key" do
61
- example do
62
- expect(api).to receive(:delete_key).with("key")
63
- provider.remove_key
64
- end
65
- end
66
-
67
- describe "#push_app" do
68
- example "when app.deployment_branch is not set" do
69
- expect(provider.context).to receive(:shell).with("git push git://something -f")
70
- provider.push_app
71
- end
72
- end
73
-
74
- context "when app.deployment_branch is set" do
75
- subject :provider do
76
- described_class.new(DummyContext.new, :user => 'foo', :password => 'foo', :domain => 'foo', :app => 'example', :key_name => 'key', :deployment_branch => 'test-branch')
77
-
78
- expect(provider.app).to receive(:deployment_branch=).with("test-branch")
79
- expect(provider.context).to receive(:shell).with("git push git://something -f test-branch")
80
- provider.push_app
81
- end
82
- end
83
-
84
- describe "#restart" do
85
- example do
86
- expect(provider.app).to receive(:restart)
87
- provider.restart
88
- end
89
- end
90
- end
91
- end
@@ -1,127 +0,0 @@
1
- require 'spec_helper'
2
- require 'aws-sdk'
3
- require 'dpl/provider'
4
- require 'dpl/provider/ops_works'
5
-
6
- describe DPL::Provider::OpsWorks do
7
-
8
- subject :provider do
9
- described_class.new(DummyContext.new, :access_key_id => 'qwertyuiopasdfghjklz', :secret_access_key => 'qwertyuiopasdfghjklzqwertyuiopasdfghjklz')
10
- end
11
-
12
- describe '#opsworks_options' do
13
- context 'without region' do
14
- example do
15
- options = provider.opsworks_options
16
- expect(options[:region]).to eq('us-east-1')
17
- end
18
- end
19
-
20
- context 'with region' do
21
- example do
22
- region = 'us-west-1'
23
- provider.options.update(:region => region)
24
- options = provider.opsworks_options
25
- expect(options[:region]).to eq(region)
26
- end
27
- end
28
- end
29
-
30
- describe "#check_auth" do
31
- example do
32
- expect(provider).to receive(:log).with('Logging in with Access Key: ****************jklz')
33
- provider.check_auth
34
- end
35
- end
36
-
37
- describe "#needs_key?" do
38
- example do
39
- expect(provider.needs_key?).to eq(false)
40
- end
41
- end
42
-
43
- describe DPL::Provider::OpsWorks do
44
- access_key_id = 'someaccesskey'
45
- secret_access_key = 'somesecretaccesskey'
46
- region = 'us-east-1'
47
-
48
- client_options = {
49
- stub_responses: true,
50
- region: region,
51
- credentials: Aws::Credentials.new(access_key_id, secret_access_key)
52
- }
53
-
54
- subject :provider do
55
- described_class.new(DummyContext.new, {
56
- access_key_id: access_key_id,
57
- secret_access_key: secret_access_key
58
- })
59
- end
60
-
61
- before :each do
62
- expect(provider).to receive(:opsworks_options).and_return(client_options)
63
- end
64
-
65
- describe '#opsworks' do
66
- example do
67
- expect(Aws::OpsWorks::Client).to receive(:new).with(client_options).once
68
- provider.opsworks
69
- end
70
- end
71
-
72
- describe "#push_app" do
73
- let(:client) { provider.opsworks }
74
- let(:ops_works_app) { {shortname: 'app', stack_id: 'stack-id'} }
75
- before do
76
- expect(provider).to receive(:current_sha).and_return('sha')
77
- expect(provider.context.env).to receive(:[]).with('TRAVIS_BUILD_NUMBER').and_return('123')
78
- end
79
-
80
- let(:custom_json) { "{\"deploy\":{\"app\":{\"migrate\":false,\"scm\":{\"revision\":\"sha\"}}}}" }
81
- example 'without :migrate option' do
82
- provider.options.update(app_id: 'app-id')
83
- expect(client).to receive(:describe_apps).with(app_ids: ['app-id']).and_return({apps: [ops_works_app]})
84
- expect(client).to receive(:create_deployment).with(
85
- stack_id: 'stack-id', app_id: 'app-id', command: {name: 'deploy'}, comment: 'Deploy build 123 via Travis CI', custom_json: custom_json
86
- ).and_return({})
87
- provider.push_app
88
- end
89
-
90
- let(:custom_json_with_migrate) { "{\"deploy\":{\"app\":{\"migrate\":true,\"scm\":{\"revision\":\"sha\"}}}}" }
91
- example 'with :migrate option' do
92
- provider.options.update(app_id: 'app-id', migrate: true)
93
- expect(client).to receive(:describe_apps).with(app_ids: ['app-id']).and_return({apps: [ops_works_app]})
94
- expect(client).to receive(:create_deployment).with(
95
- stack_id: 'stack-id', app_id: 'app-id', command: {name: 'deploy'}, comment: 'Deploy build 123 via Travis CI', custom_json: custom_json_with_migrate
96
- ).and_return({})
97
- provider.push_app
98
- end
99
-
100
- example 'with :wait_until_deployed' do
101
- provider.options.update(app_id: 'app-id', wait_until_deployed: true)
102
- expect(client).to receive(:describe_apps).with(app_ids: ['app-id']).and_return({apps: [ops_works_app]})
103
- expect(client).to receive(:create_deployment).and_return({deployment_id: 'deployment_id'})
104
- expect(client).to receive(:describe_deployments).with({deployment_ids: ['deployment_id']}).and_return({deployments: [status: 'running']}, {deployments: [status: 'successful']})
105
- provider.push_app
106
- end
107
-
108
- example 'with :instance-ids' do
109
- provider.options.update(app_id: 'app-id', instance_ids: ['instance-id'])
110
- expect(client).to receive(:describe_apps).with(app_ids: ['app-id']).and_return({apps: [ops_works_app]})
111
- expect(client).to receive(:create_deployment).with(
112
- stack_id: 'stack-id', app_id: 'app-id', instance_ids:['instance-id'], command: {name: 'deploy'}, comment: 'Deploy build 123 via Travis CI', custom_json: custom_json
113
- ).and_return({})
114
- provider.push_app
115
- end
116
-
117
- example 'with :layer-ids' do
118
- provider.options.update(app_id: 'app-id', layer_ids: ['layer-id'])
119
- expect(client).to receive(:describe_apps).with(app_ids: ['app-id']).and_return({apps: [ops_works_app]})
120
- expect(client).to receive(:create_deployment).with(
121
- stack_id: 'stack-id', app_id: 'app-id', layer_ids:['layer-id'], command: {name: 'deploy'}, comment: 'Deploy build 123 via Travis CI', custom_json: custom_json
122
- ).and_return({})
123
- provider.push_app
124
- end
125
- end
126
- end
127
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
- require 'rubygems'
3
- require 'gems'
4
- require 'dpl/provider/packagecloud'
5
-
6
- describe DPL::Provider::Packagecloud do
7
-
8
- subject :provider do
9
- described_class.new(DummyContext.new, :username => 'joedamato', :repository => 'test_repo', :token => 'test_token')
10
- end
11
-
12
- describe "#setup_auth" do
13
- it 'should get username and token' do
14
- expect(provider).to receive(:log).with("Logging into https://packagecloud.io with joedamato:****************oken")
15
- provider.setup_auth
16
- end
17
-
18
- it 'should require username' do
19
- new_provider = described_class.new(DummyContext.new, {:token => 'test_token'})
20
- expect{ new_provider.setup_auth }.to raise_error("missing username")
21
- end
22
-
23
- it 'should require token' do
24
- new_provider = described_class.new(DummyContext.new, {:username => 'test_token'})
25
- expect{ new_provider.setup_auth }.to raise_error("missing token")
26
- end
27
-
28
- it 'should require repository' do
29
- new_provider = described_class.new(DummyContext.new, {:username => 'joedamato', :token => 'test_token'})
30
- expect{ new_provider.setup_auth }.to raise_error("missing repository")
31
- end
32
-
33
- end
34
-
35
- describe "#push_app" do
36
- it 'defaults to searching everywhere' do
37
- expect(Dir).to receive(:glob).with('**/*')
38
- expect { provider.push_app }.to raise_error(DPL::Error)
39
- end
40
-
41
- it 'accepts and uses a string glob' do
42
- provider.options.update(:package_glob => 'foo*.gem')
43
-
44
- expect(Dir).to receive(:glob).with('foo*.gem')
45
- expect { provider.push_app }.to raise_error(DPL::Error)
46
- end
47
-
48
- it 'accepts and uses an array of globs' do
49
- provider.options.update(:package_glob => ['*.rpm', '**/*.deb'])
50
-
51
- expect(Dir).to receive(:glob).with('*.rpm', '**/*.deb')
52
- expect { provider.push_app }.to raise_error(DPL::Error)
53
- end
54
- end
55
-
56
- end
@@ -1,60 +0,0 @@
1
- require 'spec_helper'
2
- require 'dpl/provider/puppet_forge'
3
- require 'puppet/face'
4
- require 'puppet_blacksmith'
5
-
6
- describe DPL::Provider::PuppetForge do
7
- subject :provider do
8
- described_class.new(DummyContext.new, :user => 'puppetlabs', :password => 's3cr3t')
9
- end
10
-
11
- describe "forge" do
12
- it 'should include the user and password specified' do
13
- expect(provider.forge.username).to eq(provider.options[:user])
14
- expect(provider.forge.password).to eq(provider.options[:password])
15
- end
16
- end
17
-
18
- describe "build" do
19
- it 'should use Puppet module tool to build the module' do
20
- pmt = double('pmt')
21
- expect(::Puppet::Face).to receive(:[]).and_return(pmt)
22
- expect(pmt).to receive(:build).with('./')
23
- provider.build
24
- end
25
- end
26
-
27
- describe "#check_auth" do
28
- it 'should require a user' do
29
- provider.options.update(:user => nil)
30
- expect{ provider.check_auth }.to raise_error("must supply a user")
31
- end
32
-
33
- it 'should require a password' do
34
- provider.options.update(:password => nil)
35
- expect{ provider.check_auth }.to raise_error("must supply a password")
36
- end
37
- end
38
-
39
- describe "#check_app" do
40
- it 'should load module metadata using Blacksmith' do
41
- modulefile = double('modulefile')
42
- expect(::Blacksmith::Modulefile).to receive(:new).and_return(modulefile)
43
- expect(modulefile).to receive(:metadata) { true }
44
- provider.check_app
45
- end
46
- end
47
-
48
- describe "#push_app" do
49
- it 'should use Blacksmith to push to the Forge' do
50
- forge = double('forge')
51
- expect(provider).to receive(:build).and_return(true)
52
- expect(provider).to receive(:modulefile).at_least(:once).and_return(double('modulefile', :name => 'test'))
53
- expect(provider).to receive(:log).and_return(true)
54
- expect(::Blacksmith::Forge).to receive(:new).and_return(forge)
55
- expect(forge).to receive(:push!) { true }
56
- expect(forge).to receive(:username) { provider.options[:user] }
57
- provider.push_app
58
- end
59
- end
60
- end