Sha256: 0381e5948403389a85f3e2fc09427faa32ffb11c8926c07a97b459303ace8bc3

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

namespace :metrics do
  
  SAIKURO_DIR = File.join(MetricFu::BASE_DIRECTORY, 'saikuro')
  
  desc "A cyclomatic complexity report using Saikuro"
  task :saikuro do
    raise "SAIKURO_OPTIONS is now MetricFu::SAIKURO_OPTIONS" if defined?(SAIKURO_OPTIONS)
    default_options = {"--output_directory" => SAIKURO_DIR,
                        "--input_directory" => "app",
                        "--cyclo" => "",
                        "--filter_cyclo" => "0",
                        "--warn_cyclo" => "5",
                        "--error_cyclo" => "7"}
  
    default_options.merge!(MetricFu::SAIKURO_OPTIONS) if defined?(MetricFu::SAIKURO_OPTIONS)
    options = ""
    default_options.each_pair { |key, value| options << "#{key} #{value} " }  
     
    sh "ruby \"#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'metric_fu', 'saikuro'))}/saikuro.rb\" " +
                "#{options}" do |ok, response|
      unless ok
        puts "Saikuro failed with exit status: #{response.exitstatus}"
        exit 1
      end
    end

    if File.exist? "#{SAIKURO_DIR}/index_cyclo.html"
      mv "#{SAIKURO_DIR}/index_cyclo.html", 
         "#{SAIKURO_DIR}/index.html"
    end
    
    system("open #{SAIKURO_DIR}/index.html") if PLATFORM['darwin']
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
factorylabs-metric_fu-0.8.0.4 lib/tasks/saikuro.rake
factorylabs-metric_fu-0.8.0.5 lib/tasks/saikuro.rake
jayzes-metric_fu-0.8.0.1 lib/tasks/saikuro.rake
jayzes-metric_fu-0.8.0.2 lib/tasks/saikuro.rake
jayzes-metric_fu-0.8.0 lib/tasks/saikuro.rake
jscruggs-metric_fu-0.7.6 lib/tasks/saikuro.rake
jscruggs-metric_fu-0.8.0 lib/tasks/saikuro.rake