Class: Shaf::Command::Base

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

Direct Known Subclasses

Console, Generate, New, Server, Test, Upgrade, Version

Constant Summary

Constants included from Utils

Utils::SHAF_VERSION_FILE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

#bootstrap, deep_symbolize_keys, deep_transform_keys, deep_transform_values, environment, gem_root, iana_link_relations, #in_project_root, #in_project_root?, #is_project_root?, model_name, pluralize, #project_root, #project_root!, rackify_header, read_config, #read_shaf_file, #read_shaf_file!, #read_shaf_upgrade_failure_version, #read_shaf_version, singularize, symbol_or_quoted_string, symbol_string, #write_shaf_file, #write_shaf_file!, #write_shaf_upgrade_failure, #write_shaf_version

Constructor Details

#initialize(*args, **options) ⇒ Base

Returns a new instance of Base.



38
39
40
41
42
# File 'lib/shaf/command/base.rb', line 38

def initialize(*args, **options)
  @args = args.dup
  @options = options
  parse_options!
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



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

def args
  @args
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

.exit_with_error(msg, status) ⇒ Object



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

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

.identified_byObject



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

def identified_by
  @identifiers
end

.identifier(*ids) ⇒ Object



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

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

.inherited(child) ⇒ Object



14
15
16
# File 'lib/shaf/command/base.rb', line 14

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

.options(option_parser, options) ⇒ Object



35
# File 'lib/shaf/command/base.rb', line 35

def options(option_parser, options); end

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



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

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