I don’t think you can do it using script/runner (I may be wrong).
You could run the script directly using ruby lib/joe_converter.rb, and
handle the parameters in your script. Your rails app wouldn’t load in
this case. Another (probably preferred) option is to create a rake
task in lib/tasks that takes the parameters and calls
JoeConverter.do_the_conversion passing the parameters.
If you are accessing any other classes/modules of your rails app (like
any model for instance), go with the rake task as they would load as
well.
Well, you have to play nice with the “rules” of the command line (like
no
spaces etc). Also note that whatever comes into your rake task is simply
a
string. You would have to parse that string and build any object you
need,
such as a hash or array…
Any code on how you’re handling the params?
On Fri, Jan 9, 2009 at 4:21 PM, Joe P.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.