tree.rb 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,119 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
6
+ <link type="text/css" rel="stylesheet" href="style.css"/>
7
+
8
+
9
+ <script src="http://d3js.org/d3.v2.js"></script>
10
+ <script src="data.js"></script>
11
+
12
+
13
+
14
+
15
+ <style type="text/css">
16
+
17
+ .chart {
18
+ display: block;
19
+ margin: auto;
20
+ margin-top: 60px;
21
+ font-size: 11px;
22
+ }
23
+
24
+ rect {
25
+ stroke: #eee;
26
+ fill: #aaa;
27
+ fill-opacity: .8;
28
+ }
29
+
30
+ rect.parent {
31
+ cursor: pointer;
32
+ fill: steelblue;
33
+ }
34
+
35
+ text {
36
+ pointer-events: none;
37
+ }
38
+
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <div id="body">
43
+ <div id="footer">
44
+ d3.layout.partition
45
+ <div class="hint">click or option-click to descend or ascend</div>
46
+ </div>
47
+ </div>
48
+ <script type="text/javascript">
49
+
50
+ var w = 1120,
51
+ h = 600,
52
+ x = d3.scale.linear().range([0, w]),
53
+ y = d3.scale.linear().range([0, h]);
54
+
55
+ var vis = d3.select("#body").append("div")
56
+ .attr("class", "chart")
57
+ .style("width", w + "px")
58
+ .style("height", h + "px")
59
+ .append("svg:svg")
60
+ .attr("width", w)
61
+ .attr("height", h);
62
+
63
+ var partition = d3.layout.partition()
64
+ .value(function(d) { return d.size; });
65
+
66
+ root = data;
67
+ var g = vis.selectAll("g")
68
+ .data(partition.nodes(root))
69
+ .enter().append("svg:g")
70
+ .attr("transform", function(d) { return "translate(" + x(d.y) + "," + y(d.x) + ")"; })
71
+ .on("click", click);
72
+
73
+ var kx = w / root.dx,
74
+ ky = h / 1;
75
+
76
+ g.append("svg:rect")
77
+ .attr("width", root.dy * kx)
78
+ .attr("height", function(d) { return d.dx * ky; })
79
+ .attr("class", function(d) { return d.children ? "parent" : "child"; });
80
+
81
+ g.append("svg:text")
82
+ .attr("transform", transform)
83
+ .attr("dy", ".35em")
84
+ .style("opacity", function(d) { return d.dx * ky > 12 ? 1 : 0; })
85
+ .text(function(d) { return d.name; })
86
+
87
+ d3.select(window)
88
+ .on("click", function() { click(root); })
89
+
90
+ function click(d) {
91
+ if (!d.children) return;
92
+
93
+ kx = (d.y ? w - 40 : w) / (1 - d.y);
94
+ ky = h / d.dx;
95
+ x.domain([d.y, 1]).range([d.y ? 40 : 0, w]);
96
+ y.domain([d.x, d.x + d.dx]);
97
+
98
+ var t = g.transition()
99
+ .duration(d3.event.altKey ? 7500 : 750)
100
+ .attr("transform", function(d) { return "translate(" + x(d.y) + "," + y(d.x) + ")"; });
101
+
102
+ t.select("rect")
103
+ .attr("width", d.dy * kx)
104
+ .attr("height", function(d) { return d.dx * ky; });
105
+
106
+ t.select("text")
107
+ .attr("transform", transform)
108
+ .style("opacity", function(d) { return d.dx * ky > 12 ? 1 : 0; });
109
+
110
+ d3.event.stopPropagation();
111
+ }
112
+
113
+ function transform(d) {
114
+ return "translate(8," + d.dx * ky / 2 + ")";
115
+ }
116
+
117
+ </script>
118
+ </body>
119
+ </html>
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ ../../bin/tree.rb ../.. --format js_treemap --force -o data.js
@@ -0,0 +1,787 @@
1
+ var data = {
2
+ "name": "tree.rb",
3
+ "children": [
4
+ {
5
+ "name": "Gemfile",
6
+ "size": 37
7
+ },
8
+ {
9
+ "name": "Gemfile.lock",
10
+ "size": 544
11
+ },
12
+ {
13
+ "name": "History.txt",
14
+ "size": 2464
15
+ },
16
+ {
17
+ "name": "LICENSE.txt",
18
+ "size": 1071
19
+ },
20
+ {
21
+ "name": "README.md",
22
+ "size": 4368
23
+ },
24
+ {
25
+ "name": "Rakefile",
26
+ "size": 285
27
+ },
28
+ {
29
+ "name": "bin",
30
+ "children": [
31
+ {
32
+ "name": "rjson.rb",
33
+ "size": 230
34
+ },
35
+ {
36
+ "name": "rtree",
37
+ "size": 235
38
+ },
39
+ {
40
+ "name": "tree.rb",
41
+ "size": 235
42
+ },
43
+ {
44
+ "name": "tree_rb",
45
+ "size": 235
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "name": "doc",
51
+ "children": [
52
+ {
53
+ "name": "MD5.html",
54
+ "size": 5485
55
+ },
56
+ {
57
+ "name": "Numeric.html",
58
+ "size": 10492
59
+ },
60
+ {
61
+ "name": "SHA1.html",
62
+ "size": 5271
63
+ },
64
+ {
65
+ "name": "TreeRb",
66
+ "children": [
67
+ {
68
+ "name": "AbsNode.html",
69
+ "size": 26896
70
+ },
71
+ {
72
+ "name": "BasicTreeNodeVisitor.html",
73
+ "size": 10335
74
+ },
75
+ {
76
+ "name": "BlockTreeNodeVisitor.html",
77
+ "size": 8435
78
+ },
79
+ {
80
+ "name": "BuildDirTreeVisitor.html",
81
+ "size": 16628
82
+ },
83
+ {
84
+ "name": "CallbackTreeNodeVisitor2.html",
85
+ "size": 17922
86
+ },
87
+ {
88
+ "name": "CliJson.html",
89
+ "size": 36720
90
+ },
91
+ {
92
+ "name": "CliTree.html",
93
+ "size": 64068
94
+ },
95
+ {
96
+ "name": "CloneTreeNodeVisitor.html",
97
+ "size": 13079
98
+ },
99
+ {
100
+ "name": "ContentDir.html",
101
+ "size": 6253
102
+ },
103
+ {
104
+ "name": "ContentFile.html",
105
+ "size": 12418
106
+ },
107
+ {
108
+ "name": "DepthTreeNodeVisitor.html",
109
+ "size": 10818
110
+ },
111
+ {
112
+ "name": "DirProcessor.html",
113
+ "size": 9371
114
+ },
115
+ {
116
+ "name": "DirTreeWalker.html",
117
+ "size": 45126
118
+ },
119
+ {
120
+ "name": "DirectoryToHash2Visitor.html",
121
+ "size": 13243
122
+ },
123
+ {
124
+ "name": "DirectoryToHashVisitor.html",
125
+ "size": 12765
126
+ },
127
+ {
128
+ "name": "FlatPrintTreeNodeVisitor.html",
129
+ "size": 8276
130
+ },
131
+ {
132
+ "name": "LeafNode.html",
133
+ "size": 10822
134
+ },
135
+ {
136
+ "name": "PrintDirTreeVisitor.html",
137
+ "size": 8108
138
+ },
139
+ {
140
+ "name": "PrintTreeNodeVisitor.html",
141
+ "size": 12286
142
+ },
143
+ {
144
+ "name": "SqliteDirTreeVisitor.html",
145
+ "size": 14101
146
+ },
147
+ {
148
+ "name": "TreeNode.html",
149
+ "size": 56342
150
+ },
151
+ {
152
+ "name": "TreeNodeVisitor.html",
153
+ "size": 24955
154
+ },
155
+ {
156
+ "name": "TreeRb.html",
157
+ "size": 6517
158
+ }
159
+ ]
160
+ },
161
+ {
162
+ "name": "TreeVisitor",
163
+ "children": [
164
+ {
165
+ "name": "AbsNode.html",
166
+ "size": 26951
167
+ },
168
+ {
169
+ "name": "BasicTreeNodeVisitor.html",
170
+ "size": 8303
171
+ },
172
+ {
173
+ "name": "BlockTreeNodeVisitor.html",
174
+ "size": 7821
175
+ },
176
+ {
177
+ "name": "BuildDirTreeVisitor.html",
178
+ "size": 14762
179
+ },
180
+ {
181
+ "name": "CallbackTreeNodeVisitor.html",
182
+ "size": 11954
183
+ },
184
+ {
185
+ "name": "CallbackTreeNodeVisitor2.html",
186
+ "size": 18297
187
+ },
188
+ {
189
+ "name": "CliTree.html",
190
+ "size": 24834
191
+ },
192
+ {
193
+ "name": "CloneTreeNodeVisitor.html",
194
+ "size": 11478
195
+ },
196
+ {
197
+ "name": "DepthTreeNodeVisitor.html",
198
+ "size": 9557
199
+ },
200
+ {
201
+ "name": "DirProcessor.html",
202
+ "size": 8755
203
+ },
204
+ {
205
+ "name": "DirTreeWalker.html",
206
+ "size": 28581
207
+ },
208
+ {
209
+ "name": "DirectoryToHashVisitor.html",
210
+ "size": 11239
211
+ },
212
+ {
213
+ "name": "FlatPrintTreeNodeVisitor.html",
214
+ "size": 6712
215
+ },
216
+ {
217
+ "name": "LeafNode.html",
218
+ "size": 9865
219
+ },
220
+ {
221
+ "name": "PrintDirTreeVisitor.html",
222
+ "size": 6587
223
+ },
224
+ {
225
+ "name": "PrintTreeNodeVisitor.html",
226
+ "size": 10620
227
+ },
228
+ {
229
+ "name": "TreeNode.html",
230
+ "size": 42813
231
+ },
232
+ {
233
+ "name": "TreeNodeVisitor.html",
234
+ "size": 10114
235
+ },
236
+ {
237
+ "name": "TreeVisitor.html",
238
+ "size": 10024
239
+ },
240
+ {
241
+ "name": "_index.html",
242
+ "size": 10762
243
+ },
244
+ {
245
+ "name": "class_list.html",
246
+ "size": 6595
247
+ }
248
+ ]
249
+ },
250
+ {
251
+ "name": "css",
252
+ "children": [
253
+ {
254
+ "name": "common.css",
255
+ "size": 42
256
+ },
257
+ {
258
+ "name": "full_list.css",
259
+ "size": 5565
260
+ },
261
+ {
262
+ "name": "style.css",
263
+ "size": 17322
264
+ },
265
+ {
266
+ "name": "file.LICENSE.html",
267
+ "size": 3060
268
+ },
269
+ {
270
+ "name": "file.README.html",
271
+ "size": 7278
272
+ },
273
+ {
274
+ "name": "file_list.html",
275
+ "size": 1645
276
+ },
277
+ {
278
+ "name": "frames.html",
279
+ "size": 842
280
+ },
281
+ {
282
+ "name": "index.html",
283
+ "size": 7278
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ "name": "js",
289
+ "children": [
290
+ {
291
+ "name": "app.js",
292
+ "size": 6771
293
+ },
294
+ {
295
+ "name": "full_list.js",
296
+ "size": 5177
297
+ },
298
+ {
299
+ "name": "jquery.js",
300
+ "size": 93868
301
+ },
302
+ {
303
+ "name": "method_list.html",
304
+ "size": 34504
305
+ },
306
+ {
307
+ "name": "top-level-namespace.html",
308
+ "size": 2628
309
+ }
310
+ ]
311
+ }
312
+ ]
313
+ },
314
+ {
315
+ "name": "examples",
316
+ "children": [
317
+ {
318
+ "name": "d3_treemap",
319
+ "children": [
320
+ {
321
+ "name": "d3.js",
322
+ "size": 112632
323
+ },
324
+ {
325
+ "name": "d3.layout.js",
326
+ "size": 48146
327
+ },
328
+ {
329
+ "name": "data.js",
330
+ "size": 0
331
+ },
332
+ {
333
+ "name": "index.html",
334
+ "size": 4949
335
+ },
336
+ {
337
+ "name": "run.sh",
338
+ "size": 75
339
+ },
340
+ {
341
+ "name": "style.css",
342
+ "size": 1110
343
+ }
344
+ ]
345
+ },
346
+ {
347
+ "name": "directory_walker",
348
+ "children": [
349
+ {
350
+ "name": "directory_without_subdirectory.rb",
351
+ "size": 717
352
+ },
353
+ {
354
+ "name": "find_files.rb",
355
+ "size": 430
356
+ },
357
+ {
358
+ "name": "print_files.rb",
359
+ "size": 296
360
+ }
361
+ ]
362
+ },
363
+ {
364
+ "name": "protovis",
365
+ "children": [
366
+ {
367
+ "name": "directory_to_json_visitor.rb",
368
+ "size": 519
369
+ },
370
+ {
371
+ "name": "index.html",
372
+ "size": 2006
373
+ },
374
+ {
375
+ "name": "protovis-r3.2.js",
376
+ "size": 116579
377
+ },
378
+ {
379
+ "name": "treevisitor.js",
380
+ "size": 965
381
+ },
382
+ {
383
+ "name": "treevisitor.png",
384
+ "size": 20379
385
+ }
386
+ ]
387
+ }
388
+ ]
389
+ },
390
+ {
391
+ "name": "ext",
392
+ "children": [
393
+ {
394
+ "name": "mkrf_conf.rb",
395
+ "size": 596
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ "name": "lib",
401
+ "children": [
402
+ {
403
+ "name": "colors.rb",
404
+ "size": 1632
405
+ },
406
+ {
407
+ "name": "tree_rb",
408
+ "children": [
409
+ {
410
+ "name": "abs_node.rb",
411
+ "size": 2789
412
+ },
413
+ {
414
+ "name": "basic_tree_node_visitor.rb",
415
+ "size": 973
416
+ },
417
+ {
418
+ "name": "cli",
419
+ "children": [
420
+ {
421
+ "name": "cli_json.rb",
422
+ "size": 9558
423
+ },
424
+ {
425
+ "name": "cli_tree.rb",
426
+ "size": 9167
427
+ },
428
+ {
429
+ "name": "directory_walker.rb",
430
+ "size": 7665
431
+ },
432
+ {
433
+ "name": "extension_digest.rb",
434
+ "size": 711
435
+ },
436
+ {
437
+ "name": "extension_numeric.rb",
438
+ "size": 677
439
+ },
440
+ {
441
+ "name": "leaf_node.rb",
442
+ "size": 516
443
+ },
444
+ {
445
+ "name": "tree_node.rb",
446
+ "size": 10187
447
+ },
448
+ {
449
+ "name": "tree_node_visitor.rb",
450
+ "size": 2966
451
+ }
452
+ ]
453
+ },
454
+ {
455
+ "name": "util",
456
+ "children": [
457
+ {
458
+ "name": "dir_processor.rb",
459
+ "size": 921
460
+ },
461
+ {
462
+ "name": "version.rb",
463
+ "size": 60
464
+ }
465
+ ]
466
+ },
467
+ {
468
+ "name": "visitors",
469
+ "children": [
470
+ {
471
+ "name": "block_tree_node_visitor.rb",
472
+ "size": 371
473
+ },
474
+ {
475
+ "name": "build_dir_tree_visitor.rb",
476
+ "size": 2591
477
+ },
478
+ {
479
+ "name": "callback_tree_node_visitor2.rb",
480
+ "size": 1568
481
+ },
482
+ {
483
+ "name": "clone_tree_node_visitor.rb",
484
+ "size": 986
485
+ },
486
+ {
487
+ "name": "depth_tree_node_visitor.rb",
488
+ "size": 576
489
+ },
490
+ {
491
+ "name": "directory_to_hash2_visitor.rb",
492
+ "size": 12523
493
+ },
494
+ {
495
+ "name": "directory_to_hash_visitor.rb",
496
+ "size": 788
497
+ },
498
+ {
499
+ "name": "flat_print_tree_node_visitors.rb",
500
+ "size": 490
501
+ },
502
+ {
503
+ "name": "print_dir_tree_visitor.rb",
504
+ "size": 536
505
+ },
506
+ {
507
+ "name": "print_tree_node_visitor.rb",
508
+ "size": 856
509
+ },
510
+ {
511
+ "name": "sqlite_dir_tree_visitor.rb",
512
+ "size": 1607
513
+ }
514
+ ]
515
+ },
516
+ {
517
+ "name": "tree_rb.rb",
518
+ "size": 1391
519
+ },
520
+ {
521
+ "name": "tree_rb_cli.rb",
522
+ "size": 167
523
+ },
524
+ {
525
+ "name": "tree_visitor.rb",
526
+ "size": 108
527
+ },
528
+ {
529
+ "name": "treevisitor.rb",
530
+ "size": 104
531
+ },
532
+ {
533
+ "name": "treevisitor_cli.rb",
534
+ "size": 116
535
+ }
536
+ ]
537
+ }
538
+ ]
539
+ },
540
+ {
541
+ "name": "pkg",
542
+ "children": [
543
+ {
544
+ "name": "tree.rb-0.3.1.gem",
545
+ "size": 76288
546
+ },
547
+ {
548
+ "name": "tree.rb-0.3.2.gem",
549
+ "size": 77824
550
+ },
551
+ {
552
+ "name": "tree.rb-0.3.3.gem",
553
+ "size": 77824
554
+ },
555
+ {
556
+ "name": "tree.rb-0.3.4.gem",
557
+ "size": 78336
558
+ },
559
+ {
560
+ "name": "tree.rb-0.3.5.gem",
561
+ "size": 79360
562
+ },
563
+ {
564
+ "name": "tree.rb-0.3.6.gem",
565
+ "size": 80384
566
+ },
567
+ {
568
+ "name": "tree.rb-0.3.7.gem",
569
+ "size": 132608
570
+ },
571
+ {
572
+ "name": "tree.rb-0.3.8.gem",
573
+ "size": 133632
574
+ }
575
+ ]
576
+ },
577
+ {
578
+ "name": "spec",
579
+ "children": [
580
+ {
581
+ "name": "fixtures",
582
+ "children": [
583
+ {
584
+ "name": "test_dir_1",
585
+ "children": [
586
+ {
587
+ "name": "dir.1",
588
+ "children": [
589
+ {
590
+ "name": "dir.1.2",
591
+ "children": [
592
+ {
593
+ "name": "file.1.2.1",
594
+ "size": 11
595
+ },
596
+ {
597
+ "name": "file.1.1",
598
+ "size": 9
599
+ }
600
+ ]
601
+ }
602
+ ]
603
+ },
604
+ {
605
+ "name": "dir.2",
606
+ "children": [
607
+ {
608
+ "name": "file.2.1",
609
+ "size": 9
610
+ }
611
+ ]
612
+ }
613
+ ]
614
+ },
615
+ {
616
+ "name": "test_dir_2",
617
+ "children": [
618
+ {
619
+ "name": "[Dsube]",
620
+ "children": [
621
+ {
622
+ "name": "sub",
623
+ "children": [
624
+
625
+ ]
626
+ }
627
+ ]
628
+ }
629
+ ]
630
+ },
631
+ {
632
+ "name": "test_dir_3_with_error",
633
+ "children": [
634
+ {
635
+ "name": "accessible_dir",
636
+ "children": [
637
+
638
+ ]
639
+ }
640
+ ]
641
+ },
642
+ {
643
+ "name": "test_json",
644
+ "children": [
645
+ {
646
+ "name": "1.json",
647
+ "size": 14
648
+ }
649
+ ]
650
+ },
651
+ {
652
+ "name": "tmp",
653
+ "children": [
654
+
655
+ ]
656
+ },
657
+ {
658
+ "name": "spec.opts",
659
+ "size": 51
660
+ },
661
+ {
662
+ "name": "spec_helper.rb",
663
+ "size": 562
664
+ }
665
+ ]
666
+ },
667
+ {
668
+ "name": "tree_rb",
669
+ "children": [
670
+ {
671
+ "name": "cli",
672
+ "children": [
673
+ {
674
+ "name": "cli_json_spec.rb",
675
+ "size": 908
676
+ },
677
+ {
678
+ "name": "cli_tree_digest_spec.rb",
679
+ "size": 981
680
+ },
681
+ {
682
+ "name": "cli_tree_generic_spec.rb",
683
+ "size": 3428
684
+ },
685
+ {
686
+ "name": "cli_tree_sqlite_spec.rb",
687
+ "size": 605
688
+ },
689
+ {
690
+ "name": "directory_walker_spec.rb",
691
+ "size": 3270
692
+ },
693
+ {
694
+ "name": "extension_digest_spec.rb",
695
+ "size": 521
696
+ },
697
+ {
698
+ "name": "extension_numeric_spec.rb",
699
+ "size": 305
700
+ },
701
+ {
702
+ "name": "tree_dsl_spec.rb",
703
+ "size": 971
704
+ },
705
+ {
706
+ "name": "tree_dsl_with_derived_class1_spec.rb",
707
+ "size": 994
708
+ },
709
+ {
710
+ "name": "tree_dsl_with_derived_class_spec.rb",
711
+ "size": 882
712
+ },
713
+ {
714
+ "name": "tree_node_paths_spec.rb",
715
+ "size": 1996
716
+ },
717
+ {
718
+ "name": "tree_node_spec.rb",
719
+ "size": 3115
720
+ },
721
+ {
722
+ "name": "tree_node_visitor_delegate_spec.rb",
723
+ "size": 692
724
+ },
725
+ {
726
+ "name": "tree_node_visitor_dsl_spec.rb",
727
+ "size": 1581
728
+ }
729
+ ]
730
+ },
731
+ {
732
+ "name": "util",
733
+ "children": [
734
+ {
735
+ "name": "dir_processor_spec.rb",
736
+ "size": 316
737
+ }
738
+ ]
739
+ },
740
+ {
741
+ "name": "visitors",
742
+ "children": [
743
+ {
744
+ "name": "block_tree_node_visitor_spec.rb",
745
+ "size": 590
746
+ },
747
+ {
748
+ "name": "callback_tree_node_visitor2_spec.rb",
749
+ "size": 1034
750
+ },
751
+ {
752
+ "name": "depth_tree_node_visitor_spec.rb",
753
+ "size": 617
754
+ },
755
+ {
756
+ "name": "tree_node_visitors_spec.rb",
757
+ "size": 683
758
+ }
759
+ ]
760
+ }
761
+ ]
762
+ }
763
+ ]
764
+ },
765
+ {
766
+ "name": "tasks",
767
+ "children": [
768
+ {
769
+ "name": "rspec.rake",
770
+ "size": 686
771
+ },
772
+ {
773
+ "name": "tree_rb.rake",
774
+ "size": 405
775
+ },
776
+ {
777
+ "name": "yard.rake",
778
+ "size": 891
779
+ },
780
+ {
781
+ "name": "tree.rb.gemspec",
782
+ "size": 2676
783
+ }
784
+ ]
785
+ }
786
+ ]
787
+ }