dpl 1.10.17.travis.6637.6 → 2.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +74 -0
  3. data/CONTRIBUTING.md +392 -0
  4. data/Gemfile +17 -3
  5. data/Gemfile.lock +373 -0
  6. data/LICENSE +16 -19
  7. data/NOTES.md +275 -0
  8. data/README.md +1977 -707
  9. data/Rakefile +2 -2
  10. data/bin/dpl +7 -3
  11. data/lib/dpl.rb +20 -0
  12. data/lib/dpl/assets/atlas/install +19 -0
  13. data/lib/dpl/assets/dpl/README.erb.md +133 -0
  14. data/lib/dpl/assets/dpl/git_ssh +2 -0
  15. data/lib/dpl/assets/git/detect_private_key +8 -0
  16. data/lib/dpl/assets/hephy/filter_log +3 -0
  17. data/lib/dpl/assets/pypi/install +4 -0
  18. data/lib/dpl/assets/scalingo/install +6 -0
  19. data/lib/dpl/cli.rb +36 -48
  20. data/lib/dpl/ctx.rb +2 -0
  21. data/lib/dpl/ctx/bash.rb +543 -0
  22. data/lib/dpl/ctx/test.rb +242 -0
  23. data/lib/dpl/helper/assets.rb +36 -0
  24. data/lib/dpl/helper/cmd.rb +167 -0
  25. data/lib/dpl/helper/config_file.rb +47 -0
  26. data/lib/dpl/helper/env.rb +39 -0
  27. data/lib/dpl/helper/interpolate.rb +126 -0
  28. data/lib/dpl/helper/memoize.rb +20 -0
  29. data/lib/dpl/helper/squiggle.rb +22 -0
  30. data/lib/dpl/helper/zip.rb +69 -0
  31. data/lib/dpl/provider.rb +562 -234
  32. data/lib/dpl/provider/dsl.rb +369 -0
  33. data/lib/dpl/provider/examples.rb +128 -0
  34. data/lib/dpl/provider/status.rb +59 -0
  35. data/lib/dpl/providers.rb +40 -0
  36. data/lib/dpl/providers/anynines.rb +65 -0
  37. data/lib/dpl/providers/atlas.rb +49 -0
  38. data/lib/dpl/providers/azure_web_apps.rb +59 -0
  39. data/lib/dpl/providers/bintray.rb +313 -0
  40. data/lib/dpl/providers/bluemixcloudfoundry.rb +92 -0
  41. data/lib/dpl/providers/boxfuse.rb +48 -0
  42. data/lib/dpl/providers/cargo.rb +19 -0
  43. data/lib/dpl/providers/chef_supermarket.rb +128 -0
  44. data/lib/dpl/providers/cloud66.rb +40 -0
  45. data/lib/dpl/providers/cloudfiles.rb +56 -0
  46. data/lib/dpl/providers/cloudfoundry.rb +81 -0
  47. data/lib/dpl/providers/codedeploy.rb +179 -0
  48. data/lib/dpl/providers/datica.rb +60 -0
  49. data/lib/dpl/providers/elasticbeanstalk.rb +195 -0
  50. data/lib/dpl/providers/engineyard.rb +107 -0
  51. data/lib/dpl/providers/firebase.rb +41 -0
  52. data/lib/dpl/providers/gae.rb +74 -0
  53. data/lib/dpl/providers/gcs.rb +105 -0
  54. data/lib/dpl/providers/hackage.rb +47 -0
  55. data/lib/dpl/providers/hephy.rb +101 -0
  56. data/lib/dpl/providers/heroku.rb +111 -0
  57. data/lib/dpl/providers/heroku/api.rb +119 -0
  58. data/lib/dpl/providers/heroku/git.rb +50 -0
  59. data/lib/dpl/providers/lambda.rb +202 -0
  60. data/lib/dpl/providers/launchpad.rb +74 -0
  61. data/lib/dpl/providers/netlify.rb +30 -0
  62. data/lib/dpl/providers/npm.rb +88 -0
  63. data/lib/dpl/providers/openshift.rb +46 -0
  64. data/lib/dpl/providers/opsworks.rb +142 -0
  65. data/lib/dpl/providers/packagecloud.rb +190 -0
  66. data/lib/dpl/providers/pages.rb +17 -0
  67. data/lib/dpl/providers/pages/api.rb +102 -0
  68. data/lib/dpl/providers/pages/git.rb +251 -0
  69. data/lib/dpl/providers/puppetforge.rb +44 -0
  70. data/lib/dpl/providers/pypi.rb +120 -0
  71. data/lib/dpl/providers/releases.rb +214 -0
  72. data/lib/dpl/providers/rubygems.rb +89 -0
  73. data/lib/dpl/providers/s3.rb +243 -0
  74. data/lib/dpl/providers/scalingo.rb +63 -0
  75. data/lib/dpl/providers/script.rb +28 -0
  76. data/lib/dpl/providers/snap.rb +59 -0
  77. data/lib/dpl/providers/surge.rb +55 -0
  78. data/lib/dpl/providers/testfairy.rb +93 -0
  79. data/lib/dpl/providers/transifex.rb +66 -0
  80. data/lib/dpl/support/aws_sdk_patch.rb +23 -0
  81. data/lib/dpl/support/gems.rb +69 -0
  82. data/lib/dpl/support/gstore_patch.rb +6 -0
  83. data/lib/dpl/support/version.rb +83 -0
  84. data/lib/dpl/version.rb +2 -2
  85. metadata +98 -169
  86. data/.coveralls.yml +0 -1
  87. data/.github/CONTRIBUTING.md +0 -173
  88. data/.github/stale.yml +0 -53
  89. data/.gitignore +0 -13
  90. data/.rspec +0 -2
  91. data/.travis.yml +0 -56
  92. data/dpl-anynines.gemspec +0 -3
  93. data/dpl-atlas.gemspec +0 -3
  94. data/dpl-azure_webapps.gemspec +0 -3
  95. data/dpl-bintray.gemspec +0 -3
  96. data/dpl-bitballoon.gemspec +0 -3
  97. data/dpl-bluemix_cloud_foundry.gemspec +0 -3
  98. data/dpl-boxfuse.gemspec +0 -3
  99. data/dpl-cargo.gemspec +0 -3
  100. data/dpl-catalyze.gemspec +0 -3
  101. data/dpl-chef_supermarket.gemspec +0 -20
  102. data/dpl-cloud66.gemspec +0 -3
  103. data/dpl-cloud_files.gemspec +0 -3
  104. data/dpl-cloud_foundry.gemspec +0 -3
  105. data/dpl-code_deploy.gemspec +0 -3
  106. data/dpl-deis.gemspec +0 -3
  107. data/dpl-elastic_beanstalk.gemspec +0 -3
  108. data/dpl-engine_yard.gemspec +0 -3
  109. data/dpl-firebase.gemspec +0 -3
  110. data/dpl-gae.gemspec +0 -3
  111. data/dpl-gcs.gemspec +0 -3
  112. data/dpl-hackage.gemspec +0 -3
  113. data/dpl-hephy.gemspec +0 -3
  114. data/dpl-heroku.gemspec +0 -3
  115. data/dpl-lambda.gemspec +0 -3
  116. data/dpl-launchpad.gemspec +0 -3
  117. data/dpl-npm.gemspec +0 -3
  118. data/dpl-openshift.gemspec +0 -3
  119. data/dpl-ops_works.gemspec +0 -3
  120. data/dpl-packagecloud.gemspec +0 -3
  121. data/dpl-pages.gemspec +0 -3
  122. data/dpl-puppet_forge.gemspec +0 -3
  123. data/dpl-pypi.gemspec +0 -3
  124. data/dpl-releases.gemspec +0 -8
  125. data/dpl-rubygems.gemspec +0 -3
  126. data/dpl-s3.gemspec +0 -3
  127. data/dpl-scalingo.gemspec +0 -3
  128. data/dpl-script.gemspec +0 -3
  129. data/dpl-snap.gemspec +0 -3
  130. data/dpl-surge.gemspec +0 -3
  131. data/dpl-testfairy.gemspec +0 -3
  132. data/dpl-transifex.gemspec +0 -3
  133. data/dpl.gemspec +0 -3
  134. data/gemspec_helper.rb +0 -51
  135. data/lib/dpl/error.rb +0 -3
  136. data/notes/engine_yard.md +0 -1
  137. data/notes/heroku.md +0 -3
  138. data/spec/cli_spec.rb +0 -36
  139. data/spec/provider_spec.rb +0 -191
  140. data/spec/spec_helper.rb +0 -20
@@ -0,0 +1,6 @@
1
+ GStore::Client.class_eval do
2
+ def sign(str)
3
+ digest = OpenSSL::Digest.new('sha1') # use undeprecated constant
4
+ b64_hmac = Base64.encode64(OpenSSL::HMAC.digest(digest, @secret_key, str)).gsub("\n","")
5
+ end
6
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+ class Version
3
+ InvalidVersion = Class.new(ArgumentError)
4
+ InvalidRequire = Class.new(ArgumentError)
5
+
6
+ MSGS = {
7
+ version: 'Unable to parse version: %p',
8
+ require: 'Unable to parse requirement: %p',
9
+ }
10
+
11
+ VERSION = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/
12
+ REQUIRE = /^(~>|>|>=|=|!=|<=|<) (\d+(?:\.\d+)?(?:\.\d+)?)$/
13
+
14
+ include Comparable
15
+
16
+ def initialize(str)
17
+ @nums = split(str) || raise(InvalidVersion, MSGS[:version] % str)
18
+ end
19
+
20
+ def satisfies?(str)
21
+ send *parse(str) || raise(InvalidRequire, MSGS[:require] % str)
22
+ end
23
+
24
+ def size
25
+ nums.size
26
+ end
27
+
28
+ def to_a
29
+ nums
30
+ end
31
+
32
+ def to_s
33
+ nums.join('.')
34
+ end
35
+
36
+ def ==(other)
37
+ trunc(other.size).to_a == other.to_a
38
+ end
39
+
40
+ def !=(other)
41
+ trunc(other.size).to_a != other.to_a
42
+ end
43
+
44
+ def <=>(other)
45
+ to_a <=> other.to_a
46
+ end
47
+
48
+ define_method :'~>' do |min|
49
+ min = min.trunc(nums.size)
50
+ max = min.clone.bump
51
+ self >= min && self < max
52
+ end
53
+
54
+ def bump
55
+ ix = nums[1] ? -2 : -1
56
+ nums[ix] = nums[ix] + 1
57
+ nums[-1] = nums[-1] = 0 if nums[1]
58
+ self
59
+ end
60
+
61
+ def trunc(size)
62
+ @nums = nums[0..size - 1]
63
+ self
64
+ end
65
+
66
+ def clone
67
+ Version.new(to_s)
68
+ end
69
+
70
+ private
71
+
72
+ attr_reader :nums
73
+
74
+ def split(str)
75
+ str =~ VERSION && [$1, $2, $3].compact.map(&:to_i)
76
+ end
77
+
78
+ def parse(str)
79
+ op, version = str =~ REQUIRE && [$1, $2]
80
+ op = '==' if op == '='
81
+ [op, Version.new(version)] if op
82
+ end
83
+ end
data/lib/dpl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module DPL
2
- VERSION = '1.10.17.travis.6637.6'
1
+ module Dpl
2
+ VERSION = '2.0.0.alpha.1'
3
3
  end
metadata CHANGED
@@ -1,212 +1,140 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.17.travis.6637.6
4
+ version: 2.0.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
+ - Hiro Asari
9
+ - Sven Fuchs
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2020-11-16 00:00:00.000000000 Z
13
+ date: 2019-08-27 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
- name: rspec
16
+ name: cl
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
- - - ">="
19
+ - - "~>"
18
20
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec-its
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
21
+ version: '1.0'
22
+ type: :runtime
35
23
  prerelease: false
36
24
  version_requirements: !ruby/object:Gem::Requirement
37
25
  requirements:
38
- - - ">="
26
+ - - "~>"
39
27
  - !ruby/object:Gem::Version
40
- version: '0'
28
+ version: '1.0'
41
29
  - !ruby/object:Gem::Dependency
42
30
  name: rake
43
31
  requirement: !ruby/object:Gem::Requirement
44
32
  requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: json_pure
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: tins
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: coveralls
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: highline
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: term-ansicolor
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: faraday
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
33
+ - - "~>"
130
34
  - !ruby/object:Gem::Version
131
- version: '0'
35
+ version: '12.3'
132
36
  type: :development
133
37
  prerelease: false
134
38
  version_requirements: !ruby/object:Gem::Requirement
135
39
  requirements:
136
- - - ">="
40
+ - - "~>"
137
41
  - !ruby/object:Gem::Version
138
- version: '0'
139
- description: deploy tool abstraction for clients
140
- email: konstantin.mailinglists@googlemail.com
42
+ version: '12.3'
43
+ description: Dpl (dee-pee-ell) is a tool made for continuous deployment, running deployments
44
+ at Travis CI.
45
+ email:
46
+ - konstantin@travis-ci.com
47
+ - hiro@travis-ci.com
48
+ - sven@travis-ci.com
141
49
  executables:
142
50
  - dpl
143
51
  extensions: []
144
52
  extra_rdoc_files: []
145
53
  files:
146
- - ".coveralls.yml"
147
- - ".github/CONTRIBUTING.md"
148
- - ".github/stale.yml"
149
- - ".gitignore"
150
- - ".rspec"
151
- - ".travis.yml"
54
+ - CHANGELOG.md
152
55
  - CODE_OF_CONDUCT.md
56
+ - CONTRIBUTING.md
153
57
  - Gemfile
58
+ - Gemfile.lock
154
59
  - LICENSE
60
+ - NOTES.md
155
61
  - README.md
156
62
  - Rakefile
157
63
  - bin/dpl
158
- - dpl-anynines.gemspec
159
- - dpl-atlas.gemspec
160
- - dpl-azure_webapps.gemspec
161
- - dpl-bintray.gemspec
162
- - dpl-bitballoon.gemspec
163
- - dpl-bluemix_cloud_foundry.gemspec
164
- - dpl-boxfuse.gemspec
165
- - dpl-cargo.gemspec
166
- - dpl-catalyze.gemspec
167
- - dpl-chef_supermarket.gemspec
168
- - dpl-cloud66.gemspec
169
- - dpl-cloud_files.gemspec
170
- - dpl-cloud_foundry.gemspec
171
- - dpl-code_deploy.gemspec
172
- - dpl-deis.gemspec
173
- - dpl-elastic_beanstalk.gemspec
174
- - dpl-engine_yard.gemspec
175
- - dpl-firebase.gemspec
176
- - dpl-gae.gemspec
177
- - dpl-gcs.gemspec
178
- - dpl-hackage.gemspec
179
- - dpl-hephy.gemspec
180
- - dpl-heroku.gemspec
181
- - dpl-lambda.gemspec
182
- - dpl-launchpad.gemspec
183
- - dpl-npm.gemspec
184
- - dpl-openshift.gemspec
185
- - dpl-ops_works.gemspec
186
- - dpl-packagecloud.gemspec
187
- - dpl-pages.gemspec
188
- - dpl-puppet_forge.gemspec
189
- - dpl-pypi.gemspec
190
- - dpl-releases.gemspec
191
- - dpl-rubygems.gemspec
192
- - dpl-s3.gemspec
193
- - dpl-scalingo.gemspec
194
- - dpl-script.gemspec
195
- - dpl-snap.gemspec
196
- - dpl-surge.gemspec
197
- - dpl-testfairy.gemspec
198
- - dpl-transifex.gemspec
199
- - dpl.gemspec
200
- - gemspec_helper.rb
64
+ - lib/dpl.rb
65
+ - lib/dpl/assets/atlas/install
66
+ - lib/dpl/assets/dpl/README.erb.md
67
+ - lib/dpl/assets/dpl/git_ssh
68
+ - lib/dpl/assets/git/detect_private_key
69
+ - lib/dpl/assets/hephy/filter_log
70
+ - lib/dpl/assets/pypi/install
71
+ - lib/dpl/assets/scalingo/install
201
72
  - lib/dpl/cli.rb
202
- - lib/dpl/error.rb
73
+ - lib/dpl/ctx.rb
74
+ - lib/dpl/ctx/bash.rb
75
+ - lib/dpl/ctx/test.rb
76
+ - lib/dpl/helper/assets.rb
77
+ - lib/dpl/helper/cmd.rb
78
+ - lib/dpl/helper/config_file.rb
79
+ - lib/dpl/helper/env.rb
80
+ - lib/dpl/helper/interpolate.rb
81
+ - lib/dpl/helper/memoize.rb
82
+ - lib/dpl/helper/squiggle.rb
83
+ - lib/dpl/helper/zip.rb
203
84
  - lib/dpl/provider.rb
85
+ - lib/dpl/provider/dsl.rb
86
+ - lib/dpl/provider/examples.rb
87
+ - lib/dpl/provider/status.rb
88
+ - lib/dpl/providers.rb
89
+ - lib/dpl/providers/anynines.rb
90
+ - lib/dpl/providers/atlas.rb
91
+ - lib/dpl/providers/azure_web_apps.rb
92
+ - lib/dpl/providers/bintray.rb
93
+ - lib/dpl/providers/bluemixcloudfoundry.rb
94
+ - lib/dpl/providers/boxfuse.rb
95
+ - lib/dpl/providers/cargo.rb
96
+ - lib/dpl/providers/chef_supermarket.rb
97
+ - lib/dpl/providers/cloud66.rb
98
+ - lib/dpl/providers/cloudfiles.rb
99
+ - lib/dpl/providers/cloudfoundry.rb
100
+ - lib/dpl/providers/codedeploy.rb
101
+ - lib/dpl/providers/datica.rb
102
+ - lib/dpl/providers/elasticbeanstalk.rb
103
+ - lib/dpl/providers/engineyard.rb
104
+ - lib/dpl/providers/firebase.rb
105
+ - lib/dpl/providers/gae.rb
106
+ - lib/dpl/providers/gcs.rb
107
+ - lib/dpl/providers/hackage.rb
108
+ - lib/dpl/providers/hephy.rb
109
+ - lib/dpl/providers/heroku.rb
110
+ - lib/dpl/providers/heroku/api.rb
111
+ - lib/dpl/providers/heroku/git.rb
112
+ - lib/dpl/providers/lambda.rb
113
+ - lib/dpl/providers/launchpad.rb
114
+ - lib/dpl/providers/netlify.rb
115
+ - lib/dpl/providers/npm.rb
116
+ - lib/dpl/providers/openshift.rb
117
+ - lib/dpl/providers/opsworks.rb
118
+ - lib/dpl/providers/packagecloud.rb
119
+ - lib/dpl/providers/pages.rb
120
+ - lib/dpl/providers/pages/api.rb
121
+ - lib/dpl/providers/pages/git.rb
122
+ - lib/dpl/providers/puppetforge.rb
123
+ - lib/dpl/providers/pypi.rb
124
+ - lib/dpl/providers/releases.rb
125
+ - lib/dpl/providers/rubygems.rb
126
+ - lib/dpl/providers/s3.rb
127
+ - lib/dpl/providers/scalingo.rb
128
+ - lib/dpl/providers/script.rb
129
+ - lib/dpl/providers/snap.rb
130
+ - lib/dpl/providers/surge.rb
131
+ - lib/dpl/providers/testfairy.rb
132
+ - lib/dpl/providers/transifex.rb
133
+ - lib/dpl/support/aws_sdk_patch.rb
134
+ - lib/dpl/support/gems.rb
135
+ - lib/dpl/support/gstore_patch.rb
136
+ - lib/dpl/support/version.rb
204
137
  - lib/dpl/version.rb
205
- - notes/engine_yard.md
206
- - notes/heroku.md
207
- - spec/cli_spec.rb
208
- - spec/provider_spec.rb
209
- - spec/spec_helper.rb
210
138
  homepage: https://github.com/travis-ci/dpl
211
139
  licenses:
212
140
  - MIT
@@ -226,8 +154,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
154
  - !ruby/object:Gem::Version
227
155
  version: 1.3.1
228
156
  requirements: []
229
- rubygems_version: 3.0.8
157
+ rubyforge_project:
158
+ rubygems_version: 2.5.2.1
230
159
  signing_key:
231
160
  specification_version: 4
232
- summary: deploy tool
161
+ summary: Dpl runs deployments at Travis CI
233
162
  test_files: []
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
@@ -1,173 +0,0 @@
1
- # Writing a new deployment provider
2
-
3
- So you want to add a new deployment provider,
4
- fix a bug, or add a new feature to an
5
- existing provider.
6
-
7
- That's great.
8
-
9
- This document explains what you need to know in order
10
- to accomplish the goal.
11
-
12
- `dpl` is written in Ruby, and we assume that you have
13
- a good understanding of how it works.
14
-
15
- ## General structure of the `dpl` code base
16
-
17
- ### `lib/dpl/provider`
18
-
19
- Each provider code is a subclass of `DPL::Provider`,
20
- and it lives under `lib/dpl/provider`.
21
-
22
- ```
23
- lib
24
- └── dpl
25
- ├── cli.rb
26
- ├── error.rb
27
- ├── provider
28
- │   ├── anynines.rb
29
- │   ├── atlas.rb
30
- │   ├── azure_webapps.rb
31
- │   ├── bintray.rb
32
- │   ├── bitballoon.rb
33
- │   ├── ⋮
34
- ```
35
-
36
- `dpl` script will receive the provider name via `--provider`
37
- command-line option; e.g.,
38
-
39
- dpl --provider=script …
40
-
41
- and attempts to load it at run time.
42
-
43
- In order to make `dpl` be aware of a provider code, put the provider
44
- code in `lib/dpl/provider` and add a key-value pair to the `DPL::Provider::GEM_NAME_OF`
45
- hash in `lib/dpl/provider.rb`.
46
-
47
- For example:
48
-
49
- ```ruby
50
- module DPL
51
- class Provider
52
- GEM_NAME_OF = {
53
- 'NewProvider' => 'new_provider',
54
- }
55
- end
56
- end
57
- ```
58
-
59
- There is no standard for how the key and value are defined, but
60
- we generally recommend adhering to the snake-case naming;
61
- e.g., for the `CloudFoundry` class, the file (and the gem name) is
62
- `cloud_foundry`.
63
- (Please note that some existing provider codes violate this guideline.)
64
-
65
- #### Basic structure of the provider code
66
-
67
- When `dpl` loads the provider code, first it sets up dependencies
68
- (install `apt` packages, `npm` modules, etc.).
69
-
70
- Then the following methods on the provider code are invoked:
71
-
72
- 1. `#check_auth`: sets up (and ideally verifies) user credentials
73
- 1. `#check_app`: verify that the application is valid
74
- 1. `#push_app`: deploy the code
75
-
76
- If you are trying to implement support for a new provider and this basic
77
- flow does not suit your needs, be sure to seek help/advice.
78
-
79
- ### `spec/provider`
80
-
81
- `dpl` uses [RSpec](https://github.com/rspec) for tests.
82
- The specs reside in `spec/provider`, and each provider has the corresponding
83
- `*_spec.rb` file to hold specs.
84
-
85
- ## Testing new code locally
86
-
87
- To test it locally, first you need to write a corresponding `dpl-*.gemspec` file.
88
- You can write this file from scratch, or use the `gemspec_for` helper
89
- method, found in `gemspec_helper.rb`.
90
- We recommend the helper to ensure consistency.
91
- The important thing is that your new gem has a good runtime dependency, most
92
- notably on `dpl`.
93
-
94
- Once you have `dpl-*.gemspec`, you are ready to run specs. To do this,
95
- call `spec-*` Rake task.
96
-
97
- > This task (and others) are dynamically inferred from the presence of `dpl-*.gemspec`,
98
- > so there is no need for you to touch `Rakefile`.
99
-
100
- This Rake task builds and installs `dpl` and the provider gem from the local source,
101
- installs dependencies and runs the specs in `spec/provider/*_spec.rb`.
102
- For example, to run specs on the `s3` provider:
103
-
104
- $ bundle install
105
- $ rake spec-s3
106
-
107
- If you have other versions of `dpl` and `dpl-*` gems before running the Rake task,
108
- they may interfere with your tests.
109
-
110
- If you suspect this interference, be sure to uninstall them by
111
-
112
- $ gem uninstall -aIx dpl dpl-* # for appropriate provider(s)
113
-
114
- or
115
-
116
- $ rake clean
117
-
118
- to completely clean up the working directory.
119
-
120
- ### Testing a portion of specs
121
-
122
- The `spec-*` Rake tasks take an optional argument, which is passed on
123
- to `rspec` to indicate which lines to execute.
124
-
125
- For example:
126
-
127
- $ rake spec-s3["55"]
128
-
129
- ### Avoid making actual network calls
130
-
131
- Deployment code often interact with external services to do the job.
132
- It is tempting to make calls to external servers during the specs,
133
- but resist this temptation.
134
- Instead, mock the network calls and write specs that deal with different results.
135
- Assuming that the external resources are stable in their behavior,
136
- this will make the specs less susceptible to network issues.
137
-
138
- # Testing `dpl` in the context of Travis CI builds
139
-
140
- It is possible to test new deployment provider or new functionality
141
- of dpl when it is used from the Travis CI build script.
142
-
143
- To do so, add the following to your `.travis.yml`:
144
-
145
- ```yaml
146
- deploy:
147
- provider: X
148
- edge:
149
- source: myown/dpl
150
- branch: foo
151
- on:
152
- branch: TEST_BRANCH # or all_branches: true
153
- ⋮ # rest of provider X configuration
154
- ```
155
-
156
- This builds the `dpl` gem on the VM
157
- from `https://github.com/myown/dpl`, the `foo` branch.
158
- Then it installs the locally built gem,
159
- and uses that to deploy.
160
-
161
- Notice that this is not a merge commit, so it is important
162
- that when you are testing your PR, the branch `foo` is up-to-date
163
- with https://github.com/travis-ci/dpl/tree/master/.
164
-
165
- When opening a PR, be sure to run at least one deployment with the new configuration,
166
- and provide a link to the build in the PR.
167
-
168
- ## Automatic closure of old issues
169
-
170
- If an issue has been left open and untouched for 90 days or more, we automatically
171
- close them. We do this to ensure that new issues are more easily noticeable, and
172
- that old issues that have been resolved or are no longer relevant are closed.
173
- You can read more about this [here](https://blog.travis-ci.com/2018-03-09-closing-old-issues).