Class: Golem::Command::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/golem/command.rb

Overview

This class is abstract.

Subclass and override #run to implement a custom Command class.

Abstract class for commands.

Direct Known Subclasses

Auth, ClearRepositories, CreateRepository, DeleteRepository, Environment, SaveConfig, SetupDb, UpdateHooks, UpdateKeysFile

Instance Method Summary (collapse)

Constructor Details

- (Base) initialize(opts)

Returns a new instance of Base

Parameters:

  • opts (Hash)

    options

Options Hash (opts):

  • :verbose (Boolean)

    control verbosity.



58
59
60
# File 'lib/golem/command.rb', line 58

def initialize(opts)
    @opts = opts
end

Instance Method Details

- (Object) command(cmd, *args)

Run another command.

Parameters:

  • cmd (Symbol)

    the command to run,

  • *args

    arguments for the command.



75
76
77
# File 'lib/golem/command.rb', line 75

def command(cmd, *args)
    Golem::Command.run(cmd, @opts, *args)
end

- (Object) run

Run the command.



68
69
70
# File 'lib/golem/command.rb', line 68

def run
    abort "Bad command."
end

- (Boolean) verbose?

Check verbosity.

Returns:

  • (Boolean)


63
64
65
# File 'lib/golem/command.rb', line 63

def verbose?
    !!@opts[:verbose]
end