Open d4rky-pl opened 3 years ago
Did you get this to work with --standalone and native C extensions somehow, or any idea how to make it work?
It works great with RUBYOPT and pure Ruby gems, but as soon as you have a native extension among the bundled gems, then you cannot load that gem (fails with "incompatible library version" when loading the .so file).
Is there any way around that problem?
Bundler allows creating a standalone install that puts all gems in
bundle
directory and creates abundle/bundler/setup.rb
that loads all the gems and adds them to the$LOAD_PATH
. This allows us to run a script without rubygems enabled.I built a specifically modified version of our internal CLI tool that uses this behaviour but unfortunately other than overriding
RUBYOPT
on run time to include--disable=gems
I was unable to disable RubyGems inside packed Ruby.Here's the benchmark. The
ht-bundle-standalone
version runsrequire
call with both RubyGems and the standalone bundle, hence why it's twice as slow:As you can see, there's a consistent 15% gain in boot time of the tool. It would be great if
ruby-packer
supported this out of the box or allowed passing ruby flags other than viaRUBYOPT
env var.