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.

@KaanOzkan KaanOzkan requested a review from a team as a code owner November 15, 2024 04:09
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.

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.

1 participant