class Entruby::App

Attributes

output_dir[R]

Public Class Methods

new(argv) click to toggle source
# File lib/entruby.rb, line 131
def initialize(argv)
  if argv.size < 2
    puts "USAGE: $ entruby <source directory> <doxygen xml directory>"
    exit 1
  end

  @source_dir, @xml_dir, @output_dir = argv[0], argv[1], Dir.pwd
end

Public Instance Methods

functions() click to toggle source

@return [Array<Doxyparser::Function>]

# File lib/entruby.rb, line 141
def functions
  source_file_paths = []
  Find.find(@source_dir) do |path|
    source_file_paths << File.basename(path).gsub('_', '__') if path =~ /.*\.c$/
  end
  source_file_paths.reduce([]) do |functions, file|
    hfile = Doxyparser::parse_file(file, @xml_dir)
    functions + hfile.functions
  end
end
functions_report() click to toggle source
# File lib/entruby.rb, line 152
def functions_report
  all_functions = functions
  report = all_functions.map { |func| func.report(all_functions) }
  report.sort_by! { |row| row[:metric] }.reverse!
end
overview(couplings) click to toggle source
# File lib/entruby.rb, line 158
def overview(couplings)
  Overview.new(couplings).report
end
report() click to toggle source
# File lib/entruby.rb, line 162
def report
  couplings = functions_report
  {overview: overview(couplings), functions: couplings}
end