Class: Etna::Command

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.usage(desc) ⇒ Object



4
5
6
7
8
# File 'lib/etna/command.rb', line 4

def usage(desc)
  define_method :usage do
    "  #{"%-30s" % name}#{desc}"
  end
end

Instance Method Details

#executeObject

To be overridden during inheritance.



16
17
18
# File 'lib/etna/command.rb', line 16

def execute
  raise 'Command is not implemented'
end

#nameObject



11
12
13
# File 'lib/etna/command.rb', line 11

def name
  self.class.name.snake_case.split(/::/).last.to_sym
end

#setup(config) ⇒ Object

To be overridden during inheritance, to e.g. connect to a database. Should be called with super by inheriting method.



22
23
24
# File 'lib/etna/command.rb', line 22

def setup(config)
  Etna::Application.find(self.class).configure(config)
end