Class: FastlaneCore::Interface
- Inherits:
-
Object
- Object
- FastlaneCore::Interface
- Defined in:
- fastlane_core/lib/fastlane_core/ui/interface.rb,
fastlane_core/lib/fastlane_core/ui/errors/fastlane_crash.rb,
fastlane_core/lib/fastlane_core/ui/errors/fastlane_error.rb,
fastlane_core/lib/fastlane_core/ui/errors/fastlane_exception.rb,
fastlane_core/lib/fastlane_core/ui/errors/fastlane_shell_error.rb,
fastlane_core/lib/fastlane_core/ui/errors/fastlane_common_error.rb
Overview
Abstract super class
Direct Known Subclasses
Defined Under Namespace
Classes: FastlaneBuildFailure, FastlaneCommonException, FastlaneCrash, FastlaneDependencyCausedException, FastlaneError, FastlaneException, FastlaneShellError, FastlaneTestFailure
Messaging: show text to the user collapse
-
#command(_message) ⇒ Object
Level Command: Print out a terminal command that is being executed.
-
#command_output(_message) ⇒ Object
Level Command Output: Print the output of a command with this method.
-
#deprecated(_message) ⇒ Object
Level Deprecated: Show that a particular function is deprecated.
-
#error(_message) ⇒ Object
Level Error: Can be used to show additional error information before actually raising an exception or can be used to just show an error from which fastlane can recover (much magic).
-
#header(_message) ⇒ Object
Print a header = a text in a box use this if this message is really important.
-
#important(_message) ⇒ Object
Level Important: Can be used to show warnings to the user not necessarily negative, but something the user should be aware of.
-
#message(_message) ⇒ Object
Level Message: Show a neutral message to the user.
-
#success(_message) ⇒ Object
Level Success: Show that something was successful.
-
#verbose(_message) ⇒ Object
Level Verbose: Print out additional information for the users that are interested.
Errors: Inputs collapse
-
#confirm(_message) ⇒ Object
A simple yes or no question.
-
#input(_message) ⇒ Object
get a standard text input (single line).
-
#interactive? ⇒ Boolean
Is is possible to ask the user questions?.
-
#password(_message) ⇒ Object
Password input for the user, text field shouldn’t show plain text.
-
#select(_message, _options) ⇒ Object
Let the user select one out of x items return value is the value of the option the user chose.
Abort helper methods collapse
-
#abort_with_message!(message) ⇒ Object
Use this method to exit the program because of terminal state that is neither the fault of fastlane, nor a problem with the user’s input.
-
#build_failure!(error_message, options = {}) ⇒ Object
Use this method to exit the program because of a build failure that’s caused by the source code of the user.
-
#crash!(exception) ⇒ Object
Pass an exception to this method to exit the program using the given exception Use this method instead of user_error! if this error is unexpected, e.g.
-
#shell_error!(error_message, options = {}) ⇒ Object
Use this method to exit the program because of a shell command failure – the command returned a non-zero response.
-
#test_failure!(error_message) ⇒ Object
Use this method to exit the program because of a test failure that’s caused by the source code of the user.
-
#user_error!(error_message, options = {}) ⇒ Object
Use this method to exit the program because of an user error e.g.
Helpers collapse
Instance Method Details
#abort_with_message!(message) ⇒ Object
Use this method to exit the program because of terminal state that is neither the fault of fastlane, nor a problem with the user’s input. Using this method instead of user_error! will avoid tracking this outcome as a fastlane failure.
e.g. tests ran successfully, but no screenshots were found
This will show the message, but hide the full stack trace.
175 176 177 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 175 def () raise FastlaneCommonException.new, end |
#build_failure!(error_message, options = {}) ⇒ Object
Use this method to exit the program because of a build failure that’s caused by the source code of the user. Example for this is that gym will fail when the code doesn’t compile or because settings for the project are incorrect. By using this method we’ll have more accurate results about fastlane failures
154 155 156 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 154 def build_failure!(, = {}) raise FastlaneBuildFailure.new(), .to_s end |
#command(_message) ⇒ Object
Level Command: Print out a terminal command that is being
executed.
By default those messages shown in cyan
54 55 56 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 54 def command() not_implemented(__method__) end |
#command_output(_message) ⇒ Object
Level Command Output: Print the output of a command with
this method
By default those messages shown in magenta
62 63 64 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 62 def command_output() not_implemented(__method__) end |
#confirm(_message) ⇒ Object
A simple yes or no question
96 97 98 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 96 def confirm() not_implemented(__method__) end |
#crash!(exception) ⇒ Object
Pass an exception to this method to exit the program
using the given exception
Use this method instead of user_error! if this error is unexpected, e.g. an invalid server response that shouldn’t happen
120 121 122 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 120 def crash!(exception) raise FastlaneCrash.new, exception.to_s end |
#deprecated(_message) ⇒ Object
Level Deprecated: Show that a particular function is deprecated
By default those messages shown in strong blue
46 47 48 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 46 def deprecated() not_implemented(__method__) end |
#error(_message) ⇒ Object
Level Error: Can be used to show additional error
information before actually raising an exception
or can be used to just show an error from which
fastlane can recover (much magic)
By default those messages are shown in red
16 17 18 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 16 def error() not_implemented(__method__) end |
#header(_message) ⇒ Object
Print a header = a text in a box
use this if this is really important
77 78 79 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 77 def header() not_implemented(__method__) end |
#important(_message) ⇒ Object
Level Important: Can be used to show warnings to the user
not necessarily negative, but something the user should
be aware of.
By default those messages are shown in yellow
25 26 27 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 25 def important() not_implemented(__method__) end |
#input(_message) ⇒ Object
get a standard text input (single line)
91 92 93 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 91 def input() not_implemented(__method__) end |
#interactive? ⇒ Boolean
Is is possible to ask the user questions?
86 87 88 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 86 def interactive? not_implemented(__method__) end |
#message(_message) ⇒ Object
Level Message: Show a neutral message to the user
By default those messages shown in white/black
39 40 41 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 39 def () not_implemented(__method__) end |
#not_implemented(method_name) ⇒ Object
182 183 184 185 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 182 def not_implemented(method_name) require_relative 'ui' UI.user_error!("Current UI '#{self}' doesn't support method '#{method_name}'") end |
#password(_message) ⇒ Object
Password input for the user, text field shouldn’t show plain text
108 109 110 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 108 def password() not_implemented(__method__) end |
#select(_message, _options) ⇒ Object
Let the user select one out of x items return value is the value of the option the user chose
102 103 104 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 102 def select(, ) not_implemented(__method__) end |
#shell_error!(error_message, options = {}) ⇒ Object
Use this method to exit the program because of a shell command failure – the command returned a non-zero response. This does not specify the nature of the error. The error might be from a programming error, a user error, or an expected error because the user of the Fastfile doesn’t have their environment set up properly. Because of this, when these errors occur, it means that the caller of the shell command did not adequate error handling and the caller error handling should be improved.
144 145 146 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 144 def shell_error!(, = {}) raise FastlaneShellError.new(), .to_s end |
#success(_message) ⇒ Object
Level Success: Show that something was successful
By default those messages are shown in green
32 33 34 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 32 def success() not_implemented(__method__) end |
#test_failure!(error_message) ⇒ Object
Use this method to exit the program because of a test failure that’s caused by the source code of the user. Example for this is that scan will fail when the tests fail. By using this method we’ll have more accurate results about fastlane failures
163 164 165 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 163 def test_failure!() raise FastlaneTestFailure.new, end |
#to_s ⇒ Object
187 188 189 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 187 def to_s self.class.name.split('::').last end |
#user_error!(error_message, options = {}) ⇒ Object
Use this method to exit the program because of an user error
e.g. app doesn't exist on the given Developer Account
or invalid user credentials
or scan tests fail
This will show the error message, but doesn’t show the full
stack trace
Basically this should be used when you actively catch the error and want to show a nice error message to the user
132 133 134 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 132 def user_error!(, = {}) raise FastlaneError.new(), .to_s end |
#verbose(_message) ⇒ Object
Level Verbose: Print out additional information for the
users that are interested. Will only be printed when
FastlaneCore::Globals.verbose? = true
By default those messages are shown in white
71 72 73 |
# File 'fastlane_core/lib/fastlane_core/ui/interface.rb', line 71 def verbose() not_implemented(__method__) end |