Forum: Ruby on Rails How to use rake command in Rails application

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C6b3fb1b16a9878bc793a90bdc1c9799?d=identicon&s=25 Hema Gonaboina (hema_mca)
on 2008-12-11 09:03
(Received via mailing list)
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
5170ca260dbd2cdfd5a887a4dba7636f?d=identicon&s=25 Jeremy Weiskotten (jeremy_weiskotten)
on 2008-12-14 20:41
Hema Gonaboina wrote:
> 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

I think this will work:

Rake::Task['log:clear'].invoke
C6b3fb1b16a9878bc793a90bdc1c9799?d=identicon&s=25 Hema Gonaboina (hema_mca)
on 2009-01-12 08:13
(Received via mailing list)
Thank You
 But where I have to write the line Rake::Task['log:clear'].invoke
 It is throwing exception as RAKE uninitialised constant...


On Dec 15 2008, 12:41 am, Jeremy Weiskotten <rails-mailing-
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-12 10:04
(Received via mailing list)
i guess this should work form anywhere. but pay attention: "RAKE" (all
capitals) is expected to be a constant.
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-12 10:28
(Received via mailing list)
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
C6b3fb1b16a9878bc793a90bdc1c9799?d=identicon&s=25 Hema Gonaboina (hema_mca)
on 2009-01-20 10:51
(Received via mailing list)
Great...
Thanks a lot...
It is working Fine.. thank you very much
This topic is locked and can not be replied to.