This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
class E |
| 2 |
|
| 3 |
F["?"]||={} |
| 4 |
F["?"].update({'du'=>{ |
| 5 |
'q' => 'du', |
| 6 |
'view' => 'du', |
| 7 |
'protovis.data' => 'protovis/du', |
| 8 |
'protovis.view' => 'starburst' |
| 9 |
}}) |
| 10 |
|
| 11 |
def du |
| 12 |
`du -s #{sh}`.split(/\t/)[0].to_i |
| 13 |
end |
| 14 |
|
| 15 |
fn 'graph/du',->e,_,m{ |
| 16 |
`du -a #{e.sh}`.each_line{|p| |
| 17 |
begin |
| 18 |
s,p=p.split /\t/ |
| 19 |
p=p[Blen..-2] |
| 20 |
m[p]={'uri'=>p,'fs:size'=>s.to_i} |
| 21 |
rescue |
| 22 |
nil |
| 23 |
end |
| 24 |
} |
| 25 |
m} |
| 26 |
|
| 27 |
fn 'protovis/du',->e,c{ |
| 28 |
m={} |
| 29 |
e.map{|u,r| |
| 30 |
s = u[c['uri'].length-1..-1].split '/' |
| 31 |
p = m |
| 32 |
s[0..-2].map{|s| |
| 33 |
p[s]={} if !p[s] || p[s].class != Hash |
| 34 |
p=p[s] |
| 35 |
} |
| 36 |
p[s[-1]]||=r['fs:size'] |
| 37 |
} |
| 38 |
m[""] |
| 39 |
} |
| 40 |
|
| 41 |
fn 'view/du',->d,e{ |
| 42 |
['<a href="'+e['uri'].E.parent.uri+'/??=du" style="font-size:2em">↑</a>', |
| 43 |
'<a href="'+e['uri']+'" style="font-size:2em">𝌇</a>', |
| 44 |
(Fn 'view/protovis',d,e)]} |
| 45 |
|
| 46 |
end |