runger_release_assistant 0.8.0 → 0.10.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: acd9c7a3cd90d5c7edece48f080cb2b806186af56aacd4edb18b52b89a0a01c3
4
- data.tar.gz: cf080826178149c6a2bd001f3e41907bf6be497fee53b3c718af5a1dcb86146a
3
+ metadata.gz: 4f602de5188864bef60835e784830100b08349a1719e1d96ccd71a3e76871b3c
4
+ data.tar.gz: 103c5b3b87636d53f4dc9f8872feee81449e498ded6c190716776c0e007d9918
5
5
  SHA512:
6
- metadata.gz: 341a2cbea06b39ab4d5d2f45afebc9f457914c0a0b4777d008acb4f2a767f99b2969286811b10ee5efc683062cb36452a212a6407c4f89038c25aa4d279b990c
7
- data.tar.gz: 36c969f791d2b3da04a604dbfc68bcb658bf0502e7599fb0fbed4e5c9d5878c45510ae512dac84cef8f25eff70ddb86e735b69aaf9766ef76eab321ead6061db
6
+ metadata.gz: 70d1914de0407029e273495d797330164fab880f53e113734475410c0bbe82625b318b1b52544eb4ab028443324fe8019ef8653855775aa66a0ae1ba4813d9a6
7
+ data.tar.gz: b0cbe79c7c6255012d517289c16d14a07a20e24711f6679a8560b17a3c71e8ad1d6c86d1ec57631a15c809ef33ea821ca4f584b500210fc8e9ac2aefe3a2d1b7
@@ -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
@@ -3,13 +3,16 @@ name: Run RuboCop and RSpec
3
3
  on:
4
4
  pull_request:
5
5
  branches:
6
- - main
6
+ - '*'
7
+ push:
8
+ branches:
9
+ - main
7
10
 
8
11
  jobs:
9
12
  build:
10
13
  runs-on: ubuntu-latest
11
14
  steps:
12
- - uses: actions/checkout@v3
15
+ - uses: actions/checkout@v4
13
16
  - uses: ruby/setup-ruby@v1
14
17
  with:
15
18
  bundler-cache: true
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.3
1
+ 3.3.4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## v0.10.0 (2024-07-12)
2
+ - Don't require enter key when confirming release
3
+ - Print currently released version when confirming release
4
+ - Print changelog and diff when confirming release
5
+
6
+ ### Internal
7
+ - Bump Ruby from 3.3.3 to 3.3.4
8
+ - Update gems
9
+ - Run Gitleaks, ShellCheck, and RuboCop in pre-push hook
10
+
11
+ ## v0.9.0 (2024-06-28)
12
+ - Enforce only major and minor parts of required Ruby version (loosening the required Ruby version from 3.3.3 to 3.3.0)
13
+
1
14
  ## v0.8.0 (2024-06-15)
2
15
  - Rename primary branch from `master` to `main`
3
16
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- runger_release_assistant (0.8.0)
4
+ runger_release_assistant (0.10.0)
5
5
  activesupport (>= 6, < 8)
6
6
  memo_wise (>= 1.7, < 2)
7
7
  rainbow (>= 3.0, < 4)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.1.3.3)
13
+ activesupport (7.1.3.4)
14
14
  base64
15
15
  bigdecimal
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -25,7 +25,7 @@ GEM
25
25
  bigdecimal (3.1.8)
26
26
  byebug (11.1.3)
27
27
  coderay (1.1.3)
28
- concurrent-ruby (1.2.3)
28
+ concurrent-ruby (1.3.3)
29
29
  connection_pool (2.4.1)
30
30
  diff-lcs (1.5.1)
31
31
  drb (2.2.1)
@@ -33,15 +33,15 @@ GEM
33
33
  concurrent-ruby (~> 1.0)
34
34
  json (2.7.2)
35
35
  language_server-protocol (3.17.0.3)
36
- memo_wise (1.8.0)
37
- method_source (1.0.0)
38
- minitest (5.23.0)
36
+ memo_wise (1.9.0)
37
+ method_source (1.1.0)
38
+ minitest (5.24.1)
39
39
  mutex_m (0.2.0)
40
- parallel (1.24.0)
41
- parser (3.3.1.0)
40
+ parallel (1.25.1)
41
+ parser (3.3.4.0)
42
42
  ast (~> 2.4.1)
43
43
  racc
44
- prism (0.29.0)
44
+ prism (0.30.0)
45
45
  pry (0.14.2)
46
46
  coderay (~> 1.1)
47
47
  method_source (~> 1.0)
@@ -52,50 +52,41 @@ GEM
52
52
  rainbow (3.1.1)
53
53
  rake (13.2.1)
54
54
  regexp_parser (2.9.2)
55
- rexml (3.2.8)
56
- strscan (>= 3.0.9)
55
+ rexml (3.3.1)
56
+ strscan
57
57
  rspec (3.13.0)
58
58
  rspec-core (~> 3.13.0)
59
59
  rspec-expectations (~> 3.13.0)
60
60
  rspec-mocks (~> 3.13.0)
61
61
  rspec-core (3.13.0)
62
62
  rspec-support (~> 3.13.0)
63
- rspec-expectations (3.13.0)
63
+ rspec-expectations (3.13.1)
64
64
  diff-lcs (>= 1.2.0, < 2.0)
65
65
  rspec-support (~> 3.13.0)
66
- rspec-mocks (3.13.0)
66
+ rspec-mocks (3.13.1)
67
67
  diff-lcs (>= 1.2.0, < 2.0)
68
68
  rspec-support (~> 3.13.0)
69
- rspec-support (3.13.0)
70
- rubocop (1.64.0)
69
+ rspec-support (3.13.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)
80
80
  unicode-display_width (>= 2.4.0, < 3.0)
81
81
  rubocop-ast (1.31.3)
82
82
  parser (>= 3.3.1.0)
83
- rubocop-capybara (2.20.0)
84
- rubocop (~> 1.41)
85
- rubocop-factory_bot (2.25.1)
86
- rubocop (~> 1.41)
87
- rubocop-performance (1.21.0)
83
+ rubocop-performance (1.21.1)
88
84
  rubocop (>= 1.48.1, < 2.0)
89
85
  rubocop-ast (>= 1.31.1, < 2.0)
90
- rubocop-rspec (2.29.2)
91
- rubocop (~> 1.40)
92
- rubocop-capybara (~> 2.17)
93
- rubocop-factory_bot (~> 2.22)
94
- rubocop-rspec_rails (~> 2.28)
95
- rubocop-rspec_rails (2.28.3)
96
- rubocop (~> 1.40)
86
+ rubocop-rspec (3.0.3)
87
+ rubocop (~> 1.61)
97
88
  ruby-progressbar (1.13.0)
98
- runger_style (2.4.0)
89
+ runger_style (2.12.0)
99
90
  prism (>= 0.24.0)
100
91
  rubocop (>= 1.38.0, < 2)
101
92
  slop (4.10.1)
@@ -120,7 +111,7 @@ DEPENDENCIES
120
111
  runger_style
121
112
 
122
113
  RUBY VERSION
123
- ruby 3.3.3p89
114
+ ruby 3.3.4p94
124
115
 
125
116
  BUNDLED WITH
126
117
  2.5.11
data/README.md CHANGED
@@ -103,7 +103,7 @@ Example:
103
103
 
104
104
  ## Config
105
105
 
106
- Create a configuration file with `release --init`.
106
+ You can create a configuration file with `release --init`.
107
107
 
108
108
  Here is an example:
109
109
 
@@ -114,6 +114,15 @@ rubygems: false
114
114
  primary_branch: main
115
115
  ```
116
116
 
117
+ The above example (more or less) illustrates the default values, so you don't
118
+ need to create a config file, if those are the values that you want.
119
+
120
+ Regarding the `primary_branch` option, `runger_release_assistant` will
121
+ automatically detect as the "primary branch" any one of the following: `main`,
122
+ `master`, or `trunk`. So, if one of those is the name of your primary branch,
123
+ and if you also want `git: true` and `rubygems: false`, then you don't need to
124
+ create a config file.
125
+
117
126
  ## Using with RubyGems
118
127
 
119
128
  By default, `runger_release_assistant` assumes that you only want to "release" your gem via GitHub. If
@@ -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
data/bin/release ADDED
@@ -0,0 +1 @@
1
+ ../exe/release
@@ -19,6 +19,7 @@ class RungerReleaseAssistant::ConfigFileReader
19
19
  "#{ENV.fetch('PWD')}/.release_assistant.yml"
20
20
  end
21
21
 
22
+ memo_wise \
22
23
  def config_file_exists?
23
24
  File.exist?(config_file_path)
24
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  # rubocop:disable Style/StaticClass
4
4
  class RungerReleaseAssistant
5
- VERSION = '0.8.0'
5
+ VERSION = '0.10.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
@@ -94,19 +108,29 @@ class RungerReleaseAssistant
94
108
  end
95
109
  end
96
110
 
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}")
111
+ def print_release_info
112
+ logger.info("You are running the release process with options #{@options.to_h}.")
113
+ logger.info("Current released version is #{current_released_version.blue}.")
114
+ logger.info("Current alpha version is #{current_version.yellow}.")
115
+ logger.info("Next version will be #{next_version.green}.")
116
+
117
+ print_changelog_content_of_upcoming_release
118
+
119
+ print_diff_since_last_release
101
120
  end
102
121
 
103
- def confirm_release_plan
122
+ def confirm_release_looks_good
104
123
  logger.info('Does that look good? [y]n')
105
- response = $stdin.gets.chomp
106
124
 
107
- if response.downcase == 'n' # rubocop:disable Performance/Casecmp
125
+ case $stdin.getch
126
+ when 'n', "\u0003"
108
127
  logger.info('Okay, aborting.')
109
128
  restore_and_abort(exit_code: 0)
129
+ when 'y', "\r"
130
+ # (proceed)
131
+ else
132
+ logger.info("That's not an option.")
133
+ confirm_release_looks_good
110
134
  end
111
135
  end
112
136
 
@@ -130,8 +154,8 @@ class RungerReleaseAssistant
130
154
  memo_wise \
131
155
  def primary_branch
132
156
  @options[:primary_branch] ||
133
- common_primary_branch_name ||
134
- (raise(UnknownPrimaryBranch))
157
+ common_primary_branch_name ||
158
+ (raise(UnknownPrimaryBranch))
135
159
  end
136
160
 
137
161
  memo_wise \
@@ -177,7 +201,11 @@ class RungerReleaseAssistant
177
201
  end
178
202
 
179
203
  def create_tag
180
- execute_command(%(git tag -m "Version #{next_version}" v#{next_version}))
204
+ execute_command(%(git tag -m 'Version #{next_version}' '#{git_tag_version(next_version)}'))
205
+ end
206
+
207
+ def git_tag_version(version)
208
+ "v#{version}"
181
209
  end
182
210
 
183
211
  def push_to_git
@@ -226,6 +254,23 @@ class RungerReleaseAssistant
226
254
  exit(exit_code)
227
255
  end
228
256
 
257
+ def print_changelog_content_of_upcoming_release
258
+ logger.info('Changelog content for this upcoming release:')
259
+ File.read(changelog_path)[/\A## Unreleased\n(?:(?!\n## ).)+/m].
260
+ pipe('bat --color always --language markdown --style grid,numbers').
261
+ then { puts(_1) }
262
+ end
263
+
264
+ def print_diff_since_last_release
265
+ logger.info('Diff since the last release:')
266
+ system(
267
+ { 'DELTA_PAGER' => 'cat' },
268
+ 'git',
269
+ 'diff',
270
+ "#{git_tag_version(current_released_version)}...",
271
+ )
272
+ end
273
+
229
274
  def file_path(file_name)
230
275
  system_output("find . -type f -name #{file_name}").delete_prefix('./')
231
276
  end
@@ -248,6 +293,11 @@ class RungerReleaseAssistant
248
293
  file_path('CHANGELOG.md')
249
294
  end
250
295
 
296
+ memo_wise \
297
+ def current_released_version
298
+ `git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -1`.delete_prefix('v').rstrip
299
+ end
300
+
251
301
  memo_wise \
252
302
  def current_version
253
303
  file_contents(version_file_path).match(/VERSION += +['"](?<version>.*)['"]/)&.
@@ -39,5 +39,6 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency('rainbow', '>= 3.0', '< 4')
40
40
  spec.add_dependency('slop', '~> 4.8')
41
41
 
42
- spec.required_ruby_version = ">= #{File.read('.ruby-version').rstrip}"
42
+ required_ruby_version = File.read('.ruby-version').rstrip.sub(/\A(\d+\.\d+)\.\d+\z/, '\1.0')
43
+ spec.required_ruby_version = ">= #{required_ruby_version}"
43
44
  end
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.8.0
4
+ version: 0.10.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-16 00:00:00.000000000 Z
11
+ date: 2024-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -108,7 +108,9 @@ files:
108
108
  - Rakefile
109
109
  - bin/_guard-core
110
110
  - bin/console
111
+ - bin/githooks/pre-push
111
112
  - bin/guard
113
+ - bin/release
112
114
  - bin/rspec
113
115
  - bin/rubocop
114
116
  - bin/setup
@@ -134,14 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
136
  requirements:
135
137
  - - ">="
136
138
  - !ruby/object:Gem::Version
137
- version: 3.3.3
139
+ version: 3.3.0
138
140
  required_rubygems_version: !ruby/object:Gem::Requirement
139
141
  requirements:
140
142
  - - ">="
141
143
  - !ruby/object:Gem::Version
142
144
  version: '0'
143
145
  requirements: []
144
- rubygems_version: 3.5.11
146
+ rubygems_version: 3.5.15
145
147
  signing_key:
146
148
  specification_version: 4
147
149
  summary: A gem / CLI tool to automate the release process of other gems