Class: GenerateCommand

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

Instance Method Summary collapse

Constructor Details

#initialize(shell, view, scaffolder) ⇒ GenerateCommand

Returns a new instance of GenerateCommand.



3
4
5
6
7
# File 'lib/commands/generate_command.rb', line 3

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

Instance Method Details

#accepts_shell_command?(command) ⇒ Boolean

Returns:

  • (Boolean)


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

def accepts_shell_command? command
	command == 'setup'
end

#continue_test_loop?Boolean

Returns:

  • (Boolean)


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

def continue_test_loop?
	false
end

#execute_from_shell(params) ⇒ Object



9
10
11
# File 'lib/commands/generate_command.rb', line 9

def execute_from_shell params
	generate params[1], params[2]
end

#generate(framework, kata_file) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/commands/generate_command.rb', line 13

def generate framework, kata_file
	if not kata_file then
		@view.show_missing_command_argument_error "setup", "kata_file"
		return
	end
	begin
		@scaffolder.scaffold framework, kata_file
		@view.show "\n" + @shell.read_file("README")
	rescue
		@view.show_unknown_framework_error framework, @scaffolder.list_templates
	end		
end