Class: CaptureSingleRunCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/capture_single_run_command.rb

Constant Summary collapse

COMMAND_NAME =
'capture-single-run'

Instance Method Summary collapse

Constructor Details

#initialize(shell, view, runner) ⇒ CaptureSingleRunCommand

Returns a new instance of CaptureSingleRunCommand.



5
6
7
8
9
# File 'lib/commands/capture_single_run_command.rb', line 5

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

Instance Method Details

#accepts_shell_command?(command) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/commands/capture_single_run_command.rb', line 26

def accepts_shell_command? command
	command == COMMAND_NAME
end

#capture_single_run(run_command, kata_file) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/commands/capture_single_run_command.rb', line 17

def capture_single_run run_command, kata_file
	@runner.run_command = run_command
	session_id = @shell.newest_dir_entry(FilenameFormatter.codersdojo_workspace) 
	filename_formatter = FilenameFormatter.new
	last_state_dir = @shell.newest_dir_entry(filename_formatter.session_dir session_id)
	step = last_state_dir.nil? ? 0 : filename_formatter.step_number_from_state_dir(last_state_dir) + 1
	@runner.execute_once kata_file, session_id, step
end

#continue_test_loop?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/commands/capture_single_run_command.rb', line 30

def continue_test_loop?
	false
end

#execute_from_shell(params) ⇒ Object



11
12
13
14
15
# File 'lib/commands/capture_single_run_command.rb', line 11

def execute_from_shell params
	unless params[1] then @view.show_missing_command_argument_error COMMAND_NAME, "shell_command"; return end
	unless params[2] then @view.show_missing_command_argument_error COMMAND_NAME, "kata_file"; return end
	capture_single_run params[1], params[2]
end