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

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

Overview

rubocop:disable Style/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)


34
35
36
# File 'lib/kamaze/project/tools/yardoc.rb', line 34

def options
  @options
end

Instance Method Details

#coreYARD::CLI::Yardoc (protected)

Returns:

  • (YARD::CLI::Yardoc)


67
68
69
70
71
72
73
74
75
# File 'lib/kamaze/project/tools/yardoc.rb', line 67

def core
  require 'yard'

  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



56
57
58
# File 'lib/kamaze/project/tools/yardoc.rb', line 56

def mutable_attributes
  [:options]
end

#output_dirPathname

Get output directory (default SHOULD be doc)

Returns:

  • (Pathname)


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

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)


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

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

  retcode
end

#setupObject (protected)



62
63
64
# File 'lib/kamaze/project/tools/yardoc.rb', line 62

def setup
  @options ||= {}
end