Class: Fastlane::Actions::SpaceshipLogsAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, authors, deprecated_notes, details, lane_context, method_missing, other_action, output, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
130
131
132
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 130
def self.author
"joshdholtz"
end
|
.available_options ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 69
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :latest,
description: "Finds only the latest Spaceshop log file if set to true, otherwise returns all",
default_value: true,
type: Boolean),
FastlaneCore::ConfigItem.new(key: :print_contents,
description: "Prints the contents of the found Spaceship log file(s)",
default_value: false,
type: Boolean),
FastlaneCore::ConfigItem.new(key: :print_paths,
description: "Prints the paths of the found Spaceship log file(s)",
default_value: false,
type: Boolean),
FastlaneCore::ConfigItem.new(key: :copy_to_path,
description: "Copies the found Spaceship log file(s) to a directory",
optional: true),
FastlaneCore::ConfigItem.new(key: :copy_to_clipboard,
description: "Copies the contents of the found Spaceship log file(s) to the clipboard",
default_value: false,
type: Boolean)
]
end
|
.category ⇒ Object
118
119
120
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 118
def self.category
:misc
end
|
.description ⇒ Object
65
66
67
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 65
def self.description
"Find, print, and copy Spaceship logs"
end
|
.example_code ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 97
def self.example_code
[
'spaceship_logs',
'spaceship_logs(
copy_to_path: "/tmp/artifacts"
)',
'spaceship_logs(
copy_to_clipboard: true
)',
'spaceship_logs(
print_contents: true,
print_paths: true
)',
'spaceship_logs(
latest: false,
print_contents: true,
print_paths: true
)'
]
end
|
.is_supported?(platform) ⇒ Boolean
93
94
95
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 93
def self.is_supported?(platform)
true
end
|
.return_type ⇒ Object
126
127
128
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 126
def self.return_type
:array_of_strings
end
|
.return_value ⇒ Object
122
123
124
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 122
def self.return_value
"The array of Spaceship logs"
end
|
.run(params) ⇒ Object
4
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'fastlane/lib/fastlane/actions/spaceship_logs.rb', line 4
def self.run(params)
latest = params[:latest]
print_contents = params[:print_contents]
print_paths = params[:print_paths]
copy_to_path = params[:copy_to_path]
copy_to_clipboard = params[:copy_to_clipboard]
files = Dir.glob("/tmp/spaceship*.log").sort_by { |f| File.mtime(f) }.reverse
if files.size == 0
UI.message("No Spaceship log files found")
return []
end
if latest
files = [files.first]
end
if print_contents
files.each do |file|
data = File.read(file)
puts("-----------------------------------------------------------------------------------")
puts(" Spaceship Log Content - #{file}")
puts("-----------------------------------------------------------------------------------")
puts(data)
puts("\n")
end
end
if print_paths
puts("-----------------------------------------------------------------------------------")
puts(" Spaceship Log Paths")
puts("-----------------------------------------------------------------------------------")
files.each do |file|
puts(file)
end
puts("\n")
end
if copy_to_path
require 'fileutils'
FileUtils.mkdir_p(copy_to_path)
files.each do |file|
FileUtils.cp(file, copy_to_path)
end
end
if copy_to_clipboard
string = files.map { |file| File.read(file) }.join("\n")
ClipboardAction.run(value: string)
end
return files
end
|