lib/cli/server_task.rb in factor-0.0.92 vs lib/cli/server_task.rb in factor-0.0.93
- old
+ new
@@ -11,56 +11,61 @@
engine = Factor::Runtime::Engine.new(get_config[:email],get_config[:token])
options.tags.each {|tag,value| engine.tag(tag,value)} if options.tags?
# load channels from server
- puts "loading channels from server"
+ say "loading channels from server"
engine = @client.load_channels(engine) do |message|
- puts " #{message}"
+ say " #{message}"
end
# load channels from files
if options.channels?
options.channels.each do |file|
full_file=File.expand_path(file)
- puts " loading '#{full_file}'"
+ say " loading '#{full_file}'"
engine.load_channel(full_file)
- puts " loaded '#{full_file}'"
+ say " loaded '#{full_file}'"
end
end
- puts "loading channels complete"
+ say "loading channels complete"
# load workflows from server
- puts "loading workflows from server"
+ say "loading workflows from server"
engine = @client.load_workflows(engine) do |message|
- puts " #{message}"
+ say " #{message}"
end
- puts "loading workflows complete"
+ say "loading workflows complete"
- puts "loading credentials from server"
+ say "loading credentials from server"
engine = @client.load_credentials(engine) do |message|
- puts " #{message}"
+ say " #{message}"
end
- puts "loading credentials complete"
+ say "loading credentials complete"
- puts "starting the server..."
- engine.start
-
+ say "starting the server...", :green
+ message = engine.start
+ if message.is_a?(Exception)
+ say "An unknown exception occured '#{message}'", :red
+ else
+ say "disconnecting...", :green
+ end
+
end
desc "list", "list all the running servers"
def list
- puts "listing all servers"
+ say "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..."
+ say "Listening...", :green
engine.logs do |message|
- puts "[#{message.route}] #{message.body}"
+ say "[#{message.route}] #{message.body}"
end
end
end
end
\ No newline at end of file