Class: FastlaneCore::Shell
- Inherits:
-
Interface
show all
- Defined in:
- lib/fastlane_core/ui/implementations/shell.rb
Overview
Shell is the terminal output of things For documentation for each of the methods open ‘interface.rb`
Messaging: show text to the user
collapse
Instance Method Summary
collapse
Methods inherited from Interface
#crash!, #not_implemented, #to_s, #user_error!
Instance Method Details
#command(message) ⇒ Object
57
58
59
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 57
def command(message)
log.info("$ #{message}".cyan.underline)
end
|
#command_output(message) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 61
def command_output(message)
actual = (message.split("\r").last || "") actual.split("\n").each do |msg|
prefix = msg.include?("▸") ? "" : "▸ "
log.info(prefix + "" + msg.magenta)
end
end
|
#confirm(message) ⇒ Object
96
97
98
99
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 96
def confirm(message)
verify_interactive!(message)
agree("#{message} (y/n)".yellow, true)
end
|
#deprecated(message) ⇒ Object
53
54
55
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 53
def deprecated(message)
log.error(message.to_s.bold.blue)
end
|
#error(message) ⇒ Object
37
38
39
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 37
def error(message)
log.error(message.to_s.red)
end
|
73
74
75
76
77
78
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 73
def (message)
i = message.length + 8
success("-" * i)
success("--- " + message + " ---")
success("-" * i)
end
|
#important(message) ⇒ Object
41
42
43
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 41
def important(message)
log.warn(message.to_s.yellow)
end
|
91
92
93
94
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 91
def input(message)
verify_interactive!(message)
ask(message.to_s.yellow).to_s.strip
end
|
#interactive? ⇒ Boolean
84
85
86
87
88
89
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 84
def interactive?
interactive = true
interactive = false if $stdout.isatty == false
interactive = false if Helper.ci?
return interactive
end
|
#log ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 5
def log
return @log if @log
$stdout.sync = true
if Helper.is_test?
@log ||= Logger.new(nil) else
@log ||= Logger.new($stdout)
end
@log.formatter = proc do |severity, datetime, progname, msg|
if $verbose
string = "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: "
elsif ENV["FASTLANE_HIDE_TIMESTAMP"]
string = ""
else
string = "[#{datetime.strftime('%H:%M:%S')}]: "
end
string += "#{msg}\n"
string
end
@log
end
|
#message(message) ⇒ Object
49
50
51
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 49
def message(message)
log.info(message.to_s)
end
|
#password(message) ⇒ Object
108
109
110
111
112
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 108
def password(message)
verify_interactive!(message)
ask(message.yellow) { |q| q.echo = "*" }
end
|
#select(message, options) ⇒ Object
101
102
103
104
105
106
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 101
def select(message, options)
verify_interactive!(message)
important(message)
choose(*options)
end
|
#success(message) ⇒ Object
45
46
47
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 45
def success(message)
log.info(message.to_s.green)
end
|
#verbose(message) ⇒ Object
69
70
71
|
# File 'lib/fastlane_core/ui/implementations/shell.rb', line 69
def verbose(message)
log.debug(message.to_s) if $verbose
end
|