Sha256: 14d139cf3532c95c038545be3f32b1b214cf441f05181f267c6318ec2d8dbf67

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
factor-0.0.5 lib/cli/server_task.rb
factor-0.0.4 lib/cli/server_task.rb