public
Description: My set of personal Thor scripts.
Homepage:
Clone URL: git://github.com/crnixon/thor_tasks.git
Clinton R. Nixon (author)
Sat Sep 19 08:31:34 -0700 2009
thor_tasks / metrics.thor
100644 32 lines (24 sloc) 0.64 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env ruby
 
class Metrics < Thor
  desc "flog <dirs>", "flog the specified directories"
  def flog(*dirs)
    xargs('flog', *dirs)
  end
  
  desc "reek <dirs>", "run reek on the specified directories"
  def reek(*dirs)
    xargs('reek', *dirs)
  end
  
  desc "flay <dirs>", "run flay on the specified directories"
  def flay(*dirs)
    xargs('flay', *dirs)
  end
  
  desc "roodi <dirs>", "run flay on the specified directories"
  def roodi(*dirs)
    xargs('roodi', *dirs)
  end
  
  private
  
  def xargs(cmd, *dirs)
    dirs = ['.'] if dirs.empty?
    system "find #{dirs.join(' ')} -name \\*.rb | xargs #{cmd}"
  end
  
end