Firstly, I’m not using rails. This is vanilla ruby application. I’ve read about packaging a CLI ruby application as a GEM.
So I guess my question would be, is this the ruby way? Does this layout lend itself to class autoloading?
I’m coming from a PHP background where I’m used to application layouts that adhere to PSR-0 style (see examples section).
Yes, the way to build and distribute a Ruby command-line app is more or less as that article describes:
bin– exe goes herelib/your_app.rb– requires all files underlib/your_applib/your_app/whatever.rb– modules and files to build your command-line appyour_app.gemspec– gemspec; make sure you mention that there’s a bin fileRakefile– manage developmenttest– yup, testsIt’s completely OK to break up your app into classes and modules inside
lib. By distributing with RubyGems the command-line app will be in the user’s path and it will have access to everything inlib.RubyGems has first-class support for distributing command-line apps; it’s not just for libraries.