Class: WorkflowPluginBase

Inherits:
Thor
  • Object
show all
Defined in:
lib/core/workflow_plugin_base.rb

Overview

Base class for all workflow plugins

Constant Summary collapse

DESCF_FORMAT =
"%-8s %s"
DESC_HELP =
format(DESCF_FORMAT, "help", "[COMMAND]")

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = [], options = {}, config = {}) ⇒ WorkflowPluginBase

Returns a new instance of WorkflowPluginBase.



8
9
10
11
# File 'lib/core/workflow_plugin_base.rb', line 8

def initialize(args = [], options = {}, config = {})
  super(args, options, config)
  @logger = LogHelper.load_logger(self.class.name, @options)
end

Class Method Details

.descf(usage, args, description, options = {}) ⇒ Object

Improves formatting for desc so that args are lain out nicely



34
35
36
# File 'lib/core/workflow_plugin_base.rb', line 34

def descf(usage, args, description, options = {})
  desc(format(DESCF_FORMAT, usage, args), description, options)
end

.help_desc(help_desc) ⇒ Object

rubocop:disable all



25
26
27
# File 'lib/core/workflow_plugin_base.rb', line 25

def help_desc(help_desc)
  @help_desc = help_desc
end

.help_textObject



29
30
31
# File 'lib/core/workflow_plugin_base.rb', line 29

def help_text
  @help_desc
end

.subcommand_help(cmd) ⇒ Object

Overrides the existing thor subcommand_help to improve formatting.



39
40
41
42
# File 'lib/core/workflow_plugin_base.rb', line 39

def subcommand_help(cmd)
  desc DESC_HELP, "Describe subcommands or one specific subcommand"
  class_eval "def help(command = nil, subcommand = true); super; end"
end

Instance Method Details

#help(command = nil, subcommand = false) ⇒ Object



19
20
21
# File 'lib/core/workflow_plugin_base.rb', line 19

def help(command = nil, subcommand = false)
  super command, subcommand
end