uprb
uprb packs a Ruby script into a single executable with fast, deterministic startup.
The output still requires a Ruby interpreter and is tied to the Ruby and gems active at pack time. The default shebang runs Ruby with --disable-gems; flags below can change this.
Install
gem install uprbUsage
Pack a script:
uprb pack path/to/script.rb path/to/outputPack executables from an installed gem:
uprb gem pack GEM_NAMEInstall a gem and pack its executables:
uprb gem install GEM_NAMEOptions
-
-f,--force— overwrite destination -
-r,--require LIB— pre-requireLIB(repeatable) -
--with-rubygems— embed rubygems; needed when the script referencesGem::Versionetc. -
--dynamic— run the entry script at pack time to capture runtimerequires. Arguments after--becomeARGV(e.g.-- --helpto avoid side effects) -
--skip-disable-gems— drop--disable-gemsfrom the shebang (vendoring mode; gives up fast startup) -
--skip-ruby-path-replace— keep the source shebang's ruby invocation instead of rewriting to an absolute path -
--path DIR— destination directory (gemsubcommands only)
Gemspec metadata
uprb gem pack / uprb gem install honors uprb.requires (comma-separated) in Gem::Specification#metadata as additional pre-require libraries, merged with -r:
spec.metadata["uprb.requires"] = "openssl,json"