From 7c9675aad96aca7ffd9fd0a724bc36ae162211a2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 30 Apr 2026 10:55:43 +0100 Subject: [PATCH 1/3] docs: update release instructions --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 5228ca6..6ffa9c7 100644 --- a/README.md +++ b/README.md @@ -213,8 +213,7 @@ also run `bin/console` for an interactive prompt that will allow you to experime To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, ensure the CHANGELOG.md is updated and that everything is committed. -Then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push -the `.gem` file to [rubygems.org](https://rubygems.org). +Then run `bundle exec rake release`, which will create a git tag for the version, then push git commits and tags to GitHub. ## Contributing From 20065a6d096f0ef089e91b4a18a22a85373c4030 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 30 Apr 2026 10:56:15 +0100 Subject: [PATCH 2/3] style: fix typos in rakefile --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 73b9664..03e2f68 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # frozen_string_literal: true # We add preflight to the release task pre-requisites before loading in the -# bundler/gem_tasks to ensure that it runs first. This is becuase 'release' is +# bundler/gem_tasks to ensure that it runs first. This is because 'release' is # actually composed entirely of pre-requisites and so would otherwise end up # running the pre-flight tasks AFTER everything else task release: :preflight @@ -25,7 +25,7 @@ task :preflight do puts puts "☐ lib/record_loader/version.rb updated? Currently contains #{current_version}" puts '☐ CHANGELOG.md updated' - puts '☐ Commited, on master and up to date' + puts '☐ Committed, on master and up to date' puts print 'Proceed Y/N > ' From de1c683eab2e4d802f20cb2f38ff443408747087 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 30 Apr 2026 11:15:26 +0100 Subject: [PATCH 3/3] build: update preflight check list for formatting and automation --- Rakefile | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 03e2f68..7def1ee 100644 --- a/Rakefile +++ b/Rakefile @@ -7,9 +7,12 @@ task release: :preflight require 'bundler/gem_tasks' +require 'rainbow/refinement' require 'rspec/core/rake_task' require 'rubocop/rake_task' +using Rainbow + RSpec::Core::RakeTask.new(:spec) RuboCop::RakeTask.new @@ -17,17 +20,25 @@ task default: %i[rubocop spec] desc 'Runs the preflight checklist before building a release' task :preflight do - puts '🛫 Preflight checklist' + puts '──────────────────────'.bright + puts '🛫 Preflight checklist'.bright + puts '──────────────────────'.bright current_version = RecordLoader::VERSION + latest_changelog_entry = File.read('CHANGELOG.md').scan(/^## \[(.*?)\]/).flatten.first + latest_master = latest_master? - puts 'This is still a manual process, but before we roll a release, lets confirm a few things:' + puts 'Before we roll a release, lets confirm a few things:' + puts + puts "▢ Has the gem version been updated? Currently #{st(current_version)} in #{p('lib/record_loader/version.rb')} " + puts "▢ Has the changelog been updated? Latest entry is #{st(latest_changelog_entry)} in #{p('CHANGELOG.md')}" + puts "▢ Are all changes committed to git? #{yn(uncommitted_changes?)}" + puts "▢ Are you on master and up to date? #{yn(on_master? & latest_master)}" puts - puts "☐ lib/record_loader/version.rb updated? Currently contains #{current_version}" - puts '☐ CHANGELOG.md updated' - puts '☐ Committed, on master and up to date' + puts 'Proceeding will package the gem, create a git tag for the version, push commits and tags to GitHub, and push the .gem file to rubygems.org.'.italic + puts 'We do not currently have an accessible team account on rubygems.org, so this final step can be skipped.'.italic puts - print 'Proceed Y/N > ' + print 'Proceed [y/N] > ' proceed = $stdin.gets.chomp @@ -38,3 +49,34 @@ task :preflight do exit 1 end end + +private + +# Highlight the provided path in cyan for better visibility in the terminal +def p(path) + Rainbow(path).bright.cyan +end + +# Highlight the provided status in white for better visibility in the terminal +def st(status) + Rainbow(status).bright.white +end + +# Given a boolean value, return Yes or No, or 'N/A' if the value is nil +def yn(value) + return 'N/A' if value.nil? + + value ? 'Yes'.bright.green : 'No'.bright.red +end + +def uncommitted_changes? + `git status --porcelain`.empty? +end + +def on_master? + `git rev-parse --abrev-ref HEAD`.chomp == 'master' +end + +def latest_master? + !`git remote show origin | grep "pushes to master" | grep "(up to date)"`.empty? +end