YOU54F / traveling-ruby

Self-contained Portable Ruby ( 2.6.10 -> 3.3.x ) Binaries for Linux/MacOS/Windows
http://FooBarWidget.github.io/traveling-ruby
MIT License
29 stars 4 forks source link

Can traveling-ruby generate a single self-contained binary that contains code from several files? #6

Closed monfresh closed 2 months ago

monfresh commented 2 months ago

Hi. This is more of a question than an issue. In my case, I have a CLI that is made up of several files. I tried tutorial #2 with the gem dependencies, and it sounds like all the CLI files have to be included separately in the final output. In other words, when someone downloads and unzips my CLI, they not only get the executable, but also all the source code.

Is this the only way traveling-ruby works, or is there a way to have it generate a single binary, like ruby-packer?

YOU54F commented 2 months ago

ruby-packer unpacks the output to a temp dir and runs your code from there, so your source code is not obfuscated in any way.

traveling-ruby doesn’t support a single file output

monfresh commented 2 months ago

Thanks for confirming!

YOU54F commented 2 months ago

You may wish to look at tebako, it has a few caveats, and isn't as portable as traveling-ruby, however it gets you a single file executable with a virtual file system. It is also in active development.

https://github.com/tamatebako/tebako

I've been testing porting over our CLI application https://github.com/pact-foundation/pact-ruby-standalone, which has been a success, but having more trouble with packaging up an app that leverages native extensions https://github.com/pact-foundation/pact_broker (which is where traveling-ruby shines)

monfresh commented 2 months ago

Thanks! I'll try it out. Looking through their README, I like that it's still maintained and that it supports newer Ruby versions and Apple command line tools versions. What I don't like so much is that I need to build my CLI on a separate Mac running on Monterey in order for the executables to run on newer macOS versions.

With ruby-packer, if I build the binary on Sonoma, it can run fine on older macOS versions.