ghq-cache 0.3.1 → 0.3.2
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/cli.rb +5 -0
- data/lib/ghq/cache/stats.rb +37 -0
- data/lib/ghq/cache/version.rb +1 -1
- data/lib/ghq/cache.rb +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 732bfd5c91049a4619fe5eb026e7a2e3b4396e58
|
4
|
+
data.tar.gz: 8d6e37aac4a32a85497ad2c3cffc3c9cc6b046ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c511b2e747b4fd72db40be5bbaf4f14ddcf539aa7da71a32949ab566a99d38c4178d7db8bc130de729082b9fb99d236a124ec11a5d0531a29f4dc0145db7733
|
7
|
+
data.tar.gz: 055a76578a3cb84a4d4d2a315f24c977680b4bf8da89cea01c7c6976531853fcb6c35e5ee8ae1cad16ef1f0ba44fe13d77eaea4ac9add5a598f0d0d4af7294f8
|
data/lib/ghq/cache/cli.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ghq
|
2
|
+
module Cache
|
3
|
+
class Stats
|
4
|
+
class << self
|
5
|
+
def print_repository_usage
|
6
|
+
root = Logger.resume
|
7
|
+
(1..3).each do |depth|
|
8
|
+
print_usage_with_depth(depth, root)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def print_usage_with_depth(depth, root)
|
15
|
+
name =
|
16
|
+
case depth
|
17
|
+
when 1 then 'host'
|
18
|
+
when 2 then 'user'
|
19
|
+
when 3 then 'repository'
|
20
|
+
end
|
21
|
+
puts "[#{name}]" + ('-' * (30 - name.length))
|
22
|
+
list_with_depth(depth, root).sort_by(&:count).reverse.first(30).each do |dir|
|
23
|
+
puts "%5d %s" % [dir.count, dir.path_from_root]
|
24
|
+
end
|
25
|
+
puts
|
26
|
+
end
|
27
|
+
|
28
|
+
def list_with_depth(depth, *dirs)
|
29
|
+
return dirs if depth == 0
|
30
|
+
dirs.map do |dir|
|
31
|
+
list_with_depth(depth - 1, *dir.children)
|
32
|
+
end.flatten.compact
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/ghq/cache/version.rb
CHANGED
data/lib/ghq/cache.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghq-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/ghq/cache/cli.rb
|
87
87
|
- lib/ghq/cache/directory.rb
|
88
88
|
- lib/ghq/cache/logger.rb
|
89
|
+
- lib/ghq/cache/stats.rb
|
89
90
|
- lib/ghq/cache/version.rb
|
90
91
|
homepage: https://github.com/k0kubun/ghq-cache
|
91
92
|
licenses: []
|