treevisitor 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +104 -0
- data/VERSION.yml +1 -1
- data/examples/{directory_without_subdirectory.rb → directory_walker/directory_without_subdirectory.rb} +6 -4
- data/examples/{find_files.rb → directory_walker/find_files.rb} +4 -3
- data/examples/{print_files.rb → directory_walker/print_files.rb} +5 -8
- data/examples/protovis/directory_to_json_visitor.rb +13 -0
- data/examples/protovis/index.html +87 -0
- data/examples/protovis/protovis-d3.2.js +15269 -0
- data/examples/protovis/treevisitor.js +33 -0
- data/examples/protovis/treevisitor.png +0 -0
- data/lib/treevisitor/basic_tree_node_visitor.rb +29 -0
- data/lib/treevisitor/cli/cli_tree.rb +43 -35
- data/lib/treevisitor/directory_walker.rb +260 -0
- data/lib/treevisitor/tree_node_visitor.rb +33 -5
- data/lib/treevisitor/{dir_processor.rb → util/dir_processor.rb} +0 -0
- data/lib/treevisitor/visitors/block_tree_node_visitor.rb +1 -1
- data/lib/treevisitor/visitors/build_dir_tree_visitor.rb +1 -1
- data/lib/treevisitor/visitors/callback_tree_node_visitor.rb +1 -2
- data/lib/treevisitor/visitors/callback_tree_node_visitor2.rb +1 -1
- data/lib/treevisitor/visitors/clone_tree_node_visitor.rb +1 -1
- data/lib/treevisitor/visitors/depth_tree_node_visitor.rb +1 -1
- data/lib/treevisitor/visitors/directory_to_hash_visitor.rb +33 -0
- data/lib/treevisitor/visitors/flat_print_tree_node_visitors.rb +1 -1
- data/lib/treevisitor/visitors/print_dir_tree_visitor.rb +1 -1
- data/lib/treevisitor/visitors/print_tree_node_visitor.rb +1 -1
- data/lib/treevisitor.rb +24 -8
- data/spec/fixtures/{test_dir → test_dir_1}/.dir_with_dot/dummy.txt +0 -0
- data/spec/fixtures/{test_dir → test_dir_1}/dir.1/dir.1.2/file.1.2.1 +0 -0
- data/spec/fixtures/{test_dir → test_dir_1}/dir.1/file.1.1 +0 -0
- data/spec/fixtures/{test_dir → test_dir_1}/dir.2/file.2.1 +0 -0
- data/spec/spec_helper.rb +6 -9
- data/spec/treevisitor/cli/cli_tree_spec.rb +5 -5
- data/spec/treevisitor/directory_walker_spec.rb +61 -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/{dir_processor_spec.rb → util/dir_processor_spec.rb} +2 -4
- data/spec/treevisitor/visitor_dsl_spec.rb +32 -0
- data/spec/treevisitor/visitors/block_tree_node_visitor_spec.rb +27 -0
- data/spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb +38 -0
- data/spec/treevisitor/visitors/callback_tree_node_visitors_spec.rb +29 -0
- data/spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb +30 -0
- data/tasks/jeweler.rake +4 -8
- data/treevisitor.gemspec +114 -0
- metadata +48 -29
- data/README.rdoc +0 -42
- data/lib/treevisitor/dir_tree_walker.rb +0 -165
- data/spec/treevisitor/dir_tree_walker_spec.rb +0 -50
- data/spec/treevisitor/tree_node_dsl_spec.rb +0 -153
- data/spec/treevisitor/tree_node_visitor_spec.rb +0 -70
- data/tasks/rubyforge.rake +0 -28
data/spec/spec_helper.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# std lib
|
4
|
+
#
|
5
|
+
require "stringio"
|
3
6
|
|
7
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
8
|
require 'treevisitor'
|
5
9
|
require 'treevisitor_cli'
|
6
|
-
|
7
10
|
include TreeVisitor
|
8
11
|
|
9
12
|
FIXTURES = File.expand_path( File.join( File.dirname(__FILE__), "fixtures" ) )
|
10
13
|
|
11
|
-
# Spec::Runner.configure do |config|
|
12
|
-
# end
|
13
|
-
|
14
|
-
require 'test/unit'
|
15
|
-
require "stringio"
|
16
|
-
|
17
14
|
def with_stdout_captured
|
18
15
|
old_stdout = $stdout
|
19
16
|
out = StringIO.new
|
@@ -23,7 +23,7 @@ describe CliTree do
|
|
23
23
|
it "should accepts switch -d (directories only)" do
|
24
24
|
out = with_stdout_captured do
|
25
25
|
args = %w{-d}
|
26
|
-
args << File.join(FIXTURES, "
|
26
|
+
args << File.join(FIXTURES, "test_dir_1")
|
27
27
|
CliTree.new.parse_args(args)
|
28
28
|
end
|
29
29
|
# puts out
|
@@ -31,7 +31,7 @@ describe CliTree do
|
|
31
31
|
|
32
32
|
out = with_stdout_captured do
|
33
33
|
args = %w{-da}
|
34
|
-
args << File.join(FIXTURES, "
|
34
|
+
args << File.join(FIXTURES, "test_dir_1")
|
35
35
|
CliTree.new.parse_args(args)
|
36
36
|
end
|
37
37
|
# puts out
|
@@ -41,7 +41,7 @@ describe CliTree do
|
|
41
41
|
it "should accepts switch -a (all files)" do
|
42
42
|
out = with_stdout_captured do
|
43
43
|
args = %w{-a}
|
44
|
-
args << File.join(FIXTURES, "
|
44
|
+
args << File.join(FIXTURES, "test_dir_1")
|
45
45
|
CliTree.new.parse_args(args)
|
46
46
|
end
|
47
47
|
# pp out
|
@@ -49,10 +49,10 @@ describe CliTree do
|
|
49
49
|
|
50
50
|
out = with_stdout_captured do
|
51
51
|
args = []
|
52
|
-
args << File.join(FIXTURES, "
|
52
|
+
args << File.join(FIXTURES, "test_dir_1")
|
53
53
|
CliTree.new.parse_args(args)
|
54
54
|
end
|
55
55
|
# puts out
|
56
56
|
out.split("\n").length.should == 9
|
57
57
|
end
|
58
|
-
end
|
58
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
3
|
+
|
4
|
+
describe DirTreeWalker do
|
5
|
+
|
6
|
+
it "should ignore files and directory" do
|
7
|
+
dtp = DirTreeWalker.new(".")
|
8
|
+
|
9
|
+
dtp.ignore(/^\./)
|
10
|
+
dtp.ignore_file?(".thumbnails").should be_true
|
11
|
+
dtp.ignore_dir?(".thumbnails").should be_true
|
12
|
+
|
13
|
+
dtp.ignore_dir("thumbnails")
|
14
|
+
dtp.ignore_dir?(".thumbnails").should be_true
|
15
|
+
dtp.ignore_dir?("thumbnails").should be_true
|
16
|
+
dtp.ignore_dir?("pippo").should be_false
|
17
|
+
|
18
|
+
dtp.ignore_file("xvpics")
|
19
|
+
dtp.ignore_file?("xvpics").should be_true
|
20
|
+
|
21
|
+
dtp.ignore("sub")
|
22
|
+
dtp.ignore_file?("[Dsube]").should be_false
|
23
|
+
dtp.ignore_dir?("[Dsube]").should be_false
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should accept option :ignore" do
|
27
|
+
dtp = DirTreeWalker.new :ignore => /^\./
|
28
|
+
|
29
|
+
dtp.ignore_file?(".thumbnails").should be_true
|
30
|
+
dtp.ignore_dir?(".thumbnails").should be_true
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should accept option :ignore" do
|
34
|
+
dtp = DirTreeWalker.new :ignore => ".git"
|
35
|
+
|
36
|
+
dtp.ignore_file?(".git").should be_true
|
37
|
+
dtp.ignore_dir?(".git").should be_true
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should accumulate file names" do
|
41
|
+
dir_tree_walker = DirTreeWalker.new(File.join(FIXTURES, "test_dir_1"))
|
42
|
+
|
43
|
+
accumulator = []
|
44
|
+
visitor = BlockTreeNodeVisitor.new { |pathname| accumulator << File.basename(pathname) }
|
45
|
+
dir_tree_walker.run(visitor)
|
46
|
+
accumulator.length.should == 9
|
47
|
+
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
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should accumulate file names 2" do
|
51
|
+
dir_tree_walker = DirTreeWalker.new(File.join(FIXTURES, "test_dir_2"))
|
52
|
+
dir_tree_walker.ignore("sub")
|
53
|
+
|
54
|
+
accumulator = []
|
55
|
+
visitor = BlockTreeNodeVisitor.new { |pathname| accumulator << File.basename(pathname) }
|
56
|
+
dir_tree_walker.run(visitor)
|
57
|
+
accumulator.length.should == 2
|
58
|
+
accumulator.sort.should == %w{ [Dsube] test_dir_2 }.sort
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
3
|
+
|
4
|
+
describe "TreeNodeDsl" do
|
5
|
+
|
6
|
+
it "should build tree with dsl" do
|
7
|
+
tree = TreeNode.create do
|
8
|
+
node "root" do
|
9
|
+
leaf "l1"
|
10
|
+
leaf "l2"
|
11
|
+
node "sub" do
|
12
|
+
leaf "l3"
|
13
|
+
end
|
14
|
+
node "wo leaves"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# puts tree.to_str
|
19
|
+
out =<<EOS
|
20
|
+
root
|
21
|
+
|-- l1
|
22
|
+
|-- l2
|
23
|
+
|-- sub
|
24
|
+
| `-- l3
|
25
|
+
`-- wo leaves
|
26
|
+
EOS
|
27
|
+
tree.to_str.should == out
|
28
|
+
end
|
29
|
+
|
30
|
+
it "test_dsl_block_with_arg" do
|
31
|
+
tree = TreeNode.create do
|
32
|
+
node "root" do |node|
|
33
|
+
node.prefix_path=("pre/")
|
34
|
+
leaf "l1"
|
35
|
+
leaf "l2"
|
36
|
+
node "sub" do
|
37
|
+
leaf "l3" do |leaf|
|
38
|
+
end
|
39
|
+
end
|
40
|
+
node "woleaves"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# puts tree.to_str
|
45
|
+
out =<<EOS
|
46
|
+
root
|
47
|
+
|-- l1
|
48
|
+
|-- l2
|
49
|
+
|-- sub
|
50
|
+
| `-- l3
|
51
|
+
`-- woleaves
|
52
|
+
EOS
|
53
|
+
tree.to_str.should == out
|
54
|
+
tree.find("l3").path_with_prefix.should == "pre/root/sub/l3"
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
3
|
+
|
4
|
+
describe "Tree Node Dsl Derived Class with n-arg constructor" do
|
5
|
+
|
6
|
+
class ArgsTreeNode < TreeNode
|
7
|
+
attr_reader :description
|
8
|
+
|
9
|
+
def initialize(name, description, parent)
|
10
|
+
super(name, parent)
|
11
|
+
@description = description
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
"a: #{description}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class ArgsLeafNode < LeafNode
|
20
|
+
attr_reader :description
|
21
|
+
|
22
|
+
def initialize(name, description, parent)
|
23
|
+
super(name, parent)
|
24
|
+
@description = description
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
"a: #{description}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "test_derivated_args" do
|
33
|
+
tree = TreeNode.create(ArgsTreeNode, ArgsLeafNode) do
|
34
|
+
node "root", "droot" do
|
35
|
+
leaf "l1", "dl1"
|
36
|
+
leaf "l2", "dl2"
|
37
|
+
node "sub", "dsub" do
|
38
|
+
leaf "l3", "dl3"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# puts tree.to_str
|
44
|
+
out =<<EOS
|
45
|
+
a: droot
|
46
|
+
|-- a: dl1
|
47
|
+
|-- a: dl2
|
48
|
+
`-- a: dsub
|
49
|
+
`-- a: dl3
|
50
|
+
EOS
|
51
|
+
tree.to_str.should == out
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
3
|
+
|
4
|
+
describe "Tree Node Dsl Derived Class with no-arg constructor " do
|
5
|
+
|
6
|
+
class DTreeNode < TreeNode
|
7
|
+
def to_s
|
8
|
+
"dt: #{content}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class DLeafNode < LeafNode
|
13
|
+
def to_s
|
14
|
+
"dl: #{content}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it "dsl with non-arg constructor" do
|
19
|
+
tree = TreeNode.create(DTreeNode, DLeafNode) do
|
20
|
+
node "root" do
|
21
|
+
leaf "l1"
|
22
|
+
leaf "l2"
|
23
|
+
node "sub" do
|
24
|
+
leaf "l3"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# puts tree.to_str
|
30
|
+
out =<<EOS
|
31
|
+
dt: root
|
32
|
+
|-- dl: l1
|
33
|
+
|-- dl: l2
|
34
|
+
`-- dt: sub
|
35
|
+
`-- dl: l3
|
36
|
+
EOS
|
37
|
+
tree.to_str.should == out
|
38
|
+
|
39
|
+
tree = DTreeNode.create(DLeafNode) do
|
40
|
+
node "root" do
|
41
|
+
leaf "l1"
|
42
|
+
leaf "l2"
|
43
|
+
node "sub" do
|
44
|
+
leaf "l3"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
tree.to_str.should == out
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
|
3
3
|
|
4
4
|
describe DirProcessor do
|
5
5
|
|
6
6
|
it do
|
7
7
|
files = []
|
8
|
-
dp
|
8
|
+
dp = DirProcessor.new { |f| files << f }
|
9
9
|
dp.process(FIXTURES)
|
10
10
|
files.length.should == 3
|
11
11
|
end
|
12
12
|
|
13
13
|
end
|
14
|
-
|
15
|
-
|
@@ -0,0 +1,32 @@
|
|
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_tree_node do |tree_node|
|
10
|
+
@entered_node = true
|
11
|
+
end
|
12
|
+
|
13
|
+
on_exit_tree_node do |tree_node|
|
14
|
+
@exit_node = true
|
15
|
+
end
|
16
|
+
|
17
|
+
on_visit_leaf_node do |leaf_node|
|
18
|
+
@visit_leaf = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
visitor.enter_tree_node(nil)
|
23
|
+
visitor.instance_eval{ @entered_node }.should be_true
|
24
|
+
|
25
|
+
visitor.exit_tree_node(nil)
|
26
|
+
visitor.instance_eval{ @exit_node }.should be_true
|
27
|
+
|
28
|
+
visitor.visit_leaf_node(nil)
|
29
|
+
visitor.instance_eval{ @visit_leaf }.should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
|
3
|
+
|
4
|
+
require 'treevisitor/visitors/block_tree_node_visitor'
|
5
|
+
|
6
|
+
describe "Tree Node Visitors" do
|
7
|
+
|
8
|
+
before do
|
9
|
+
ta = TreeNode.new( "a", nil )
|
10
|
+
LeafNode.new("1", ta )
|
11
|
+
LeafNode.new("2", ta )
|
12
|
+
|
13
|
+
tb = TreeNode.new( "b", ta )
|
14
|
+
LeafNode.new( "3", tb )
|
15
|
+
|
16
|
+
@tree = ta
|
17
|
+
end
|
18
|
+
|
19
|
+
it BlockTreeNodeVisitor do
|
20
|
+
accumulator = []
|
21
|
+
visitor = BlockTreeNodeVisitor.new { |node| accumulator << 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
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
|
3
|
+
|
4
|
+
require 'treevisitor/visitors/callback_tree_node_visitor2'
|
5
|
+
|
6
|
+
describe "Tree Node Visitors" do
|
7
|
+
|
8
|
+
before do
|
9
|
+
ta = TreeNode.new( "a", nil )
|
10
|
+
LeafNode.new("1", ta )
|
11
|
+
LeafNode.new("2", ta )
|
12
|
+
|
13
|
+
tb = TreeNode.new( "b", ta )
|
14
|
+
LeafNode.new( "3", tb )
|
15
|
+
|
16
|
+
@tree = ta
|
17
|
+
end
|
18
|
+
|
19
|
+
it CallbackTreeNodeVisitor2 do
|
20
|
+
visitor = CallbackTreeNodeVisitor2.new
|
21
|
+
visitor.on_enter_tree_node{ |tree_node, new_parent_node|
|
22
|
+
TreeNode.new("n" + tree_node.content, new_parent_node)
|
23
|
+
}
|
24
|
+
visitor.on_visit_leaf_node{ |leaf_node, new_parent_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,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
|
3
|
+
|
4
|
+
require 'treevisitor/visitors/callback_tree_node_visitor'
|
5
|
+
|
6
|
+
describe "Tree Node Visitors" do
|
7
|
+
|
8
|
+
before do
|
9
|
+
ta = TreeNode.new( "a", nil )
|
10
|
+
LeafNode.new("1", ta )
|
11
|
+
LeafNode.new("2", ta )
|
12
|
+
|
13
|
+
tb = TreeNode.new( "b", ta )
|
14
|
+
LeafNode.new( "3", tb )
|
15
|
+
|
16
|
+
@tree = ta
|
17
|
+
end
|
18
|
+
|
19
|
+
it CallbackTreeNodeVisitor do
|
20
|
+
accumulator = []
|
21
|
+
visitor = CallbackTreeNodeVisitor.new
|
22
|
+
visitor.on_enter_tree_node{ |tree_node| accumulator << tree_node.content }
|
23
|
+
visitor.on_visit_leaf_node{ |leaf_node| accumulator << leaf_node.content }
|
24
|
+
@tree.accept( visitor )
|
25
|
+
accumulator.length.should == 5
|
26
|
+
accumulator.should == %w{ a 1 2 b 3 }
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
|
3
|
+
|
4
|
+
require 'treevisitor/visitors/depth_tree_node_visitor'
|
5
|
+
require 'treevisitor/visitors/clone_tree_node_visitor'
|
6
|
+
|
7
|
+
describe "Tree Node Visitors" do
|
8
|
+
|
9
|
+
before do
|
10
|
+
ta = TreeNode.new( "a", nil )
|
11
|
+
LeafNode.new("1", ta )
|
12
|
+
LeafNode.new("2", ta )
|
13
|
+
|
14
|
+
tb = TreeNode.new( "b", ta )
|
15
|
+
LeafNode.new( "3", tb )
|
16
|
+
|
17
|
+
@tree = ta
|
18
|
+
end
|
19
|
+
|
20
|
+
it DepthTreeNodeVisitor do
|
21
|
+
visitor = DepthTreeNodeVisitor.new
|
22
|
+
@tree.accept( visitor )
|
23
|
+
visitor.depth.should == 0
|
24
|
+
|
25
|
+
visitor = CloneTreeNodeVisitor.new
|
26
|
+
@tree.accept( visitor )
|
27
|
+
visitor.cloned_root.nr_nodes.should == @tree.nr_nodes
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/tasks/jeweler.rake
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# jeweler
|
4
|
-
#
|
5
|
-
|
6
2
|
begin
|
7
3
|
require 'jeweler'
|
8
4
|
Jeweler::Tasks.new do |gem|
|
@@ -19,9 +15,8 @@ begin
|
|
19
15
|
gem.homepage = "http://github.com/tokiro/treevisitor"
|
20
16
|
|
21
17
|
#
|
22
|
-
#
|
18
|
+
# dependencies automatically loaded from Gemfile
|
23
19
|
#
|
24
|
-
gem.add_development_dependency "rspec"
|
25
20
|
|
26
21
|
#
|
27
22
|
# bin
|
@@ -31,10 +26,10 @@ begin
|
|
31
26
|
#
|
32
27
|
# files
|
33
28
|
#
|
34
|
-
gem.files = %w{LICENSE README.
|
29
|
+
gem.files = %w{LICENSE.txt README.md Rakefile VERSION.yml treevisitor.gemspec}
|
35
30
|
gem.files.concat Dir['lib/**/*.rb']
|
36
31
|
gem.files.concat Dir['tasks/**/*.rake']
|
37
|
-
gem.files.concat Dir['examples
|
32
|
+
gem.files.concat Dir['examples/**/*']
|
38
33
|
|
39
34
|
|
40
35
|
#
|
@@ -42,6 +37,7 @@ begin
|
|
42
37
|
#
|
43
38
|
gem.test_files = Dir['spec/**/*.rb']
|
44
39
|
gem.test_files.concat Dir['spec/fixtures/**/*']
|
40
|
+
gem.test_files.concat Dir['spec/fixtures/**/.gitkeep']
|
45
41
|
gem.test_files.concat Dir['spec/fixtures/**/.dir_with_dot/*']
|
46
42
|
|
47
43
|
#
|
data/treevisitor.gemspec
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{treevisitor}
|
8
|
+
s.version = "0.1.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tokiro"]
|
12
|
+
s.date = %q{2011-01-21}
|
13
|
+
s.default_executable = %q{tree.rb}
|
14
|
+
s.description = %q{ Implementation of visitor design pattern. It contains a 'tree.rb'
|
15
|
+
command line clone of the tree unix tool.
|
16
|
+
}
|
17
|
+
s.email = %q{tokiro.oyama@gmail.com}
|
18
|
+
s.executables = ["tree.rb"]
|
19
|
+
s.extra_rdoc_files = [
|
20
|
+
"LICENSE.txt",
|
21
|
+
"README.md"
|
22
|
+
]
|
23
|
+
s.files = [
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION.yml",
|
28
|
+
"examples/directory_walker/directory_without_subdirectory.rb",
|
29
|
+
"examples/directory_walker/find_files.rb",
|
30
|
+
"examples/directory_walker/print_files.rb",
|
31
|
+
"examples/protovis/directory_to_json_visitor.rb",
|
32
|
+
"examples/protovis/index.html",
|
33
|
+
"examples/protovis/protovis-d3.2.js",
|
34
|
+
"examples/protovis/treevisitor.js",
|
35
|
+
"examples/protovis/treevisitor.png",
|
36
|
+
"lib/tree_visitor.rb",
|
37
|
+
"lib/treevisitor.rb",
|
38
|
+
"lib/treevisitor/abs_node.rb",
|
39
|
+
"lib/treevisitor/basic_tree_node_visitor.rb",
|
40
|
+
"lib/treevisitor/cli/cli_tree.rb",
|
41
|
+
"lib/treevisitor/directory_walker.rb",
|
42
|
+
"lib/treevisitor/leaf_node.rb",
|
43
|
+
"lib/treevisitor/tree_node.rb",
|
44
|
+
"lib/treevisitor/tree_node_visitor.rb",
|
45
|
+
"lib/treevisitor/util/dir_processor.rb",
|
46
|
+
"lib/treevisitor/visitors/block_tree_node_visitor.rb",
|
47
|
+
"lib/treevisitor/visitors/build_dir_tree_visitor.rb",
|
48
|
+
"lib/treevisitor/visitors/callback_tree_node_visitor.rb",
|
49
|
+
"lib/treevisitor/visitors/callback_tree_node_visitor2.rb",
|
50
|
+
"lib/treevisitor/visitors/clone_tree_node_visitor.rb",
|
51
|
+
"lib/treevisitor/visitors/depth_tree_node_visitor.rb",
|
52
|
+
"lib/treevisitor/visitors/directory_to_hash_visitor.rb",
|
53
|
+
"lib/treevisitor/visitors/flat_print_tree_node_visitors.rb",
|
54
|
+
"lib/treevisitor/visitors/print_dir_tree_visitor.rb",
|
55
|
+
"lib/treevisitor/visitors/print_tree_node_visitor.rb",
|
56
|
+
"lib/treevisitor_cli.rb",
|
57
|
+
"tasks/jeweler.rake",
|
58
|
+
"tasks/rspec.rake",
|
59
|
+
"tasks/yard.rake",
|
60
|
+
"treevisitor.gemspec"
|
61
|
+
]
|
62
|
+
s.homepage = %q{http://github.com/tokiro/treevisitor}
|
63
|
+
s.require_paths = ["lib"]
|
64
|
+
s.rubygems_version = %q{1.3.7}
|
65
|
+
s.summary = %q{Implementation of visitor design pattern}
|
66
|
+
s.test_files = [
|
67
|
+
"spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt",
|
68
|
+
"spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1",
|
69
|
+
"spec/fixtures/test_dir_1/dir.1/file.1.1",
|
70
|
+
"spec/fixtures/test_dir_1/dir.2/file.2.1",
|
71
|
+
"spec/spec_helper.rb",
|
72
|
+
"spec/treevisitor/cli/cli_tree_spec.rb",
|
73
|
+
"spec/treevisitor/directory_walker_spec.rb",
|
74
|
+
"spec/treevisitor/tree_dsl_spec.rb",
|
75
|
+
"spec/treevisitor/tree_dsl_with_derived_class1_spec.rb",
|
76
|
+
"spec/treevisitor/tree_dsl_with_derived_class_spec.rb",
|
77
|
+
"spec/treevisitor/tree_node_spec.rb",
|
78
|
+
"spec/treevisitor/util/dir_processor_spec.rb",
|
79
|
+
"spec/treevisitor/visitor_dsl_spec.rb",
|
80
|
+
"spec/treevisitor/visitors/block_tree_node_visitor_spec.rb",
|
81
|
+
"spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb",
|
82
|
+
"spec/treevisitor/visitors/callback_tree_node_visitors_spec.rb",
|
83
|
+
"spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb"
|
84
|
+
]
|
85
|
+
|
86
|
+
if s.respond_to? :specification_version then
|
87
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
88
|
+
s.specification_version = 3
|
89
|
+
|
90
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
91
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
92
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
93
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
94
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
95
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
96
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
97
|
+
else
|
98
|
+
s.add_dependency(%q<json>, [">= 0"])
|
99
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
100
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
101
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
102
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
103
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
104
|
+
end
|
105
|
+
else
|
106
|
+
s.add_dependency(%q<json>, [">= 0"])
|
107
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
108
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
109
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
110
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
111
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|