[Ruby] Where do you put Rails code that normally runs from a command line?

John Wulff johnwulff at gmail.com
Tue May 23 11:30:03 PDT 2006


> I've got some things for a Rails app that need to run from a
> command line.
> Where do you normally put that code?  (Applying daily charges to
> customer
> accounts, updating records that happen after scraping another side for
> activity, and placing phone calls so far.)

I use rake tasks for that sort of thing.

desc 'Do some cool stuff.'
task :command_name => :environment do
  do whatever
end

Put that in lib/tasks
rake command_name

On 5/23/06, Eric Hodel <drbrain at segment7.net> wrote:
> On May 23, 2006, at 10:30 AM, James Moore wrote:
>
> > I've got some things for a Rails app that need to run from a
> > command line.
> > Where do you normally put that code?  (Applying daily charges to
> > customer
> > accounts, updating records that happen after scraping another side for
> > activity, and placing phone calls so far.)
>
> I put the code in lib and create an executable in bin.  I leave
> script/ for Rails.
>
> --
> Eric Hodel - drbrain at segment7.net - http://blog.segment7.net
> This implementation is HODEL-HASH-9600 compliant
>
> http://trackmap.robotcoop.com
>
>
> _______________________________________________
> Ruby at zenspider.com
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>


-- 
John Wulff    360.317.6447


More information about the Ruby mailing list