runger_release_assistant 0.9.0 → 0.11.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0c99d3dec5f2bdd4c9568d3ce6326371cf08d7f7ddde0f0237f6122fdef768a
4
- data.tar.gz: d01f8b764551671d3db86dadc41216aac3c0a89275a25f2b273a327607f88d0f
3
+ metadata.gz: 64a1650c650f99a77f5b9c36b0656420ec0943a31ce803b6501a83ed3018ed13
4
+ data.tar.gz: 32780af66bf5a617d190f01044f9e73440b42e5c653ff1e9d9daea94b5c626b2
5
5
  SHA512:
6
- metadata.gz: 76746bae3f96fee9498b4e31547ca9ca414c2b1f9a957ab45b9075128eddba960f7d12a3506575f2c32416f7b7ae6b4eebb4ba69b601bc384f5805f924d28bcc
7
- data.tar.gz: 8d6f05637af0a6dbe3e805b849a46e4c030906f3b0a26e7c234c35fc45907dd257856eae241f52d9ad3f14697eeb7ab6eb2f20054b99c6b4896f4827aa744e95
6
+ metadata.gz: a59b28167492a89d8d2f42fb89a7a41bbf6b509c41610189a0cfc997814cef46437d3d18723544ab850571be627dd3dc9a7ae98f322e54b44fcd2b253b97b4d6
7
+ data.tar.gz: 41c32e223762cdfa3caa319d75dec549843b6a19bf7b8dcaa9e8a901b63e0497bfc0d1b76b0a9e5c5144f5e4b353399aaf613b24d91f1a535e34d71b1c1147a1
@@ -1,9 +1,12 @@
1
+ ---
1
2
  version: 2
2
3
  updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "04:04"
8
- timezone: America/Chicago
9
- open-pull-requests-limit: 20
4
+ - package-ecosystem: bundler
5
+ directory: "/"
6
+ schedule:
7
+ interval: daily
8
+ time: "04:04"
9
+ timezone: America/Chicago
10
+ open-pull-requests-limit: 20
11
+ allow:
12
+ - dependency-type: all
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.3
1
+ 3.3.4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## v0.11.0 (2024-07-23)
2
+ - Run 'safe' command (if one exists) after releasing
3
+
4
+ ## v0.10.0 (2024-07-12)
5
+ - Don't require enter key when confirming release
6
+ - Print currently released version when confirming release
7
+ - Print changelog and diff when confirming release
8
+
9
+ ### Internal
10
+ - Bump Ruby from 3.3.3 to 3.3.4
11
+ - Update gems
12
+ - Run Gitleaks, ShellCheck, and RuboCop in pre-push hook
13
+
1
14
  ## v0.9.0 (2024-06-28)
2
15
  - Enforce only major and minor parts of required Ruby version (loosening the required Ruby version from 3.3.3 to 3.3.0)
3
16
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- runger_release_assistant (0.9.0)
4
+ runger_release_assistant (0.11.0)
5
5
  activesupport (>= 6, < 8)
6
6
  memo_wise (>= 1.7, < 2)
7
7
  rainbow (>= 3.0, < 4)
@@ -35,10 +35,10 @@ GEM
35
35
  language_server-protocol (3.17.0.3)
36
36
  memo_wise (1.9.0)
37
37
  method_source (1.1.0)
38
- minitest (5.24.0)
38
+ minitest (5.24.1)
39
39
  mutex_m (0.2.0)
40
40
  parallel (1.25.1)
41
- parser (3.3.3.0)
41
+ parser (3.3.4.0)
42
42
  ast (~> 2.4.1)
43
43
  racc
44
44
  prism (0.30.0)
@@ -52,7 +52,7 @@ GEM
52
52
  rainbow (3.1.1)
53
53
  rake (13.2.1)
54
54
  regexp_parser (2.9.2)
55
- rexml (3.3.1)
55
+ rexml (3.3.2)
56
56
  strscan
57
57
  rspec (3.13.0)
58
58
  rspec-core (~> 3.13.0)
@@ -67,13 +67,13 @@ GEM
67
67
  diff-lcs (>= 1.2.0, < 2.0)
68
68
  rspec-support (~> 3.13.0)
69
69
  rspec-support (3.13.1)
70
- rubocop (1.64.1)
70
+ rubocop (1.65.0)
71
71
  json (~> 2.3)
72
72
  language_server-protocol (>= 3.17.0)
73
73
  parallel (~> 1.10)
74
74
  parser (>= 3.3.0.2)
75
75
  rainbow (>= 2.2.2, < 4.0)
76
- regexp_parser (>= 1.8, < 3.0)
76
+ regexp_parser (>= 2.4, < 3.0)
77
77
  rexml (>= 3.2.5, < 4.0)
78
78
  rubocop-ast (>= 1.31.1, < 2.0)
79
79
  ruby-progressbar (~> 1.7)
@@ -83,10 +83,10 @@ GEM
83
83
  rubocop-performance (1.21.1)
84
84
  rubocop (>= 1.48.1, < 2.0)
85
85
  rubocop-ast (>= 1.31.1, < 2.0)
86
- rubocop-rspec (3.0.1)
86
+ rubocop-rspec (3.0.3)
87
87
  rubocop (~> 1.61)
88
88
  ruby-progressbar (1.13.0)
89
- runger_style (2.8.0)
89
+ runger_style (2.12.0)
90
90
  prism (>= 0.24.0)
91
91
  rubocop (>= 1.38.0, < 2)
92
92
  slop (4.10.1)
@@ -111,7 +111,7 @@ DEPENDENCIES
111
111
  runger_style
112
112
 
113
113
  RUBY VERSION
114
- ruby 3.3.3p89
114
+ ruby 3.3.4p94
115
115
 
116
116
  BUNDLED WITH
117
117
  2.5.11
data/README.md CHANGED
@@ -2,27 +2,46 @@
2
2
 
3
3
  # `runger_release_assistant`
4
4
 
5
- This is a CLI tool that helps to automate the process of releasing new versions of a gem via
6
- git/GitHub and (optionally) via RubyGems.
5
+ This is a CLI tool that I (David Runger) use to automate the release of new gem
6
+ versions via git/GitHub and (optionally) via RubyGems.
7
+
8
+ **I do not recommend this gem for general use.**
7
9
 
8
10
  <!--ts-->
9
- * [runger_release_assistant](#runger_release_assistant)
10
- * [Dependencies](#dependencies)
11
- * [Installation](#installation)
12
- * [Global installation](#global-installation)
13
- * [Installation in a specific project](#installation-in-a-specific-project)
14
- * [Create a binstub](#create-a-binstub)
15
- * [Basic usage](#basic-usage)
16
- * [Available options and examples](#available-options-and-examples)
17
- * [Using with RubyGems](#using-with-rubygems)
18
- * [Development](#development)
19
- * [Contributing](#contributing)
20
- * [License](#license)
21
-
22
- <!-- Added by: david, at: Mon Feb 1 20:16:03 PST 2021 -->
11
+ * [runger_release_assistant](#runger_release_assistant)
12
+ * [Not recommended for general use!](#not-recommended-for-general-use)
13
+ * [Dependencies](#dependencies)
14
+ * [Installation](#installation)
15
+ * [Global installation](#global-installation)
16
+ * [Installation in a specific project](#installation-in-a-specific-project)
17
+ * [Create a binstub](#create-a-binstub)
18
+ * [Basic usage](#basic-usage)
19
+ * [Available options and examples](#available-options-and-examples)
20
+ * [Config](#config)
21
+ * [Using with RubyGems](#using-with-rubygems)
22
+ * [Development](#development)
23
+ * [Contributing](#contributing)
24
+ * [License](#license)
25
+
26
+ <!-- Created by https://github.com/ekalinin/github-markdown-toc -->
27
+ <!-- Added by: david, at: Tue Jul 23 12:46:01 AM CDT 2024 -->
23
28
 
24
29
  <!--te-->
25
30
 
31
+ ## Not recommended for general use!
32
+
33
+ This gem is somewhat customized and built specifically for my (David Runger's)
34
+ custom and idiosyncratic workflow. For example, after releasing, this gem will
35
+ automatically execute a `safe` command, if one is present on the machine. You
36
+ might not want this behavior (if you have a `safe` command that you _don't_ want
37
+ to be invoked after a release).
38
+
39
+ Realistically speaking, though, this gem actually probably could be used by
40
+ anyone, since most of this gem's functionality actually is built in a
41
+ generalized way that I think won't conflict with most other people's workflows,
42
+ but, still, I'm guessing that there are other, better tools available, anyway,
43
+ and, so, on net, I just wouldn't recommend that others use this gem.
44
+
26
45
  ## Dependencies
27
46
 
28
47
  This gem assumes that you have `git` installed.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail # exit on any error, don't allow undefined variables, pipes don't swallow errors
4
+
5
+ lint gitleaks
6
+
7
+ background-and-notify lint rubocop
8
+ background-and-notify lint shellcheck
@@ -2,6 +2,6 @@
2
2
 
3
3
  # rubocop:disable Style/StaticClass
4
4
  class RungerReleaseAssistant
5
- VERSION = '0.9.0'
5
+ VERSION = '0.11.0'
6
6
  end
7
7
  # rubocop:enable Style/StaticClass
@@ -1,12 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/all'
4
+ require 'io/console'
4
5
  require 'memo_wise'
5
6
  require 'rainbow/refinement'
6
7
  require 'slop'
7
8
  require 'yaml'
8
9
 
10
+ module StringWithPipe
11
+ refine String do
12
+ def pipe(command)
13
+ IO.popen(command, 'r+') do |io|
14
+ io.puts(self)
15
+ io.close_write
16
+ io.read
17
+ end
18
+ end
19
+ end
20
+ end
21
+
9
22
  using Rainbow
23
+ using StringWithPipe
10
24
 
11
25
  # We need to define the class before requiring the modules.
12
26
  # rubocop:disable Lint/EmptyClass
@@ -57,8 +71,8 @@ class RungerReleaseAssistant
57
71
  end
58
72
 
59
73
  def run_release
60
- print_release_plan
61
- confirm_release_plan
74
+ print_release_info
75
+ confirm_release_looks_good
62
76
  verify_repository_cleanliness
63
77
  remember_initial_branch
64
78
  switch_to_main
@@ -83,6 +97,7 @@ class RungerReleaseAssistant
83
97
  ERROR_LOG
84
98
  restore_and_abort(exit_code: 1)
85
99
  else
100
+ run_safe_command
86
101
  switch_to_initial_branch
87
102
  end
88
103
 
@@ -94,19 +109,29 @@ class RungerReleaseAssistant
94
109
  end
95
110
  end
96
111
 
97
- def print_release_plan
98
- logger.info("You are running the release process with options #{@options.to_h}!")
99
- logger.info("Current version is #{current_version}")
100
- logger.info("Next version will be #{next_version}")
112
+ def print_release_info
113
+ logger.info("You are running the release process with options #{@options.to_h}.")
114
+ logger.info("Current released version is #{current_released_version.blue}.")
115
+ logger.info("Current alpha version is #{current_version.yellow}.")
116
+ logger.info("Next version will be #{next_version.green}.")
117
+
118
+ print_changelog_content_of_upcoming_release
119
+
120
+ print_diff_since_last_release
101
121
  end
102
122
 
103
- def confirm_release_plan
123
+ def confirm_release_looks_good
104
124
  logger.info('Does that look good? [y]n')
105
- response = $stdin.gets.chomp
106
125
 
107
- if response.downcase == 'n' # rubocop:disable Performance/Casecmp
126
+ case $stdin.getch
127
+ when 'n', "\u0003"
108
128
  logger.info('Okay, aborting.')
109
129
  restore_and_abort(exit_code: 0)
130
+ when 'y', "\r"
131
+ # (proceed)
132
+ else
133
+ logger.info("That's not an option.")
134
+ confirm_release_looks_good
110
135
  end
111
136
  end
112
137
 
@@ -177,7 +202,11 @@ class RungerReleaseAssistant
177
202
  end
178
203
 
179
204
  def create_tag
180
- execute_command(%(git tag -m "Version #{next_version}" v#{next_version}))
205
+ execute_command(%(git tag -m 'Version #{next_version}' '#{git_tag_version(next_version)}'))
206
+ end
207
+
208
+ def git_tag_version(version)
209
+ "v#{version}"
181
210
  end
182
211
 
183
212
  def push_to_git
@@ -192,6 +221,12 @@ class RungerReleaseAssistant
192
221
  execute_command('bundle exec rake release', show_system_output: true)
193
222
  end
194
223
 
224
+ def run_safe_command
225
+ if system('which safe')
226
+ execute_command('safe')
227
+ end
228
+ end
229
+
195
230
  def switch_to_initial_branch
196
231
  execute_command("git checkout #{@initial_branch}") if @initial_branch
197
232
  end
@@ -226,6 +261,23 @@ class RungerReleaseAssistant
226
261
  exit(exit_code)
227
262
  end
228
263
 
264
+ def print_changelog_content_of_upcoming_release
265
+ logger.info('Changelog content for this upcoming release:')
266
+ File.read(changelog_path)[/\A## Unreleased\n(?:(?!\n## ).)+/m].
267
+ pipe('bat --color always --language markdown --style grid,numbers').
268
+ then { puts(_1) }
269
+ end
270
+
271
+ def print_diff_since_last_release
272
+ logger.info('Diff since the last release:')
273
+ system(
274
+ { 'DELTA_PAGER' => 'cat' },
275
+ 'git',
276
+ 'diff',
277
+ "#{git_tag_version(current_released_version)}...",
278
+ )
279
+ end
280
+
229
281
  def file_path(file_name)
230
282
  system_output("find . -type f -name #{file_name}").delete_prefix('./')
231
283
  end
@@ -248,6 +300,11 @@ class RungerReleaseAssistant
248
300
  file_path('CHANGELOG.md')
249
301
  end
250
302
 
303
+ memo_wise \
304
+ def current_released_version
305
+ `git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -1`.delete_prefix('v').rstrip
306
+ end
307
+
251
308
  memo_wise \
252
309
  def current_version
253
310
  file_contents(version_file_path).match(/VERSION += +['"](?<version>.*)['"]/)&.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runger_release_assistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Runger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-29 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -108,6 +108,7 @@ files:
108
108
  - Rakefile
109
109
  - bin/_guard-core
110
110
  - bin/console
111
+ - bin/githooks/pre-push
111
112
  - bin/guard
112
113
  - bin/release
113
114
  - bin/rspec
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
- rubygems_version: 3.5.14
146
+ rubygems_version: 3.5.15
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: A gem / CLI tool to automate the release process of other gems