Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when Tapioca is executed without Bundler #2075

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KaanOzkan
Copy link
Contributor

Motivation

Addresses the finding in #1934 (comment)

Implementation

Print a warning as early as possible. Looking at various env variables BUNDLER_VERSION felt like a safe bet.

Tests

Tested manually. I can add it if wanted.

exe/tapioca Outdated
Comment on lines 23 to 26
unless ENV["BUNDLER_VERSION"]
puts "Warning: You're running tapioca without Bundler. This isn't recommended and may cause issues."\
" Please use the provided binstub through `bin/tapioca` instead."
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENV['BUNDLER_VERSION'] is not a reliable indicator of Bundler being active, as it may be unset even when running under Bundler. Two more reliable alternatives are:

  1. Check ENV['BUNDLE_GEMFILE'], which Bundler consistently sets
  2. Check defined?(Bundler) to detect if Bundler is loaded

Either approach would prevent false warnings in valid Bundler environments.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egiurleo
Copy link
Contributor

Is it possible to create a CLI test for this?

@KaanOzkan
Copy link
Contributor Author

Is it possible to create a CLI test for this?

I tried shelling to tapioca without bundle exec in the test but Bundler is still available so I'm not sure how to test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants