ghq-cache 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ghq/cache/stats.rb +11 -5
- data/lib/ghq/cache/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f06e4789f5cb92b6981bbbb370ed464cdbcdde90
|
4
|
+
data.tar.gz: 745daa0aad6f9d6bfd199d7d9005d01b292d7db3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a136625939910d9de208caa457f488f11c23c8906f1fcd9c8d9d6832eabf42f368fdcb4c4d42af384451a5f76697c5c267c81e09deb694524eff038aa062f2a2
|
7
|
+
data.tar.gz: 4937099c27f4c84089c0c840408fb391de611b48d2edf98345c99bec05e4e1cecaf5a7322a6b122f52435e778f71050847985b73d87fcdea466771f348ff3690
|
data/lib/ghq/cache/stats.rb
CHANGED
@@ -4,23 +4,29 @@ module Ghq
|
|
4
4
|
class << self
|
5
5
|
def print_repository_usage
|
6
6
|
root = Logger.resume
|
7
|
+
dir = list_with_depth(1, root).sort_by(&:count).reverse.first
|
8
|
+
count_max = dir.count.to_s.length
|
7
9
|
(1..3).each do |depth|
|
8
|
-
print_usage_with_depth(depth, root)
|
10
|
+
print_usage_with_depth(depth, root, count_max)
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
14
|
private
|
13
15
|
|
14
|
-
def print_usage_with_depth(depth, root)
|
16
|
+
def print_usage_with_depth(depth, root, count_max)
|
17
|
+
list = list_with_depth(depth, root).sort_by(&:count).reverse
|
18
|
+
repo_max = `ghq list`.split("\n").map(&:length).max
|
19
|
+
|
15
20
|
name =
|
16
21
|
case depth
|
17
22
|
when 1 then 'host'
|
18
23
|
when 2 then 'user'
|
19
24
|
when 3 then 'repository'
|
20
25
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
26
|
+
|
27
|
+
puts "[#{name}]" + ('-' * (count_max + repo_max + 4 - name.length))
|
28
|
+
list.first(30).each_with_index do |dir, index|
|
29
|
+
puts "[%2d] %-#{repo_max}s %#{count_max}d" % [index + 1, dir.path_from_root, dir.count]
|
24
30
|
end
|
25
31
|
puts
|
26
32
|
end
|
data/lib/ghq/cache/version.rb
CHANGED