treevisitor 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/README.md +6 -1
  2. data/Rakefile +6 -11
  3. data/lib/tree_visitor.rb +1 -1
  4. data/lib/treevisitor.rb +1 -38
  5. data/lib/treevisitor_cli.rb +2 -4
  6. data/treevisitor.gemspec +16 -28
  7. metadata +11 -143
  8. data/.gemtest +0 -0
  9. data/bin/tree.rb +0 -9
  10. data/examples/directory_walker/directory_without_subdirectory.rb +0 -37
  11. data/examples/directory_walker/find_files.rb +0 -18
  12. data/examples/directory_walker/print_files.rb +0 -12
  13. data/examples/protovis/directory_to_json_visitor.rb +0 -15
  14. data/examples/protovis/index.html +0 -87
  15. data/examples/protovis/protovis-r3.2.js +0 -277
  16. data/examples/protovis/treevisitor.js +0 -33
  17. data/examples/protovis/treevisitor.png +0 -0
  18. data/lib/treevisitor/abs_node.rb +0 -144
  19. data/lib/treevisitor/basic_tree_node_visitor.rb +0 -44
  20. data/lib/treevisitor/cli/cli_tree.rb +0 -106
  21. data/lib/treevisitor/directory_walker.rb +0 -300
  22. data/lib/treevisitor/leaf_node.rb +0 -33
  23. data/lib/treevisitor/tree_node.rb +0 -251
  24. data/lib/treevisitor/tree_node_visitor.rb +0 -119
  25. data/lib/treevisitor/util/dir_processor.rb +0 -46
  26. data/lib/treevisitor/version.rb +0 -4
  27. data/lib/treevisitor/visitors/block_tree_node_visitor.rb +0 -21
  28. data/lib/treevisitor/visitors/build_dir_tree_visitor.rb +0 -57
  29. data/lib/treevisitor/visitors/callback_tree_node_visitor2.rb +0 -48
  30. data/lib/treevisitor/visitors/clone_tree_node_visitor.rb +0 -39
  31. data/lib/treevisitor/visitors/depth_tree_node_visitor.rb +0 -27
  32. data/lib/treevisitor/visitors/directory_to_hash_visitor.rb +0 -33
  33. data/lib/treevisitor/visitors/flat_print_tree_node_visitors.rb +0 -20
  34. data/lib/treevisitor/visitors/print_dir_tree_visitor.rb +0 -21
  35. data/lib/treevisitor/visitors/print_tree_node_visitor.rb +0 -40
  36. data/spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt +0 -0
  37. data/spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1 +0 -0
  38. data/spec/fixtures/test_dir_1/dir.1/file.1.1 +0 -0
  39. data/spec/fixtures/test_dir_1/dir.2/file.2.1 +0 -0
  40. data/spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep +0 -0
  41. data/spec/spec_helper.rb +0 -28
  42. data/spec/treevisitor/cli/cli_tree_spec.rb +0 -69
  43. data/spec/treevisitor/directory_walker_spec.rb +0 -99
  44. data/spec/treevisitor/tree_dsl_spec.rb +0 -57
  45. data/spec/treevisitor/tree_dsl_with_derived_class1_spec.rb +0 -53
  46. data/spec/treevisitor/tree_dsl_with_derived_class_spec.rb +0 -51
  47. data/spec/treevisitor/tree_node_paths_spec.rb +0 -70
  48. data/spec/treevisitor/tree_node_spec.rb +0 -135
  49. data/spec/treevisitor/tree_node_visitor_delegate_spec.rb +0 -35
  50. data/spec/treevisitor/tree_node_visitor_dsl_spec.rb +0 -66
  51. data/spec/treevisitor/util/dir_processor_spec.rb +0 -13
  52. data/spec/treevisitor/visitors/block_tree_node_visitor_spec.rb +0 -25
  53. data/spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb +0 -38
  54. data/spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb +0 -28
  55. data/spec/treevisitor/visitors/tree_node_visitors_spec.rb +0 -27
  56. data/tasks/rspec.rake +0 -34
  57. data/tasks/yard.rake +0 -36
@@ -1,13 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
3
-
4
- describe DirProcessor do
5
-
6
- it do
7
- files = []
8
- dp = DirProcessor.new { |f| files << f }
9
- dp.process(FIXTURES)
10
- files.length.should == 3
11
- end
12
-
13
- end
@@ -1,25 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
3
-
4
- describe "Tree Node Visitors" do
5
-
6
- before do
7
- ta = TreeNode.new( "a", nil )
8
- LeafNode.new("1", ta )
9
- LeafNode.new("2", ta )
10
-
11
- tb = TreeNode.new( "b", ta )
12
- LeafNode.new( "3", tb )
13
-
14
- @tree = ta
15
- end
16
-
17
- it BlockTreeNodeVisitor do
18
- accumulator = []
19
- visitor = BlockTreeNodeVisitor.new { |node| accumulator << node.content}
20
- @tree.accept( visitor )
21
- accumulator.length.should == 5
22
- accumulator.should == %w{ a 1 2 b 3 }
23
- end
24
-
25
- end
@@ -1,38 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
3
-
4
- describe "Tree Node Visitors" do
5
-
6
- before do
7
- ta = TreeNode.new( "a", nil )
8
- LeafNode.new("1", ta )
9
- LeafNode.new("2", ta )
10
-
11
- tb = TreeNode.new( "b", ta )
12
- LeafNode.new( "3", tb )
13
-
14
- @tree = ta
15
- end
16
-
17
- it CallbackTreeNodeVisitor2 do
18
- visitor = CallbackTreeNodeVisitor2.new
19
- visitor.on_enter_node{ |tree_node, new_parent_node|
20
- # puts "**** #{tree_node}"
21
- TreeNode.new("n" + tree_node.content, new_parent_node)
22
- }
23
- visitor.on_visit_leaf{ |leaf_node, new_parent_node|
24
- # puts "**** #{leaf_node}"
25
- LeafNode.new( "n" + leaf_node.content, new_parent_node )
26
- }
27
- @tree.accept( visitor )
28
- new_root = visitor.root
29
- new_root.content.should == "n" + @tree.content
30
-
31
- accumulator = []
32
- visitor = BlockTreeNodeVisitor.new { |node| accumulator << node.content}
33
- new_root.accept( visitor )
34
- accumulator.length.should == 5
35
- accumulator.should == %w{ na n1 n2 nb n3 }
36
- end
37
-
38
- end
@@ -1,28 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
3
-
4
-
5
- describe "Tree Node Visitors" do
6
-
7
- before do
8
- ta = TreeNode.new( "a", nil )
9
- LeafNode.new("1", ta )
10
- LeafNode.new("2", ta )
11
-
12
- tb = TreeNode.new( "b", ta )
13
- LeafNode.new( "3", tb )
14
-
15
- @tree = ta
16
- end
17
-
18
- it DepthTreeNodeVisitor do
19
- visitor = DepthTreeNodeVisitor.new
20
- @tree.accept( visitor )
21
- visitor.depth.should == 0
22
-
23
- visitor = CloneTreeNodeVisitor.new
24
- @tree.accept( visitor )
25
- visitor.cloned_root.nr_nodes.should == @tree.nr_nodes
26
- end
27
-
28
- end
@@ -1,27 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
3
-
4
- describe TreeNodeVisitor do
5
-
6
- before do
7
- ta = TreeNode.new( "a", nil )
8
- LeafNode.new("1", ta )
9
- LeafNode.new("2", ta )
10
-
11
- tb = TreeNode.new( "b", ta )
12
- LeafNode.new( "3", tb )
13
-
14
- @tree = ta
15
- end
16
-
17
- it TreeNodeVisitor do
18
- accumulator = []
19
- visitor = TreeNodeVisitor.new
20
- visitor.on_enter_node{ |tree_node| accumulator << tree_node.content }
21
- visitor.on_leaf{ |leaf_node| accumulator << leaf_node.content }
22
- @tree.accept( visitor )
23
- accumulator.length.should == 5
24
- accumulator.should == %w{ a 1 2 b 3 }
25
- end
26
-
27
- end
data/tasks/rspec.rake DELETED
@@ -1,34 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # spec
4
- #
5
- begin
6
- require 'rspec/core/rake_task'
7
- RSpec::Core::RakeTask.new(:spec)
8
-
9
- RSpec::Core::RakeTask.new do |t|
10
- t.rspec_opts = ["--color", "--format", "spec", '--backtrace']
11
- t.pattern = 'spec/**/*_spec.rb'
12
- end
13
-
14
- rescue LoadError
15
- puts "rspec (or a dependency) not available. Install it with: sudo gem install rspec"
16
- end
17
-
18
-
19
- #
20
- #
21
- #begin
22
- # require 'rcov/rcovtask'
23
- # Rcov::RcovTask.new do |test|
24
- # test.libs << 'test'
25
- # test.pattern = 'test/**/*_test.rb'
26
- # test.verbose = true
27
- # end
28
- #rescue LoadError
29
- # task :rcov do
30
- # abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
31
- # end
32
- #end
33
- #
34
- #
data/tasks/yard.rake DELETED
@@ -1,36 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- begin
3
- require 'yard'
4
-
5
- YARD::Rake::YardocTask.new do |t|
6
- # t.files = ['lib/**/*.rb']
7
- # t.options = [
8
- # '--readme', 'README.rdoc',
9
- # ]
10
- end
11
-
12
- rescue LoadError
13
- puts "Yard (or a dependency) not available. Install it with: sudo gem install jeweler"
14
- end
15
-
16
-
17
-
18
- # require 'hanna/rdoctask'
19
- #require 'rake/rdoctask'
20
- #require 'sdoc'
21
- #
22
- #Rake::RDocTask.new do |rdoc|
23
- # config = YAML.load(File.read('VERSION.yml'))
24
- # version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
25
- #
26
- # rdoc.rdoc_dir = 'doc' # rdoc output folder
27
- # rdoc.title = "Tree Visitor #{version}"
28
- # rdoc.main = "README.rdoc" # page to start on
29
- #
30
- # rdoc.rdoc_files.include('README*')
31
- # rdoc.rdoc_files.include('lib/**/*.rb')
32
- #
33
- # # sdoc
34
- # rdoc.options << '--fmt' << 'shtml' # explictly set shtml generator
35
- # rdoc.template = 'direct' # lighter template used on railsapi.com
36
- #end