Class: Toys::Templates::Rdoc

Inherits:
Object
  • Object
show all
Includes:
Toys::Template
Defined in:
lib/toys/templates/rdoc.rb

Overview

A template that generates rdoc tools.

Constant Summary collapse

DEFAULT_GEM_VERSION_REQUIREMENTS =

Default version requirements for the rdoc gem.

Returns:

  • (Array<String>)
[">= 6.1.0"].freeze
DEFAULT_TOOL_NAME =

Default tool name

Returns:

  • (String)
"rdoc"
DEFAULT_OUTPUT_DIR =

Default output directory

Returns:

  • (String)
"html"
DEFAULT_FILES =

Default file globs

Returns:

  • (Array<String>)
["lib/**/*.rb"].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Toys::Template

create

Constructor Details

#initialize(name: nil, gem_version: nil, files: nil, output_dir: nil, markup: nil, title: nil, main: nil, template: nil, generator: nil, options: [], bundler: false, context_directory: nil) ⇒ Rdoc

Create the template settings for the Rdoc template.

Parameters:

  • name (String) (defaults to: nil)

    Name of the tool to create. Defaults to DEFAULT_TOOL_NAME.

  • gem_version (String, Array<String>) (defaults to: nil)

    Version requirements for the rdoc gem. Defaults to DEFAULT_GEM_VERSION_REQUIREMENTS.

  • files (Array<String>) (defaults to: nil)

    An array of globs indicating the files to document. Defaults to DEFAULT_FILES.

  • output_dir (String) (defaults to: nil)

    Name of directory to receive html output files. Defaults to DEFAULT_OUTPUT_DIR.

  • markup (String) (defaults to: nil)

    Markup format. Allowed values include "rdoc", "rd", and "tomdoc". If not specified, RDoc will use its default markup, which is "rdoc".

  • title (String) (defaults to: nil)

    Title of RDoc documentation. If not specified, RDoc will use a default title.

  • main (String) (defaults to: nil)

    Name of the file to use as the main top level document. Default is none.

  • template (String) (defaults to: nil)

    Name of the template to use. If not specified, RDoc will use its default template.

  • generator (String) (defaults to: nil)

    Name of the format generator. If not specified, RDoc will use its default generator.

  • options (Array<String>) (defaults to: [])

    Additional options to pass to RDoc.

  • bundler (Boolean, Hash) (defaults to: false)

    If false (the default), bundler is not enabled for this tool. If true or a Hash of options, bundler is enabled. See the documentation for the bundler mixin for information on available options.

  • context_directory (String) (defaults to: nil)

    A custom context directory to use when executing this tool.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/toys/templates/rdoc.rb', line 66

def initialize(name: nil,
               gem_version: nil,
               files: nil,
               output_dir: nil,
               markup: nil,
               title: nil,
               main: nil,
               template: nil,
               generator: nil,
               options: [],
               bundler: false,
               context_directory: nil)
  @name = name
  @gem_version = gem_version
  @files = files
  @output_dir = output_dir
  @markup = markup
  @title = title
  @main = main
  @template = template
  @generator = generator
  @options = options
  @bundler = bundler
  @context_directory = context_directory
end

Instance Attribute Details

#bundler=(value) ⇒ Boolean, Hash (writeonly)

Set the bundler state and options for this tool.

Pass false to disable bundler. Pass true or a hash of options to enable bundler. See the documentation for the bundler mixin for information on the options that can be passed.

Parameters:

  • value (Boolean, Hash)

Returns:

  • (Boolean, Hash)


200
201
202
# File 'lib/toys/templates/rdoc.rb', line 200

def bundler=(value)
  @bundler = value
end

#context_directory=(value) ⇒ String

Custom context directory for this tool.

Parameters:

  • value (String)

Returns:

  • (String)


187
188
189
# File 'lib/toys/templates/rdoc.rb', line 187

def context_directory=(value)
  @context_directory = value
end

#files=(value) ⇒ Array<String>

An array of globs indicating which files to document.

Parameters:

  • value (Array<String>)

Returns:

  • (Array<String>)


117
118
119
# File 'lib/toys/templates/rdoc.rb', line 117

def files=(value)
  @files = value
end

#gem_version=(value) ⇒ String, ...

Version requirements for the rdoc gem. If set to nil, uses the bundled version if bundler is enabled, or defaults to DEFAULT_GEM_VERSION_REQUIREMENTS if bundler is not enabled.

Parameters:

  • value (String, Array<String>, nil)

Returns:

  • (String, Array<String>, nil)


109
110
111
# File 'lib/toys/templates/rdoc.rb', line 109

def gem_version=(value)
  @gem_version = value
end

#generator=(value) ⇒ String?

Name of the format generator. If set to nil, RDoc will use its default generator.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


171
172
173
# File 'lib/toys/templates/rdoc.rb', line 171

def generator=(value)
  @generator = value
end

#main=(value) ⇒ String?

Name of the file to use as the main top level document, or nil for no top level document.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


153
154
155
# File 'lib/toys/templates/rdoc.rb', line 153

def main=(value)
  @main = value
end

#markup=(value) ⇒ String?

Markup format. Allowed values include "rdoc", "rd", and "tomdoc". If set to nil, RDoc will use its default markup, which is "rdoc".

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


135
136
137
# File 'lib/toys/templates/rdoc.rb', line 135

def markup=(value)
  @markup = value
end

#name=(value) ⇒ String

Name of the tool to create.

Parameters:

  • value (String)

Returns:

  • (String)


98
99
100
# File 'lib/toys/templates/rdoc.rb', line 98

def name=(value)
  @name = value
end

#options=(value) ⇒ Array<String>

Additional options to pass to RDoc

Parameters:

  • value (Array<String>)

Returns:

  • (Array<String>)


179
180
181
# File 'lib/toys/templates/rdoc.rb', line 179

def options=(value)
  @options = value
end

#output_dir=(value) ⇒ String?

Name of directory to receive html output files. If set to nil, defaults to DEFAULT_OUTPUT_DIR.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


126
127
128
# File 'lib/toys/templates/rdoc.rb', line 126

def output_dir=(value)
  @output_dir = value
end

#template=(value) ⇒ String?

Name of the template to use. If set to nil, RDoc will choose a default template.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


162
163
164
# File 'lib/toys/templates/rdoc.rb', line 162

def template=(value)
  @template = value
end

#title=(value) ⇒ String?

Title of RDoc documentation pages. If set to nil, RDoc will use a default title.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


144
145
146
# File 'lib/toys/templates/rdoc.rb', line 144

def title=(value)
  @title = value
end

Instance Method Details

#use_bundler(**opts) ⇒ self

Use bundler for this tool.

See the documentation for the bundler mixin for information on the options that can be passed.

Parameters:

  • opts (keywords)

    Options for bundler

Returns:

  • (self)


212
213
214
215
# File 'lib/toys/templates/rdoc.rb', line 212

def use_bundler(**opts)
  @bundler = opts
  self
end