Class: Shogun::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/shogun/command.rb,
lib/shogun/command/new.rb,
lib/shogun/command/generate.rb

Defined Under Namespace

Classes: Generate, New

Instance Method Summary collapse

Constructor Details

#initialize(namespace, command, *parameters) ⇒ Command

Returns a new instance of Command.



10
11
12
13
14
# File 'lib/shogun/command.rb', line 10

def initialize(namespace, command, *parameters)
  @namespace = namespace
  @command = command
  @parameters = parameters
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/shogun/command.rb', line 16

def execute
  case @command
  when "new" then
    ::Shogun::Command::New.new(@namespace, *@parameters).execute
  when "generate" then
    ::Shogun::Command::Generate.new(@namespace, *@parameters).execute
  when "database" then
    case ARGV.shift
    when "reset" then
      ::Shogun::Database.setup!(logger: Logger.new(STDOUT))
    when "console" then
      ::Shogun::Database.new(logger: Logger.new(STDOUT))
      binding.pry
    end
  when "console" then
    binding.pry
  end
end