Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-08-17 13:15:20 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-08-17 13:15:20 +0300
commitfa0624fc6409d84373f3e06275e936c9e5171b79 (patch)
treee884a367f605548365c6e3745f1a7a4457afe487 /lib/gitlab/downtime_check/message.rb
parent88a0c984fc0bdbe0951b02c4e1d4b749dce88a24 (diff)
Better formatting for downtime check messages
This removes excessive whitespace from the messages (e.g. leading whitespace) and ensures the message is more clearly visible.
Diffstat (limited to 'lib/gitlab/downtime_check/message.rb')
-rw-r--r--lib/gitlab/downtime_check/message.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/gitlab/downtime_check/message.rb b/lib/gitlab/downtime_check/message.rb
index fd85f087c03..40a4815a9a0 100644
--- a/lib/gitlab/downtime_check/message.rb
+++ b/lib/gitlab/downtime_check/message.rb
@@ -1,7 +1,7 @@
module Gitlab
class DowntimeCheck
class Message
- attr_reader :path, :offline, :reason
+ attr_reader :path, :offline
OFFLINE = "\e[31moffline\e[0m"
ONLINE = "\e[32monline\e[0m"
@@ -19,10 +19,21 @@ module Gitlab
label = offline ? OFFLINE : ONLINE
message = "[#{label}]: #{path}"
- message += ": #{reason}" if reason
+
+ if reason?
+ message += ":\n\n#{reason}\n\n"
+ end
message
end
+
+ def reason?
+ @reason.present?
+ end
+
+ def reason
+ @reason.strip.lines.map(&:strip).join("\n")
+ end
end
end
end