Module: EasyAppHelper::Scripts::SubCommandBase

Includes:
EasyAppHelper, Common
Defined in:
lib/easy_app_helper/scripts/sub_command_base.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

PROVIDER =
'Core'
NAME =
''
DESCRIPTION =
''
CATEGORY =
''
ALIASES =
[]

Constants included from EasyAppHelper

ManagedConfig, ManagedLogger, VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#extra_parameters, #pre_process, #safe_execution

Methods included from EasyAppHelper

#config, #logger, #puts_and_logs, #safely_exec_code, #safely_exec_command

Class Method Details

.included(base) ⇒ Object



15
16
17
18
# File 'lib/easy_app_helper/scripts/sub_command_base.rb', line 15

def self.included(base)
  EasyAppHelper::Scripts::SubCommandManager.register base
  base.extend ClassMethods
end

Instance Method Details

#command_parametersObject



20
21
22
23
24
25
# File 'lib/easy_app_helper/scripts/sub_command_base.rb', line 20

def command_parameters
  params = extra_parameters
  command = params.shift
  raise 'Something weird happened !!' unless command == self.class::NAME or self.class::ALIASES.include? command
  params
end

#display_helpObject



31
32
33
34
# File 'lib/easy_app_helper/scripts/sub_command_base.rb', line 31

def display_help
  config.app_description = self.class::DESCRIPTION
  config.command_line_help
end

#do_processObject



27
28
29
# File 'lib/easy_app_helper/scripts/sub_command_base.rb', line 27

def do_process
  raise "Process for '#{name}' in '#{self::PROVIDER}' not implemented !"
end