Class: Redmine::CLI::CommandFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/cli/command_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(args, config) ⇒ CommandFactory

Returns a new instance of CommandFactory.



14
15
16
17
# File 'lib/redmine/cli/command_factory.rb', line 14

def initialize(args, config)
  @arguments = args
  @config    = config
end

Instance Method Details

#commandObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/redmine/cli/command_factory.rb', line 19

def command
  case @arguments.command
  when Redmine::CLI::Parser::COMMAND_START
    Redmine::Commands::Start.new(@arguments, @config)
  when Redmine::CLI::Parser::COMMAND_LIST
    Redmine::Commands::List.new
  when Redmine::CLI::Parser::COMMAND_INSTALL_PLUGINS
    Redmine::Commands::PullPlugins.new(@arguments)
  when Redmine::CLI::Parser::COMMAND_STOP
    Redmine::Commands::Stop.new(@arguments)
  when Redmine::CLI::Parser::COMMAND_SHOW
    Redmine::Commands::Show.new(@arguments)
  when Redmine::CLI::Parser::COMMAND_SHELL
    Redmine::Commands::Shell.new(@arguments)
  when Redmine::CLI::Parser::COMMAND_HELP
    Redmine::Commands::Help.new
  when Redmine::CLI::Parser::COMMAND_LOGS
    Redmine::Commands::Logs.new(@arguments)
  else
    raise Redmine::CLI::UnclearCommand, @arguments.command
  end
end