tree.rb 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/bin/rjson.rb +1 -2
  2. data/bin/rtree +1 -3
  3. data/bin/tree.rb +1 -3
  4. data/bin/tree_rb +1 -3
  5. data/examples/d3js_layout_partition/run.sh +0 -0
  6. data/examples/d3js_layout_treemap/index.html +0 -0
  7. data/examples/d3js_layout_treemap/run.sh +0 -0
  8. data/examples/d3js_layout_treemap/style.css +0 -0
  9. data/lib/tree_rb.rb +6 -6
  10. data/lib/tree_rb/cli/cli_json.rb +11 -215
  11. data/lib/tree_rb/cli/cli_tree.rb +103 -85
  12. data/lib/tree_rb/core/tree_node.rb +8 -7
  13. data/lib/tree_rb/core/tree_node_visitor.rb +13 -6
  14. data/lib/tree_rb/extension_numeric.rb +4 -4
  15. data/lib/tree_rb/{input_file_system → input_plugins/file_system}/dir_processor.rb +1 -1
  16. data/lib/tree_rb/{input_file_system → input_plugins/file_system}/directory_walker.rb +17 -9
  17. data/lib/tree_rb/{input_html_page → input_plugins/html_page}/dom_walker.rb +0 -0
  18. data/lib/tree_rb/{output_dircat/dircat_helper.rb → output_plugins/dircat/dircat_output.rb} +5 -5
  19. data/lib/tree_rb/{output_dircat → output_plugins/dircat}/dircat_visitor.rb +0 -0
  20. data/lib/tree_rb/{output_dircat → output_plugins/dircat}/entry.rb +1 -1
  21. data/lib/tree_rb/{output_html/d3js_helper.rb → output_plugins/html/d3js_output.rb} +5 -4
  22. data/lib/tree_rb/{output_html → output_plugins/html}/directory_to_hash2_visitor.rb +0 -0
  23. data/lib/tree_rb/{output_html → output_plugins/html}/erb_render.rb +0 -0
  24. data/lib/tree_rb/{output_sqlite → output_plugins/sqlite}/sqlite_dir_tree_visitor.rb +9 -4
  25. data/lib/tree_rb/{output_sqlite/sqlite_helper.rb → output_plugins/sqlite/sqlite_output.rb} +11 -9
  26. data/lib/tree_rb/version.rb +1 -1
  27. data/lib/tree_rb/visitors/print_tree_node_visitor.rb +4 -4
  28. data/spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt +1 -0
  29. data/spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep +0 -0
  30. data/spec/fixtures/tmp/test.db +0 -0
  31. data/spec/spec_helper.rb +2 -2
  32. data/spec/tree_rb/cli/cli_json_spec.rb +5 -5
  33. data/spec/tree_rb/cli/cli_tree_d3js_spec.rb +3 -3
  34. data/spec/tree_rb/cli/cli_tree_generic_spec.rb +126 -95
  35. data/spec/tree_rb/cli/cli_tree_sqlite_spec.rb +38 -22
  36. data/spec/tree_rb/core/tree_node_spec.rb +135 -135
  37. data/spec/tree_rb/input_file_system/dir_processor_spec.rb +3 -3
  38. data/spec/tree_rb/input_file_system/directory_walker_conf_spec.rb +59 -0
  39. data/spec/tree_rb/input_file_system/directory_walker_run_spec.rb +62 -0
  40. data/tasks/rspec.rake +2 -2
  41. data/tasks/tree_rb.rake +2 -2
  42. data/tasks/yard.rake +1 -1
  43. data/tree.rb.gemspec +1 -1
  44. metadata +121 -108
  45. checksums.yaml +0 -7
  46. data/lib/colors.rb +0 -39
  47. data/spec/fixtures/tmp/dircat +0 -34
  48. data/spec/tree_rb/input_file_system/directory_walker_spec.rb +0 -98
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 2cb987c6a880527ec3110fa658983b5d60caa431
4
- data.tar.gz: 7ab651eb25d463d83fbab1fd5e056a5e53499b57
5
- SHA512:
6
- metadata.gz: 3cab8085a32ff8ac7a4a6c588fb42135dccfed166a274f70f59d947dfd584664fcf7dbfbf2c943fa2ca909ac25d7e14664f3fabb7c56daf7bc270d1e2d4816d7
7
- data.tar.gz: 82dc7d99808412b5254790087c9ded891b970909a0a12f29e3d69bfb9f7fa52efca1545bcb5b490d7ea3b4c748b7cf7b951f1972c2ee32cc818923d0c8028fb4
@@ -1,39 +0,0 @@
1
- # Below are the color init strings for the basic file types. A color init
2
- # string consists of one or more of the following numeric codes:
3
- # Attribute codes:
4
- # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
5
- # Text color codes:
6
- # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
7
- # Background color codes:
8
- # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
9
-
10
-
11
- m = { }
12
- ENV['LS_COLORS'].split(":").each do |e|
13
- k, v = e.split('=')
14
- m[k] = v
15
- end
16
-
17
- puts m
18
-
19
-
20
- ## ANSIname => ANSIcode LUT
21
- #ANSINAME2CODE= { "reset" => "\e[0m", "bold" => "\e[1m",
22
- # "underline" => "\e[4m", "blink" => "\e[5m",
23
- # "reverse" => "\e[7m", "invisible" => "\e[8m",
24
- # "black" => "\e[0;30m", "darkgrey" => "\e[1;30m",
25
- # "red" => "\e[0;31m", "lightred" => "\e[1;31m",
26
- # "green" => "\e[0;32m", "lightgreen" => "\e[1;32m",
27
- # "brown" => "\e[0;33m", "yellow" => "\e[1;33m",
28
- # "blue" => "\e[0;34m", "lightblue" => "\e[1;34m",
29
- # "purple" => "\e[0;35m", "magenta" => "\e[1;35m",
30
- # "cyan" => "\e[1;36m", "lightcyan" => "\e[1;36m",
31
- # "grey" => "\e[0;37m", "white" => "\e[1;37m",
32
- # "bgblack" => "\e[40m", "bgred" => "\e[41m",
33
- # "bggreen" => "\e[42m", "bgyellow" => "\e[43m",
34
- # "bgblue" => "\e[44m", "bgmagenta" => "\e[45m",
35
- # "bgcyan" => "\e[46m", "bgwhite" => "\e[47m"
36
- i,e= m['*.tga'].split(';')
37
-
38
- puts "\e[#{i}m\e[1;#{e}m prova.tga \e[0m"
39
-
@@ -1,34 +0,0 @@
1
- --- !ruby/object:DirCat::DirCatSer
2
- table:
3
- :dircat_version: 0.2.1
4
- :dirname:
5
- :ctime:
6
- :entries:
7
- - !ruby/object:DirCat::EntrySer
8
- table:
9
- :md5: !binary |-
10
- YWZiOTZmMjY1MmY0YmEzY2Q4NGY3YmUwYWU2ZmZmZTM=
11
- :name: file.1.2.1
12
- :path: /home/gf/GioPrj.home/tree.rb/spec/fixtures/test_dir_1/dir.1/dir.1.2
13
- :size: 11
14
- :mtime: 2012-08-19 22:26:38.000000000 +02:00
15
- modifiable: true
16
- - !ruby/object:DirCat::EntrySer
17
- table:
18
- :md5: !binary |-
19
- YTQ3ODhiYTI1ZDQyZjIxMDAzZGIxMWVjNTMxMTJmMWU=
20
- :name: file.1.1
21
- :path: /home/gf/GioPrj.home/tree.rb/spec/fixtures/test_dir_1/dir.1
22
- :size: 9
23
- :mtime: 2012-08-19 22:26:38.000000000 +02:00
24
- modifiable: true
25
- - !ruby/object:DirCat::EntrySer
26
- table:
27
- :md5: !binary |-
28
- YzRjMGM1MzBiODQyZWZlNDAzOGFjNGE2NTliZmJlNzc=
29
- :name: file.2.1
30
- :path: /home/gf/GioPrj.home/tree.rb/spec/fixtures/test_dir_1/dir.2
31
- :size: 9
32
- :mtime: 2012-08-19 22:26:38.000000000 +02:00
33
- modifiable: true
34
- modifiable: true
@@ -1,98 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
3
-
4
- describe DirTreeWalker do
5
-
6
- it 'should accept option :ignore with regex' do
7
- walker = DirTreeWalker.new :ignore => /^\./
8
- walker.ignore_file?('.thumbnails').should be_true
9
- walker.ignore_dir?('.thumbnails').should be_true
10
- end
11
-
12
- it 'should accept option :ignore with string' do
13
- walker = DirTreeWalker.new :ignore => '.git'
14
- walker.ignore_file?('.git').should be_true
15
- walker.ignore_dir?('.git').should be_true
16
- end
17
-
18
- it 'should accept option :ignore_dir' do
19
- dtw = DirTreeWalker.new :ignore_dir => [/^\./, "private_dir" ]
20
- dtw.should be_ignore_dir ".git"
21
- dtw.should be_ignore_dir "private_dir"
22
- end
23
-
24
- it "should accept option :ignore_file" do
25
- dtw = DirTreeWalker.new :ignore_file => [/.xml/, /(ignore)|(orig)/ ]
26
- dtw.should be_ignore_file "pippo.xml"
27
- end
28
-
29
- it 'should accept option :match' do
30
- dtw = DirTreeWalker.new :match => /.jpg/
31
- dtw.should be_match 'foo.jpg'
32
- end
33
-
34
- it "should ignore files and directory" do
35
- walker = DirTreeWalker.new(".")
36
-
37
- walker.ignore(/^\./)
38
- walker.ignore_file?(".thumbnails").should be_true
39
- walker.ignore_dir?(".thumbnails").should be_true
40
-
41
- walker.ignore_dir("thumbnails")
42
- walker.ignore_dir?(".thumbnails").should be_true
43
- walker.ignore_dir?("thumbnails").should be_true
44
- walker.ignore_dir?("pippo").should be_false
45
-
46
- walker.ignore_file("xvpics")
47
- walker.ignore_file?("xvpics").should be_true
48
-
49
- walker.ignore("sub")
50
- walker.ignore_file?("[Dsube]").should be_false
51
- walker.ignore_dir?("[Dsube]").should be_false
52
- end
53
-
54
- it "should accumulate file names" do
55
- dir_tree_walker = DirTreeWalker.new(File.join(FIXTURES, "test_dir_1"))
56
-
57
- accumulator = []
58
- visitor = BlockTreeNodeVisitor.new { |pathname| accumulator << File.basename(pathname) }
59
- dir_tree_walker.run(visitor)
60
- accumulator.length.should == 9
61
- accumulator.sort.should == %w{ test_dir_1 dir.1 dir.1.2 file.1.2.1 file.1.1 dir.2 file.2.1 .dir_with_dot dummy.txt }.sort
62
- end
63
-
64
- it "should accumulate file names 2" do
65
- dir_tree_walker = DirTreeWalker.new(File.join(FIXTURES, "test_dir_2"))
66
- dir_tree_walker.ignore("sub")
67
-
68
- accumulator = []
69
- visitor = BlockTreeNodeVisitor.new { |pathname| accumulator << File.basename(pathname) }
70
- dir_tree_walker.run(visitor)
71
- accumulator.length.should == 2
72
- accumulator.sort.should == %w{ [Dsube] test_dir_2 }.sort
73
- end
74
-
75
- it "should ignore not accessible directory" do
76
-
77
- dir = File.join(FIXTURES, "test_dir_3_with_error")
78
-
79
- f1 = File.join(dir, "no_accessible_dir")
80
- Dir.rmdir(f1) if File.exist?(f1)
81
- Dir.mkdir(f1, 0000)
82
-
83
- f2 = File.join(dir, "accessible_dir")
84
- Dir.rmdir(f2) if File.exist?(f2)
85
- Dir.mkdir(f2)
86
-
87
- dir_tree_walker = DirTreeWalker.new(File.join(FIXTURES, "test_dir_3_with_error"))
88
- accumulator = []
89
- visitor = BlockTreeNodeVisitor.new { |pathname| accumulator << File.basename(pathname) }
90
- dir_tree_walker.run(visitor)
91
- accumulator.length.should == 2
92
- accumulator.sort.should == %w{accessible_dir test_dir_3_with_error }.sort
93
-
94
- # Dir.rmdir(f1)
95
- # Dir.rmdir(f2)
96
- end
97
-
98
- end