Class: Fastlane::Actions::PromptAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary
collapse
action_name, author, lane_context, method_missing, other_action, return_value, sh, step_text
Class Method Details
.authors ⇒ Object
63
64
65
|
# File 'lib/fastlane/actions/prompt.rb', line 63
def self.authors
["KrauseFx"]
end
|
.available_options ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/fastlane/actions/prompt.rb', line 40
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :text,
description: "The text that will be displayed to the user",
default_value: "Please enter a text: "),
FastlaneCore::ConfigItem.new(key: :ci_input,
description: "The default text that will be used when being executed on a CI service",
default_value: ''),
FastlaneCore::ConfigItem.new(key: :boolean,
description: "Is that a boolean question (yes/no)? This will add (y/n) at the end",
default_value: false,
is_string: false),
FastlaneCore::ConfigItem.new(key: :multi_line_end_keyword,
description: "Enable multi-line inputs by providing an end text (e.g. 'END') which will stop the user input",
optional: true,
is_string: true)
]
end
|
.category ⇒ Object
87
88
89
|
# File 'lib/fastlane/actions/prompt.rb', line 87
def self.category
:misc
end
|
.description ⇒ Object
28
29
30
|
# File 'lib/fastlane/actions/prompt.rb', line 28
def self.description
"Ask the user for a value or for confirmation"
end
|
.details ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/fastlane/actions/prompt.rb', line 32
def self.details
[
"You can use `prompt` to ask the user for a value or to just let the user confirm the next step",
"When this is executed on a CI service, the passed `ci_input` value will be returned",
"This action also supports multi-line inputs using the `multi_line_end_keyword` option."
].join("\n")
end
|
.example_code ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/fastlane/actions/prompt.rb', line 71
def self.example_code
[
'changelog = prompt(text: "Changelog: ")',
'changelog = prompt(
text: "Changelog: ",
multi_line_end_keyword: "END"
)
crashlytics(notes: changelog)'
]
end
|
.is_supported?(platform) ⇒ Boolean
67
68
69
|
# File 'lib/fastlane/actions/prompt.rb', line 67
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
59
60
61
|
# File 'lib/fastlane/actions/prompt.rb', line 59
def self.output
[]
end
|
.run(params) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/fastlane/actions/prompt.rb', line 4
def self.run(params)
params[:text] += " (y/n)" if params[:boolean]
UI.message(params[:text])
return params[:ci_input] unless UI.interactive?
if params[:multi_line_end_keyword]
end_tag = params[:multi_line_end_keyword]
UI.important("Submit inputs using \"#{params[:multi_line_end_keyword]}\"")
user_input = STDIN.gets(end_tag).chomp.gsub(end_tag, "").strip
else
user_input = STDIN.gets.chomp.strip while (user_input || "").length == 0
end
user_input = user_input.casecmp('y').zero? if params[:boolean]
return user_input
end
|
.sample_return_value ⇒ Object
83
84
85
|
# File 'lib/fastlane/actions/prompt.rb', line 83
def self.sample_return_value
"User Content\nWithNewline"
end
|