File: metrics.rake

package info (click to toggle)
ruby-flexmock 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 836 kB
  • sloc: ruby: 7,572; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 941 bytes parent folder | download | duplicates (4)
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
33
34
35
36
37
38
39
40
METRICS_FILES = FileList['lib/**/*.rb']

task :metrics => [:cane, :flog, :flay]

task :flog, [:all] do |t, args|
  flags = args.all ? "--all" : ""
  flags = "-m #{flags}"
  Bundler.with_clean_env do
    puts "\nFLOG:"
    sh "flog #{flags} #{METRICS_FILES}" do |status, flag|
      if status.nil?
        puts "Install flog with: 'gem install flog'"
      end
    end
  end
end

task :flay do
  Bundler.with_clean_env do
    puts "\nFLAY:"
    sh "flay #{METRICS_FILES}" do |status, flag|
      if status.nil?
        puts "Install flay with: 'gem install flay'"
      end
    end
  end
end

task :cane, [:max_line] do |t, args|
  max_line = args.max_line || 90
  Bundler.with_clean_env do
    puts "\nCANE:"
    sh "cane --style-measure #{max_line} --no-doc" do |status, flag|
      if status.nil?
        puts "DBG: [status, flag]=#{[status, flag].inspect}"
        puts "Install cane with: 'gem install cane'"
      end
    end
  end
end