module Apiway::Commands

Constants

DESC
HANDLERS

Public Class Methods

run( command = nil, *args ) click to toggle source
# File lib/apiway/commands.rb, line 25
def run( command = nil, *args )
  return help unless command
  HANDLERS.each { |handler, commands| return send( handler, *args ) if commands.include? command }
  puts "Apiway: Unknown command `#{ args.unshift( command ).join " " }`"
end

Private Class Methods

create( *args ) click to toggle source
# File lib/apiway/commands.rb, line 46
def create( *args )
  generate "app", *args
end
generate( *args ) click to toggle source
# File lib/apiway/commands.rb, line 42
def generate( *args )
  Generator.run *args
end
help( *args ) click to toggle source
# File lib/apiway/commands.rb, line 50
def help( *args )
  puts "\n Apiway commands: \n\n"
  HANDLERS.each do |handler, commands|
    puts "  [#{ commands.join( "], [" ) }]".ljust(30) << "# #{ DESC[ handler ] } "
  end
end
server( *args ) click to toggle source
# File lib/apiway/commands.rb, line 38
def server( *args )
  exec "bundle exec thin start #{ args.join " " }"
end
version( *args ) click to toggle source
# File lib/apiway/commands.rb, line 34
def version( *args )
  puts "Apiway version #{ Apiway::VERSION }"
end