Class: Procrastinator::Rake::DaemonTasks
- Inherits:
-
Object
- Object
- Procrastinator::Rake::DaemonTasks
- Includes:
- Rake::Cloneable, Rake::DSL
- Defined in:
- lib/procrastinator/rake/daemon_tasks.rb
Overview
RakeTask builder class. Use DaemonTasks.define to generate the needed tasks.
Class Method Summary collapse
-
.define(**args, &block) ⇒ Object
Shorthand for DaemonTasks.new.define.
Instance Method Summary collapse
-
#define(pid_path: nil) ⇒ Object
Defines procrastinator:start and procrastinator:stop Rake tasks that operate on the given scheduler.
Class Method Details
.define(**args, &block) ⇒ Object
Shorthand for DaemonTasks.new.define
28 29 30 |
# File 'lib/procrastinator/rake/daemon_tasks.rb', line 28 def self.define(**args, &block) new.define(**args, &block) end |
Instance Method Details
#define(pid_path: nil) ⇒ Object
Defines procrastinator:start and procrastinator:stop Rake tasks that operate on the given scheduler.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/procrastinator/rake/daemon_tasks.rb', line 38 def define(pid_path: nil) raise ArgumentError, 'must provide a scheduler builder block' unless block_given? @pid_path = Scheduler::DaemonWorking.normalize_pid pid_path namespace :procrastinator do desc 'Start the Procrastinator daemon' task :start do start(yield) end desc 'Show Procrastinator daemon status' task :status do status end desc 'Stop the Procrastinator daemon' task stop: [:status] do stop end desc 'Restart Procrastinator daemon' task restart: [:stop, :start] end end |