Skip to content

Commit d6ca545

Browse files
justin808claude
andcommitted
Fix Bundler conflict in install generator
Make shakapacker_in_gemfile? method more robust by checking if shakapacker is already available in the current bundle. This prevents the generator from trying to add shakapacker when it's already loaded from parent environments, avoiding version constraint conflicts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a1a9953 commit d6ca545

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/generators/react_on_rails/install_generator.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,16 @@ def shakapacker_in_gemfile?
186186
return false unless File.exist?("Gemfile")
187187

188188
gemfile_content = File.read("Gemfile")
189-
gemfile_content.match?(/gem\s+['"]shakapacker['"]/)
189+
return true if gemfile_content.match?(/gem\s+['"]shakapacker['"]/)
190+
191+
# Also check if shakapacker is already available in the current bundle
192+
# This handles cases where it might be loaded from parent environments
193+
begin
194+
require "shakapacker"
195+
true
196+
rescue LoadError
197+
false
198+
end
190199
end
191200

192201
def add_bin_scripts

0 commit comments

Comments
 (0)