class Boto::Commands::Tasks

Constants

COMMAND_WHITELIST

Public Class Methods

new(argv) click to toggle source
# File lib/boto/commands/tasks.rb, line 6
def initialize(argv)
  @args = argv
end

Public Instance Methods

console() click to toggle source
# File lib/boto/commands/tasks.rb, line 16
def console
  set_application_directory!

  require APP_PATH
  Dir.chdir(Boto.application.root)

  require "pry" rescue nil
  if defined? Pry
    Pry.start
  else
    require "irb"
    IRB.start
  end
end
new() click to toggle source
# File lib/boto/commands/tasks.rb, line 47
def new
end
run_command!(command) click to toggle source
# File lib/boto/commands/tasks.rb, line 10
def run_command!(command)
  command = parse_command(command)

  send(command) if COMMAND_WHITELIST.include?(command)
end
runner() click to toggle source
# File lib/boto/commands/tasks.rb, line 44
def runner
end
server() click to toggle source
# File lib/boto/commands/tasks.rb, line 31
def server
  set_application_directory!
  require_command!("server")

  Boto::Server.new.tap do |server|
    # We need to require application after the server sets environment,
    # otherwise the --environment option given to the server won't propagate.
    require APP_PATH
    Dir.chdir(Boto.application.root)
    server.start
  end
end
version() click to toggle source
# File lib/boto/commands/tasks.rb, line 50
def version
end

Private Instance Methods

parse_command(command) click to toggle source
# File lib/boto/commands/tasks.rb, line 63
def parse_command(command)
  case command
  when '--version', '-v'
    'version'
  when '--help', '-h'
    'help'
  else
    command
  end
end
require_command!(command) click to toggle source
# File lib/boto/commands/tasks.rb, line 59
def require_command!(command)
  require "boto/commands/#{command}"
end
set_application_directory!() click to toggle source
# File lib/boto/commands/tasks.rb, line 55
def set_application_directory!
  Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exist?(File.expand_path("config.ru"))
end