Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
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)
# We don't use bundler/gem_tasks because it conflicts with our custom release task
desc "Build gem into 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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Make the build task cross-platform.

mkdir -p and mv are Unix-specific; rake build will fail on Windows where Bundler’s original tasks used Ruby helpers. Please switch to FileUtils to keep the task portable.

-require 'rspec/core/rake_task'
+require 'rspec/core/rake_task'
+require 'fileutils'
@@
 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/"
+  FileUtils.mkdir_p("pkg")
+  FileUtils.mv("cypress-on-rails-#{CypressOnRails::VERSION}.gem", "pkg/", force: true)
 end
🤖 Prompt for AI Agents
In Rakefile around lines 8 to 14, the build task uses Unix-only shell commands
(`mkdir -p` and `mv`) which fail on Windows; replace these with Ruby FileUtils
calls: require 'fileutils' at top (or inside the task), use FileUtils.mkdir_p to
create the pkg directory and FileUtils.mv to move the built gem into pkg,
keeping the sh "gem build ..." call as-is; this makes the task cross-platform
and preserves existing behavior.


task default: %w[spec build]
4 changes: 2 additions & 2 deletions rakelib/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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`
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.

Note, accept defaults for rubygems options. Script will pause to get 2FA tokens.

Example: `rake release[1.19.0,false]`")
Example: `rake release[2.1.0,false]`")
task :release, %i[gem_version dry_run] do |_t, args|
include CypressOnRails::TaskHelpers

Expand Down