Class: Toys::Templates::Clean

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

Overview

A template for tools that clean build artifacts

Constant Summary collapse

DEFAULT_TOOL_NAME =

Default tool name

Returns:

  • (String)
"clean"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Toys::Template

create

Constructor Details

#initialize(name: nil, paths: [], preserve: [], context_directory: nil) ⇒ Clean

Create the template settings for the Clean template.

Parameters:

  • name (String) (defaults to: nil)

    Name of the tool to create. Defaults to DEFAULT_TOOL_NAME.

  • paths (Array<String,:gitignore>) (defaults to: [])

    An array of glob patterns indicating what to clean. You can also include the symbol :gitignore which will clean all items covered by .gitignore files, if contained in a git working tree.

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

    An array of glob patterns indicating what to preserve. Matching paths will be skipped even if they match paths.

  • context_directory (String) (defaults to: nil)

    A custom context directory to use when executing this tool.



32
33
34
35
36
37
# File 'lib/toys/templates/clean.rb', line 32

def initialize(name: nil, paths: [], preserve: [], context_directory: nil)
  @name = name
  @paths = paths
  @preserve = preserve
  @context_directory = context_directory
end

Instance Attribute Details

#context_directory=(value) ⇒ String

Custom context directory for this tool.

Parameters:

  • value (String)

Returns:

  • (String)


71
72
73
# File 'lib/toys/templates/clean.rb', line 71

def context_directory=(value)
  @context_directory = value
end

#name=(value) ⇒ String

Name of the tool to create.

Parameters:

  • value (String)

Returns:

  • (String)


45
46
47
# File 'lib/toys/templates/clean.rb', line 45

def name=(value)
  @name = value
end

#paths=(value) ⇒ Array<String,:gitignore>

An array of glob patterns indicating what to clean. May also include the symbol :gitignore which indicates all items covered by .gitignore files, if contained in a git working tree.

Parameters:

  • value (Array<String,:gitignore>)

Returns:

  • (Array<String,:gitignore>)


55
56
57
# File 'lib/toys/templates/clean.rb', line 55

def paths=(value)
  @paths = value
end

#preserve=(value) ⇒ Array<String>

An array of glob patterns indicating what to preserve.

Parameters:

  • value (Array<String>)

Returns:

  • (Array<String>)


63
64
65
# File 'lib/toys/templates/clean.rb', line 63

def preserve=(value)
  @preserve = value
end