I'm working on an application that periodically wakes up, looks at entries in an Oracle table, and for each relevant row that it finds, processes some XML and generates some files for ftp. I'd love to use Ruby as my 'glue' language (I'm on Windows so nothing is already installed on the machine and I might as well pick the language I
like).
Even better, I'd be thrilled if I could use rails and simply point a model at my table and then very easily "find all" with the appropriate conditions and iterate over the results, without worrying about any of the backend database config or environment switching or anything like that.
My question is, has anybody done work (possibly with new forms of generators) to create a Rails application that does *not* expect to
run
as a web server / web service? If I fire up irb I can piece together the necessary require statements to do what I want to do. Has a "best practice" for this evolved yet, or should I just hack up some sort of launcher.rb file that does my dirty work?
I've got a perl app I wrote about five years ago that sounds quite
similar.
However, I found that I did want a web interface, just so I can admin
the master tables, and easily pull reports.
You can certainly use ActiveRecord without the need for a complete rails app.
Also, I use runner to do things like cleaning my session table from cron:
#!/bin/sh
export RAILS_ENV="production"
/usr/local/rails/mcalogin/current/script/runner \ 'ActiveRecord::Base.connection.delete("DELETE FROM sessions where updated_at < now() - INTERVAL 24 HOUR")'