Class: Discharger::SetupRunner::Commands::BaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/discharger/setup_runner/commands/base_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, app_root, logger) ⇒ BaseCommand

Returns a new instance of BaseCommand.



9
10
11
12
13
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 9

def initialize(config, app_root, logger)
  @config = config
  @app_root = app_root
  @logger = logger
end

Instance Attribute Details

#app_rootObject (readonly)

Returns the value of attribute app_root.



7
8
9
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 7

def app_root
  @app_root
end

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 7

def config
  @config
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 7

def logger
  @logger
end

Instance Method Details

#can_execute?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 19

def can_execute?
  true
end

#descriptionObject



23
24
25
26
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 23

def description
  class_name = self.class.name || "AnonymousCommand"
  class_name.demodulize.underscore.humanize
end

#executeObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 15

def execute
  raise NotImplementedError, "#{self.class} must implement #execute"
end