Hello all. I''ve just written up a bit of ruby code that I''d like to use in a rake task for my web application (it has to be run on a schedule, and calling rake through cron seems to be a good way to do that). My question is: Where should I place this code so that it''s both accessible to the rake task and logically located in the rails application directory structure? I could place it into a plugin. However, I don''t feel entirely comfortable with that approach since this functionality is pretty important to the application. It''s not really something that should be tacked on. I could also place the code into the lib/tasks directory. However, that seems rather messy. Where would you put it? Thanks for any suggestions or insight. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Francois Beausoleil
2006-Dec-05 17:56 UTC
Re: Required file for rake task -- put into a plugin?
Hello Jon, 2006/12/5, Jon Fuller <rails-mailing-list@andreas-s.net>:> I could also place the code into the lib/tasks directory. However, that > seems rather messy.Why do you think it's messy ? That's where Rake tasks are supposed to go. Simply name your file "lib/tasks/mytasks.rake" and go from there. Bye ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, François! I have no problem putting the rake file in the lib/tasks directory. I''m just curious whether I should also put my library file (containing objects I use in the rake task) in the same place. It just struck me as a little messy to put it in the same directory as the rake task files. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Okay, I went googling around the web and ran across at least one example of libraries being placed in -- you guessed it -- the lib directory. That seems to work correctly for rake and the application controllers. It also doesn''t offend my rails-powered sense of ''rightness''. ( Ah, so obvious... ) Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Francois Beausoleil
2006-Dec-05 20:00 UTC
Re: Required file for rake task -- put into a plugin?
Hello Jon, 2006/12/5, Jon Fuller <rails-mailing-list@andreas-s.net>:> Okay, I went googling around the web and ran across at least one example > of libraries being placed in -- you guessed it -- the lib directory. > That seems to work correctly for rake and the application controllers. > It also doesn't offend my rails-powered sense of 'rightness'.I realize now that I misread your original E-Mail. You wanted to have some utility code available for the Rake task, but not necessarily for the rest of the application. Now that I understand your requirement, I guess I would simply have dropped the code in the task file. Simple, effective. Bye ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---