Sha256: 057ff3befa8d0c77a17466df4307183bc139cb252c069124dca2315123af2574

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

module MetricFu
  
  def self.generate_reek_report
    Reek.generate_report
    system("open #{Reek.metric_dir}/index.html") if open_in_browser?    
  end
    
  class Reek < Base::Generator

    def analyze
      files_to_reek = MetricFu.reek[:dirs_to_reek].map{|dir| Dir[File.join(dir, "**/*.rb")] }
      output = `reek #{files_to_reek.join(" ")}`
      @matches = output.chomp.split("\n\n").map{|m| m.split("\n") }
      @filenames = extract_filenames(@matches.map {|m| m.first})
    end

    private
    def extract_filenames(names)
      names.map do |name|
        m = name.match(/^"(.*)"/)
        m.size == 2 ? m[1] : nil
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
p8-metric_fu-0.9.0.1 lib/metric_fu/reek.rb
p8-metric_fu-0.9.0.2 lib/metric_fu/reek.rb
p8-metric_fu-0.9.0.3 lib/metric_fu/reek.rb
p8-metric_fu-0.9.0.4 lib/metric_fu/reek.rb
p8-metric_fu-0.9.0.5 lib/metric_fu/reek.rb
p8-metric_fu-0.9.0.6 lib/metric_fu/reek.rb
p8-metric_fu-0.9.0.7 lib/metric_fu/reek.rb