aboutsummaryrefslogtreecommitdiff
path: root/rakelib/support/ui.rb
diff options
context:
space:
mode:
Diffstat (limited to 'rakelib/support/ui.rb')
-rw-r--r--rakelib/support/ui.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/rakelib/support/ui.rb b/rakelib/support/ui.rb
new file mode 100644
index 0000000..3120721
--- /dev/null
+++ b/rakelib/support/ui.rb
@@ -0,0 +1,25 @@
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at https://mozilla.org/MPL/2.0/.
+# frozen_string_literal: true
+
+require 'term/ansicolor'
+
+# Terminal UI helpers for build milestones, debug logging, and operational errors.
+module UI
+ extend Term::ANSIColor
+
+ def self.step(message)
+ puts green(message)
+ end
+
+ def self.debug(message)
+ puts "#{dark(' ->')} #{dark(message)}" if Rake.verbose
+ end
+
+ def self.fatal(message, hint: nil)
+ output = red(message)
+ output += "\n#{bold(cyan('Hint:'))} #{hint}" if hint
+ abort output
+ end
+end