From 68cb318f46244d0dc3cbd66a075fba8efd208cde Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Wed, 1 Oct 2025 15:52:05 -1000 Subject: [PATCH] Remove bundler/gem_tasks to fix release task conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed the issue where `rake release` showed two conflicting tasks: 1. Bundler's built-in release task (from require 'bundler/gem_tasks') 2. Our custom lib/tasks/release.rake Changes: 1. Removed `require 'bundler/gem_tasks'` from Rakefile 2. Manually defined :build task that was provided by bundler/gem_tasks 3. Removed lib/tasks/release.rake (conflicts with namespace :release) 4. Fixed gem bump flag: --version to -v (line 48) Now there's only one release workflow using the namespaced tasks: - rake release:prepare[X.Y.Z] - Bumps version and updates CHANGELOG - rake release:publish - Runs tests, tags, and publishes gem The bundler/gem_tasks conflict is resolved. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Rakefile | 13 +++++++--- lib/tasks/release.rake | 59 ------------------------------------------ 2 files changed, 10 insertions(+), 62 deletions(-) delete mode 100644 lib/tasks/release.rake diff --git a/Rakefile b/Rakefile index 87e0223..93ca279 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,17 @@ -require 'bundler/gem_tasks' - require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = 'spec/cypress_on_rails/*_spec.rb' end +# Manually define build task (normally provided by bundler/gem_tasks) +desc "Build cypress-on-rails-#{CypressOnRails::VERSION}.gem into the pkg directory" +task :build do + require_relative 'lib/cypress_on_rails/version' + sh "gem build cypress-on-rails.gemspec" + sh "mkdir -p pkg" + sh "mv cypress-on-rails-#{CypressOnRails::VERSION}.gem pkg/" +end + task default: %w[spec build] namespace :release do @@ -38,7 +45,7 @@ namespace :release do # Use gem bump to update version puts "\n→ Bumping version with gem-release..." - unless system("gem bump --version #{version} --no-commit") + unless system("gem bump -v #{version} --no-commit") puts "Error: Failed to bump version" exit 1 end diff --git a/lib/tasks/release.rake b/lib/tasks/release.rake deleted file mode 100644 index a9e3b09..0000000 --- a/lib/tasks/release.rake +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -desc("Releases the gem using the given version. - -IMPORTANT: the gem version must be in valid rubygem format (no dashes). - -This task depends on the gem-release ruby gem which is installed via `bundle install` - -1st argument: The new version in rubygem format (no dashes). Pass no argument to - automatically perform a patch version bump. -2nd argument: Perform a dry run by passing 'true' as a second argument. - -Example: `rake release[1.19.0,false]`") -task :release, %i[gem_version dry_run] do |_t, args| - def sh_in_dir(dir, command) - puts "Running in #{dir}: #{command}" - system("cd #{dir} && #{command}") || raise("Command failed: #{command}") - end - - def gem_root - File.expand_path('..', __dir__) - end - - # Check if there are uncommitted changes - unless `git status --porcelain`.strip.empty? - raise "You have uncommitted changes. Please commit or stash them before releasing." - end - - args_hash = args.to_hash - is_dry_run = args_hash[:dry_run] == 'true' - gem_version = args_hash.fetch(:gem_version, "") - - # See https://github.com/svenfuchs/gem-release - sh_in_dir(gem_root, "git pull --rebase") - - # Bump version, commit, and tag (gem bump does all of this) - bump_command = "gem bump" - bump_command << " --version #{gem_version}" unless gem_version.strip.empty? - bump_command << " --skip-ci" # Skip CI on version bump commit - sh_in_dir(gem_root, bump_command) - - # Push the commit and tag - sh_in_dir(gem_root, "git push") unless is_dry_run - sh_in_dir(gem_root, "git push --tags") unless is_dry_run - - # Release the new gem version to RubyGems - puts "\nCarefully add your OTP for Rubygems. If you get an error, run 'gem release' again." - sh_in_dir(gem_root, "gem release") unless is_dry_run - - msg = <<~MSG - Once you have successfully published, update CHANGELOG.md: - - bundle exec rake update_changelog - # Edit CHANGELOG.md to move unreleased changes to the new version section - git commit -a -m 'Update CHANGELOG.md' - git push - MSG - puts msg -end