Sha256: 004d90d16ff28bbca8f96bfe4cfc808e938f4ab9e6fc7b9c296aa8ac1de5194f

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'rubygems'
require 'cli/command'

module Factor
  module CLI
    class ServerTask < Command
      desc "start", "start the server"
      method_option :tags, :alias=>"-t", :type=>:hash, :desc=>"Optional tags to identify from workflow"
      def start
        engine = Factor::Runtime::Engine.new(get_config[:email],get_config[:token])
        
        options.tags.each {|tag,value| engine.tag(tag,value)}
   
        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::Runtime::Engine.new(get_config[:email],get_config[:token])
        puts "Listening..."
        engine.logs do |message|
          puts "[#{message.route}] #{message.body}"
        end
      end
  
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factor-0.0.8 lib/cli/server_task.rb