Skip to content

Commit 1d39a02

Browse files
justin808claude
andcommitted
fix: Use destination_root for Gemfile path in generator
Fix shakapacker detection by using destination_root for the Gemfile path instead of just "Gemfile". This ensures we check the correct Gemfile in the target Rails app, not the gem's directory. This prevents the "gem specified twice" error that occurred when Rails apps already had shakapacker in their Gemfile but our detection failed to find it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2a78c8a commit 1d39a02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/generators/react_on_rails/install_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def shakapacker_in_bundler_specs?(gem_name)
267267
end
268268

269269
def shakapacker_in_gemfile_text?(gem_name)
270-
gemfile = ENV["BUNDLE_GEMFILE"] || "Gemfile"
270+
gemfile = ENV["BUNDLE_GEMFILE"] || File.join(destination_root, "Gemfile")
271271

272272
File.file?(gemfile) &&
273273
File.foreach(gemfile).any? { |l| l.match?(/^\s*gem\s+['"]#{Regexp.escape(gem_name)}['"]/) }

0 commit comments

Comments
 (0)