Topic: How can my code distinguish between rails server and rails console?
I have a kind of long-running processing job that I periodically execute in my rails app. I would like to see status updates from the job as it goes about its various tasks. Of course, I can do this in a quick and dirty way when I'm using the rails console via puts messages.
However, I would love to be able to see message notifications when running the rails server via a strategy like faye (http://railscasts.com/episodes/260-messaging-with-faye).
My question is, how can I automatically distinguish between when I am running my rails app via the console versus running it via the server? My aim is to have the processing job automatically know whether it should send me status updates via puts to STDOUT (when on the console) or by issuing faye pub/sub commands (when on the server).