Class: Charyf::Command::ConsoleCommand

Inherits:
Base
  • Object
show all
Includes:
EnvironmentArgument
Defined in:
lib/charyf/utils/commands/console/console_command.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from EnvironmentArgument

included

Methods inherited from Base

banner, base_name, command_name, desc, desc_file, executable, #help, hide_command!, inherited, namespace, perform, printing_commands

Methods included from Actions

#load_generators, #require_application_and_environment!, #start_interfaces!, #start_pipeline!

Constructor Details

#initialize(args = [], local_options = {}, config = {}) ⇒ ConsoleCommand

Returns a new instance of ConsoleCommand.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/charyf/utils/commands/console/console_command.rb', line 50

def initialize(args = [], local_options = {}, config = {})
  console_options = []

  # For the same behavior as OptionParser, leave only options after "--" in ARGV.
  termination = local_options.find_index("--")
  if termination
    console_options = local_options[termination + 1..-1]
    local_options = local_options[0...termination]
  end

  ARGV.replace(console_options)
  super(args, local_options, config)
end

Instance Method Details

#performObject



64
65
66
67
68
69
70
71
72
73
# File 'lib/charyf/utils/commands/console/console_command.rb', line 64

def perform
  extract_environment_option

  # CHARYF_ENV needs to be set before application is required.
  ENV["CHARYF_ENV"] = options[:environment]

  require_application_and_environment!

  Charyf::Console.start(Charyf.application, options)
end