dpl 2.0.3.beta.4 → 2.0.3.beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +15 -3
  3. data/Gemfile.lock +444 -211
  4. data/Rakefile +36 -34
  5. data/bin/dpl +3 -1
  6. data/dpl.gemspec +25 -0
  7. data/lib/dpl/cli.rb +19 -14
  8. data/lib/dpl/ctx/bash.rb +18 -12
  9. data/lib/dpl/ctx/test.rb +21 -15
  10. data/lib/dpl/ctx.rb +2 -0
  11. data/lib/dpl/helper/assets.rb +4 -2
  12. data/lib/dpl/helper/cmd.rb +20 -18
  13. data/lib/dpl/helper/config_file.rb +5 -3
  14. data/lib/dpl/helper/cookbook_site_streaming_uploader.rb +249 -0
  15. data/lib/dpl/helper/env.rb +26 -22
  16. data/lib/dpl/helper/github.rb +2 -0
  17. data/lib/dpl/helper/interpolate.rb +8 -4
  18. data/lib/dpl/helper/memoize.rb +4 -1
  19. data/lib/dpl/helper/squiggle.rb +3 -1
  20. data/lib/dpl/helper/transliterate.rb +3 -1
  21. data/lib/dpl/helper/wrap.rb +3 -1
  22. data/lib/dpl/helper/zip.rb +3 -1
  23. data/lib/dpl/provider/dsl.rb +18 -4
  24. data/lib/dpl/provider/examples.rb +6 -2
  25. data/lib/dpl/provider/status.rb +26 -24
  26. data/lib/dpl/providers/anynines.rb +22 -20
  27. data/lib/dpl/providers/azure_web_apps.rb +21 -19
  28. data/lib/dpl/providers/bintray.rb +44 -37
  29. data/lib/dpl/providers/bluemixcloudfoundry.rb +38 -36
  30. data/lib/dpl/providers/boxfuse.rb +12 -10
  31. data/lib/dpl/providers/cargo.rb +7 -5
  32. data/lib/dpl/providers/chef_supermarket.rb +82 -80
  33. data/lib/dpl/providers/cloud66.rb +17 -15
  34. data/lib/dpl/providers/cloudfiles.rb +8 -6
  35. data/lib/dpl/providers/cloudformation.rb +191 -187
  36. data/lib/dpl/providers/cloudfoundry.rb +32 -30
  37. data/lib/dpl/providers/codedeploy.rb +35 -33
  38. data/lib/dpl/providers/convox.rb +32 -25
  39. data/lib/dpl/providers/datica.rb +30 -28
  40. data/lib/dpl/providers/ecr.rb +66 -64
  41. data/lib/dpl/providers/elasticbeanstalk.rb +14 -12
  42. data/lib/dpl/providers/engineyard.rb +60 -58
  43. data/lib/dpl/providers/firebase.rb +6 -4
  44. data/lib/dpl/providers/flynn.rb +8 -6
  45. data/lib/dpl/providers/gae.rb +28 -25
  46. data/lib/dpl/providers/gcs.rb +59 -57
  47. data/lib/dpl/providers/git_push.rb +199 -195
  48. data/lib/dpl/providers/gleis.rb +19 -17
  49. data/lib/dpl/providers/hackage.rb +15 -13
  50. data/lib/dpl/providers/hephy.rb +18 -16
  51. data/lib/dpl/providers/heroku/api.rb +72 -70
  52. data/lib/dpl/providers/heroku/git.rb +15 -13
  53. data/lib/dpl/providers/heroku.rb +40 -38
  54. data/lib/dpl/providers/lambda.rb +134 -134
  55. data/lib/dpl/providers/launchpad.rb +45 -43
  56. data/lib/dpl/providers/netlify.rb +7 -5
  57. data/lib/dpl/providers/npm.rb +61 -58
  58. data/lib/dpl/providers/nuget.rb +8 -6
  59. data/lib/dpl/providers/openshift.rb +8 -6
  60. data/lib/dpl/providers/opsworks.rb +23 -21
  61. data/lib/dpl/providers/pages/api.rb +14 -14
  62. data/lib/dpl/providers/pages/git.rb +53 -47
  63. data/lib/dpl/providers/pages.rb +3 -1
  64. data/lib/dpl/providers/puppetforge.rb +6 -4
  65. data/lib/dpl/providers/pypi.rb +55 -54
  66. data/lib/dpl/providers/releases.rb +30 -23
  67. data/lib/dpl/providers/rubygems.rb +35 -31
  68. data/lib/dpl/providers/s3.rb +148 -142
  69. data/lib/dpl/providers/scalingo.rb +18 -16
  70. data/lib/dpl/providers/script.rb +4 -2
  71. data/lib/dpl/providers/snap.rb +12 -9
  72. data/lib/dpl/providers/surge.rb +7 -5
  73. data/lib/dpl/providers/testfairy.rb +47 -43
  74. data/lib/dpl/providers/transifex.rb +20 -18
  75. data/lib/dpl/providers.rb +3 -1
  76. data/lib/dpl/string_ext.rb +3 -1
  77. data/lib/dpl/support/aws_sdk_patch.rb +4 -1
  78. data/lib/dpl/support/gems.rb +7 -3
  79. data/lib/dpl/support/gstore_patch.rb +3 -1
  80. data/lib/dpl/support/version.rb +13 -12
  81. data/lib/dpl/version.rb +3 -1
  82. data/lib/dpl.rb +2 -0
  83. data/status.json +237 -0
  84. metadata +32 -15
  85. /data/lib/dpl/providers/{packagecloud.rb → packagecloud.rb_} +0 -0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  # split this up to CodeDeploy::Github and CodeDeploy::S3 using the
@@ -9,12 +11,12 @@ module Dpl
9
11
 
10
12
  full_name 'AWS Code Deploy'
11
13
 
12
- description sq(<<-str)
14
+ description sq(<<-STR)
13
15
  tbd
14
- str
16
+ STR
15
17
 
16
18
  gem 'aws-sdk-codedeploy', '~> 1.0'
17
- gem 'aws-sdk-s3', '~> 1.0'
19
+ gem 'aws-sdk-s3', '~> 1'
18
20
 
19
21
  env :aws, :codedeploy
20
22
  config '~/.aws/credentials', '~/.aws/config', prefix: 'aws'
@@ -23,28 +25,28 @@ module Dpl
23
25
  opt '--secret_access_key KEY', 'AWS secret access key', required: true, secret: true
24
26
  opt '--application NAME', 'CodeDeploy application name', required: true
25
27
  opt '--deployment_group GROUP', 'CodeDeploy deployment group name'
26
- opt '--revision_type TYPE', 'CodeDeploy revision type', enum: %w(s3 github), downcase: true
28
+ opt '--revision_type TYPE', 'CodeDeploy revision type', enum: %w[s3 github], downcase: true
27
29
  opt '--commit_id SHA', 'Commit ID in case of GitHub'
28
30
  opt '--repository NAME', 'Repository name in case of GitHub'
29
31
  opt '--bucket NAME', 'S3 bucket in case of S3'
30
32
  opt '--region REGION', 'AWS availability zone', default: 'us-east-1'
31
- opt '--file_exists_behavior STR', 'How to handle files that already exist in a deployment target location', enum: %w(disallow overwrite retain), default: 'disallow'
33
+ opt '--file_exists_behavior STR', 'How to handle files that already exist in a deployment target location', enum: %w[disallow overwrite retain], default: 'disallow'
32
34
  opt '--wait_until_deployed', 'Wait until the deployment has finished'
33
35
  opt '--bundle_type TYPE', 'Bundle type of the revision'
34
36
  opt '--key KEY', 'S3 bucket key of the revision'
35
37
  opt '--description DESCR', 'Description of the revision', interpolate: true
36
38
  opt '--endpoint ENDPOINT', 'S3 endpoint url'
37
39
 
38
- msgs login: 'Using Access Key: %{access_key_id}',
39
- deploy_triggered: 'Deployment triggered: %s',
40
- register_revision: 'Registering app revision with version=%s, etag=%s',
41
- waiting_for_deploy: 'Waiting for the deployment to finish ',
42
- finished_deploy: 'done: %s.',
43
- description: 'Deploy build %{build_number} via Travis CI',
44
- missing_bucket: 'Missing required bucket for S3 deployment',
45
- missing_key: 'Missing required key for S3 deployment',
40
+ msgs login: 'Using Access Key: %{access_key_id}',
41
+ deploy_triggered: 'Deployment triggered: %s',
42
+ register_revision: 'Registering app revision with version=%s, etag=%s',
43
+ waiting_for_deploy: 'Waiting for the deployment to finish ',
44
+ finished_deploy: 'done: %s.',
45
+ description: 'Deploy build %{build_number} via Travis CI',
46
+ missing_bucket: 'Missing required bucket for S3 deployment',
47
+ missing_key: 'Missing required key for S3 deployment',
46
48
  unknown_revision_type: 'Unknown revision type %p',
47
- unknown_bundle_type: 'Unknown bundle type'
49
+ unknown_bundle_type: 'Unknown bundle type'
48
50
 
49
51
  vars :build_number
50
52
 
@@ -64,18 +66,18 @@ module Dpl
64
66
  def register_revision
65
67
  info :register_revision, revision_info[:version], revision_info[:e_tag]
66
68
  code_deploy.register_application_revision(
67
- revision: revision,
69
+ revision:,
68
70
  application_name: application,
69
- description: description
71
+ description:
70
72
  )
71
73
  end
72
74
 
73
75
  def create_deployment
74
76
  deployment = code_deploy.create_deployment(
75
- revision: revision,
77
+ revision:,
76
78
  application_name: application,
77
79
  deployment_group_name: deployment_group,
78
- description: description,
80
+ description:,
79
81
  file_exists_behavior: file_exists_behavior.upcase
80
82
  )
81
83
  deployment.deployment_id
@@ -83,7 +85,7 @@ module Dpl
83
85
 
84
86
  def wait_until_deployed(id)
85
87
  print :waiting_for_deploy
86
- status = poll(id) until %w(Succeeded Failed Stopped).include?(status)
88
+ status = poll(id) until %w[Succeeded Failed Stopped].include?(status)
87
89
  case status
88
90
  when 'Succeeded'
89
91
  info :finished_deploy, status
@@ -104,28 +106,28 @@ module Dpl
104
106
 
105
107
  def revision
106
108
  @revision ||= case revision_type
107
- when 's3' then s3_revision
108
- when 'github' then github_revision
109
- when nil then bucket? ? s3_revision : github_revision
110
- else error :unknown_revision_type, revision_type
111
- end
109
+ when 's3' then s3_revision
110
+ when 'github' then github_revision
111
+ when nil then bucket? ? s3_revision : github_revision
112
+ else error :unknown_revision_type, revision_type
113
+ end
112
114
  end
113
115
 
114
116
  def s3_revision
115
117
  {
116
118
  revision_type: 'S3',
117
119
  s3_location: compact(
118
- bucket: bucket,
119
- bundle_type: bundle_type,
120
+ bucket:,
121
+ bundle_type:,
120
122
  version: revision_version_info[:version_id],
121
123
  e_tag: revision_version_info[:etag],
122
- key: key,
124
+ key:
123
125
  )
124
126
  }
125
127
  end
126
128
 
127
129
  def revision_version_info
128
- s3.head_object(bucket: bucket, key: key)
130
+ s3.head_object(bucket:, key:)
129
131
  rescue Aws::Errors::ServiceError => e
130
132
  error e.message
131
133
  end
@@ -134,8 +136,8 @@ module Dpl
134
136
  {
135
137
  revision_type: 'GitHub',
136
138
  git_hub_location: {
137
- commit_id: commit_id,
138
- repository: repository
139
+ commit_id:,
140
+ repository:
139
141
  }
140
142
  }
141
143
  end
@@ -157,11 +159,11 @@ module Dpl
157
159
  end
158
160
 
159
161
  def bundle_type
160
- super || key =~ /\.(tar|tgz|zip)$/ && $1 || error(:unknown_bundle_type)
162
+ super || key =~ /\.(tar|tgz|zip)$/ && ::Regexp.last_match(1) || error(:unknown_bundle_type)
161
163
  end
162
164
 
163
165
  def description
164
- interpolate(super || msg(:description), vars: vars)
166
+ interpolate(super || msg(:description), vars:)
165
167
  end
166
168
 
167
169
  def build_number
@@ -177,7 +179,7 @@ module Dpl
177
179
  end
178
180
 
179
181
  def client_options
180
- compact(region: region, credentials: credentials, endpoint: endpoint)
182
+ compact(region:, credentials:, endpoint:)
181
183
  end
182
184
 
183
185
  def credentials
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Convox < Provider
@@ -5,9 +7,9 @@ module Dpl
5
7
 
6
8
  status :dev
7
9
 
8
- description sq(<<-str)
10
+ description sq(<<-STR)
9
11
  tbd
10
- str
12
+ STR
11
13
 
12
14
  gem 'json'
13
15
 
@@ -30,21 +32,21 @@ module Dpl
30
32
  opt '--prepare CMDS', 'Run commands with convox cli available just before deployment', type: :array
31
33
 
32
34
  # if app and rack are exported to the env, do they need to be passed to these commands?
33
- cmds login: 'convox version --rack %{rack}',
35
+ cmds login: 'convox version --rack %{rack}',
34
36
  validate: 'convox apps info --rack %{rack} --app %{app}',
35
- create: 'convox apps create %{app} --generation %{generation} --rack %{rack} --wait',
36
- update: 'convox update',
37
- set_env: 'convox env set %{env} --rack %{rack} --app %{app} --replace',
38
- build: 'convox build --rack %{rack} --app %{app} --id --description %{escaped_description}',
39
- deploy: 'convox deploy --rack %{rack} --app %{app} --wait --id --description %{escaped_description}'
40
-
41
- msgs create: 'Application %{app} does not exist on rack %{rack}. Creating it ...',
42
- missing: 'Application %{app} does not exist on rack %{rack}.',
37
+ create: 'convox apps create %{app} --generation %{generation} --rack %{rack} --wait',
38
+ update: 'convox update',
39
+ set_env: 'convox env set %{env} --rack %{rack} --app %{app} --replace',
40
+ build: 'convox build --rack %{rack} --app %{app} --id --description %{escaped_description}',
41
+ deploy: 'convox deploy --rack %{rack} --app %{app} --wait --id --description %{escaped_description}'
42
+
43
+ msgs create: 'Application %{app} does not exist on rack %{rack}. Creating it ...',
44
+ missing: 'Application %{app} does not exist on rack %{rack}.',
43
45
  env_file: 'The given env_file does not exist.',
44
- deploy: 'Building and promoting application ...',
45
- build: 'Building application ...'
46
+ deploy: 'Building and promoting application ...',
47
+ build: 'Building application ...'
46
48
 
47
- errs login: 'Login failed.'
49
+ errs login: 'Login failed.'
48
50
 
49
51
  def install
50
52
  script :install
@@ -86,23 +88,28 @@ module Dpl
86
88
 
87
89
  def env_file
88
90
  return [] unless env_file?
91
+
89
92
  error :env_file unless file?(super)
90
93
  lines = read(super).split("\n").map(&:strip)
91
94
  lines.reject(&:empty?)
92
95
  end
93
96
 
94
97
  def description
95
- description? ? super : JSON.dump(
96
- repo_slug: repo_slug,
97
- git_commit_sha: git_sha,
98
- git_commit_message: git_commit_msg,
99
- git_commit_author: git_author_name,
100
- git_tag: git_tag,
101
- branch: git_branch,
102
- travis_build_id: ENV['TRAVIS_BUILD_ID'],
103
- travis_build_number: ENV['TRAVIS_BUILD_NUMBER'],
104
- pull_request: ENV['TRAVIS_PULL_REQUEST']
105
- )
98
+ if description?
99
+ super
100
+ else
101
+ JSON.dump(
102
+ repo_slug:,
103
+ git_commit_sha: git_sha,
104
+ git_commit_message: git_commit_msg,
105
+ git_commit_author: git_author_name,
106
+ git_tag:,
107
+ branch: git_branch,
108
+ travis_build_id: ENV['TRAVIS_BUILD_ID'],
109
+ travis_build_number: ENV['TRAVIS_BUILD_NUMBER'],
110
+ pull_request: ENV['TRAVIS_PULL_REQUEST']
111
+ )
112
+ end
106
113
  end
107
114
 
108
115
  def export
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Datica < Provider
@@ -7,9 +9,9 @@ module Dpl
7
9
 
8
10
  register :datica, :catalyze
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  tbd
12
- str
14
+ STR
13
15
 
14
16
  env :datica, :catalyze
15
17
 
@@ -19,12 +21,12 @@ module Dpl
19
21
  needs :git
20
22
 
21
23
  cmds checkout: 'git checkout HEAD',
22
- add: 'git add %{path} --all --force',
23
- commit: 'git commit -m "%{message}" --quiet',
24
- push: 'git push --force %{target} HEAD:master'
24
+ add: 'git add %{path} --all --force',
25
+ commit: 'git commit -m "%{message}" --quiet',
26
+ push: 'git push --force %{target} HEAD:master'
25
27
 
26
- msgs commit: 'Committing build files for deployment',
27
- push: 'Deploying to Datica: %{target}'
28
+ msgs commit: 'Committing build files for deployment',
29
+ push: 'Deploying to Datica: %{target}'
28
30
 
29
31
  def setup
30
32
  commit if git_dirty? && !cleanup?
@@ -36,27 +38,27 @@ module Dpl
36
38
 
37
39
  private
38
40
 
39
- def commit
40
- info :commit
41
- shell :checkout
42
- shell :add
43
- shell :commit
44
- end
45
-
46
- def message
47
- vars.empty? ? 'Local build' : 'Build #%s (%s) of %s@%s' % vars
48
- end
49
-
50
- VARS = %w(
51
- TRAVIS_BUILD_NUMBER
52
- TRAVIS_COMMIT
53
- TRAVIS_REPO_SLUG
54
- TRAVIS_BRANCH
55
- )
56
-
57
- def vars
58
- @vars ||= ENV.values_at(*VARS).compact
59
- end
41
+ def commit
42
+ info :commit
43
+ shell :checkout
44
+ shell :add
45
+ shell :commit
46
+ end
47
+
48
+ def message
49
+ vars.empty? ? 'Local build' : 'Build #%s (%s) of %s@%s' % vars
50
+ end
51
+
52
+ VARS = %w[
53
+ TRAVIS_BUILD_NUMBER
54
+ TRAVIS_COMMIT
55
+ TRAVIS_REPO_SLUG
56
+ TRAVIS_BRANCH
57
+ ].freeze
58
+
59
+ def vars
60
+ @vars ||= ENV.values_at(*VARS).compact
61
+ end
60
62
  end
61
63
  end
62
64
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Ecr < Provider
@@ -5,9 +7,9 @@ module Dpl
5
7
 
6
8
  full_name 'AWS ECR'
7
9
 
8
- description sq(<<-str)
10
+ description sq(<<-STR)
9
11
  tbd
10
- str
12
+ STR
11
13
 
12
14
  gem 'aws-sdk-ecr', '~> 1.0'
13
15
  # gem 'docker-api', '~> 1.34'
@@ -22,14 +24,14 @@ module Dpl
22
24
  opt '--target TARGET', 'Comma separated list of partial repository names to push to', eg: 'image-one:tag,image-two', required: true
23
25
  opt '--region REGION', 'Comma separated list of regions to push to', default: 'us-east-1'
24
26
 
25
- msgs login: 'Using Access Key: %{access_key_id}',
26
- auth_region: 'Authenticated with %{url}',
27
- deploy: 'Pushing image %{source} to regions %{regions} as %{targets}',
27
+ msgs login: 'Using Access Key: %{access_key_id}',
28
+ auth_region: 'Authenticated with %{url}',
29
+ deploy: 'Pushing image %{source} to regions %{regions} as %{targets}',
28
30
  image_pushed: 'Pushed image %{source} to region %{region} as %{target}'
29
31
 
30
32
  cmds login: 'docker login -u %{user} -p %{pass} %{url}',
31
- tag: 'docker tag %{source} %{url}/%{repo}:%{tag}',
32
- push: 'docker push %{url}/%{repo}'
33
+ tag: 'docker tag %{source} %{url}/%{repo}:%{tag}',
34
+ push: 'docker push %{url}/%{repo}'
33
35
 
34
36
  errs unknown_image: 'Image %{source} not found in the local Docker repository'
35
37
 
@@ -41,7 +43,7 @@ module Dpl
41
43
  end
42
44
 
43
45
  def validate
44
- # TODO validate the image exists locally
46
+ # TODO: validate the image exists locally
45
47
  end
46
48
 
47
49
  def deploy
@@ -53,75 +55,75 @@ module Dpl
53
55
 
54
56
  private
55
57
 
56
- def push(region, target)
57
- url, repo, tag = endpoints[region], *target.split(':')
58
- shell :tag, url: url, repo: repo, tag: tag || 'latest'
59
- shell :push, url: url, repo: repo
60
- info :image_pushed, region: region, target: target
61
- end
58
+ def push(region, target)
59
+ url, repo, tag = endpoints[region], *target.split(':')
60
+ shell :tag, url:, repo:, tag: tag || 'latest'
61
+ shell(:push, url:, repo:)
62
+ info :image_pushed, region:, target:
63
+ end
62
64
 
63
- def auth_regions
64
- @endpoints = regions.map { |region| [region, auth_region(region)] }.to_h
65
- end
65
+ def auth_regions
66
+ @endpoints = regions.map { |region| [region, auth_region(region)] }.to_h
67
+ end
66
68
 
67
- def auth_region(region)
68
- token = auth_token(region)
69
- user, pass = parse_auth(token.authorization_token)
70
- url = token.proxy_endpoint
71
- shell :login, user: user, pass: pass, url: url, echo: false, silent: true
72
- info :auth_region, url: url
73
- strip_protocol(url)
74
- end
69
+ def auth_region(region)
70
+ token = auth_token(region)
71
+ user, pass = parse_auth(token.authorization_token)
72
+ url = token.proxy_endpoint
73
+ shell :login, user:, pass:, url:, echo: false, silent: true
74
+ info(:auth_region, url:)
75
+ strip_protocol(url)
76
+ end
75
77
 
76
- def auth_token(region)
77
- ecr(region).get_authorization_token(registry_ids).authorization_data[0]
78
- end
78
+ def auth_token(region)
79
+ ecr(region).get_authorization_token(registry_ids).authorization_data[0]
80
+ end
79
81
 
80
- def registry_ids
81
- account_id? ? { registry_ids: [account_id] } : {}
82
- end
82
+ def registry_ids
83
+ account_id? ? { registry_ids: [account_id] } : {}
84
+ end
83
85
 
84
- def regions
85
- # not sure how this was meant to be normalized when being a YAML list
86
- region.split(',')
87
- end
86
+ def regions
87
+ # not sure how this was meant to be normalized when being a YAML list
88
+ region.split(',')
89
+ end
88
90
 
89
- def targets
90
- # not sure how this was meant to be normalized when being a YAML list
91
- target.split(',')
92
- end
91
+ def targets
92
+ # not sure how this was meant to be normalized when being a YAML list
93
+ target.split(',')
94
+ end
93
95
 
94
- def creds
95
- @creds ||= only(opts, :access_key_id, :secret_access_key)
96
- end
96
+ def creds
97
+ @creds ||= only(opts, :access_key_id, :secret_access_key)
98
+ end
97
99
 
98
- def ecr(region)
99
- Aws::ECR::Client.new(region: region, **creds)
100
- end
100
+ def ecr(region)
101
+ Aws::ECR::Client.new(region:, **creds)
102
+ end
101
103
 
102
- def parse_auth(str)
103
- user, pass = Base64.decode64(str).split(':')
104
- [user, pass.chomp]
105
- end
104
+ def parse_auth(str)
105
+ user, pass = Base64.decode64(str).split(':')
106
+ [user, pass.chomp]
107
+ end
106
108
 
107
- def strip_protocol(url)
108
- url.sub(/^https?:\/\//, '')
109
- end
109
+ def strip_protocol(url)
110
+ url.sub(%r{^https?://}, '')
111
+ end
110
112
 
111
- def progress(events)
112
- events.split("\r\n").each do |event|
113
- event = JSON.parse(event)
114
- if e = event['error']
115
- error e
116
- elsif %w(Preparing Pushing).include?(event['status'])
117
- nil
118
- elsif event['id']
119
- info "#{event['status']} [#{event['id']}]"
120
- elsif event['status']
121
- info event['status']
122
- end
113
+ def progress(events)
114
+ events.split("\r\n").each do |event|
115
+ event = JSON.parse(event)
116
+ if e = event['error']
117
+ error e
118
+ elsif %w[Preparing Pushing].include?(event['status'])
119
+ nil
120
+ elsif event['id']
121
+ info "#{event['status']} [#{event['id']}]"
122
+ elsif event['status']
123
+ info event['status']
123
124
  end
124
125
  end
126
+ end
125
127
  end
126
128
  end
127
129
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Elasticbeanstalk < Provider
@@ -7,7 +9,7 @@ module Dpl
7
9
 
8
10
  full_name 'AWS Elastic Beanstalk'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  Deploy to AWS Elastic Beanstalk: https://aws.amazon.com/elasticbeanstalk/
12
14
 
13
15
  This provider:
@@ -16,12 +18,12 @@ module Dpl
16
18
  * Uploads it to your EB application
17
19
  * Optionally deploys to a specific EB environment
18
20
  * Optionally waits until the deployment finishes
19
- str
21
+ STR
20
22
 
21
- gem 'aws-sdk-elasticbeanstalk', '~> 1.0'
22
- gem 'aws-sdk-s3', '~> 1.0'
23
- gem 'rubyzip', '~> 1.2.2', require: 'zip'
24
- gem 'pathspec', '~> 0.2.1', require: 'pathspec'
23
+ gem 'aws-sdk-elasticbeanstalk', '~> 1'
24
+ gem 'aws-sdk-s3', '~> 1'
25
+ gem 'rubyzip', '~> 2.3', require: 'zip'
26
+ gem 'pathspec', '~> 1.1', require: 'pathspec'
25
27
 
26
28
  env :aws, :elastic_beanstalk
27
29
  config '~/.aws/credentials', '~/.aws/config', prefix: 'aws'
@@ -40,7 +42,7 @@ module Dpl
40
42
  opt '--wait_until_deployed_timeout SEC', 'How many seconds to wait for Elastic Beanstalk deployment update.', type: :integer, default: 600
41
43
  opt '--debug', internal: true
42
44
 
43
- msgs login: 'Using Access Key: %{access_key_id}',
45
+ msgs login: 'Using Access Key: %{access_key_id}',
44
46
  zip_add: 'Adding %s'
45
47
 
46
48
  msgs clean_description: 'Removed non-printable characters from the version description'
@@ -53,7 +55,7 @@ module Dpl
53
55
 
54
56
  def setup
55
57
  info :login
56
- Aws.config.update(credentials: credentials, region: region)
58
+ Aws.config.update(credentials:, region:)
57
59
  end
58
60
 
59
61
  def deploy
@@ -82,7 +84,7 @@ module Dpl
82
84
  end
83
85
 
84
86
  def bucket_path
85
- bucket_path? ? "#{super.gsub(/\/*$/, '')}/#{archive_name}" : archive_name
87
+ bucket_path? ? "#{super.gsub(%r{/*$}, '')}/#{archive_name}" : archive_name
86
88
  end
87
89
 
88
90
  def cwd
@@ -90,7 +92,7 @@ module Dpl
90
92
  end
91
93
 
92
94
  def zip_exists?
93
- File.exists?(zip_file)
95
+ File.exist?(zip_file)
94
96
  end
95
97
 
96
98
  def create_zip
@@ -150,7 +152,7 @@ module Dpl
150
152
 
151
153
  def files
152
154
  files = Dir.glob('**/*', File::FNM_DOTMATCH)
153
- ignore = %w(.ebignore .gitignore).detect { |file| file?(file) }
155
+ ignore = %w[.ebignore .gitignore].detect { |file| file?(file) }
154
156
  files = filter(files, ignore) if ignore
155
157
  files
156
158
  end
@@ -198,7 +200,7 @@ module Dpl
198
200
  end
199
201
 
200
202
  def debug(*args)
201
- info *args if debug?
203
+ info(*args) if debug?
202
204
  end
203
205
  end
204
206
  end