Having a hard time getting any useful results from various searches on this concept -- probably because it's a. Wrong and/or b. obscure. Essentially, though, I'd like to write an application which works as either a normal web app or with a command-line interface. I've done this in the ancient past for sysadmin-y stuff using Perl, but that had none of the joy that using Ruby/Rails brings.

I am comfortable enough with Rails itself, and also use standalone Ruby for all manner of CLI stuff. What I'm looking for is best practices, if they exist, for extending a Rails application to have CLI functionality.

Perhaps the answer is as simple as using script/runner and doing my own "VC" while using my Rails models... This is what I was planning on doing, but I thought I'd step back and sanity-check that approach first. I'm having a hard time imagining how I'd utilize any of the Rails controller stuff, given that it's so tightly married to HTTP requests, but I'm often surprised by what clever(er) folks come up with.

Thanks for any useful responses.