Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
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

task default: %w[spec build]
task default: :spec
6 changes: 3 additions & 3 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 All @@ -40,7 +40,7 @@ task :release, %i[gem_version dry_run] do |_t, args|

# See https://github.com/svenfuchs/gem-release
sh_in_dir(gem_root, "git pull --rebase")
sh_in_dir(gem_root, "gem bump --no-commit #{gem_version.strip.empty? ? '' : %(-v #{gem_version})}")
sh_in_dir(gem_root, "gem bump --no-commit --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(-v #{gem_version})}")

# Release the new gem version
puts "Carefully add your OTP for Rubygems. If you get an error, run 'gem release' again."
Expand Down
12 changes: 10 additions & 2 deletions rakelib/task_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ def gem_root

# Executes a string or an array of strings in a shell in the given directory
def sh_in_dir(dir, *shell_commands)
shell_commands.flatten.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) }
Dir.chdir(dir) do
# Without `with_unbundled_env`, running bundle in the child directories won't correctly
# update the Gemfile.lock
Bundler.with_unbundled_env do
shell_commands.flatten.each do |shell_command|
sh(shell_command.strip)
end
end
end
end
end
end
end