Class: MetaModel::Command::Generate
- Inherits:
-
MetaModel::Command
- Object
- CLAide::Command
- MetaModel::Command
- MetaModel::Command::Generate
- Defined in:
- lib/metamodel/command/generate.rb
Constant Summary
Constants inherited from MetaModel::Command
METAMODEL_COMMAND_ALIAS, METAMODEL_OPTION_ALIAS
Instance Method Summary collapse
-
#initialize(argv) ⇒ Generate
constructor
A new instance of Generate.
- #run ⇒ Object
Methods inherited from MetaModel::Command
#installer_for_config, options, run
Methods included from MetaModel::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Generate
Returns a new instance of Generate.
11 12 13 14 15 |
# File 'lib/metamodel/command/generate.rb', line 11 def initialize(argv) @model_name = argv.shift_argument @metafile_path = config. super end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/metamodel/command/generate.rb', line 17 def run UI.section "Generating model scaffold" do = { :verbose_prefix => '-> '.green } UI.titled_section "Adding `#{@model_name.camelize} model to Metafile", do @metafile_path.open('a') do |source| source.puts model_template(@model_name) end end UI.notice "Adding `#{@model_name.camelize}` model scaffold to Metafile, use the command below to edit it.\n" UI. "vim Metafile" end end |