Run rake task as a job #8

Closed
opened 2025-12-29 00:21:07 +01:00 by adam · 3 comments
Owner

Originally created by @plashchynski on GitHub (Mar 19, 2015).

Originally created by @plashchynski on GitHub (Mar 19, 2015).
adam closed this issue 2025-12-29 00:21:07 +01:00
Author
Owner

@michaelachrisco commented on GitHub (Apr 3, 2015):

# cronotab.rb
require 'rake'
AppName::Application.load_tasks

class Test
  def perform
    Rake::Task['crono:hello'].invoke
  end
end

Crono.perform(Test).every 5.seconds

With the rake task of:

#lib/tasks/test.rake
namespace :crono do
  desc 'Update all tables'
  task :hello => :environment do
    puts "hello"
  end
end
@michaelachrisco commented on GitHub (Apr 3, 2015): ``` Ruby # cronotab.rb require 'rake' AppName::Application.load_tasks class Test def perform Rake::Task['crono:hello'].invoke end end Crono.perform(Test).every 5.seconds ``` With the rake task of: ``` Ruby #lib/tasks/test.rake namespace :crono do desc 'Update all tables' task :hello => :environment do puts "hello" end end ```
Author
Owner

@plashchynski commented on GitHub (Apr 4, 2015):

@michaelachrisco Thank you, that's good variant. Closed by #15

@plashchynski commented on GitHub (Apr 4, 2015): @michaelachrisco Thank you, that's good variant. Closed by #15
Author
Owner

@karthikdc88 commented on GitHub (Oct 3, 2015):

Hi, i have put this code in my project. I am planning on running a email generation code using rake. But in the above example how do i run the crono gem. How do i make it run so every 5 sec it will give me a output of hello. Does the hello appear on the terminal?

Please help me out i am stuck at this for my project.

@karthikdc88 commented on GitHub (Oct 3, 2015): Hi, i have put this code in my project. I am planning on running a email generation code using rake. But in the above example how do i run the crono gem. How do i make it run so every 5 sec it will give me a output of hello. Does the hello appear on the terminal? Please help me out i am stuck at this for my project.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/crono#8