Class: Loris::CLI::Main

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

Defined Under Namespace

Classes: DummyActioner

Class Method Summary collapse

Class Method Details

.execute(args) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/loris.rb', line 67

def execute(args)
  puts 'Loris is running!'

  debug = args.length > 0

  dir = Dir.pwd

  w = SleepWaiter.new(1)
  c = AlwaysContinuer.new
  ff = FileFinder.new(Find, dir)
  ff.add_filter(FileFilter.new(File))
  ff.add_filter(ModifiedFilter.new(File))

  oc = OutputCollection.new()
  oc.add(ShellOutput.new($stdout))
  oc.add(ConsoleClearingOutput.new())

  if (!debug)
    oc.add(GrowlOutput.new(Growl))          
  end
  
  tm = TaskManager.new(oc)
  tm.add(ListTask.new()) if debug
  tm.add(JavascriptLintTask.new(JavascriptLintRunner.new(dir), dir))
  tm.add(JSpecTask.new(JSpecRunner.new(dir)))

  a = FileActioner.new(ff, tm)    
  
  da = DummyActioner.new(a, $stdout)
        
  p = Poller.new(w, c, debug ? da : a)
  
  p.start()

end