Skip to content

Commit 405c2bf

Browse files
authored
Improve release script to update spec/dummy dependencies (#610)
- Add bundle install for spec/dummy after gem release - Add npm install for spec/dummy (uses npm per packageManager field) - Automatically commit and push spec/dummy/Gemfile.lock changes - Fixes issues reported where spec/dummy Gemfile.lock wasn't updated
1 parent 5cc9884 commit 405c2bf

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

rakelib/release.rake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,22 @@ task :create_release, %i[gem_version dry_run] do |_t, args|
6262
puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
6363

6464
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "gem release") unless is_dry_run
65+
66+
# Update spec/dummy Gemfile.lock to use the new version
67+
spec_dummy_dir = File.join(gem_root, "spec", "dummy")
68+
puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
69+
puts "Updating spec/dummy dependencies"
70+
puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
71+
Shakapacker::Utils::Misc.sh_in_dir(spec_dummy_dir, "bundle install") unless is_dry_run
72+
# Note: spec/dummy uses npm (not yarn) as defined in its packageManager field
73+
Shakapacker::Utils::Misc.sh_in_dir(spec_dummy_dir, "npm install") unless is_dry_run
74+
75+
# Check if there are changes to spec/dummy/Gemfile.lock
76+
changes_output = `git status --porcelain spec/dummy/Gemfile.lock 2>&1`
77+
if !changes_output.strip.empty? && !is_dry_run
78+
puts "Committing and pushing spec/dummy/Gemfile.lock changes"
79+
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "git add spec/dummy/Gemfile.lock")
80+
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "git commit -m 'Update spec/dummy Gemfile.lock after release'")
81+
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "git push")
82+
end
6583
end

0 commit comments

Comments
 (0)