diff options
| author | Jeppe Toustrup | 2017-02-25 11:09:57 +0000 |
|---|---|---|
| committer | Jeppe Toustrup | 2017-02-25 11:30:46 +0000 |
| commit | ebaf3cdc6a8cf637ec8f8b8a7e289a8d0dfd8f88 (patch) | |
| tree | e5da0f3084c87eebcc3d74a9cce05b6621f1eafc /Library | |
| parent | 9a0116d5c4967441a6c85656ef7f15795cd02bbc (diff) | |
| download | brew-ebaf3cdc6a8cf637ec8f8b8a7e289a8d0dfd8f88.tar.bz2 | |
Add 'B' for bytes to cleanup command output
When `brew cleanup` is run it prints out a message like the following:
> This operation has freed approximately 222M of disk space.
The '222M' refers to megabytes but the normal acronym for megabytes would be
'MB'. The 'B' is also missing from kilobytes and gigabytes in the output, so
that's what this commit adds.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/pathname_spec.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/utils_spec.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/Library/Homebrew/test/pathname_spec.rb b/Library/Homebrew/test/pathname_spec.rb index da12d4347..6e7dc34aa 100644 --- a/Library/Homebrew/test/pathname_spec.rb +++ b/Library/Homebrew/test/pathname_spec.rb @@ -30,13 +30,13 @@ describe Pathname do describe "#abv" do context "when called on a directory" do it "returns a string with the file count and disk usage" do - expect(dir.abv).to eq("3 files, 1M") + expect(dir.abv).to eq("3 files, 1MB") end end context "when called on a file" do it "returns the disk usage" do - expect((dir/"a-file").abv).to eq("1M") + expect((dir/"a-file").abv).to eq("1MB") end end end diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index 040ad630b..b3fdedcb9 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -232,10 +232,10 @@ describe "globally-scoped helper methods" do specify "#disk_usage_readable" do expect(disk_usage_readable(1)).to eq("1B") expect(disk_usage_readable(1000)).to eq("1000B") - expect(disk_usage_readable(1024)).to eq("1K") - expect(disk_usage_readable(1025)).to eq("1K") - expect(disk_usage_readable(4_404_020)).to eq("4.2M") - expect(disk_usage_readable(4_509_715_660)).to eq("4.2G") + expect(disk_usage_readable(1024)).to eq("1KB") + expect(disk_usage_readable(1025)).to eq("1KB") + expect(disk_usage_readable(4_404_020)).to eq("4.2MB") + expect(disk_usage_readable(4_509_715_660)).to eq("4.2GB") end describe "#number_readable" do diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index b129c7328..56ddfd611 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -422,13 +422,13 @@ end def disk_usage_readable(size_in_bytes) if size_in_bytes >= 1_073_741_824 size = size_in_bytes.to_f / 1_073_741_824 - unit = "G" + unit = "GB" elsif size_in_bytes >= 1_048_576 size = size_in_bytes.to_f / 1_048_576 - unit = "M" + unit = "MB" elsif size_in_bytes >= 1_024 size = size_in_bytes.to_f / 1_024 - unit = "K" + unit = "KB" else size = size_in_bytes unit = "B" |
