How do I pronounce
- en: Ruby format
- jp: ルビーフォーマット
Does it work right now?
No, but it's getting really close
How do I use it
- Make sure you've got cargo installed
export RUBYFMT_USE_RELEASE=1to your
~/.bashrcor whichever file gets loaded when your shell boots (
❤️zsh users, I just am not one). This'll make sure you use the release version of Rubyfmt, and not the debug version, which mostly only matters for speed and logging spam.
Rubyfmt supports the following CLI invocations:
ruby --disable=all path/to/rubyfmt/rubyfmt.rb filenameto format a file to stdout
ruby --disable=all path/to/rubyfmt/rubyfmt.rb directoryto format all ruby files in that directory in place
ruby --disable=all path/to/rubyfmt/rubyfmt.rb -i many file or directory namesto format many file and directory names in place
If you'd like, you can set up an alias (if you are an RBenv user please read the section below):
alias rubyfmt="ruby --disable=all /absolute/path/to/rubyfmt/rubyfmt.rb"
RBenv runs what it calls "shims",
all ruby commands, but most importantly the
ruby command itself. These
shims impose a penalty to Ruby startup time, because they do a bunch of stuff.
Rubyfmt doesn't need any of this stuff to get going. If you'd like the
best performance, make sure you're running ruby by directly going to the binary,
~/.rbenv/versions/<ruby-version>/bin/ruby --disable=all rubyfmt.rb
Useful environment variables:
RUBYFMT_USE_RELEASE=1: use release rust compile, much faster + no logging
RUBYFMT_DISABLE_SZUSH=1: disables the backend render queue writer, very useful for debugging, literally useless if you're not developing rubyfmt itself.