travis_dpl_test 2.0.3.beta.4.ror
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +172 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +392 -0
- data/Gemfile +32 -0
- data/Gemfile.lock +611 -0
- data/LICENSE +19 -0
- data/README.md +2744 -0
- data/Rakefile +210 -0
- data/bin/dpl +11 -0
- data/config/transliterate.yml +733 -0
- data/dpl.gemspec +23 -0
- data/lib/dpl/assets/atlas/install +19 -0
- data/lib/dpl/assets/convox/install +11 -0
- data/lib/dpl/assets/dpl/README.erb.md +138 -0
- data/lib/dpl/assets/dpl/git_ssh +8 -0
- data/lib/dpl/assets/git/detect_private_key +8 -0
- data/lib/dpl/assets/hephy/filter_log +3 -0
- data/lib/dpl/assets/pypi/install +4 -0
- data/lib/dpl/assets/scalingo/install +6 -0
- data/lib/dpl/cli.rb +100 -0
- data/lib/dpl/ctx/bash.rb +549 -0
- data/lib/dpl/ctx/test.rb +255 -0
- data/lib/dpl/ctx.rb +4 -0
- data/lib/dpl/helper/assets.rb +38 -0
- data/lib/dpl/helper/cmd.rb +169 -0
- data/lib/dpl/helper/config_file.rb +49 -0
- data/lib/dpl/helper/cookbook_site_streaming_uploader.rb +249 -0
- data/lib/dpl/helper/env.rb +92 -0
- data/lib/dpl/helper/github.rb +22 -0
- data/lib/dpl/helper/interpolate.rb +160 -0
- data/lib/dpl/helper/memoize.rb +23 -0
- data/lib/dpl/helper/squiggle.rb +24 -0
- data/lib/dpl/helper/transliterate.rb +13 -0
- data/lib/dpl/helper/wrap.rb +11 -0
- data/lib/dpl/helper/zip.rb +71 -0
- data/lib/dpl/provider/dsl.rb +410 -0
- data/lib/dpl/provider/examples.rb +132 -0
- data/lib/dpl/provider/status.rb +61 -0
- data/lib/dpl/provider.rb +651 -0
- data/lib/dpl/providers/anynines.rb +71 -0
- data/lib/dpl/providers/azure_web_apps.rb +63 -0
- data/lib/dpl/providers/bintray.rb +324 -0
- data/lib/dpl/providers/bluemixcloudfoundry.rb +98 -0
- data/lib/dpl/providers/boxfuse.rb +52 -0
- data/lib/dpl/providers/cargo.rb +32 -0
- data/lib/dpl/providers/chef_supermarket.rb +132 -0
- data/lib/dpl/providers/cloud66.rb +46 -0
- data/lib/dpl/providers/cloudfiles.rb +62 -0
- data/lib/dpl/providers/cloudformation.rb +281 -0
- data/lib/dpl/providers/cloudfoundry.rb +89 -0
- data/lib/dpl/providers/codedeploy.rb +190 -0
- data/lib/dpl/providers/convox.rb +130 -0
- data/lib/dpl/providers/datica.rb +64 -0
- data/lib/dpl/providers/ecr.rb +129 -0
- data/lib/dpl/providers/elasticbeanstalk.rb +207 -0
- data/lib/dpl/providers/engineyard.rb +113 -0
- data/lib/dpl/providers/firebase.rb +45 -0
- data/lib/dpl/providers/flynn.rb +35 -0
- data/lib/dpl/providers/gae.rb +78 -0
- data/lib/dpl/providers/gcs.rb +132 -0
- data/lib/dpl/providers/git_push.rb +273 -0
- data/lib/dpl/providers/gleis.rb +74 -0
- data/lib/dpl/providers/hackage.rb +53 -0
- data/lib/dpl/providers/hephy.rb +107 -0
- data/lib/dpl/providers/heroku/api.rb +123 -0
- data/lib/dpl/providers/heroku/git.rb +54 -0
- data/lib/dpl/providers/heroku.rb +111 -0
- data/lib/dpl/providers/lambda.rb +211 -0
- data/lib/dpl/providers/launchpad.rb +80 -0
- data/lib/dpl/providers/netlify.rb +38 -0
- data/lib/dpl/providers/npm.rb +130 -0
- data/lib/dpl/providers/nuget.rb +41 -0
- data/lib/dpl/providers/openshift.rb +52 -0
- data/lib/dpl/providers/opsworks.rb +146 -0
- data/lib/dpl/providers/packagecloud.rb_ +194 -0
- data/lib/dpl/providers/pages/api.rb +106 -0
- data/lib/dpl/providers/pages/git.rb +262 -0
- data/lib/dpl/providers/pages.rb +18 -0
- data/lib/dpl/providers/puppetforge.rb +50 -0
- data/lib/dpl/providers/pypi.rb +125 -0
- data/lib/dpl/providers/releases.rb +234 -0
- data/lib/dpl/providers/rubygems.rb +97 -0
- data/lib/dpl/providers/s3.rb +251 -0
- data/lib/dpl/providers/scalingo.rb +69 -0
- data/lib/dpl/providers/script.rb +32 -0
- data/lib/dpl/providers/snap.rb +68 -0
- data/lib/dpl/providers/surge.rb +59 -0
- data/lib/dpl/providers/testfairy.rb +101 -0
- data/lib/dpl/providers/transifex.rb +72 -0
- data/lib/dpl/providers.rb +48 -0
- data/lib/dpl/string_ext.rb +23 -0
- data/lib/dpl/support/aws_sdk_patch.rb +26 -0
- data/lib/dpl/support/gems.rb +73 -0
- data/lib/dpl/support/gstore_patch.rb +8 -0
- data/lib/dpl/support/version.rb +84 -0
- data/lib/dpl/version.rb +5 -0
- data/lib/dpl.rb +23 -0
- data/status.json +237 -0
- metadata +161 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Dpl
|
|
4
|
+
module Providers
|
|
5
|
+
class Pages < Provider
|
|
6
|
+
register :pages
|
|
7
|
+
|
|
8
|
+
abstract
|
|
9
|
+
|
|
10
|
+
env :github, :pages
|
|
11
|
+
|
|
12
|
+
opt '--strategy NAME', 'GitHub Pages deployment strategy', default: 'git', enum: %w[api git]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require 'dpl/providers/pages/git'
|
|
18
|
+
require 'dpl/providers/pages/api'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Dpl
|
|
4
|
+
module Providers
|
|
5
|
+
class Puppetforge < Provider
|
|
6
|
+
register :puppetforge
|
|
7
|
+
|
|
8
|
+
status :alpha
|
|
9
|
+
|
|
10
|
+
full_name 'Puppet Forge'
|
|
11
|
+
|
|
12
|
+
description sq(<<-STR)
|
|
13
|
+
tbd
|
|
14
|
+
STR
|
|
15
|
+
|
|
16
|
+
gem 'puppet', '~> 7.25', require: 'puppet/face'
|
|
17
|
+
gem 'puppet-blacksmith', '~> 7', require: 'puppet_blacksmith'
|
|
18
|
+
|
|
19
|
+
env :puppetforge
|
|
20
|
+
|
|
21
|
+
opt '--username NAME', 'Puppet Forge user name', required: true, alias: :user
|
|
22
|
+
opt '--password PASS', 'Puppet Forge password', required: true, secret: true
|
|
23
|
+
opt '--url URL', 'Puppet Forge URL to deploy to', default: 'https://forgeapi.puppetlabs.com/'
|
|
24
|
+
|
|
25
|
+
msgs upload: 'Uploading to Puppet Forge %s/%s'
|
|
26
|
+
|
|
27
|
+
def validate
|
|
28
|
+
file.metadata
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def deploy
|
|
32
|
+
build
|
|
33
|
+
info :upload, forge.username, file.name
|
|
34
|
+
forge.push!(file.name)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def file
|
|
38
|
+
@file ||= Blacksmith::Modulefile.new
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def build
|
|
42
|
+
Puppet::Face['module', :current].build('./')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def forge
|
|
46
|
+
@forge ||= Blacksmith::Forge.new(username, password, url)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Dpl
|
|
4
|
+
module Providers
|
|
5
|
+
class Pypi < Provider
|
|
6
|
+
register :pypi
|
|
7
|
+
|
|
8
|
+
status :stable
|
|
9
|
+
|
|
10
|
+
full_name 'PyPI'
|
|
11
|
+
|
|
12
|
+
description sq(<<-STR)
|
|
13
|
+
tbd
|
|
14
|
+
STR
|
|
15
|
+
|
|
16
|
+
env :pypi
|
|
17
|
+
|
|
18
|
+
VERSION = /\A\d+(?:\.\d+)*\z/
|
|
19
|
+
|
|
20
|
+
env :pypi
|
|
21
|
+
|
|
22
|
+
opt '--username NAME', 'PyPI Username', required: true, alias: :user
|
|
23
|
+
opt '--password PASS', 'PyPI Password', required: true, secret: true
|
|
24
|
+
opt '--server SERVER', 'Release to a different index', default: 'https://upload.pypi.org/legacy/'
|
|
25
|
+
opt '--distributions DISTS', 'Space-separated list of distributions to be uploaded to PyPI', default: 'sdist'
|
|
26
|
+
opt '--docs_dir DIR', 'Path to the directory to upload documentation from', default: 'build/docs'
|
|
27
|
+
opt '--skip_existing', 'Do not overwrite an existing file with the same name on the server.'
|
|
28
|
+
opt '--upload_docs', 'Upload documentation', default: false, type: :boolean, note: 'most PyPI servers, including upload.pypi.org, do not support uploading documentation'
|
|
29
|
+
opt '--twine_check', 'Whether to run twine check', default: true
|
|
30
|
+
opt '--remove_build_dir', 'Remove the build dir after the upload', default: true
|
|
31
|
+
opt '--setuptools_version VER', format: VERSION
|
|
32
|
+
opt '--twine_version VER', format: VERSION
|
|
33
|
+
opt '--wheel_version VER', format: VERSION
|
|
34
|
+
|
|
35
|
+
msgs login: 'Authenticated as %{username}',
|
|
36
|
+
upload_docs: 'Uploading documentation (skip using "skip_upload_docs: true")'
|
|
37
|
+
|
|
38
|
+
cmds setup_py: 'python setup.py %{distributions}',
|
|
39
|
+
twine_check: 'twine check dist/*',
|
|
40
|
+
twine_upload: 'twine upload %{skip_existing_option} -r pypi dist/*',
|
|
41
|
+
rm_dist: 'rm -rf dist/*',
|
|
42
|
+
upload_docs: 'python setup.py upload_docs %{docs_dir_option} -r %{server}'
|
|
43
|
+
|
|
44
|
+
errs install: 'Failed to install pip, setuptools, twine or wheel.',
|
|
45
|
+
setup_py: 'setup.py failed',
|
|
46
|
+
twine_check: 'Twine check failed',
|
|
47
|
+
twine_upload: 'Twine upload failed.',
|
|
48
|
+
upload_docs: 'Uploading docs failed.'
|
|
49
|
+
|
|
50
|
+
def install
|
|
51
|
+
script :install
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def login
|
|
55
|
+
write_config
|
|
56
|
+
info :login
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def setup
|
|
60
|
+
shell :setup_py
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def validate
|
|
64
|
+
shell :twine_check if twine_check?
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def deploy
|
|
68
|
+
shell :twine_upload
|
|
69
|
+
upload_docs if upload_docs?
|
|
70
|
+
shell :rm_dist if remove_build_dir?
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
PYPIRC = sq(<<-RC)
|
|
76
|
+
[distutils]
|
|
77
|
+
index-servers = pypi
|
|
78
|
+
pypi
|
|
79
|
+
[pypi]
|
|
80
|
+
repository: %{server}
|
|
81
|
+
username: %{username}
|
|
82
|
+
password: %{password}
|
|
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
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'dpl/helper/github'
|
|
4
|
+
|
|
5
|
+
module Dpl
|
|
6
|
+
module Providers
|
|
7
|
+
class Releases < Provider
|
|
8
|
+
include Github
|
|
9
|
+
|
|
10
|
+
register :releases
|
|
11
|
+
|
|
12
|
+
status :stable
|
|
13
|
+
|
|
14
|
+
full_name 'GitHub Releases'
|
|
15
|
+
|
|
16
|
+
description sq(<<-STR)
|
|
17
|
+
tbd
|
|
18
|
+
STR
|
|
19
|
+
|
|
20
|
+
gem 'octokit', '~> 7'
|
|
21
|
+
gem 'mime-types', '~> 3.4.1'
|
|
22
|
+
gem 'public_suffix', '~> 5'
|
|
23
|
+
|
|
24
|
+
env :github, :releases
|
|
25
|
+
|
|
26
|
+
required :token, %i[username password]
|
|
27
|
+
|
|
28
|
+
opt '--token TOKEN', 'GitHub oauth token (needs public_repo or repo permission)', secret: true, alias: :api_key
|
|
29
|
+
opt '--username LOGIN', 'GitHub login name', alias: :user
|
|
30
|
+
opt '--password PASS', 'GitHub password', secret: true
|
|
31
|
+
opt '--repo SLUG', 'GitHub repo slug', default: :repo_slug
|
|
32
|
+
opt '--file GLOB', 'File or glob to release to GitHub', default: '*', type: :array
|
|
33
|
+
opt '--file_glob', 'Interpret files as globs', default: true
|
|
34
|
+
opt '--overwrite', 'Overwrite files with the same name'
|
|
35
|
+
opt '--prerelease', 'Identify the release as a prerelease'
|
|
36
|
+
opt '--release_number NUM', 'Release number (override automatic release detection)'
|
|
37
|
+
opt '--release_notes STR', 'Content for the release notes', alias: :body
|
|
38
|
+
opt '--release_notes_file PATH', 'Path to a file containing the release notes', note: 'will be ignored if --release_notes is given'
|
|
39
|
+
opt '--draft', 'Identify the release as a draft'
|
|
40
|
+
opt '--tag_name TAG', 'Git tag from which to create the release'
|
|
41
|
+
opt '--target_commitish STR', 'Commitish value that determines where the Git tag is created from'
|
|
42
|
+
opt '--name NAME', 'Name for the release'
|
|
43
|
+
# should this have --url, like Pages does?
|
|
44
|
+
|
|
45
|
+
needs :git
|
|
46
|
+
|
|
47
|
+
msgs deploy: 'Deploying to repo: %{slug}',
|
|
48
|
+
local_tag: 'Current tag is: %{local_tag}',
|
|
49
|
+
login: 'Authenticated as %s',
|
|
50
|
+
insufficient_scopes: 'Dpl does not have permission to upload assets. Make sure your token has the repo or public_repo scope.',
|
|
51
|
+
insufficient_perm: 'Release resource not found. Make sure your token belongs to an account which has push permission to this repo.',
|
|
52
|
+
overwrite_existing: 'File %s already exists, overwriting.',
|
|
53
|
+
skip_existing: 'File %s already exists, skipping.',
|
|
54
|
+
upload_file: 'Uploading file %s ...',
|
|
55
|
+
set_tag_name: 'Setting tag_name to %s',
|
|
56
|
+
set_target_commitish: 'Setting target_commitish to %s',
|
|
57
|
+
missing_file: 'File %s does not exist.',
|
|
58
|
+
not_a_file: '%s is not a file, skipping.'
|
|
59
|
+
|
|
60
|
+
cmds git_fetch_tags: 'git fetch --tags'
|
|
61
|
+
|
|
62
|
+
URL = 'https://api.github.com/repos/%s/releases/%s'
|
|
63
|
+
|
|
64
|
+
OCTOKIT_OPTS = %i[
|
|
65
|
+
repo
|
|
66
|
+
name
|
|
67
|
+
body
|
|
68
|
+
prerelease
|
|
69
|
+
release_number
|
|
70
|
+
tag_name
|
|
71
|
+
target_commitish
|
|
72
|
+
].freeze
|
|
73
|
+
|
|
74
|
+
TIMEOUTS = {
|
|
75
|
+
timeout: 180,
|
|
76
|
+
open_timeout: 180
|
|
77
|
+
}.freeze
|
|
78
|
+
|
|
79
|
+
def validate
|
|
80
|
+
info :deploy
|
|
81
|
+
shell :git_fetch_tags if env_tag.nil?
|
|
82
|
+
info :local_tag
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def login
|
|
86
|
+
user.login
|
|
87
|
+
info :login, user.login
|
|
88
|
+
error :insufficient_scopes unless sufficient_scopes?
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def deploy
|
|
92
|
+
upload_files
|
|
93
|
+
api.update_release(url, octokit_opts)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def upload_files
|
|
97
|
+
files.each { |file| upload_file(file) }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def upload_file(path)
|
|
101
|
+
file = normalize_filename(path)
|
|
102
|
+
asset = asset(file)
|
|
103
|
+
return info :skip_existing, file if asset && !overwrite?
|
|
104
|
+
|
|
105
|
+
delete(asset, file) if asset
|
|
106
|
+
info :upload_file, file
|
|
107
|
+
api.upload_asset(url, path, name: file, content_type: content_type(path))
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def delete(asset, file)
|
|
111
|
+
info :overwrite_existing, file
|
|
112
|
+
api.delete_release_asset(asset.url)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def octokit_opts
|
|
116
|
+
opts = with_tag(self.opts.dup)
|
|
117
|
+
opts = with_target_commitish(opts)
|
|
118
|
+
opts = opts.select { |key, _| OCTOKIT_OPTS.include?(key) }
|
|
119
|
+
compact(opts.merge(body: release_notes, draft: draft?))
|
|
120
|
+
end
|
|
121
|
+
memoize :octokit_opts
|
|
122
|
+
|
|
123
|
+
def with_tag(opts)
|
|
124
|
+
return opts if tag_name? || draft?
|
|
125
|
+
|
|
126
|
+
info :set_tag_name, local_tag
|
|
127
|
+
opts.merge(tag_name: local_tag)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def with_target_commitish(opts)
|
|
131
|
+
return opts if target_commitish? || !same_repo?
|
|
132
|
+
|
|
133
|
+
info :set_target_commitish, git_sha
|
|
134
|
+
opts.merge(target_commitish: git_sha)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def content_type(file)
|
|
138
|
+
type = MIME::Types.type_for(file).first
|
|
139
|
+
type ||= 'application/octet-stream'
|
|
140
|
+
type.to_s
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def url
|
|
144
|
+
if release_number?
|
|
145
|
+
format(URL, slug, release_number)
|
|
146
|
+
elsif release
|
|
147
|
+
release.rels[:self].href
|
|
148
|
+
else
|
|
149
|
+
create_release.rels[:self].href
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
memoize :url
|
|
153
|
+
|
|
154
|
+
def release
|
|
155
|
+
releases.detect { |release| release.tag_name == local_tag }
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def create_release
|
|
159
|
+
api.create_release(slug, local_tag, octokit_opts.merge(draft: true))
|
|
160
|
+
rescue Octokit::NotFound
|
|
161
|
+
error :insufficient_perm
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def local_tag
|
|
165
|
+
env_tag || git_tag
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def env_tag
|
|
169
|
+
tag = ENV['TRAVIS_TAG']
|
|
170
|
+
tag unless tag.to_s.empty?
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def sufficient_scopes?
|
|
174
|
+
api.scopes.include?('public_repo') || api.scopes.include?('repo')
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def slug
|
|
178
|
+
repo || repo_slug
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def same_repo?
|
|
182
|
+
slug == repo_slug
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def asset(name)
|
|
186
|
+
api.release_assets(url).detect { |asset| asset.name == name }
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def release_notes
|
|
190
|
+
super || release_notes_file || nil
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def release_notes_file
|
|
194
|
+
release_notes_file? && exists?(super) && read(super)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def user
|
|
198
|
+
@user ||= api.user
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def releases
|
|
202
|
+
@releases ||= api.releases(slug)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def api
|
|
206
|
+
@api ||= Octokit::Client.new(**creds, auto_paginate: true, connection_options: { request: TIMEOUTS })
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def creds
|
|
210
|
+
username && password ? { login: username, password: } : { access_token: token }
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def files
|
|
214
|
+
files = file_glob? ? Dir.glob("{#{file.join(',')}}").uniq : file
|
|
215
|
+
files = files.select { |file| exists?(file) }
|
|
216
|
+
files.select { |file| file?(file) }
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def exists?(file)
|
|
220
|
+
return true if File.exist?(file)
|
|
221
|
+
|
|
222
|
+
error :missing_file, file
|
|
223
|
+
false
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def file?(file)
|
|
227
|
+
return true if File.file?(file)
|
|
228
|
+
|
|
229
|
+
warn :not_a_file, file
|
|
230
|
+
false
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Dpl
|
|
4
|
+
module Providers
|
|
5
|
+
class Rubygems < Provider
|
|
6
|
+
register :rubygems
|
|
7
|
+
|
|
8
|
+
status :stable
|
|
9
|
+
|
|
10
|
+
description sq(<<-STR)
|
|
11
|
+
tbd
|
|
12
|
+
STR
|
|
13
|
+
|
|
14
|
+
gem 'gems', '~> 1.1.1'
|
|
15
|
+
|
|
16
|
+
env :rubygems
|
|
17
|
+
|
|
18
|
+
required :api_key, %i[username password]
|
|
19
|
+
|
|
20
|
+
opt '--api_key KEY', 'Rubygems api key', secret: true
|
|
21
|
+
opt '--username USER', 'Rubygems user name', alias: :user
|
|
22
|
+
opt '--password PASS', 'Rubygems password', secret: true
|
|
23
|
+
opt '--gem NAME', 'Name of the gem to release', default: :repo_name
|
|
24
|
+
opt '--gemspec FILE', 'Gemspec file to use to build the gem'
|
|
25
|
+
opt '--gemspec_glob GLOB', 'Glob pattern to search for gemspec files when multiple gems are generated in the repository (overrides the gemspec option)'
|
|
26
|
+
opt '--host URL'
|
|
27
|
+
|
|
28
|
+
msgs login_api_key: 'Authenticating with api key %{api_key}',
|
|
29
|
+
login_creds: 'Authenticating with username %{username} and password %{password}',
|
|
30
|
+
setup: 'Setting up host %{host}',
|
|
31
|
+
gem_lookup: 'Looking up gem %{gem} ... ',
|
|
32
|
+
gem_found: 'found.',
|
|
33
|
+
gem_not_found: 'no such gem.',
|
|
34
|
+
gem_push: 'Pushing gem %{gem}'
|
|
35
|
+
|
|
36
|
+
cmds gem_build: 'gem build %{gemspec}'
|
|
37
|
+
|
|
38
|
+
errs gem_build: 'Failed to build %{gemspec}'
|
|
39
|
+
|
|
40
|
+
def setup
|
|
41
|
+
return unless host?
|
|
42
|
+
|
|
43
|
+
info :setup
|
|
44
|
+
Gems.host = host
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def login
|
|
48
|
+
api_key? ? login_api_key : login_creds
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def validate
|
|
52
|
+
print :gem_lookup
|
|
53
|
+
name = Gems.info(gem)['name']
|
|
54
|
+
info name ? :gem_found : :gem_not_found
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def deploy
|
|
58
|
+
build
|
|
59
|
+
push
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def login_api_key
|
|
65
|
+
info :login_api_key
|
|
66
|
+
Gems.key = api_key
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def login_creds
|
|
70
|
+
info :login_creds
|
|
71
|
+
Gems.username = username
|
|
72
|
+
Gems.password = password
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def build
|
|
76
|
+
Dir[gemspec_glob].each do |gemspec|
|
|
77
|
+
shell :gem_build, gemspec: gemspec.whitelist
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def push
|
|
82
|
+
Dir["#{gem}-*.gem"].each do |file|
|
|
83
|
+
info :gem_push, gem: file.whitelist
|
|
84
|
+
info Gems.push(File.new(file), *[host].compact)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def gemspec_glob
|
|
89
|
+
super || "#{gemspec || gem}.gemspec"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def gemspec
|
|
93
|
+
super.gsub('.gemspec', '') if gemspec?
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|