gem-release 2.0.4 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +49 -49
- data/README.md +5 -2
- data/config.ru +5 -0
- data/gem-release.gemspec +19 -0
- data/lib/gem/release/cmds.rb +1 -0
- data/lib/gem/release/cmds/bump.rb +1 -1
- data/lib/gem/release/cmds/github.rb +79 -0
- data/lib/gem/release/cmds/release.rb +42 -7
- data/lib/gem/release/context/gemspec.rb +10 -2
- data/lib/gem/release/context/git.rb +1 -1
- data/lib/gem/release/context/github.rb +62 -0
- data/lib/gem/release/files/template.rb +4 -0
- data/lib/gem/release/helper.rb +6 -3
- data/lib/gem/release/helper/http.rb +39 -0
- data/lib/gem/release/support/gem_command.rb +2 -2
- data/lib/gem/release/version.rb +3 -1
- data/lib/gem/release/version/number.rb +6 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e449d756e94c4481c1aa935a110f9e349671ad211eacd4793b4a48b104067512
|
4
|
+
data.tar.gz: a3e95dc96402384039d750d000aa2949384798354933d8b90141aaee8b381dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 204a586c20ee01dff608cab12c4562f9fcd1fa121164480b5083aaa13a660d1212c26bb778cb3ea3b393d6aa63fb1e6c757ae771bebab71a2e03897c2d4aef47
|
7
|
+
data.tar.gz: a167159e43bbf4a03d852710411ab40ab1390785e4dc936a870352a681d5af8bd6b02dbe3a45eedfb06c5f863f382bc19d3c51758c95f6370c000268a43db221
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v2.2.2 - 2021-05-31
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- Add missing require for `fileutils`
|
8
|
+
(Issue: https://github.com/svenfuchs/gem-release/issues/100)
|
9
|
+
|
10
|
+
## v2.2.1 - 2021-01-22
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Ensure git index is refreshed before uncommitted changes check
|
15
|
+
(PR: https://github.com/svenfuchs/gem-release/pull/99)
|
16
|
+
|
17
|
+
## v2.2.0 - 2020-10-12
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- Allow version bump to specific prerelease version number
|
22
|
+
(PR: https://github.com/svenfuchs/gem-release/pull/97)
|
23
|
+
|
24
|
+
## v2.1.1 - 2019-10-28
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- Fix error when custom message provided for `gem bump`
|
29
|
+
(PR: https://github.com/svenfuchs/gem-release/pull/92)
|
30
|
+
|
31
|
+
## v2.1.0 - 2019-10-17
|
32
|
+
|
33
|
+
### Added
|
34
|
+
|
35
|
+
- Add gem release --github
|
36
|
+
(PR: https://github.com/svenfuchs/gem-release/pull/73)
|
37
|
+
|
3
38
|
## v2.0.4 - 2019-10-10
|
4
39
|
|
5
40
|
### Fixed
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,74 +1,74 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gem-release (2.
|
4
|
+
gem-release (2.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
addressable (2.
|
10
|
-
public_suffix (>= 2.0.2, <
|
11
|
-
builder (3.2.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
diff-lcs (1.3)
|
21
|
-
docile (1.3.2)
|
22
|
-
faraday (0.15.4)
|
9
|
+
addressable (2.7.0)
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
11
|
+
builder (3.2.4)
|
12
|
+
crack (0.4.5)
|
13
|
+
rexml
|
14
|
+
diff-lcs (1.4.4)
|
15
|
+
docile (1.4.0)
|
16
|
+
faraday (1.4.1)
|
17
|
+
faraday-excon (~> 1.1)
|
18
|
+
faraday-net_http (~> 1.0)
|
19
|
+
faraday-net_http_persistent (~> 1.1)
|
23
20
|
multipart-post (>= 1.2, < 3)
|
24
|
-
|
21
|
+
ruby2_keywords (>= 0.0.4)
|
22
|
+
faraday-excon (1.1.0)
|
23
|
+
faraday-net_http (1.0.1)
|
24
|
+
faraday-net_http_persistent (1.1.0)
|
25
|
+
geminabox (1.3.0)
|
25
26
|
builder
|
26
27
|
faraday
|
27
28
|
httpclient (>= 2.2.7)
|
28
29
|
nesty
|
29
30
|
reentrant_flock
|
30
31
|
sinatra (>= 1.2.7)
|
31
|
-
hashdiff (0.
|
32
|
+
hashdiff (1.0.1)
|
32
33
|
httpclient (2.8.3)
|
33
|
-
json (2.2.0)
|
34
34
|
multipart-post (2.1.1)
|
35
|
-
mustermann (1.
|
35
|
+
mustermann (1.1.1)
|
36
|
+
ruby2_keywords (~> 0.0.1)
|
36
37
|
nesty (1.0.2)
|
37
|
-
public_suffix (
|
38
|
-
rack (2.
|
39
|
-
rack-protection (2.0
|
38
|
+
public_suffix (4.0.6)
|
39
|
+
rack (2.2.3)
|
40
|
+
rack-protection (2.1.0)
|
40
41
|
rack
|
41
42
|
reentrant_flock (0.1.1)
|
42
|
-
|
43
|
-
|
44
|
-
rspec-
|
45
|
-
rspec-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
rexml (3.2.5)
|
44
|
+
rspec (3.10.0)
|
45
|
+
rspec-core (~> 3.10.0)
|
46
|
+
rspec-expectations (~> 3.10.0)
|
47
|
+
rspec-mocks (~> 3.10.0)
|
48
|
+
rspec-core (3.10.1)
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-expectations (3.10.1)
|
49
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-mocks (3.10.2)
|
52
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-support (3.
|
55
|
-
|
56
|
-
simplecov (0.
|
55
|
+
rspec-support (~> 3.10.0)
|
56
|
+
rspec-support (3.10.2)
|
57
|
+
ruby2_keywords (0.0.4)
|
58
|
+
simplecov (0.21.2)
|
57
59
|
docile (~> 1.1)
|
58
|
-
|
59
|
-
|
60
|
-
simplecov-html (0.
|
61
|
-
|
60
|
+
simplecov-html (~> 0.11)
|
61
|
+
simplecov_json_formatter (~> 0.1)
|
62
|
+
simplecov-html (0.12.3)
|
63
|
+
simplecov-lcov (0.8.0)
|
64
|
+
simplecov_json_formatter (0.1.3)
|
65
|
+
sinatra (2.1.0)
|
62
66
|
mustermann (~> 1.0)
|
63
|
-
rack (~> 2.
|
64
|
-
rack-protection (= 2.0
|
67
|
+
rack (~> 2.2)
|
68
|
+
rack-protection (= 2.1.0)
|
65
69
|
tilt (~> 2.0)
|
66
|
-
|
67
|
-
|
68
|
-
thor (0.20.3)
|
69
|
-
tilt (2.0.9)
|
70
|
-
tins (1.20.3)
|
71
|
-
webmock (3.6.0)
|
70
|
+
tilt (2.0.10)
|
71
|
+
webmock (3.12.2)
|
72
72
|
addressable (>= 2.3.6)
|
73
73
|
crack (>= 0.3.2)
|
74
74
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -77,12 +77,12 @@ PLATFORMS
|
|
77
77
|
ruby
|
78
78
|
|
79
79
|
DEPENDENCIES
|
80
|
-
coveralls
|
81
80
|
gem-release!
|
82
81
|
geminabox
|
83
82
|
rspec
|
84
83
|
simplecov
|
84
|
+
simplecov-lcov
|
85
85
|
webmock
|
86
86
|
|
87
87
|
BUNDLED WITH
|
88
|
-
2.
|
88
|
+
2.2.18
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to th
|
|
9
9
|
| Gem name | gem-release |
|
10
10
|
| License | [MIT](https://github.com/svenfuchs/gem-release/blob/master/LICENSE.md) |
|
11
11
|
| Version | [![Gem Version](https://badge.fury.io/rb/gem-release.svg)](http://badge.fury.io/rb/gem-release) |
|
12
|
-
| Continuous integration | [![Build Status](https://
|
12
|
+
| Continuous integration | [![GitHub Build Status](https://img.shields.io/github/workflow/status/svenfuchs/gem-release/Tests)](https://github.com/svenfuchs/gem-release/actions?query=workflow%3ATests) |
|
13
13
|
| Test coverage | [![Coverage Status](https://coveralls.io/repos/svenfuchs/gem-release/badge.svg)](https://coveralls.io/r/svenfuchs/gem-release) |
|
14
14
|
| Documentation | [Documentation](http://rdoc.info/github/svenfuchs/gem-release/frames) |
|
15
15
|
| Credits | [Contributors](https://github.com/svenfuchs/gem-release/graphs/contributors) |
|
@@ -209,7 +209,7 @@ gem_name - name of the gem (optional, will use the directory name, or all gemspe
|
|
209
209
|
### Options
|
210
210
|
|
211
211
|
```
|
212
|
-
-v, --version VERSION Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x]
|
212
|
+
-v, --version VERSION Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x, x.x.x.yyy.z]
|
213
213
|
-c, --[no-]commit Create a commit after incrementing gem version (default: true)
|
214
214
|
-m, --message Commit message template (default: Bump %{name} to %{version} %{skip_ci})
|
215
215
|
--skip-ci Add the [skip ci] tag to the commit message
|
@@ -249,6 +249,7 @@ minor # Bump to the next minor level (e.g. 0.0.1 to 0.1.0)
|
|
249
249
|
patch # Bump to the next patch level (e.g. 0.0.1 to 0.0.2)
|
250
250
|
pre|rc|etc # Bump to the next pre-release level (e.g. 0.0.1 to
|
251
251
|
# 0.1.0.pre.1, 1.0.0.pre.1 to 1.0.0.pre.2)
|
252
|
+
1.2.0.pre.3 # Bump to specific version number with provided pre-release level and build number
|
252
253
|
```
|
253
254
|
|
254
255
|
When searching for the version file for a gem named `gem-name`: the
|
@@ -312,6 +313,8 @@ gem_name - name of the gem (optional, will use the first gemspec, or all gemspec
|
|
312
313
|
--recurse Recurse into directories that contain gemspec files
|
313
314
|
--[no-]color
|
314
315
|
--pretend
|
316
|
+
--github Creates a Release on GitHub. Requires GitHub OAuth token passed by `--token TOKEN`
|
317
|
+
--token GitHub OAuth token. See https://developer.github.com/v3/#oauth2-token-sent-in-a-header for more details.
|
315
318
|
```
|
316
319
|
|
317
320
|
### Description
|
data/config.ru
ADDED
data/gem-release.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require 'gem/release/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'gem-release'
|
8
|
+
s.version = Gem::Release::VERSION
|
9
|
+
s.authors = ['Sven Fuchs', 'Dan Gebhardt']
|
10
|
+
s.email = ['me@svenfuchs.com']
|
11
|
+
s.homepage = 'https://github.com/svenfuchs/gem-release'
|
12
|
+
s.licenses = ['MIT']
|
13
|
+
s.summary = 'Release your ruby gems with ease'
|
14
|
+
s.description = 'Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)'
|
15
|
+
|
16
|
+
s.files = Dir.glob('{bin/*,lib/**/*,[A-Z]*}', File::FNM_DOTMATCH)
|
17
|
+
s.platform = Gem::Platform::RUBY
|
18
|
+
s.require_path = 'lib'
|
19
|
+
end
|
data/lib/gem/release/cmds.rb
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'gem/release/cmds/base'
|
2
|
+
require 'gem/release/context/github'
|
3
|
+
|
4
|
+
module Gem
|
5
|
+
module Release
|
6
|
+
module Cmds
|
7
|
+
class Github < Base
|
8
|
+
summary "Creates a GitHub release for the current version."
|
9
|
+
|
10
|
+
description <<-str.split("\n").map(&:lstrip).join("\n")
|
11
|
+
Creates a GitHub release for the current version.
|
12
|
+
|
13
|
+
Requires a tag `v[version]` to be present or --tag to be given.
|
14
|
+
str
|
15
|
+
|
16
|
+
MSGS = {
|
17
|
+
release: 'Creating GitHub release for %s version %s.',
|
18
|
+
no_tag: 'Tag %s does not exist. Run `gem tag` or pass `--tag`.',
|
19
|
+
no_repo: 'Could not determine the repository name. Please pass `--repo REPO`, or set homepage or metadata[:github_url] to the GitHub repository URL in the gemspec.',
|
20
|
+
no_token: 'Could not determine the GitHub OAuth token. Please pass `--token TOKEN`. See https://developer.github.com/v3/#oauth2-token-sent-in-a-header for more details.',
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
def run
|
24
|
+
in_gem_dirs do
|
25
|
+
announce :release, gem.name, tag_name
|
26
|
+
validate
|
27
|
+
release
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def validate
|
34
|
+
abort :no_tag, tag_name unless tagged?
|
35
|
+
abort :no_token unless token
|
36
|
+
end
|
37
|
+
|
38
|
+
def tagged?
|
39
|
+
git.tags.include?(tag_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
def release
|
43
|
+
return if pretend?
|
44
|
+
Context::Github.new(repo, data).release
|
45
|
+
end
|
46
|
+
|
47
|
+
def data
|
48
|
+
{
|
49
|
+
version: gem.version,
|
50
|
+
tag_name: tag_name,
|
51
|
+
name: "#{gem.name} #{tag_name}",
|
52
|
+
descr: descr,
|
53
|
+
token: token
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def tag_name
|
58
|
+
"v#{gem.version}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def repo
|
62
|
+
opts[:repo] || repo_from(gem.spec.homepage) || repo_from(gem.spec.metadata[:github_url]) || abort(:no_repo)
|
63
|
+
end
|
64
|
+
|
65
|
+
def repo_from(url)
|
66
|
+
url && url =~ %r(https://github\.com/(.*/.*)) && $1
|
67
|
+
end
|
68
|
+
|
69
|
+
def token
|
70
|
+
opts[:token]
|
71
|
+
end
|
72
|
+
|
73
|
+
def descr
|
74
|
+
opts[:descr]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -32,8 +32,17 @@ module Gem
|
|
32
32
|
host: 'Push to a compatible host other than rubygems.org',
|
33
33
|
key: 'Use the API key from ~/.gem/credentials',
|
34
34
|
tag: 'Shortcut for running the `gem tag` command',
|
35
|
-
push:
|
36
|
-
|
35
|
+
push: 'Push tag to the remote git repository',
|
36
|
+
github: 'Create a GitHub release',
|
37
|
+
recurse: 'Recurse into directories that contain gemspec files',
|
38
|
+
|
39
|
+
# region github
|
40
|
+
|
41
|
+
descr: 'Description of the release',
|
42
|
+
repo: "Full name of the repository on GitHub, e.g. svenfuchs/gem-release (defaults to the repo name from the gemspec's homepage if this is a GitHub URL)",
|
43
|
+
token: 'GitHub OAuth token'
|
44
|
+
|
45
|
+
# endregion github
|
37
46
|
}.freeze
|
38
47
|
|
39
48
|
opt '-h', '--host HOST', descr(:host) do |value|
|
@@ -56,6 +65,26 @@ module Gem
|
|
56
65
|
opts[:recurse] = value
|
57
66
|
end
|
58
67
|
|
68
|
+
# region github
|
69
|
+
|
70
|
+
opt '-g', '--github', descr(:github) do |value|
|
71
|
+
opts[:github] = value
|
72
|
+
end
|
73
|
+
|
74
|
+
opt '-d', '--description DESCRIPTION', descr(:descr) do |value|
|
75
|
+
opts[:descr] = value
|
76
|
+
end
|
77
|
+
|
78
|
+
opt '--repo REPO', descr(:repo) do |value|
|
79
|
+
opts[:repo] = value
|
80
|
+
end
|
81
|
+
|
82
|
+
opt '--token TOKEN', descr(:token) do |value|
|
83
|
+
opts[:token] = value
|
84
|
+
end
|
85
|
+
|
86
|
+
# endregion github
|
87
|
+
|
59
88
|
MSGS = {
|
60
89
|
release: 'Releasing %s with version %s',
|
61
90
|
build: 'Building %s',
|
@@ -73,7 +102,8 @@ module Gem
|
|
73
102
|
validate
|
74
103
|
release
|
75
104
|
end
|
76
|
-
tag
|
105
|
+
tag if opts[:tag]
|
106
|
+
github if opts[:github]
|
77
107
|
end
|
78
108
|
|
79
109
|
private
|
@@ -84,16 +114,13 @@ module Gem
|
|
84
114
|
|
85
115
|
def release
|
86
116
|
announce :release, gem.name, target_version
|
117
|
+
return if pretend?
|
87
118
|
build
|
88
119
|
push
|
89
120
|
ensure
|
90
121
|
cleanup
|
91
122
|
end
|
92
123
|
|
93
|
-
def tag
|
94
|
-
Tag.new(context, args, opts).run
|
95
|
-
end
|
96
|
-
|
97
124
|
def build
|
98
125
|
gem_cmd :build, gem.spec_filename
|
99
126
|
end
|
@@ -102,6 +129,14 @@ module Gem
|
|
102
129
|
gem_cmd :push, gem.filename, *push_args
|
103
130
|
end
|
104
131
|
|
132
|
+
def tag
|
133
|
+
Tag.new(context, args, opts).run
|
134
|
+
end
|
135
|
+
|
136
|
+
def github
|
137
|
+
Github.new(context, args, opts).run
|
138
|
+
end
|
139
|
+
|
105
140
|
def push_args
|
106
141
|
args = [:key, :host].map { |opt| ["--#{opt}", opts[opt]] if opts[opt] }
|
107
142
|
args << "--quiet" if quiet?
|
@@ -9,6 +9,10 @@ module Gem
|
|
9
9
|
@filename = name && "#{name}.gemspec" || filenames.first
|
10
10
|
end
|
11
11
|
|
12
|
+
def exists?
|
13
|
+
filename && File.exist?(filename)
|
14
|
+
end
|
15
|
+
|
12
16
|
def gem_name
|
13
17
|
gemspec.name if gemspec
|
14
18
|
end
|
@@ -21,8 +25,12 @@ module Gem
|
|
21
25
|
gemspec.file_name if gemspec
|
22
26
|
end
|
23
27
|
|
24
|
-
def
|
25
|
-
|
28
|
+
def metadata
|
29
|
+
gemspec && gemspec.metadata || {}
|
30
|
+
end
|
31
|
+
|
32
|
+
def homepage
|
33
|
+
gemspec.homepage if gemspec
|
26
34
|
end
|
27
35
|
|
28
36
|
private
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'gem/release/helper/http'
|
3
|
+
require 'gem/release/version'
|
4
|
+
|
5
|
+
module Gem
|
6
|
+
module Release
|
7
|
+
class Context
|
8
|
+
class Github
|
9
|
+
include Helper::Http
|
10
|
+
|
11
|
+
URL = 'https://api.github.com/repos/%s/releases'
|
12
|
+
|
13
|
+
MSGS = {
|
14
|
+
error: 'GitHub returned %s (body: %p)'
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
attr_reader :repo, :data
|
18
|
+
|
19
|
+
def initialize(repo, data)
|
20
|
+
@repo = repo
|
21
|
+
@data = data
|
22
|
+
end
|
23
|
+
|
24
|
+
def release
|
25
|
+
# Create a release
|
26
|
+
# https://developer.github.com/v3/repos/releases/#create-a-release
|
27
|
+
resp = post(url, body, headers)
|
28
|
+
status, body = resp
|
29
|
+
# success status code is 201 (created) not 200 (ok)
|
30
|
+
raise Abort, MSGS.fetch(:error) % [status, body] unless status == 201
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def url
|
36
|
+
URL % repo
|
37
|
+
end
|
38
|
+
|
39
|
+
def body
|
40
|
+
JSON.dump(
|
41
|
+
tag_name: data[:tag_name],
|
42
|
+
name: data[:name],
|
43
|
+
body: data[:descr],
|
44
|
+
prerelease: pre?(data[:version])
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def headers
|
49
|
+
{
|
50
|
+
'User-Agent' => "gem-release/v#{::Gem::Release::VERSION}",
|
51
|
+
'Content-Type' => 'text/json',
|
52
|
+
'Authorization' => "token #{data[:token]}",
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def pre?(version)
|
57
|
+
Version::Number.new(version).pre?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
1
4
|
require 'gem/release/files/template/context'
|
2
5
|
|
3
6
|
module Gem
|
@@ -30,6 +33,7 @@ module Gem
|
|
30
33
|
|
31
34
|
def write
|
32
35
|
return false if exists?
|
36
|
+
|
33
37
|
FileUtils.mkdir_p(File.dirname(target))
|
34
38
|
File.write(target, render)
|
35
39
|
FileUtils.chmod('+x', target) if opts[:executable]
|
data/lib/gem/release/helper.rb
CHANGED
@@ -34,9 +34,12 @@ module Gem
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def abort(msg, *args)
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
processed_msg = if msg.is_a?(Symbol)
|
38
|
+
self.class::MSGS.fetch(msg) % args
|
39
|
+
else
|
40
|
+
msg
|
41
|
+
end
|
42
|
+
context.abort("#{processed_msg} Aborting.")
|
40
43
|
end
|
41
44
|
end
|
42
45
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module Gem
|
5
|
+
module Release
|
6
|
+
module Helper
|
7
|
+
module Http
|
8
|
+
class Client < Struct.new(:method, :url, :body, :headers)
|
9
|
+
def request
|
10
|
+
req = const.new(uri.request_uri, headers)
|
11
|
+
req.body = body if body
|
12
|
+
resp = client.request(req)
|
13
|
+
[resp.code.to_i, resp.body]
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def uri
|
19
|
+
@uri ||= URI.parse(url)
|
20
|
+
end
|
21
|
+
|
22
|
+
def client
|
23
|
+
http_client = Net::HTTP.new(uri.host, uri.port)
|
24
|
+
http_client.use_ssl = (uri.scheme == 'https')
|
25
|
+
http_client
|
26
|
+
end
|
27
|
+
|
28
|
+
def const
|
29
|
+
Net::HTTP.const_get(method.to_s.capitalize)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def post(url, body = nil, headers = {})
|
34
|
+
Client.new(:post, url, body, headers).request
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/gem/release/version.rb
CHANGED
@@ -3,6 +3,7 @@ module Gem
|
|
3
3
|
module Version
|
4
4
|
class Number < Struct.new(:number, :target)
|
5
5
|
NUMBER = /^(\d+)\.?(\d+)?\.?(\d+)?(\-|\.)?(\w+)?\.?(\d+)?$/
|
6
|
+
PRE_RELEASE = /^(\d+)\.(\d+)\.(\d+)\.?(.*)(\d+)$/
|
6
7
|
|
7
8
|
STAGES = %i(alpha beta pre rc)
|
8
9
|
|
@@ -14,10 +15,14 @@ module Gem
|
|
14
15
|
parts.join(stage_delim)
|
15
16
|
end
|
16
17
|
|
18
|
+
def pre?
|
19
|
+
!!parts[4]
|
20
|
+
end
|
21
|
+
|
17
22
|
private
|
18
23
|
|
19
24
|
def specific?
|
20
|
-
target =~ NUMBER
|
25
|
+
target =~ NUMBER || target =~ PRE_RELEASE
|
21
26
|
end
|
22
27
|
|
23
28
|
def major
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
8
8
|
- Dan Gebhardt
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Release your ruby gems with ease. (What a bold statement for such a tiny
|
15
15
|
plugin ...)
|
@@ -25,12 +25,15 @@ files:
|
|
25
25
|
- MIT-LICENSE.md
|
26
26
|
- README.md
|
27
27
|
- README.md.erb
|
28
|
+
- config.ru
|
29
|
+
- gem-release.gemspec
|
28
30
|
- lib/gem/release.rb
|
29
31
|
- lib/gem/release/cmds.rb
|
30
32
|
- lib/gem/release/cmds/base.rb
|
31
33
|
- lib/gem/release/cmds/bootstrap.rb
|
32
34
|
- lib/gem/release/cmds/bump.rb
|
33
35
|
- lib/gem/release/cmds/gemspec.rb
|
36
|
+
- lib/gem/release/cmds/github.rb
|
34
37
|
- lib/gem/release/cmds/release.rb
|
35
38
|
- lib/gem/release/cmds/runner.rb
|
36
39
|
- lib/gem/release/cmds/tag.rb
|
@@ -41,6 +44,7 @@ files:
|
|
41
44
|
- lib/gem/release/context/gem.rb
|
42
45
|
- lib/gem/release/context/gemspec.rb
|
43
46
|
- lib/gem/release/context/git.rb
|
47
|
+
- lib/gem/release/context/github.rb
|
44
48
|
- lib/gem/release/context/paths.rb
|
45
49
|
- lib/gem/release/context/ui.rb
|
46
50
|
- lib/gem/release/data.rb
|
@@ -51,6 +55,7 @@ files:
|
|
51
55
|
- lib/gem/release/files/version.rb
|
52
56
|
- lib/gem/release/helper.rb
|
53
57
|
- lib/gem/release/helper/hash.rb
|
58
|
+
- lib/gem/release/helper/http.rb
|
54
59
|
- lib/gem/release/helper/string.rb
|
55
60
|
- lib/gem/release/support/gem_command.rb
|
56
61
|
- lib/gem/release/support/registry.rb
|
@@ -77,7 +82,7 @@ homepage: https://github.com/svenfuchs/gem-release
|
|
77
82
|
licenses:
|
78
83
|
- MIT
|
79
84
|
metadata: {}
|
80
|
-
post_install_message:
|
85
|
+
post_install_message:
|
81
86
|
rdoc_options: []
|
82
87
|
require_paths:
|
83
88
|
- lib
|
@@ -92,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
97
|
- !ruby/object:Gem::Version
|
93
98
|
version: '0'
|
94
99
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
96
|
-
signing_key:
|
100
|
+
rubygems_version: 3.2.18
|
101
|
+
signing_key:
|
97
102
|
specification_version: 4
|
98
103
|
summary: Release your ruby gems with ease
|
99
104
|
test_files: []
|