Sha256: efe9719ade495becb2a77e0ffc466a523bd62f64bcd7687c65d80a1af2d514f1

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

namespace :metricks do
  
  SAIKURO_DIR = File.join(Metricks::BASE_DIRECTORY, 'saikuro')
  
  desc "A cyclomatic complexity report using Saikuro"
  task :saikuro do
    default_options = {"--output_directory" => SAIKURO_DIR,
                        "--input_directory" => "app",
                        "--cyclo" => "",
                        "--filter_cyclo" => "0",
                        "--warn_cyclo" => "5",
                        "--error_cyclo" => "7"}
  
    default_options.merge!(SAIKURO_OPTIONS) if defined?(SAIKURO_OPTIONS)
    options = ""
    default_options.each_pair { |key, value| options << "#{key} #{value} " } 
     
    sh "ruby #{File.expand_path(File.join(File.dirname(__FILE__), '..', 'metricks', '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

3 entries across 3 versions & 1 rubygems

Version Path
revolutionhealth-metricks-0.4.1 lib/tasks/saikuro.rake
revolutionhealth-metricks-0.4.2 lib/tasks/saikuro.rake
revolutionhealth-metricks-0.4 lib/tasks/saikuro.rake