Custom command line libraries for controllers and rails

I have a library that is basically used on the command-line. I am
trying to fit it in for my rails application. So far it works, but I
was worried about how rails does caching or anything else. Basically,
is this an ok approach.

So far, I put the library in RAILS_APP/lib/bot.rb

And ‘bot.rb’ contains a class ‘VM’.

I have a controller:

BotController…

And I put this at the top:

require File.dirname(FILE) + ‘/…/…/lib/bot’

And then I just allocate an instance in one my controller methods and
that is it.

Of course, there is one instance per request which is a little
wasteful. But, that is my initial approach thus far.


Berlin B.
(ramaza3 on freenode)
http://www.newspiritcompany.com
http://www.newspiritcompany.com/newforums
also checkout alpha version of botverse:
http://www.newspiritcompany.com:8086/universe_home