but 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abd129d50d267af66d41279fbb6ae787a66110f1ad1f16953a1bead04b377bc9
4
- data.tar.gz: 23264ed3f2984516b6dee0e4580cb7310ab6776935d0499bf85153b35ba38f61
3
+ metadata.gz: d1e0e7f89684475a8ab03efce23401e10563fcd76b52ad811007437900892866
4
+ data.tar.gz: 1eb6a7f6f0f809a0e1a573f306702839d20cdc1c044c9ef0f64d2a6d53e9c95c
5
5
  SHA512:
6
- metadata.gz: 17d68c15cdb023b8551ce7dce30a512662db12292eabfb8d8d7a91512b5e325739916dc9f495e43002c391599f872f8d77e94bcdbc1c9ea45906c1881f2da495
7
- data.tar.gz: dfe73f4d8d3bda17e89b24f84b24e6039db08137e432eccc9d3bc1bdf8beca2dfce84961c2d9742630b77a88abc48b36f8cba85c3fafd774131175967a1caf2a
6
+ metadata.gz: 8da2f660ae317bf5be7bbf3709d8ca9b1abf112046dfbfe14b5bd758e1cd50dc85eb9327a27e00c2fa21c92bcdfac0c45485e2b250851daaa7370ab0f8cabc92
7
+ data.tar.gz: 30f680abc3f62da8ae30042a3ab8278496f8ed623a4d986b012e37daee332c8d04b344b05db72576a852165dcd86cfdf15ec967e1a53de0266fb842a69651482
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- but (0.1.7)
4
+ but (0.1.8)
5
5
  colorize
6
6
  ruby-prof
7
7
  ruby-progressbar
@@ -17,15 +17,12 @@ module But
17
17
  total_disc_usage = total_disc_usage.to_i
18
18
 
19
19
  if total_disc_usage >= But::HOMELIMIT
20
- return "Dare you! Your directory #{dir} contains #{total_disc_usage}, which is #{total_disc_usage - But::HOMELIMIT} above the limit of #{But::HOMELIMIT}. Dare you!".red
20
+ return "Dare you! Your directory #{dir} contains ~#{h_readable total_disc_usage}, which is ~#{h_readable (total_disc_usage - But::HOMELIMIT)} above the limit of #{h_readable But::HOMELIMIT}. Dare you!".red
21
21
  else
22
- return "Good job! Your directory #{dir} takes only #{total_disc_usage} disk storage. Good job!".light_green
22
+ return "Good job! Your directory #{dir} takes only ~#{h_readable total_disc_usage} disk storage. Good job!".light_green
23
23
  end
24
24
  end
25
25
 
26
- def self.all_eof(files)
27
- files.find { |f| !f.eof }.nil?
28
- end
29
26
 
30
27
  # Q: is $HOME always set?
31
28
  def self.create_disk_usage_file(options = {})
@@ -60,7 +57,7 @@ module But
60
57
 
61
58
  #puts "fileno: #{fileno}, data: #{data.inspect}"
62
59
  progressbar.progress += data.lines.count
63
- progressbar.title = "just completed: %s" % data.split(/\s+/).last
60
+ progressbar.title = "completed: %s" % data.split(/\s+/).last
64
61
  tmpfile.write(data)
65
62
  rescue EOFError => e
66
63
  #puts "fileno: #{fileno} EOF"
@@ -85,6 +82,16 @@ module But
85
82
  tmpfile.rewind
86
83
  return tmpfile.path
87
84
  end
85
+
86
+ private
87
+
88
+ def self.all_eof(files)
89
+ files.find { |f| !f.eof }.nil?
90
+ end
91
+
92
+ def self.h_readable(bytes)
93
+ return "%.2f GB"% (bytes / (1024.0 * 1024.0))
94
+ end
88
95
 
89
96
  end
90
97
  end
@@ -1,3 +1,3 @@
1
1
  module But
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: but
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Müller