Class: Shaf::Command::Base

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/shaf/command.rb

Direct Known Subclasses

Console, Generate, New, Server

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

#bootstrap, #in_project_root, #in_project_root?, #is_project_root?, pluralize, #pluralize, #project_root, #project_root!

Constructor Details

#initialize(*args) ⇒ Base

Returns a new instance of Base.



37
38
39
# File 'lib/shaf/command.rb', line 37

def initialize(*args)
  @args = args.dup
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



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

def args
  @args
end

Class Method Details

.exit_with_error(msg, status) ⇒ Object



31
32
33
34
# File 'lib/shaf/command.rb', line 31

def exit_with_error(msg, status)
  STDERR.puts msg
  exit status
end

.identifier(*ids) ⇒ Object



23
24
25
# File 'lib/shaf/command.rb', line 23

def identifier(*ids)
  @identifiers = ids.flatten
end

.inherited(child) ⇒ Object



19
20
21
# File 'lib/shaf/command.rb', line 19

def inherited(child)
  Factory.register(child)
end

.usage(str = nil, &block) ⇒ Object



27
28
29
# File 'lib/shaf/command.rb', line 27

def usage(str = nil, &block)
  @usage = str || block
end