require 'rubygems' require 'cli/command' module Factor module CLI class ServerTask < Command desc "start", "start the server" def start engine = Factor::Engine.new client = Factor::Client.new client.login_token(get_config[:token]) puts "loading channels" engine = client.load_channels(engine) puts "loading channels complete" puts "loading workflows" engine = client.load_workflows(engine) puts "loading workflows complete" puts "loading credentials" engine = client.load_credentials(engine) puts "loading credentials complete" puts "starting the server..." engine.start end desc "list", "list all the running servers" def list puts "listing all servers" end desc "logs", "listen to incoming logs" def logs engine = Factor::Engine.new puts "Listening..." engine.logs do |message| puts "[#{message.route}] #{message.body}" end end end end end