Class: Detroit::LOCat

Inherits:
Tool
  • Object
show all
Includes:
Standard
Defined in:
lib/detroit-locat.rb

Overview

LOCat is tool for generating LOC statistics.

This tool targets the following stations of the standard toolchain:

  • generate

Constant Summary collapse

MANPAGE =

Location of manpage for this tool.

File.dirname(__FILE__) + '/../man/detroit-locat.5'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

List of config files to use.



46
47
48
# File 'lib/detroit-locat.rb', line 46

def config
  @config
end

#excludeObject

Exclude subpaths from ‘path`.



40
41
42
# File 'lib/detroit-locat.rb', line 40

def exclude
  @exclude
end

#formatObject

Output format cane be html, json or yaml. By default the format will be determined by the ‘output` file extension.



50
51
52
# File 'lib/detroit-locat.rb', line 50

def format
  @format
end

#ignoreObject

Exclude subpaths from ‘path` by matching basename.



43
44
45
# File 'lib/detroit-locat.rb', line 43

def ignore
  @ignore
end

#outputObject

File to generate.



56
57
58
# File 'lib/detroit-locat.rb', line 56

def output
  @output
end

#pathObject

Limit paths of files to render.



31
32
33
# File 'lib/detroit-locat.rb', line 31

def path
  @path
end

#titleObject

Title to place at top of report.



53
54
55
# File 'lib/detroit-locat.rb', line 53

def title
  @title
end

Instance Method Details

#assemble?(station, options = {}) ⇒ Boolean

This tool ties into the ‘generate` station of the standard assembly.

Returns:

  • (Boolean)


79
80
81
82
# File 'lib/detroit-locat.rb', line 79

def assemble?(station, options={})
  return true if station == :generate
  return false
end

#generateObject

Render templates.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/detroit-locat.rb', line 61

def generate
  options = {}
  options[:title]  = title  if title
  options[:format] = format if format
  options[:output] = output if output
  options[:config] = config if config

  options[:files]  = collect_files

  locat = ::LOCat::Command.new(options)

  locat.run
end

#prerequisiteObject



25
26
27
28
# File 'lib/detroit-locat.rb', line 25

def prerequisite
  require 'locat'
  @path = 'lib'
end