Class: Kamaze::Project::Tools::Yardoc

Inherits:
BaseTool show all
Includes:
Watchable
Defined in:
lib/kamaze/project/tools/yardoc.rb

Overview

Tool to run CLI::Yardoc and generate documentation

Defined Under Namespace

Modules: Watchable Classes: File, Watcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Kamaze::Project::Tools::BaseTool

Instance Attribute Details

#observer_peersHash|nil (readonly, protected) Originally defined in module Concern::Observable

Returns:

  • (Hash|nil)

#optionsHash

Options used by YARD::CLI::Yardoc

Returns:

  • (Hash)


32
33
34
# File 'lib/kamaze/project/tools/yardoc.rb', line 32

def options
  @options
end

Instance Method Details

#coreYARD::CLI::Yardoc (protected)

Returns:

  • (YARD::CLI::Yardoc)


65
66
67
68
69
70
71
# File 'lib/kamaze/project/tools/yardoc.rb', line 65

def core
  YARD::CLI::Yardoc.new.tap do |yard|
    yard.parse_arguments

    options.to_h.each { |k, v| yard.options[k.to_sym] = v }
  end
end

#excludedArray<String> Originally defined in module Watchable

Ignores files matching path match (regexp)

Returns:

  • (Array<String>)

#filesArray<Kamaze::Project::Tools::Yardoc::File> Originally defined in module Watchable

Get files

Mostly patterns, addition of files with options.files SHOULD include README file, when .yardopts defined

#mutable_attributesObject



54
55
56
# File 'lib/kamaze/project/tools/yardoc.rb', line 54

def mutable_attributes
  [:options]
end

#output_dirPathname

Get output directory (default SHOULD be doc)

Returns:

  • (Pathname)


45
46
47
48
49
50
# File 'lib/kamaze/project/tools/yardoc.rb', line 45

def output_dir
  core.options
      .yield_self(&:serializer)
      .yield_self(&:basepath).gsub(%r{^\./+}, '')
      .yield_self { |path| ::Pathname.new(path) }
end

#pathsArray<Pathname> Originally defined in module Watchable

Get paths

Returns:

  • (Array<Pathname>)

#patternsArray<String> Originally defined in module Watchable

Get patterns (usable for glob pattern matching)

Returns:

  • (Array<String>)

#runFixnum Also known as: call

Returns:

  • (Fixnum)


35
36
37
38
39
40
# File 'lib/kamaze/project/tools/yardoc.rb', line 35

def run
  retcode = core.run
  retcode = retcode ? 0 : 1 if [true, false].include?(retcode)

  retcode
end

#setupObject (protected)



60
61
62
# File 'lib/kamaze/project/tools/yardoc.rb', line 60

def setup
  @options ||= {}
end