tree.rb 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/LICENSE.txt +20 -0
- data/README.md +160 -0
- data/Rakefile +12 -0
- data/bin/tree.rb +9 -0
- data/examples/directory_walker/directory_without_subdirectory.rb +37 -0
- data/examples/directory_walker/find_files.rb +18 -0
- data/examples/directory_walker/print_files.rb +12 -0
- data/examples/protovis/directory_to_json_visitor.rb +15 -0
- data/examples/protovis/index.html +87 -0
- data/examples/protovis/protovis-r3.2.js +277 -0
- data/examples/protovis/treevisitor.js +33 -0
- data/examples/protovis/treevisitor.png +0 -0
- data/lib/tree_visitor.rb +2 -0
- data/lib/treevisitor/abs_node.rb +144 -0
- data/lib/treevisitor/basic_tree_node_visitor.rb +44 -0
- data/lib/treevisitor/cli/cli_tree.rb +121 -0
- data/lib/treevisitor/directory_walker.rb +300 -0
- data/lib/treevisitor/leaf_node.rb +33 -0
- data/lib/treevisitor/tree_node.rb +296 -0
- data/lib/treevisitor/tree_node_visitor.rb +120 -0
- data/lib/treevisitor/util/dir_processor.rb +46 -0
- data/lib/treevisitor/version.rb +4 -0
- data/lib/treevisitor/visitors/block_tree_node_visitor.rb +21 -0
- data/lib/treevisitor/visitors/build_dir_tree_visitor.rb +57 -0
- data/lib/treevisitor/visitors/callback_tree_node_visitor2.rb +48 -0
- data/lib/treevisitor/visitors/clone_tree_node_visitor.rb +39 -0
- data/lib/treevisitor/visitors/depth_tree_node_visitor.rb +27 -0
- data/lib/treevisitor/visitors/directory_to_hash_visitor.rb +33 -0
- data/lib/treevisitor/visitors/flat_print_tree_node_visitors.rb +20 -0
- data/lib/treevisitor/visitors/print_dir_tree_visitor.rb +21 -0
- data/lib/treevisitor/visitors/print_tree_node_visitor.rb +40 -0
- data/lib/treevisitor.rb +40 -0
- data/lib/treevisitor_cli.rb +7 -0
- data/spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt +0 -0
- data/spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1 +0 -0
- data/spec/fixtures/test_dir_1/dir.1/file.1.1 +0 -0
- data/spec/fixtures/test_dir_1/dir.2/file.2.1 +0 -0
- data/spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep +0 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/treevisitor/cli/cli_tree_spec.rb +69 -0
- data/spec/treevisitor/directory_walker_spec.rb +99 -0
- data/spec/treevisitor/tree_dsl_spec.rb +57 -0
- data/spec/treevisitor/tree_dsl_with_derived_class1_spec.rb +53 -0
- data/spec/treevisitor/tree_dsl_with_derived_class_spec.rb +51 -0
- data/spec/treevisitor/tree_node_paths_spec.rb +70 -0
- data/spec/treevisitor/tree_node_spec.rb +135 -0
- data/spec/treevisitor/tree_node_visitor_delegate_spec.rb +35 -0
- data/spec/treevisitor/tree_node_visitor_dsl_spec.rb +66 -0
- data/spec/treevisitor/util/dir_processor_spec.rb +13 -0
- data/spec/treevisitor/visitors/block_tree_node_visitor_spec.rb +25 -0
- data/spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb +38 -0
- data/spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb +28 -0
- data/spec/treevisitor/visitors/tree_node_visitors_spec.rb +27 -0
- data/tasks/rspec.rake +34 -0
- data/tasks/yard.rake +36 -0
- data/tree.rb.gemspec +70 -0
- metadata +231 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
3
|
+
|
4
|
+
describe TreeNodeVisitor do
|
5
|
+
|
6
|
+
class Delegate
|
7
|
+
def enter_node(node)
|
8
|
+
@entered_node= true
|
9
|
+
end
|
10
|
+
|
11
|
+
def exit_node(node)
|
12
|
+
@exit_node= true
|
13
|
+
end
|
14
|
+
|
15
|
+
def visit_leaf(leaf)
|
16
|
+
@visited_leaf= true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should use a delegate" do
|
21
|
+
|
22
|
+
delegate = Delegate.new
|
23
|
+
visitor = TreeNodeVisitor.new(delegate)
|
24
|
+
|
25
|
+
visitor.enter_node(nil)
|
26
|
+
delegate.instance_eval{ @entered_node }.should be_true
|
27
|
+
|
28
|
+
visitor.exit_node(nil)
|
29
|
+
delegate.instance_eval{ @exit_node }.should be_true
|
30
|
+
|
31
|
+
visitor.visit_leaf(nil)
|
32
|
+
delegate.instance_eval{ @visited_leaf }.should be_true
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
3
|
+
|
4
|
+
describe TreeNodeVisitor do
|
5
|
+
|
6
|
+
it "should initialize correctly" do
|
7
|
+
visitor = TreeNodeVisitor.new do
|
8
|
+
|
9
|
+
on_enter_node do |tree_node|
|
10
|
+
@entered_node = true
|
11
|
+
end
|
12
|
+
|
13
|
+
on_exit_node do |tree_node|
|
14
|
+
@exit_node = true
|
15
|
+
end
|
16
|
+
|
17
|
+
on_leaf do |leaf_node|
|
18
|
+
@visit_leaf = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
visitor.enter_node(nil)
|
23
|
+
visitor.instance_eval{ @entered_node }.should be_true
|
24
|
+
|
25
|
+
visitor.exit_node(nil)
|
26
|
+
visitor.instance_eval{ @exit_node }.should be_true
|
27
|
+
|
28
|
+
visitor.visit_leaf(nil)
|
29
|
+
visitor.instance_eval{ @visit_leaf }.should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should initialize correctly" do
|
33
|
+
visitor = TreeNodeVisitor.new do
|
34
|
+
|
35
|
+
on_enter_node do |node, parent|
|
36
|
+
@node = node
|
37
|
+
@parent = parent
|
38
|
+
end
|
39
|
+
|
40
|
+
on_exit_node do |node, parent|
|
41
|
+
@node = node
|
42
|
+
@parent = parent
|
43
|
+
end
|
44
|
+
|
45
|
+
on_leaf do |leaf, parent|
|
46
|
+
@leaf = leaf
|
47
|
+
@parent = parent
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
visitor.instance_eval{ @stack = ["p"] }
|
52
|
+
visitor.enter_node("n")
|
53
|
+
visitor.instance_eval{ @node }.should == "n"
|
54
|
+
visitor.instance_eval{ @parent }.should == "p"
|
55
|
+
visitor.instance_eval{ @stack }.should have(2).node
|
56
|
+
|
57
|
+
visitor.exit_node("n")
|
58
|
+
visitor.instance_eval{ @node }.should == "n"
|
59
|
+
visitor.instance_eval{ @stack }.should have(1).node
|
60
|
+
|
61
|
+
visitor.instance_eval{ @stack = ["p"] }
|
62
|
+
visitor.visit_leaf("l")
|
63
|
+
visitor.instance_eval{ @leaf }.should == "l"
|
64
|
+
visitor.instance_eval{ @parent }.should == "p"
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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
|
@@ -0,0 +1,25 @@
|
|
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
|
@@ -0,0 +1,38 @@
|
|
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
|
@@ -0,0 +1,28 @@
|
|
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
|
@@ -0,0 +1,27 @@
|
|
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
ADDED
@@ -0,0 +1,34 @@
|
|
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
ADDED
@@ -0,0 +1,36 @@
|
|
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
|
data/tree.rb.gemspec
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- encoding: utf-8; mode: ruby -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "treevisitor/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "tree.rb"
|
7
|
+
gem.version = TreeVisitor::VERSION
|
8
|
+
gem.platform = Gem::Platform::RUBY
|
9
|
+
gem.summary = "tree.rb is a 'clone' of tree unix command. The gem implements a library to mange tree structures."
|
10
|
+
|
11
|
+
gem.description = <<-EOF
|
12
|
+
(This gem was named as treevisitor)
|
13
|
+
tree.rb is a 'clone' of tree unix command. The gem implements a library to mange tree structures.
|
14
|
+
The gem contains also a library to build tree with a dsl (domain specific language), and
|
15
|
+
an implementation of visitor design pattern.
|
16
|
+
An example of DSL to build tree:
|
17
|
+
<pre>
|
18
|
+
tree = TreeNode.create do
|
19
|
+
node "root" do
|
20
|
+
leaf "l1"
|
21
|
+
node "sub" do
|
22
|
+
leaf "l3"
|
23
|
+
end
|
24
|
+
node "wo leaves"
|
25
|
+
end
|
26
|
+
</pre>
|
27
|
+
EOF
|
28
|
+
|
29
|
+
gem.authors = ["Tokiro"]
|
30
|
+
gem.email = "tokiro.oyama@gmail.com"
|
31
|
+
gem.homepage = "http://github.com/tokiro/tree.rb"
|
32
|
+
|
33
|
+
#
|
34
|
+
# dependencies
|
35
|
+
#
|
36
|
+
|
37
|
+
gem.add_runtime_dependency(%q<json>, [">= 0"])
|
38
|
+
gem.add_runtime_dependency(%q<ansi>, [">= 0"])
|
39
|
+
|
40
|
+
gem.add_development_dependency(%q<rake>, [">= 0"])
|
41
|
+
gem.add_development_dependency(%q<yard>, [">= 0"])
|
42
|
+
gem.add_development_dependency(%q<bundler>, [">= 0"])
|
43
|
+
gem.add_development_dependency(%q<rspec>, [">= 0"])
|
44
|
+
|
45
|
+
#
|
46
|
+
# bin
|
47
|
+
#
|
48
|
+
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
49
|
+
gem.executables = %w{ tree.rb }
|
50
|
+
|
51
|
+
#
|
52
|
+
# files
|
53
|
+
#
|
54
|
+
# s.files = `git ls-files`.split("\n")
|
55
|
+
gem.files = %w{LICENSE.txt README.md Rakefile tree.rb.gemspec .gemtest}
|
56
|
+
gem.files.concat Dir['lib/**/*.rb']
|
57
|
+
gem.files.concat Dir['tasks/**/*.rake']
|
58
|
+
gem.files.concat Dir['examples/**/*']
|
59
|
+
|
60
|
+
#
|
61
|
+
# test files
|
62
|
+
#
|
63
|
+
# s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
64
|
+
gem.test_files = Dir['spec/**/*.rb']
|
65
|
+
gem.test_files.concat Dir['spec/fixtures/**/*']
|
66
|
+
gem.test_files.concat Dir['spec/fixtures/**/.gitkeep']
|
67
|
+
gem.test_files.concat Dir['spec/fixtures/**/.dir_with_dot/*']
|
68
|
+
|
69
|
+
gem.require_paths = ["lib"]
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,231 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tree.rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tokiro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ansi
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: yard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: ! "(This gem was named as treevisitor)\ntree.rb is a 'clone' of tree
|
111
|
+
unix command. The gem implements a library to mange tree structures.\nThe gem contains
|
112
|
+
also a library to build tree with a dsl (domain specific language), and \nan implementation
|
113
|
+
of visitor design pattern.\nAn example of DSL to build tree:\n<pre>\n tree = TreeNode.create
|
114
|
+
do\n node \"root\" do\n leaf \"l1\"\n node \"sub\" do\n leaf
|
115
|
+
\"l3\"\n end\n node \"wo leaves\"\n end\n</pre>\n"
|
116
|
+
email: tokiro.oyama@gmail.com
|
117
|
+
executables:
|
118
|
+
- tree.rb
|
119
|
+
extensions: []
|
120
|
+
extra_rdoc_files: []
|
121
|
+
files:
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- tree.rb.gemspec
|
126
|
+
- .gemtest
|
127
|
+
- bin/tree.rb
|
128
|
+
- lib/treevisitor.rb
|
129
|
+
- lib/tree_visitor.rb
|
130
|
+
- lib/treevisitor_cli.rb
|
131
|
+
- lib/treevisitor/util/dir_processor.rb
|
132
|
+
- lib/treevisitor/abs_node.rb
|
133
|
+
- lib/treevisitor/version.rb
|
134
|
+
- lib/treevisitor/directory_walker.rb
|
135
|
+
- lib/treevisitor/tree_node.rb
|
136
|
+
- lib/treevisitor/basic_tree_node_visitor.rb
|
137
|
+
- lib/treevisitor/tree_node_visitor.rb
|
138
|
+
- lib/treevisitor/cli/cli_tree.rb
|
139
|
+
- lib/treevisitor/visitors/block_tree_node_visitor.rb
|
140
|
+
- lib/treevisitor/visitors/flat_print_tree_node_visitors.rb
|
141
|
+
- lib/treevisitor/visitors/clone_tree_node_visitor.rb
|
142
|
+
- lib/treevisitor/visitors/build_dir_tree_visitor.rb
|
143
|
+
- lib/treevisitor/visitors/directory_to_hash_visitor.rb
|
144
|
+
- lib/treevisitor/visitors/depth_tree_node_visitor.rb
|
145
|
+
- lib/treevisitor/visitors/callback_tree_node_visitor2.rb
|
146
|
+
- lib/treevisitor/visitors/print_tree_node_visitor.rb
|
147
|
+
- lib/treevisitor/visitors/print_dir_tree_visitor.rb
|
148
|
+
- lib/treevisitor/leaf_node.rb
|
149
|
+
- tasks/rspec.rake
|
150
|
+
- tasks/yard.rake
|
151
|
+
- examples/directory_walker/directory_without_subdirectory.rb
|
152
|
+
- examples/directory_walker/find_files.rb
|
153
|
+
- examples/directory_walker/print_files.rb
|
154
|
+
- examples/protovis/treevisitor.js
|
155
|
+
- examples/protovis/protovis-r3.2.js
|
156
|
+
- examples/protovis/index.html
|
157
|
+
- examples/protovis/treevisitor.png
|
158
|
+
- examples/protovis/directory_to_json_visitor.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
- spec/treevisitor/tree_node_paths_spec.rb
|
161
|
+
- spec/treevisitor/util/dir_processor_spec.rb
|
162
|
+
- spec/treevisitor/tree_node_spec.rb
|
163
|
+
- spec/treevisitor/directory_walker_spec.rb
|
164
|
+
- spec/treevisitor/tree_dsl_spec.rb
|
165
|
+
- spec/treevisitor/tree_dsl_with_derived_class1_spec.rb
|
166
|
+
- spec/treevisitor/cli/cli_tree_spec.rb
|
167
|
+
- spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
|
168
|
+
- spec/treevisitor/visitors/tree_node_visitors_spec.rb
|
169
|
+
- spec/treevisitor/visitors/block_tree_node_visitor_spec.rb
|
170
|
+
- spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb
|
171
|
+
- spec/treevisitor/tree_dsl_with_derived_class_spec.rb
|
172
|
+
- spec/treevisitor/tree_node_visitor_delegate_spec.rb
|
173
|
+
- spec/treevisitor/tree_node_visitor_dsl_spec.rb
|
174
|
+
- spec/fixtures/test_dir_1/dir.2/file.2.1
|
175
|
+
- spec/fixtures/test_dir_1/dir.1/file.1.1
|
176
|
+
- spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1
|
177
|
+
- spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep
|
178
|
+
- spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt
|
179
|
+
homepage: http://github.com/tokiro/tree.rb
|
180
|
+
licenses: []
|
181
|
+
post_install_message:
|
182
|
+
rdoc_options: []
|
183
|
+
require_paths:
|
184
|
+
- lib
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
segments:
|
192
|
+
- 0
|
193
|
+
hash: -2920884827506678874
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
segments:
|
201
|
+
- 0
|
202
|
+
hash: -2920884827506678874
|
203
|
+
requirements: []
|
204
|
+
rubyforge_project:
|
205
|
+
rubygems_version: 1.8.24
|
206
|
+
signing_key:
|
207
|
+
specification_version: 3
|
208
|
+
summary: tree.rb is a 'clone' of tree unix command. The gem implements a library to
|
209
|
+
mange tree structures.
|
210
|
+
test_files:
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
- spec/treevisitor/tree_node_paths_spec.rb
|
213
|
+
- spec/treevisitor/util/dir_processor_spec.rb
|
214
|
+
- spec/treevisitor/tree_node_spec.rb
|
215
|
+
- spec/treevisitor/directory_walker_spec.rb
|
216
|
+
- spec/treevisitor/tree_dsl_spec.rb
|
217
|
+
- spec/treevisitor/tree_dsl_with_derived_class1_spec.rb
|
218
|
+
- spec/treevisitor/cli/cli_tree_spec.rb
|
219
|
+
- spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
|
220
|
+
- spec/treevisitor/visitors/tree_node_visitors_spec.rb
|
221
|
+
- spec/treevisitor/visitors/block_tree_node_visitor_spec.rb
|
222
|
+
- spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb
|
223
|
+
- spec/treevisitor/tree_dsl_with_derived_class_spec.rb
|
224
|
+
- spec/treevisitor/tree_node_visitor_delegate_spec.rb
|
225
|
+
- spec/treevisitor/tree_node_visitor_dsl_spec.rb
|
226
|
+
- spec/fixtures/test_dir_1/dir.2/file.2.1
|
227
|
+
- spec/fixtures/test_dir_1/dir.1/file.1.1
|
228
|
+
- spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1
|
229
|
+
- spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep
|
230
|
+
- spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt
|
231
|
+
has_rdoc:
|