Class: MetaModel::Command

Inherits:
CLAide::Command
  • Object
show all
Includes:
MetaModel::Config::Mixin
Defined in:
lib/metamodel/command.rb,
lib/metamodel/command/init.rb,
lib/metamodel/command/clean.rb,
lib/metamodel/command/install.rb,
lib/metamodel/command/generate.rb

Direct Known Subclasses

Clean, Generate, Init, Install

Defined Under Namespace

Classes: Clean, Generate, Init, Install

Constant Summary collapse

METAMODEL_COMMAND_ALIAS =
{
  "g"  => "generate",
  "i"  => "install",
  "b"  => "build",
  "c"  => "clean"
}
METAMODEL_OPTION_ALIAS =
{
  "-s"  => "--skip-build"
}

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MetaModel::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.



44
45
46
47
48
49
# File 'lib/metamodel/command.rb', line 44

def initialize(argv)
  config.skip_build = argv.flag?("skip-build", false)
  # config.verbose = self.verbose?
  config.verbose = true
  super
end

Class Method Details

.optionsObject



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

def self.options
  [
    ['--skip-build', 'Skip building MetaModel framework process']
  ].concat(super)
end

.run(argv) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/metamodel/command.rb', line 30

def self.run(argv)
  if METAMODEL_COMMAND_ALIAS[argv.first]
    super([METAMODEL_COMMAND_ALIAS[argv.first]] + argv[1..-1])
  else
    super(argv)
  end
end

Instance Method Details

#installer_for_configObject



51
52
53
# File 'lib/metamodel/command.rb', line 51

def installer_for_config
  Installer.new(config.metafile)
end