Module: PredictabilityEngine::CliBase

Included in:
Cli, Viz
Defined in:
lib/predictability_engine/cli.rb

Overview

Shared Thor configuration for Cli and Viz: common class_options plus auto-wiring of PredictabilityEngine.setup_logging from –log-level/–log-file.

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VALID_SIZES =
Report::Constants::RESOLUTION_CONFIG.keys.freeze
SIZE_DESC =
"Image size for PNG/PPT reports (#{VALID_SIZES.join(', ')})".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/predictability_engine/cli.rb', line 16

def self.included(base)
  base.extend(ClassMethods)
  base.class_option :output_dir, type: :string, desc: 'Output directory for reports'
  base.class_option :size, type: :string, default: Report::Constants::DEFAULT_SIZE,
                           enum: VALID_SIZES, desc: SIZE_DESC
  base.class_option :log_level, type: :string, default: 'info',
                                desc: 'Logging level (debug, info, warn, error)'
  base.class_option :log_file, type: :string, desc: 'Log file path'
  base.class_option :url_prefix, type: :string,
                                 desc: 'URL prefix for constructing item URLs from IDs (e.g. https://jira.example.com/browse/)'
end

Instance Method Details

#initialize(*args) ⇒ Object



34
35
36
37
# File 'lib/predictability_engine/cli.rb', line 34

def initialize(*args)
  super
  PredictabilityEngine.setup_logging(level: options[:log_level], log_file: options[:log_file])
end