Class: RerunTask::WatchProcess

Inherits:
Object
  • Object
show all
Defined in:
lib/rerun_task/watch_process.rb

Instance Method Summary collapse

Constructor Details

#initialize(rake_task_name) ⇒ WatchProcess

Returns a new instance of WatchProcess.



4
5
6
7
8
# File 'lib/rerun_task/watch_process.rb', line 4

def initialize(rake_task_name)
  @name = rake_task_name
  @pid_dir = "#{RerunTask::CONFIG['pid_dir']}/rerun_task/pids"
  @process_file = ProcessFile.new(@pid_dir)
end

Instance Method Details

#call(&block) ⇒ Object



10
11
12
13
14
# File 'lib/rerun_task/watch_process.rb', line 10

def call(&block)
  start
  block.call
  finished
end

#finishedObject



20
21
22
# File 'lib/rerun_task/watch_process.rb', line 20

def finished
  @process_file.destroy
end

#startObject



16
17
18
# File 'lib/rerun_task/watch_process.rb', line 16

def start
  @process_file.create_pid_file
end