rubyrubygemsbundler

Check presence of loaded Gemfile


How can you check for the presence of both Bundler as well as a Gemfile?

My initial guess was defined?(Bundler) && File.exist?('Gemfile'), but since you can have a Gemfile with a different name, this won’t cover all cases.


Solution

  • This:

    Bundler::SharedHelpers.in_bundle?