diff options
| author | Andrew Janke | 2016-07-05 08:45:17 -0400 |
|---|---|---|
| committer | GitHub | 2016-07-05 08:45:17 -0400 |
| commit | f518f57bd8c9ff864dc23911fac59f10995302b9 (patch) | |
| tree | 7e2e4eb6ab977329bf47679f48de56113831a4b4 /Library/Homebrew/dev-cmd | |
| parent | 1b1bf56733e1ede7d414c8a5ef1e04dabc645455 (diff) | |
| download | brew-f518f57bd8c9ff864dc23911fac59f10995302b9.tar.bz2 | |
gist-logs: truncate log files to be gist-friendly (#279)
Truncates each log file to about 1 MB. This avoids upload and
download errors with the gists, and respects GitHub's suggested
size limits.
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/test-bot.rb | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb index 3a5fd9f25..296d52f7b 100644 --- a/Library/Homebrew/dev-cmd/test-bot.rb +++ b/Library/Homebrew/dev-cmd/test-bot.rb @@ -45,10 +45,6 @@ module Homebrew HOMEBREW_TAP_REGEX = %r{^([\w-]+)/homebrew-([\w-]+)$} - def ruby_has_encoding? - String.method_defined?(:force_encoding) - end - if ruby_has_encoding? def fix_encoding!(str) # Assume we are starting from a "mostly" UTF-8 string @@ -1032,13 +1028,7 @@ module Homebrew # Truncate to 1MB to avoid hitting CI limits if output.bytesize > MAX_STEP_OUTPUT_SIZE - if ruby_has_encoding? - binary_output = output.force_encoding("BINARY") - output = binary_output.slice(-MAX_STEP_OUTPUT_SIZE, MAX_STEP_OUTPUT_SIZE) - fix_encoding!(output) - else - output = output.slice(-MAX_STEP_OUTPUT_SIZE, MAX_STEP_OUTPUT_SIZE) - end + output = truncate_text_to_approximate_size(output, MAX_STEP_OUTPUT_SIZE, :front_weight => 0.0) output = "truncated output to 1MB:\n" + output end end |
