Parent

Syckle::Plugins::Stats

Simple Code Statistics Plugin

The Stats plugin is a simple code statistics analyizer, producing a basic LOC analysis.

TODO: Add support for testable demo/ (how?).

Constants

DEFAULT_EXCLUDE

Default folders and/or file patterns to exclude from analysis.

DEFAULT_FOLDER

Default folder to store generated files under log/.

DEFAULT_TESTPATH

Default folder(s) to find test scripts.

Attributes

exclude[RW]

Files patterns to specially exclude from loadpath. Default is [‘ext’] b/c this does not yet support C analysis.

loadpath[RW]

Directories to scan for scripts. The default is the project’s loadpath.

output[RW]

Output directory. Default is stats/ folder under the project’s log directory. This should alwasy be a dedicated directory because mutiple files are generated with generic names, eg. index.html.

testpath[RW]

Directories to scan for tests. The default is test/.

title[RW]

Title of pacakge. Thisis used to put a header in the output.

Public Instance Methods

analyize() click to toggle source

Scan source code counting files, lines of code and comments and presents a report of it’s findings.

TODO: Add C support for ext/.

# File lib/plugins/syckle/stats.rb, line 62
def analyize
  loadpath = self.loadpath.to_list
  exclude  = self.exclude.to_list

  files = multiglob_r(*loadpath) - multiglob_r(*exclude)

  #() #.inject([]){ |memo, find| memo.concat(glob(find)); memo }
  #Dir.multiglob_with_default(DEFAULT_STATS_FILES)

  if output.outofdate?(*files) or force?
    generate_stats(files)
  else
    out = output.relative_path_from(project.root)
    report "Stats are current (#{out})."
  end
end
initialize_defaults() click to toggle source

Setup default attribute values.

# File lib/plugins/syckle/stats.rb, line 49
def initialize_defaults
  @title    = metadata.title #|| metadata.package
  @loadpath = metadata.loadpath #|| ['lib']
  @testpath = DEFAULT_TESTPATH
  @exclude  = DEFAULT_EXCLUDE
  @output   = project.log + DEFAULT_FOLDER
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.