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
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_logs(dir)
|
def load_logs(dir, basedir = dir)
|
||||||
logs = {}
|
logs = {}
|
||||||
if dir.exist?
|
if dir.exist?
|
||||||
dir.children.sort.each do |file|
|
dir.children.sort.each do |file|
|
||||||
contents = file.size? ? file.read : "empty log"
|
if file.directory?
|
||||||
# small enough to avoid GitHub "unicorn" page-load-timeout errors
|
logs.merge! load_logs(file, basedir)
|
||||||
max_file_size = 1_000_000
|
else
|
||||||
contents = truncate_text_to_approximate_size(contents, max_file_size, front_weight: 0.2)
|
contents = file.size? ? file.read : "empty log"
|
||||||
logs[file.basename.to_s] = { content: contents }
|
# 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
|
||||||
end
|
end
|
||||||
odie "No logs." if logs.empty?
|
odie "No logs." if logs.empty?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user