Ruby - Command Line

04 Aug 25

$ ruby -I lib -r rgsql -e 'RgSql.start_server'

The Ruby interpreter accepts command-line options:
  • -I lib (load files from the lib folder)
  • -r rgsql (require the  rgsql.rb file)
  • -e 'RgSql.start_server' (execute the 'RgSql.start_server method.)

See Chris Zetter's build a database tutorial (~/environment/tutorial/database/rgsql) runs this command. Makes for a good way for organizing files. Run an initial minimal entrypoint file that requires some files and calls a method in another file.