Class: Mxrb::Scaffold::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/scaffold/cli.rb

Overview

Parses and renders the conventional scaffold subcommands.

Constant Summary collapse

INIT_COMMANDS =
%w[presentation security design ci].freeze
QUIET_COMMANDS =
%w[ci evaluation functional-test].freeze

Instance Method Summary collapse

Constructor Details

#initialize(command, argv, output: $stdout) ⇒ CLI

Returns a new instance of CLI.



10
11
12
13
14
# File 'lib/mxrb/scaffold/cli.rb', line 10

def initialize(command, argv, output: $stdout)
  @command = command
  @argv = argv
  @output = output
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mxrb/scaffold/cli.rb', line 16

def run
  return show_help if help?
  return render_page_templates if page_templates?

  validate_action!
  @dry_run = @argv.delete('--dry-run') ? true : false
  @json = @argv.delete('--json') ? true : false
  result = generator.scaffold
  render(result)
rescue ArgumentError => e
  abort "[mxrb] error: #{e.message}"
end