uprb

Test Gem Version

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 uprb

Usage

Pack a script:

uprb pack path/to/script.rb path/to/output

Pack executables from an installed gem:

uprb gem pack GEM_NAME

Install a gem and pack its executables:

uprb gem install GEM_NAME

Options

  • -f, --force — overwrite destination
  • -r, --require LIB — pre-require LIB (repeatable)
  • --with-rubygems — embed rubygems; needed when the script references Gem::Version etc.
  • --dynamic — run the entry script at pack time to capture runtime requires. Arguments after -- become ARGV (e.g. -- --help to avoid side effects)
  • --skip-disable-gems — drop --disable-gems from 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 (gem subcommands 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.["uprb.requires"] = "openssl,json"