How to use rake command in Rails application

Hi,

I want to clear my logs files when they are exceeding certain limit of memory

The size of the files can be determined by using the File.size() and I can clear the log files using the rake log:clear command

But this has to be done through my application

where i will create a method when the user clicks the logout button then the method checks the log files and if the files occupied more memory then it automatically refreshes the contents…

Please help me how to achieve my requirement

Thanks

Thank You But where I have to write the line Rake::Task['log:clear'].invoke It is throwing exception as RAKE uninitialised constant...

i guess this should work form anywhere. but pay attention: "RAKE" (all capitals) is expected to be a constant.

edit: if it still fails, try something like this:   require 'rake'   require 'rake/testtask'   require 'rake/rdoctask'   require 'tasks/rails'

after that, this should work   Rake::Task['taskname'].invoke

Great... Thanks a lot... It is working Fine.. thank you very much