Skip to content

Commit dff7ad3

Browse files
justin808claude
andcommitted
Fix bundler error when running --status from demo directory
The issue was that swap-deps was requiring bundler/setup unconditionally, which would fail when running from a demo directory with a Gemfile that had GitHub gems not yet checked out. Solution: Only require bundler/setup for commands that actually need gem dependencies (swap, restore, apply). Read-only commands (status, cache, list-watch, kill-watch, clean-cache) only use git/filesystem operations and don't need bundler. This fixes the error: 'The git source https://github.com/... is not yet checked out. Please run `bundle install`...' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 93cd90b commit dff7ad3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/demo_scripts/swap_deps_cli.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ def run!
3939
detect_context!
4040
parse_options!
4141

42-
# Require bundler/setup only when actually running commands (not for --help)
43-
require 'bundler/setup'
42+
# Only require bundler/setup for commands that actually need gem dependencies
43+
# Status, cache, and watch commands only use git/filesystem, not gems
44+
require 'bundler/setup' unless read_only_command?
4445

4546
if @show_status
4647
show_status_info
@@ -83,6 +84,11 @@ def run!
8384

8485
private
8586

87+
# Check if the command is read-only (doesn't need bundler/setup)
88+
def read_only_command?
89+
@show_status || @show_cache || @list_watch || @kill_watch || @clean_cache || @clean_cache_gem
90+
end
91+
8692
# rubocop:disable Lint/DuplicateBranch
8793
def process_gem_value(gem_name, value)
8894
# Check if it's a local filesystem path first (before checking for GitHub specs)

0 commit comments

Comments
 (0)