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
  class Nuget < Provider
@@ -5,9 +7,9 @@ module Dpl
5
7
 
6
8
  full_name 'nuget'
7
9
 
8
- description sq(<<-str)
10
+ description sq(<<-STR)
9
11
  tbd
10
- str
12
+ STR
11
13
 
12
14
  env :nuget, :dotnet
13
15
 
@@ -18,7 +20,7 @@ module Dpl
18
20
  opt '--skip_duplicate', 'Do not overwrite existing packages'
19
21
 
20
22
  msgs login: 'Authenticating with API key %{api_key}',
21
- push: 'Pushing package %{src} to %{registry}'
23
+ push: 'Pushing package %{src} to %{registry}'
22
24
 
23
25
  cmds push: 'dotnet nuget push %{src} -k %{api_key} -s %{registry} %{push_opts}'
24
26
 
@@ -31,9 +33,9 @@ module Dpl
31
33
 
32
34
  private
33
35
 
34
- def push_opts
35
- opts_for(%i(no_symbols skip_duplicate), dashed: true)
36
- end
36
+ def push_opts
37
+ opts_for(%i[no_symbols skip_duplicate], dashed: true)
38
+ end
37
39
  end
38
40
  end
39
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Openshift < Provider
@@ -7,9 +9,9 @@ module Dpl
7
9
 
8
10
  full_name 'OpenShift'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  tbd
12
- str
14
+ STR
13
15
 
14
16
  env :openshift
15
17
 
@@ -19,14 +21,14 @@ module Dpl
19
21
  opt '--app APP', 'OpenShift application', default: :repo_name
20
22
 
21
23
  cmds install: 'curl %{URL} | tar xz',
22
- login: './oc login --token=%{token} --server=%{server}',
24
+ login: './oc login --token=%{token} --server=%{server}',
23
25
  prepare: './oc project %{project}',
24
- deploy: './oc start-build %{app} --follow --commit %{git_sha}'
26
+ deploy: './oc start-build %{app} --follow --commit %{git_sha}'
25
27
 
26
28
  errs install: 'CLI tool installation failed',
27
- login: 'Authentication failed',
29
+ login: 'Authentication failed',
28
30
  prepare: 'Unable to select project %{project}',
29
- deploy: 'Deployment failed'
31
+ deploy: 'Deployment failed'
30
32
 
31
33
  URL = 'https://mirror.openshift.com/pub/openshift-v4/clients/oc/4.1/linux/oc.tar.gz'
32
34
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Opsworks < Provider
@@ -7,9 +9,9 @@ module Dpl
7
9
 
8
10
  full_name 'AWS OpsWorks'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  tbd
12
- str
14
+ STR
13
15
 
14
16
  gem 'aws-sdk-opsworks', '~> 1.0'
15
17
 
@@ -27,17 +29,17 @@ module Dpl
27
29
  opt '--update_on_success', 'When wait-until-deployed and updated-on-success are both not given, application source is updated to the current SHA. Ignored when wait-until-deployed is not given.', alias: :update_app_on_success
28
30
  opt '--custom_json JSON', 'Custom json options override (overwrites default configuration)'
29
31
 
30
- msgs login: 'Using Access Key: %{access_key_id}',
32
+ msgs login: 'Using Access Key: %{access_key_id}',
31
33
  create_deploy: 'Creating deployment ... ',
32
- done: 'Done: %s',
33
- waiting: 'Deploying ',
34
- failed: 'Failed.',
35
- success: 'Success.',
36
- update_app: 'Updating application source branch/revision setting.',
34
+ done: 'Done: %s',
35
+ waiting: 'Deploying ',
36
+ failed: 'Failed.',
37
+ success: 'Success.',
38
+ update_app: 'Updating application source branch/revision setting.',
37
39
  app_not_found: 'App %s not found.',
38
- timeout: 'Timeout: failed to finish deployment within 10 minutes.',
40
+ timeout: 'Timeout: failed to finish deployment within 10 minutes.',
39
41
  service_error: 'Deployment failed. OpsWorks service error: %s',
40
- comment: 'Deploy build %{build_number} via Travis CI'
42
+ comment: 'Deploy build %{build_number} via Travis CI'
41
43
 
42
44
  def login
43
45
  info :login
@@ -58,13 +60,13 @@ module Dpl
58
60
 
59
61
  def deploy_config
60
62
  compact(
61
- stack_id: stack_id,
62
- app_id: app_id,
63
+ stack_id:,
64
+ app_id:,
63
65
  command: { name: 'deploy' },
64
- comment: comment,
65
- custom_json: custom_json,
66
- instance_ids: instance_ids,
67
- layer_ids: layer_ids
66
+ comment:,
67
+ custom_json:,
68
+ instance_ids:,
69
+ layer_ids:
68
70
  )
69
71
  end
70
72
 
@@ -89,9 +91,9 @@ module Dpl
89
91
 
90
92
  def update_config
91
93
  {
92
- app_id: app_id,
94
+ app_id:,
93
95
  app_source: {
94
- revision: git_sha,
96
+ revision: git_sha
95
97
  }
96
98
  }
97
99
  end
@@ -118,7 +120,7 @@ module Dpl
118
120
 
119
121
  def describe_app
120
122
  data = opsworks.describe_apps(app_ids: [app_id])
121
- error :app_not_found, app_id unless data[:apps] && data[:apps].any?
123
+ error :app_not_found, app_id unless data[:apps]&.any?
122
124
  data[:apps].first
123
125
  end
124
126
 
@@ -127,7 +129,7 @@ module Dpl
127
129
  end
128
130
 
129
131
  def opsworks
130
- @opsworks ||= Aws::OpsWorks::Client.new(region: region, credentials: credentials)
132
+ @opsworks ||= Aws::OpsWorks::Client.new(region:, credentials:)
131
133
  end
132
134
 
133
135
  def credentials
@@ -135,7 +137,7 @@ module Dpl
135
137
  end
136
138
 
137
139
  def timeout(sec, &block)
138
- Timeout::timeout(sec, &block)
140
+ Timeout.timeout(sec, &block)
139
141
  rescue Timeout::Error
140
142
  error :timeout
141
143
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'timeout'
2
4
 
3
5
  module Dpl
@@ -16,13 +18,13 @@ module Dpl
16
18
  TIMEOUTS = {
17
19
  timeout: 180,
18
20
  open_timeout: 180
19
- }
21
+ }.freeze
20
22
 
21
- gem 'octokit', '~> 4.15.0'
23
+ gem 'octokit', '~> 7'
22
24
 
23
25
  full_name 'GitHub Pages (API)'
24
26
 
25
- description sq(<<-str)
27
+ description sq(<<-STR)
26
28
  This provider requests GitHub Pages build for the repository given by
27
29
  the `--repo` flag, or the current one, if the flag is not given.
28
30
  Note that `dpl` does not perform any check about the fitness of the request;
@@ -31,18 +33,18 @@ module Dpl
31
33
  For example, if your GitHub Pages is configured to use `gh-pages` but the
32
34
  deployment is run on the `master` branch, you would have to ensure that the
33
35
  `gh-pages` would be updated accordingly during the build.
34
- str
36
+ STR
35
37
 
36
38
  opt '--repo SLUG', 'GitHub repo slug', default: :repo_slug
37
39
  opt '--token TOKEN', 'GitHub oauth token with repo permission', required: true, secret: true, alias: :github_token
38
40
 
39
- msgs not_found: sq(<<-msg),
41
+ msgs not_found: sq(<<-MSG),
40
42
  GitHub Pages not found for %{slug}.
41
43
  Either the given token has insufficient scope (repo or public_repo), or
42
44
  GitHub Pages is not enabled for this repo (see https://github.com/%{slug}/settings)'
43
- msg
45
+ MSG
44
46
  timeout: 'GitHub Pages build request timed out',
45
- deploy: 'Requesting GitHub Pages build using API'
47
+ deploy: 'Requesting GitHub Pages build using API'
46
48
 
47
49
  def validate
48
50
  error :not_found unless pages_enabled?
@@ -56,7 +58,7 @@ module Dpl
56
58
  response = api.pages slug
57
59
  logger.debug response
58
60
 
59
- Timeout::timeout(30) do
61
+ Timeout.timeout(30) do
60
62
  until response.status == 'built'
61
63
  response = api.pages slug
62
64
  logger.debug response
@@ -71,10 +73,9 @@ module Dpl
71
73
 
72
74
  info "Pages deployed to #{response.html_url}, using commit #{latest_pages_build.commit}"
73
75
  logger.debug latest_pages_build
74
-
75
- rescue Octokit::Forbidden => fb
76
- error fb.message
77
- rescue Timeout::Error => to
76
+ rescue Octokit::Forbidden => e
77
+ error e.message
78
+ rescue Timeout::Error
78
79
  error :timeout
79
80
  end
80
81
 
@@ -96,10 +97,9 @@ module Dpl
96
97
 
97
98
  def pages_enabled?
98
99
  api.pages slug
99
- rescue Octokit::NotFound => e
100
+ rescue Octokit::NotFound
100
101
  false
101
102
  end
102
-
103
103
  end
104
104
  end
105
105
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Pages
@@ -8,12 +10,12 @@ module Dpl
8
10
 
9
11
  full_name 'GitHub Pages'
10
12
 
11
- description sq(<<-str)
13
+ description sq(<<-STR)
12
14
  tbd
13
- str
15
+ STR
14
16
 
15
- gem 'octokit', '~> 4.15.0'
16
- gem 'public_suffix', '~> 3.0.3'
17
+ gem 'octokit', '~> 7'
18
+ gem 'public_suffix', '~> 5'
17
19
 
18
20
  required :token, :deploy_key
19
21
 
@@ -36,45 +38,45 @@ module Dpl
36
38
 
37
39
  needs :git
38
40
 
39
- msgs login: 'Authenticated as %s',
40
- invalid_token: 'The provided GitHub token is invalid (error: %s)',
41
+ msgs login: 'Authenticated as %s',
42
+ invalid_token: 'The provided GitHub token is invalid (error: %s)',
41
43
  insufficient_scopes: 'Dpl does not have permission to access %{url} using the provided GitHub token. Please make sure the token have the repo or public_repo scope.',
42
- setup_deploy_key: 'Moving deploy key %{deploy_key} to %{path}',
43
- check_deploy_key: 'Checking deploy key',
44
- deploy: 'Deploying branch %{target_branch} to %{url}',
45
- keep_history: 'The deployment is configured to preserve the target branch if it exists on remote.',
46
- work_dir: 'Using temporary work directory %{work_dir}',
47
- committer_from_gh: 'The repo is configured to use committer user and email.',
48
- setup_dir: 'The source dir for deployment is %s',
49
- git_clone: 'Cloning the branch %{target_branch} from the remote repo',
50
- git_init: 'Initializing local git repo',
51
- git_checkout: 'Checking out orphan branch %{target_branch}',
52
- copy_files: 'Copying %{src_dir} contents to %{work_dir}',
53
- git_config: 'Configuring git committer to be %{name} <%{email}>',
54
- prepare: 'Preparing to deploy %{target_branch} branch to gh-pages',
55
- git_push: 'Pushing to %{url}',
56
- stop: 'There are no changes to commit, stopping.'
57
-
58
- cmds git_clone: 'git clone --quiet --branch="%{target_branch}" --depth=1 "%{remote_url}" . > /dev/null 2>&1',
59
- git_init: 'git init .',
60
- git_checkout: 'git checkout --orphan "%{target_branch}"',
61
- check_deploy_key: 'ssh -i %{key} -T git@%{url} 2>&1 | grep successful > /dev/null',
62
- copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" .',
63
- git_config_email: 'git config user.email %{quoted_email}',
64
- git_config_name: 'git config user.name %{quoted_name}',
65
- deployment_file: 'touch "deployed at %{now} by %{name}"',
66
- cname: 'echo "%{fqdn}" > CNAME',
67
- git_add: 'git add -A .',
68
- git_commit_hook: 'cp %{path} .git/hooks/pre-commit',
69
- git_commit: 'git commit %{git_commit_opts} -q %{git_commit_msg_opts}',
70
- git_show: 'git show --stat-count=10 HEAD',
71
- git_push: 'git push%{git_push_opts} --quiet "%{remote_url}" "%{target_branch}":"%{target_branch}" > /dev/null 2>&1'
72
-
73
- errs copy_files: 'Failed to copy %{src_dir}.',
74
- check_deploy_key: 'Failed to authenticate using the deploy key',
75
- git_init: 'Failed to create new git repo',
76
- git_checkout: 'Failed to create the orphan branch',
77
- git_push: 'Failed to push the build to %{url}:%{target_branch}'
44
+ setup_deploy_key: 'Moving deploy key %{deploy_key} to %{path}',
45
+ check_deploy_key: 'Checking deploy key',
46
+ deploy: 'Deploying branch %{target_branch} to %{url}',
47
+ keep_history: 'The deployment is configured to preserve the target branch if it exists on remote.',
48
+ work_dir: 'Using temporary work directory %{work_dir}',
49
+ committer_from_gh: 'The repo is configured to use committer user and email.',
50
+ setup_dir: 'The source dir for deployment is %s',
51
+ git_clone: 'Cloning the branch %{target_branch} from the remote repo',
52
+ git_init: 'Initializing local git repo',
53
+ git_checkout: 'Checking out orphan branch %{target_branch}',
54
+ copy_files: 'Copying %{src_dir} contents to %{work_dir}',
55
+ git_config: 'Configuring git committer to be %{name} <%{email}>',
56
+ prepare: 'Preparing to deploy %{target_branch} branch to gh-pages',
57
+ git_push: 'Pushing to %{url}',
58
+ stop: 'There are no changes to commit, stopping.'
59
+
60
+ cmds git_clone: 'git clone --quiet --branch="%{target_branch}" --depth=1 "%{remote_url}" . > /dev/null 2>&1',
61
+ git_init: 'git init .',
62
+ git_checkout: 'git checkout --orphan "%{target_branch}"',
63
+ check_deploy_key: 'ssh -i %{key} -T git@%{url} 2>&1 | grep successful > /dev/null',
64
+ copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" .',
65
+ git_config_email: 'git config user.email %{quoted_email}',
66
+ git_config_name: 'git config user.name %{quoted_name}',
67
+ deployment_file: 'touch "deployed at %{now} by %{name}"',
68
+ cname: 'echo "%{fqdn}" > CNAME',
69
+ git_add: 'git add -A .',
70
+ git_commit_hook: 'cp %{path} .git/hooks/pre-commit',
71
+ git_commit: 'git commit %{git_commit_opts} -q %{git_commit_msg_opts}',
72
+ git_show: 'git show --stat-count=10 HEAD',
73
+ git_push: 'git push%{git_push_opts} --quiet "%{remote_url}" "%{target_branch}":"%{target_branch}" > /dev/null 2>&1'
74
+
75
+ errs copy_files: 'Failed to copy %{src_dir}.',
76
+ check_deploy_key: 'Failed to authenticate using the deploy key',
77
+ git_init: 'Failed to create new git repo',
78
+ git_checkout: 'Failed to create the orphan branch',
79
+ git_push: 'Failed to push the build to %{url}:%{target_branch}'
78
80
 
79
81
  def login
80
82
  token? ? login_token : setup_deploy_key
@@ -97,6 +99,7 @@ module Dpl
97
99
  git_clone? ? git_clone : git_init
98
100
  copy_files
99
101
  return info :stop if git_clone? && !git_dirty?
102
+
100
103
  git_config
101
104
  git_commit
102
105
  git_push
@@ -115,7 +118,7 @@ module Dpl
115
118
 
116
119
  def setup_deploy_key
117
120
  path = '~/.dpl/deploy_key'
118
- info :setup_deploy_key, path: path
121
+ info(:setup_deploy_key, path:)
119
122
  mv deploy_key, path
120
123
  chmod 0600, path
121
124
  setup_git_ssh path
@@ -171,8 +174,8 @@ module Dpl
171
174
  end
172
175
 
173
176
  def git_commit_msg_opts
174
- msg = interpolate(commit_message, vars: vars)
175
- msg.split("\n").reject(&:empty?).map { |msg| %(-m #{quote(msg)}) }
177
+ msg = interpolate(commit_message, vars:)
178
+ msg.split("\n").reject(&:empty?).map { |message| %(-m #{quote(message)}) }
176
179
  end
177
180
 
178
181
  def git_push_opts
@@ -225,6 +228,9 @@ module Dpl
225
228
 
226
229
  def user
227
230
  @user ||= api.user
231
+ rescue StandardError => e
232
+ puts "ERR: #{e.inspect}"
233
+ puts e.backtrace
228
234
  end
229
235
 
230
236
  def src_dir
@@ -236,7 +242,7 @@ module Dpl
236
242
  end
237
243
 
238
244
  def api
239
- @api ||= Octokit::Client.new(access_token: token, api_endpoint: api_endpoint)
245
+ @api ||= Octokit::Client.new(access_token: token, api_endpoint:)
240
246
  end
241
247
 
242
248
  def api_endpoint
@@ -248,7 +254,7 @@ module Dpl
248
254
  end
249
255
 
250
256
  def debug(*args)
251
- info *args if verbose?
257
+ info(*args) if verbose?
252
258
  end
253
259
  end
254
260
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Pages < Provider
@@ -7,7 +9,7 @@ module Dpl
7
9
 
8
10
  env :github, :pages
9
11
 
10
- opt '--strategy NAME', 'GitHub Pages deployment strategy', default: 'git', enum: %w(api git)
12
+ opt '--strategy NAME', 'GitHub Pages deployment strategy', default: 'git', enum: %w[api git]
11
13
  end
12
14
  end
13
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Puppetforge < Provider
@@ -7,12 +9,12 @@ module Dpl
7
9
 
8
10
  full_name 'Puppet Forge'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  tbd
12
- str
14
+ STR
13
15
 
14
- gem 'puppet', '~> 6.26.0', require: 'puppet/face'
15
- gem 'puppet-blacksmith', '~> 4.1.2', require: 'puppet_blacksmith'
16
+ gem 'puppet', '~> 7.25', require: 'puppet/face'
17
+ gem 'puppet-blacksmith', '~> 7', require: 'puppet_blacksmith'
16
18
 
17
19
  env :puppetforge
18
20
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dpl
2
4
  module Providers
3
5
  class Pypi < Provider
@@ -7,9 +9,9 @@ module Dpl
7
9
 
8
10
  full_name 'PyPI'
9
11
 
10
- description sq(<<-str)
12
+ description sq(<<-STR)
11
13
  tbd
12
- str
14
+ STR
13
15
 
14
16
  env :pypi
15
17
 
@@ -30,21 +32,20 @@ module Dpl
30
32
  opt '--twine_version VER', format: VERSION
31
33
  opt '--wheel_version VER', format: VERSION
32
34
 
33
- msgs login: 'Authenticated as %{username}',
34
- upload_docs: 'Uploading documentation (skip using "skip_upload_docs: true")'
35
+ msgs login: 'Authenticated as %{username}',
36
+ upload_docs: 'Uploading documentation (skip using "skip_upload_docs: true")'
35
37
 
36
- cmds setup_py: 'python setup.py %{distributions}',
37
- twine_check: 'twine check dist/*',
38
+ cmds setup_py: 'python setup.py %{distributions}',
39
+ twine_check: 'twine check dist/*',
38
40
  twine_upload: 'twine upload %{skip_existing_option} -r pypi dist/*',
39
- rm_dist: 'rm -rf dist/*',
40
- upload_docs: 'python setup.py upload_docs %{docs_dir_option} -r %{server}'
41
+ rm_dist: 'rm -rf dist/*',
42
+ upload_docs: 'python setup.py upload_docs %{docs_dir_option} -r %{server}'
41
43
 
42
- errs install: 'Failed to install pip, setuptools, twine or wheel.',
43
- setup_py: 'setup.py failed',
44
- twine_check: 'Twine check failed',
44
+ errs install: 'Failed to install pip, setuptools, twine or wheel.',
45
+ setup_py: 'setup.py failed',
46
+ twine_check: 'Twine check failed',
45
47
  twine_upload: 'Twine upload failed.',
46
- upload_docs: 'Uploading docs failed.'
47
-
48
+ upload_docs: 'Uploading docs failed.'
48
49
 
49
50
  def install
50
51
  script :install
@@ -71,7 +72,7 @@ module Dpl
71
72
 
72
73
  private
73
74
 
74
- PYPIRC = sq(<<-rc)
75
+ PYPIRC = sq(<<-RC)
75
76
  [distutils]
76
77
  index-servers = pypi
77
78
  pypi
@@ -79,46 +80,46 @@ module Dpl
79
80
  repository: %{server}
80
81
  username: %{username}
81
82
  password: %{password}
82
- rc
83
-
84
- def write_config
85
- write_file('~/.pypirc', pypirc)
86
- end
87
-
88
- def pypirc
89
- interpolate(PYPIRC, opts, secure: true)
90
- end
91
-
92
- def upload_docs
93
- info :upload_docs
94
- shell :upload_docs
95
- end
96
-
97
- def skip_existing_option
98
- '--skip-existing' if skip_existing?
99
- end
100
-
101
- def docs_dir_option
102
- '--upload-dir ' + docs_dir if docs_dir
103
- end
104
-
105
- def setuptools_arg
106
- version_arg(:setuptools)
107
- end
108
-
109
- def twine_arg
110
- version_arg(:twine)
111
- end
112
-
113
- def wheel_arg
114
- version_arg(:wheel)
115
- end
116
-
117
- def version_arg(name)
118
- arg = name.to_s
119
- arg << "==#{send(:"#{name}_version")}" if send(:"#{name}_version") =~ VERSION
120
- arg
121
- end
83
+ RC
84
+
85
+ def write_config
86
+ write_file('~/.pypirc', pypirc)
87
+ end
88
+
89
+ def pypirc
90
+ interpolate(PYPIRC, opts, secure: true)
91
+ end
92
+
93
+ def upload_docs
94
+ info :upload_docs
95
+ shell :upload_docs
96
+ end
97
+
98
+ def skip_existing_option
99
+ '--skip-existing' if skip_existing?
100
+ end
101
+
102
+ def docs_dir_option
103
+ "--upload-dir #{docs_dir}" if docs_dir
104
+ end
105
+
106
+ def setuptools_arg
107
+ version_arg(:setuptools)
108
+ end
109
+
110
+ def twine_arg
111
+ version_arg(:twine)
112
+ end
113
+
114
+ def wheel_arg
115
+ version_arg(:wheel)
116
+ end
117
+
118
+ def version_arg(name)
119
+ arg = name.to_s
120
+ arg << "==#{send(:"#{name}_version")}" if send(:"#{name}_version") =~ VERSION
121
+ arg
122
+ end
122
123
  end
123
124
  end
124
125
  end