Class: CemAcpt::Bolt::TaskList

Inherits:
Object
  • Object
show all
Includes:
Helpers, Logging
Defined in:
lib/cem_acpt/bolt/tasks.rb

Overview

Holds and manages the list of tasks in the current bolt project

Constant Summary

Constants included from Helpers

Helpers::BOLT_PROJECT_FILE, Helpers::INVENTORY_FILE

Constants included from Logging

Logging::LEVEL_MAP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#bolt_bin, #load_object_test, #new_bolt_project_hash, #new_inventory_hash

Methods included from Logging

current_log_config, #current_log_config, current_log_format, #current_log_format, #current_log_level, current_log_level, included, #logger, logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, #new_log_level, new_log_level, #new_logger, new_logger, verbose?, #verbose?

Constructor Details

#initialize(config, inventory = nil, project = nil) ⇒ TaskList

Returns a new instance of TaskList.



59
60
61
62
63
64
65
# File 'lib/cem_acpt/bolt/tasks.rb', line 59

def initialize(config, inventory = nil, project = nil)
  @config = config
  @inventory = inventory
  @project = project
  @tasks = []
  @metadata = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **kwargs, &block) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/cem_acpt/bolt/tasks.rb', line 94

def method_missing(method, *args, **kwargs, &block)
  if tasks.respond_to?(method)
    tasks.send(method, *args, **kwargs, &block)
  else
    super
  end
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



57
58
59
# File 'lib/cem_acpt/bolt/tasks.rb', line 57

def 
  @metadata
end

Instance Method Details

#ignoreObject



86
87
88
# File 'lib/cem_acpt/bolt/tasks.rb', line 86

def ignore
  @ignore ||= @config.get('bolt.tasks.ignore') || []
end

#inspectObject



106
107
108
# File 'lib/cem_acpt/bolt/tasks.rb', line 106

def inspect
  tasks.inspect
end

#module_patternObject



78
79
80
# File 'lib/cem_acpt/bolt/tasks.rb', line 78

def module_pattern
  @module_pattern ||= get_pattern('bolt.tasks.module_pattern')
end

#name_filterObject



82
83
84
# File 'lib/cem_acpt/bolt/tasks.rb', line 82

def name_filter
  @name_pattern ||= get_pattern('bolt.tasks.name_filter', default: %r{^$})
end

#onlyObject



90
91
92
# File 'lib/cem_acpt/bolt/tasks.rb', line 90

def only
  @only ||= @config.get('bolt.tasks.only') || []
end

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/cem_acpt/bolt/tasks.rb', line 102

def respond_to_missing?(method, include_private = false)
  tasks.respond_to?(method, include_private) || super
end

#tasksObject



71
72
73
74
75
76
# File 'lib/cem_acpt/bolt/tasks.rb', line 71

def tasks
  return @tasks unless @tasks.nil? || @tasks.empty?

  @tasks = filter_tasks(unfiltered)
  @tasks
end

#unfilteredObject



67
68
69
# File 'lib/cem_acpt/bolt/tasks.rb', line 67

def unfiltered
  find_all_tasks
end