ruby-packer sets BUNDLE_GEMFILE inside the running script
d4rky-pl opened this issue · 0 comments
I'm aware that this project is no longer actively maintained but I'm leaving this info here for the people still using it and googling answers:
When packaging the app, ruby-packer
embeds BUNDLE_GEMFILE
environment variable inside so it's visible to the script being packed and all the processes spawned by it.
This may trip you over if you try to run system("bundle")
inside your code and you will see this error instead:
[!] There was an error parsing `Gemfile`: No such file or directory @ rb_sysopen - /__enclose_io_memfs__/local/Gemfile. Bundler cannot continue.
The workaround for this is to ENV.delete 'BUNDLE_GEMFILE'
inside your script. If you still need to support this env var coming from the outside you can add if ENV['BUNDLE_GEMFILE'] == '/__enclose_io_memfs__/local/Gemfile'
to ensure you're only clearing the default.
Also shout out to ericbeland/ruby-packer for a working Ruby 3.1 fork 👋