gem_toys 0.9.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -1
- data/README.md +6 -6
- data/lib/gem_toys/template/common_code.rb +15 -4
- data/lib/gem_toys/template/release/changelog.rb +5 -2
- data/lib/gem_toys/template/release/git.rb +6 -5
- data/lib/gem_toys/template/release.rb +26 -15
- data/lib/gem_toys/template/versions.rb +3 -1
- data/lib/gem_toys/template.rb +1 -1
- data/lib/gem_toys/version.rb +1 -1
- metadata +10 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fea5af09163d451da7c5b9f23bae4050be9485ba4eddf0c119740502ac6feafc
|
4
|
+
data.tar.gz: 4dc42971cbaa2706969aab2f7bf6c246c36a5f51211921a44d0079008cede0d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 336ff0b6d142324b6d37db1dc106864f120dd4cae1952bce715a0a3570b57534826ae687a70e789dea1bea5eacae7c3699b5a8e05c9f9ee86f45d21d4b6d9e4d
|
7
|
+
data.tar.gz: 4543e8537c06d8551d37a1bc02e2f99e861200e9359d7a5e20aa7ae6c039703de8025119b62ddc1149dc109e0e1e04c9229954019648b8fa4f93406a582d2371
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,41 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 0.12.1 (2022-02-07)
|
6
|
+
|
7
|
+
* Drop Ruby 2.5 support.
|
8
|
+
* Add Ruby 3.1 support.
|
9
|
+
|
10
|
+
## 0.12.0 (2022-02-07)
|
11
|
+
|
12
|
+
* Update Faraday to version 2.
|
13
|
+
* Update development dependencies.
|
14
|
+
|
15
|
+
## 0.11.3 (2021-11-10)
|
16
|
+
|
17
|
+
* Resolve RuboCop offense, take out manual check menu choices.
|
18
|
+
|
19
|
+
## 0.11.2 (2021-11-07)
|
20
|
+
|
21
|
+
* Fix version for gem staff after manual refresh too.
|
22
|
+
|
23
|
+
## 0.11.1 (2021-11-07)
|
24
|
+
|
25
|
+
* Fix new version for git staff after manual refresh.
|
26
|
+
|
27
|
+
## 0.11.0 (2021-10-29)
|
28
|
+
|
29
|
+
* Revert version and changelog files changes at rejection.
|
30
|
+
* Revert version file changes at changelog fails.
|
31
|
+
* Update development dependencies.
|
32
|
+
|
33
|
+
## 0.10.0 (2021-10-15)
|
34
|
+
|
35
|
+
* Process cases with non-JSON String from RubyGems.org.
|
36
|
+
* Update development dependencies.
|
37
|
+
* Resolve new offenses from RuboCop.
|
38
|
+
* Change default for unreleased in Changelog.
|
4
39
|
|
5
40
|
## 0.9.0 (2021-08-26)
|
6
41
|
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Gem Toys
|
2
2
|
|
3
3
|
[![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/AlexWayfer/gem_toys?style=flat-square)](https://cirrus-ci.com/github/AlexWayfer/gem_toys)
|
4
|
-
[![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/gem_toys/
|
4
|
+
[![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/gem_toys/main.svg?style=flat-square)](https://codecov.io/gh/AlexWayfer/gem_toys)
|
5
5
|
[![Code Climate](https://img.shields.io/codeclimate/maintainability/AlexWayfer/gem_toys.svg?style=flat-square)](https://codeclimate.com/github/AlexWayfer/gem_toys)
|
6
6
|
[![Depfu](https://img.shields.io/depfu/AlexWayfer/benchmark_toys?style=flat-square)](https://depfu.com/repos/github/AlexWayfer/gem_toys)
|
7
|
-
[![Inline docs](https://inch-ci.org/github/AlexWayfer/gem_toys.svg?branch=
|
8
|
-
[![license](https://img.shields.io/github/license/AlexWayfer/gem_toys.svg?style=flat-square)](https://github.com/AlexWayfer/gem_toys/blob/
|
7
|
+
[![Inline docs](https://inch-ci.org/github/AlexWayfer/gem_toys.svg?branch=main)](https://inch-ci.org/github/AlexWayfer/gem_toys)
|
8
|
+
[![license](https://img.shields.io/github/license/AlexWayfer/gem_toys.svg?style=flat-square)](https://github.com/AlexWayfer/gem_toys/blob/main/LICENSE.txt)
|
9
9
|
[![Gem](https://img.shields.io/gem/v/gem_toys.svg?style=flat-square)](https://rubygems.org/gems/gem_toys)
|
10
10
|
|
11
11
|
[Toys](https://github.com/dazuma/toys) template for gems, like building, releasing, etc.
|
@@ -38,8 +38,8 @@ require 'gem_toys'
|
|
38
38
|
expand GemToys::Template,
|
39
39
|
## default is `CHANGELOG.md`
|
40
40
|
changelog_file_name: 'ChangeLog.md',
|
41
|
-
## default is `##
|
42
|
-
unreleased_title: '##
|
41
|
+
## default is `## Unreleased`
|
42
|
+
unreleased_title: '## main (unreleased)',
|
43
43
|
## default is `"lib/#{project_name_with_slashes_instead_dashes}/version.rb"`
|
44
44
|
version_file_path: 'lib/my-awesome_gem.rb',
|
45
45
|
## default is `v`, so tags are like `v4.1.0`
|
@@ -63,7 +63,7 @@ alias_tool :g, :gem
|
|
63
63
|
|
64
64
|
1. Update `lib/*gem_name*/version.rb` file.
|
65
65
|
Can be refined with `:version_file_path` option on `expand`.
|
66
|
-
2. Insert Markdown title with changes from `##
|
66
|
+
2. Insert Markdown title with changes from `## Unreleased` in a `CHANGELOG.md` file.
|
67
67
|
Can be refined with `:unreleased_title` option on `expand`.
|
68
68
|
3. [Builds](#build) a gem.
|
69
69
|
4. Ask you for manual check, if you want (print anything of OK).
|
@@ -28,6 +28,10 @@ module GemToys
|
|
28
28
|
end
|
29
29
|
|
30
30
|
memoize def current_version
|
31
|
+
parse_version_from_file
|
32
|
+
end
|
33
|
+
|
34
|
+
def parse_version_from_file
|
31
35
|
version_file_content.match(/VERSION = '(.+)'/)[1]
|
32
36
|
end
|
33
37
|
|
@@ -49,15 +53,22 @@ module GemToys
|
|
49
53
|
|
50
54
|
memoize def rubygems_connection
|
51
55
|
require 'faraday'
|
52
|
-
require 'faraday_middleware'
|
53
56
|
|
54
|
-
Faraday.new 'https://rubygems.org/api/v1' do |
|
55
|
-
|
57
|
+
Faraday.new 'https://rubygems.org/api/v1' do |connection|
|
58
|
+
connection.response :json,
|
59
|
+
content_type: /\bjson$/,
|
60
|
+
parser_options: { symbolize_names: true }
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
59
64
|
memoize def rubygems_versions
|
60
|
-
rubygems_connection.get("versions/#{project_name}.json").body
|
65
|
+
response = rubygems_connection.get("versions/#{project_name}.json").body
|
66
|
+
|
67
|
+
return response if response.is_a?(Array)
|
68
|
+
|
69
|
+
return [] if response == 'This rubygem could not be found.'
|
70
|
+
|
71
|
+
raise "Unexpected response from RubyGems.org: #{response.inspect}"
|
61
72
|
end
|
62
73
|
|
63
74
|
def current_version_hash
|
@@ -28,11 +28,14 @@ module GemToys
|
|
28
28
|
|
29
29
|
unreleased_title_index = @changelog_lines.index("#{unreleased_title}\n")
|
30
30
|
|
31
|
-
|
31
|
+
unless unreleased_title_index
|
32
|
+
sh "git restore --worktree #{version_file_path}"
|
33
|
+
abort_without_unreleased_title
|
34
|
+
end
|
32
35
|
|
33
36
|
@changelog_lines.insert(
|
34
37
|
unreleased_title_index + 2,
|
35
|
-
'#' * unreleased_title.scan(/^#+/).first.size + " #{@new_version} (#{@today})\n\n"
|
38
|
+
('#' * unreleased_title.scan(/^#+/).first.size) + " #{@new_version} (#{@today})\n\n"
|
36
39
|
).join
|
37
40
|
end
|
38
41
|
|
@@ -8,16 +8,17 @@ module GemToys
|
|
8
8
|
private
|
9
9
|
|
10
10
|
def process_git
|
11
|
-
|
11
|
+
## `current_version` should be refreshed before this method invocation
|
12
|
+
version_git_tag = "#{@template.version_tag_prefix}#{current_version}"
|
12
13
|
|
13
|
-
## Checkout to a new git branch, required for protected `
|
14
|
-
# sh "git switch -c #{
|
14
|
+
## Checkout to a new git branch, required for protected `main` with CI
|
15
|
+
# sh "git switch -c #{version_git_tag}"
|
15
16
|
|
16
17
|
commit_changes
|
17
18
|
|
18
19
|
## Tag commit
|
19
20
|
puts 'Tagging the commit...'
|
20
|
-
sh "git tag -a #{
|
21
|
+
sh "git tag -a #{version_git_tag} -m 'Version #{current_version}'"
|
21
22
|
|
22
23
|
## Push commit
|
23
24
|
puts 'Pushing commit...'
|
@@ -33,7 +34,7 @@ module GemToys
|
|
33
34
|
|
34
35
|
sh "git add #{version_file_path} #{changelog_file_path}"
|
35
36
|
|
36
|
-
sh "git commit -m 'Update version to #{
|
37
|
+
sh "git commit -m 'Update version to #{current_version}'"
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -76,8 +76,6 @@ module GemToys
|
|
76
76
|
else
|
77
77
|
new_version
|
78
78
|
end
|
79
|
-
|
80
|
-
clear_memery_cache! :current_version
|
81
79
|
end
|
82
80
|
|
83
81
|
def handle_keyword_in_new_version(current_version_parts, version_index)
|
@@ -101,10 +99,31 @@ module GemToys
|
|
101
99
|
)
|
102
100
|
end
|
103
101
|
|
102
|
+
self::MANUAL_CHECK_MENU = {
|
103
|
+
yes: (proc do
|
104
|
+
## `current_version` is using in `git` and `gem` commands
|
105
|
+
clear_memery_cache! :current_version
|
106
|
+
end),
|
107
|
+
no: (proc do
|
108
|
+
handle_refusing_to_continue
|
109
|
+
end),
|
110
|
+
refresh: (proc do
|
111
|
+
wait_for_manual_check
|
112
|
+
end)
|
113
|
+
}.freeze
|
114
|
+
|
104
115
|
def wait_for_manual_check
|
105
116
|
print_files_diff
|
106
117
|
|
107
|
-
|
118
|
+
HighLine.new.choose do |menu|
|
119
|
+
menu.layout = :one_line
|
120
|
+
|
121
|
+
menu.prompt = 'Are these changes correct? '
|
122
|
+
|
123
|
+
self.class::MANUAL_CHECK_MENU.each do |choice, block|
|
124
|
+
menu.choice(choice) { instance_exec(&block) }
|
125
|
+
end
|
126
|
+
end
|
108
127
|
end
|
109
128
|
|
110
129
|
def print_files_diff
|
@@ -113,19 +132,11 @@ module GemToys
|
|
113
132
|
$stdout.puts
|
114
133
|
end
|
115
134
|
|
116
|
-
def
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
menu.prompt = 'Are these changes correct? '
|
121
|
-
|
122
|
-
menu.choice(:yes)
|
123
|
-
menu.choice(:no) { abort }
|
124
|
-
menu.choice(:refresh) do
|
125
|
-
handle_new_version
|
126
|
-
wait_for_manual_check
|
127
|
-
end
|
135
|
+
def handle_refusing_to_continue
|
136
|
+
[version_file_path, changelog_file_path].each do |file_path|
|
137
|
+
sh "git restore --worktree #{file_path}"
|
128
138
|
end
|
139
|
+
abort
|
129
140
|
end
|
130
141
|
end
|
131
142
|
end
|
@@ -19,7 +19,9 @@ module GemToys
|
|
19
19
|
|
20
20
|
versions = rubygems_versions
|
21
21
|
|
22
|
-
versions.
|
22
|
+
if versions.empty? || current_version != versions.first[:number]
|
23
|
+
versions.unshift current_version_hash
|
24
|
+
end
|
23
25
|
|
24
26
|
puts_versions versions
|
25
27
|
end
|
data/lib/gem_toys/template.rb
CHANGED
@@ -15,7 +15,7 @@ module GemToys
|
|
15
15
|
changelog_file_name: 'CHANGELOG.md',
|
16
16
|
version_file_path: nil,
|
17
17
|
version_tag_prefix: 'v',
|
18
|
-
unreleased_title: '##
|
18
|
+
unreleased_title: '## Unreleased'
|
19
19
|
)
|
20
20
|
@changelog_file_name = changelog_file_name
|
21
21
|
@version_file_path = version_file_path
|
data/lib/gem_toys/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_toys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alt_memery
|
@@ -30,28 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: faraday_middleware
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.0'
|
33
|
+
version: '2.0'
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '2.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: highline
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +142,14 @@ dependencies:
|
|
156
142
|
requirements:
|
157
143
|
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
145
|
+
version: 1.24.1
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
152
|
+
version: 1.24.1
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: rubocop-performance
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,7 +204,8 @@ licenses:
|
|
218
204
|
metadata:
|
219
205
|
source_code_uri: https://github.com/AlexWayfer/gem_toys
|
220
206
|
homepage_uri: https://github.com/AlexWayfer/gem_toys
|
221
|
-
changelog_uri: https://github.com/AlexWayfer/gem_toys/blob/
|
207
|
+
changelog_uri: https://github.com/AlexWayfer/gem_toys/blob/main/CHANGELOG.md
|
208
|
+
rubygems_mfa_required: 'true'
|
222
209
|
post_install_message:
|
223
210
|
rdoc_options: []
|
224
211
|
require_paths:
|
@@ -227,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
214
|
requirements:
|
228
215
|
- - ">="
|
229
216
|
- !ruby/object:Gem::Version
|
230
|
-
version: '2.
|
217
|
+
version: '2.6'
|
231
218
|
- - "<"
|
232
219
|
- !ruby/object:Gem::Version
|
233
220
|
version: '4'
|
@@ -237,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
224
|
- !ruby/object:Gem::Version
|
238
225
|
version: '0'
|
239
226
|
requirements: []
|
240
|
-
rubygems_version: 3.
|
227
|
+
rubygems_version: 3.3.3
|
241
228
|
signing_key:
|
242
229
|
specification_version: 4
|
243
230
|
summary: Toys template for gems
|