Class: Everqueen::Cli

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.execute(argv) ⇒ Object



3
4
5
# File 'lib/everqueen/cli.rb', line 3

def self.execute(argv)
  new.execute(argv)
end

Instance Method Details

#execute(argv) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/everqueen/cli.rb', line 7

def execute(argv)
  command = argv.shift
  Everqueen.root = File.expand_path(argv.shift || '.', Dir.pwd)

  # detect Rails apps
  if File.exist?(File.join(Everqueen.root, 'config/environment.rb'))
    require File.join(Everqueen.root, 'config/environment.rb')
    require 'everqueen/rails' if defined?(Rails)
  end

  case command
  when "serve"
    Everqueen::Server.new.serve
    return true
  when "run"
    return Everqueen::Runner.new.run
  else
    puts "no such command '#{command}'"
    return false
  end
end