Class: CodersDojo

Inherits:
Object
  • Object
show all
Defined in:
app/codersdojo.rb

Instance Method Summary collapse

Constructor Details

#initialize(params, hostname = "http://www.codersdojo.com") ⇒ CodersDojo

Returns a new instance of CodersDojo.



10
11
12
13
# File 'app/codersdojo.rb', line 10

def initialize params, hostname = "http://www.codersdojo.com"
	@params = params
	@hostname = hostname
end

Instance Method Details

#called_from_spec?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/codersdojo.rb', line 32

def called_from_spec?
  @params and @params[0] == "spec"
end

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/codersdojo.rb', line 15

def run
if called_from_spec? then return end
shell = ShellWrapper.new
scaffolder = Scaffolder.new shell
view = ConsoleView.new scaffolder
controller = Controller.new shell, view, scaffolder, @hostname

begin
	arg_parser = ArgumentParser.new controller
	command = arg_parser.parse @params
rescue ShellArgumentException => e
	view.show_unknwon_command_message e.command
rescue PropertyFileMissingException => e
	view.show_properties_file_missing_error e.filename
end
end