Class: Discharger::SetupRunner::Commands::BaseCommand
- Inherits:
-
Object
- Object
- Discharger::SetupRunner::Commands::BaseCommand
- Defined in:
- lib/discharger/setup_runner/commands/base_command.rb
Direct Known Subclasses
AsdfCommand, BrewCommand, BundlerCommand, ConfigCommand, CustomCommand, DatabaseCommand, DockerCommand, EnvCommand, GitCommand, PgToolsCommand, YarnCommand
Instance Attribute Summary collapse
-
#app_root ⇒ Object
readonly
Returns the value of attribute app_root.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #can_execute? ⇒ Boolean
- #description ⇒ Object
- #execute ⇒ Object
-
#initialize(config, app_root, logger) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
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_root ⇒ Object (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 |
#config ⇒ Object (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 |
#logger ⇒ Object (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
19 20 21 |
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 19 def can_execute? true end |
#description ⇒ Object
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 |
#execute ⇒ Object
15 16 17 |
# File 'lib/discharger/setup_runner/commands/base_command.rb', line 15 def execute raise NotImplementedError, "#{self.class} must implement #execute" end |