Merge pull request #11803 from gromgit/gist-logs/dirs
gist-logs: grab files in subdirectories too
This commit is contained in:
commit
a1067f9721
@ -92,15 +92,19 @@ module Homebrew
|
||||
result
|
||||
end
|
||||
|
||||
def load_logs(dir)
|
||||
def load_logs(dir, basedir = dir)
|
||||
logs = {}
|
||||
if dir.exist?
|
||||
dir.children.sort.each do |file|
|
||||
contents = file.size? ? file.read : "empty log"
|
||||
# small enough to avoid GitHub "unicorn" page-load-timeout errors
|
||||
max_file_size = 1_000_000
|
||||
contents = truncate_text_to_approximate_size(contents, max_file_size, front_weight: 0.2)
|
||||
logs[file.basename.to_s] = { content: contents }
|
||||
if file.directory?
|
||||
logs.merge! load_logs(file, basedir)
|
||||
else
|
||||
contents = file.size? ? file.read : "empty log"
|
||||
# small enough to avoid GitHub "unicorn" page-load-timeout errors
|
||||
max_file_size = 1_000_000
|
||||
contents = truncate_text_to_approximate_size(contents, max_file_size, front_weight: 0.2)
|
||||
logs[file.relative_path_from(basedir).to_s.tr("/", ":")] = { content: contents }
|
||||
end
|
||||
end
|
||||
end
|
||||
odie "No logs." if logs.empty?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user