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

Setting BUNDLE_GEMFILE causes issues with bundle exec #122

Closed
matiaskorhonen opened this issue Feb 24, 2023 · 3 comments
Closed

Setting BUNDLE_GEMFILE causes issues with bundle exec #122

matiaskorhonen opened this issue Feb 24, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@matiaskorhonen
Copy link

Orb version: 2.0.0

What happened:

The current default configuration for the install-deps command results in broken behavior when running bundle exec commands in project subdirectories:

$ bundle exec fastlane detox_build
bundler: command not found: fastlane
Install missing gem executables with `bundle install`

That error occurs after a successful bundle install only because it was run in ~/project/android instead of ~/project/

By default, bundler will search up from the current working directory until it finds a Gemfile. However, setting the gemfile/BUNDLE_GEMFILE configuration option results in this getting short-circuited, even when set to Gemfile.

You can see this behavior here:

# …

def find_gemfile
  given = ENV["BUNDLE_GEMFILE"]
  return given if given && !given.empty?
  find_file(*gemfile_names)
end

def gemfile_names
  ["gems.rb", "Gemfile"]
end

def find_file(*names)
  search_up(*names) do |filename|
    return filename if File.file?(filename)
  end
end

#...

Expected behavior:

If the Gemfile name hasn't been customized, the gemfile configuration option should not be set.

Additional Information:

It might also be worth it it to not set the path/BUNDLE_PATH configuration option either the current value (vendor/bundle) is already the default when using Bundler in deployment mode. It doesn't seem to be causing the same problems as the gemfile setting though, so it's a judgement call…

@matiaskorhonen matiaskorhonen added the bug Something isn't working label Feb 24, 2023
@marboledacci
Copy link
Contributor

@matiaskorhonen If I understood well, the problem is coming when line bundle config set gemfile "$PARAM_GEMFILE" is executed. Why is it a problem that the value is set to Gemfile?

@matiaskorhonen
Copy link
Author

Because you might need to run commands in a project subdirectory and explicitly setting gemfile to a relative path causes Bundler not to locate the Gemfile in the parent directory (the default Bundler behaviour).

@marboledacci
Copy link
Contributor

Version 2.2.1 now uses absolute path for the Gemfile, so this shouldn't be an issue anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants