Class: Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/flote/runner.rb

Constant Summary collapse

WORKING_DIR =
'.'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell, view) ⇒ Runner

Returns a new instance of Runner.



9
10
11
12
# File 'lib/flote/runner.rb', line 9

def initialize shell, view
  @shell = shell
@view = view
end

Instance Attribute Details

#execute_callbackObject

Returns the value of attribute execute_callback.



5
6
7
# File 'lib/flote/runner.rb', line 5

def execute_callback
  @execute_callback
end

#init_session_callbackObject

Returns the value of attribute init_session_callback.



5
6
7
# File 'lib/flote/runner.rb', line 5

def init_session_callback
  @init_session_callback
end

#run_commandObject

Returns the value of attribute run_command.



5
6
7
# File 'lib/flote/runner.rb', line 5

def run_command
  @run_command
end

#source_filesObject

Returns the value of attribute source_files.



5
6
7
# File 'lib/flote/runner.rb', line 5

def source_files
  @source_files
end

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/flote/runner.rb', line 19

def execute
files = @shell.files_in_dir_tree WORKING_DIR, @source_files
newest_dir_entry = @shell.newest_dir_entry WORKING_DIR, files
  change_time = @shell.modification_time newest_dir_entry
  if change_time == @previous_change_time then
	  Progress.next
    return
  end
  Progress.end
@view.show_run_once_message newest_dir_entry, change_time
execute_once files
  @previous_change_time = change_time
end

#execute_once(files) ⇒ Object



33
34
35
36
# File 'lib/flote/runner.rb', line 33

def execute_once files
	process = @shell.execute @run_command
	if @execute_callback then @execute_callback.call(files, process) end
end

#startObject



14
15
16
17
# File 'lib/flote/runner.rb', line 14

def start
 if @init_session_callback then @init_session_callback.call end
  execute
end