Class: Nestor::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/nestor/cli.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#customize(path) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/nestor/cli.rb', line 50

def customize(path)
  raise "Destination #{path.inspect} already exists: will not overwrite" if !options[:force] && File.file?(path)

  puts "Using #{options[:framework].inspect} framework with #{options[:testlib].inspect} as the testing library"
  klass = mapper_class(options[:framework], options[:testlib])
  FileUtils.cp(klass.default_script_path, path)

  puts "Wrote #{klass.name} script to #{path.inspect}"
end

#startObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nestor/cli.rb', line 20

def start
  Watchr.options.debug = options[:debug]

  if options[:script] then
    puts "Launching with custom script #{options[:script].inspect}"
  else
    puts "Launching..."
  end

  puts "Using #{options[:framework].inspect} framework with #{options[:testlib].inspect} as the testing library"
  mapper      = mapper_instance(options[:framework], options[:testlib])
  machine     = Nestor::Machine.new(mapper, :quick => options[:quick])

  script_path = options[:script] ? Pathname.new(options[:script]) : nil
  script      = Nestor::Script.new(script_path || mapper.class.default_script_path)

  options[:require].each do |path|
    puts "Loading #{path.inspect} plugin"
    require path
  end

  script.nestor_machine = machine
  Watchr::Controller.new(script, Watchr.handler.new).run
end