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
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  tree.rb / tree visitor library
2
2
  ================================================
3
3
 
4
+ Project is moved to new gem tree.rb (https://rubygems.org/gems/tree.rb/stats)
5
+ and new repository (https://github.com/tokiro/tree.rb)
6
+
7
+
8
+
4
9
  **tree.rb** is a 'clone' of tree unix command. It is based on tree visitor library.
5
10
  Tree visitor is an implementation of visitor design pattern.
6
11
 
@@ -72,7 +77,7 @@ $ ruby bin/tree.rb --format json lib
72
77
 
73
78
  The json structure can be transformed into image:
74
79
 
75
- <img src='https://github.com/tokiro/treevisitor/raw/master/examples/protovis/treevisitor.png'/>
80
+ <img src='https://github.com/tokiro/tree.rb/raw/master/examples/protovis/treevisitor.png'/>
76
81
 
77
82
  ### Documentation
78
83
 
data/Rakefile CHANGED
@@ -1,11 +1,6 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- require 'bundler'
5
- Bundler::GemHelper.install_tasks
6
-
7
- # Load tasks
8
- Dir.glob('tasks/**/*.rake').each { |r| Rake.application.add_import r }
9
-
10
- task :test => :spec
11
- task :default => :spec
1
+ # -*- encoding: utf-8; mode: ruby -*-
2
+ require 'rubygems'
3
+ require 'rake'
4
+
5
+ require 'bundler'
6
+ Bundler::GemHelper.install_tasks
data/lib/tree_visitor.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'treevisitor'
2
+ require 'tree_rb'
data/lib/treevisitor.rb CHANGED
@@ -1,39 +1,2 @@
1
1
  # -*- coding: utf-8 -*-
2
-
3
- #
4
- # std lib
5
- #
6
- require 'pathname'
7
- require 'yaml'
8
-
9
- #
10
- # rubygems
11
- #
12
- # require 'rubygems' # rubygems must be loaded from binary file to not modify $LOAD_PATH
13
- require 'json'
14
-
15
- #
16
- # treevisitor
17
- #
18
-
19
- require "treevisitor/version"
20
- require "treevisitor/abs_node"
21
- require 'treevisitor/leaf_node'
22
- require 'treevisitor/tree_node'
23
- require 'treevisitor/basic_tree_node_visitor'
24
- require 'treevisitor/tree_node_visitor'
25
-
26
- require 'treevisitor/directory_walker'
27
-
28
- #
29
- # visitors
30
- #
31
- require 'treevisitor/visitors/block_tree_node_visitor'
32
- require 'treevisitor/visitors/build_dir_tree_visitor'
33
- require 'treevisitor/visitors/callback_tree_node_visitor2'
34
- require 'treevisitor/visitors/clone_tree_node_visitor'
35
- require 'treevisitor/visitors/depth_tree_node_visitor'
36
- require 'treevisitor/visitors/print_dir_tree_visitor'
37
- require 'treevisitor/visitors/directory_to_hash_visitor'
38
-
39
- require 'treevisitor/util/dir_processor'
2
+ require 'tree_rb'
@@ -1,7 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  #
2
3
  # cli
3
4
  #
4
-
5
- require 'optparse'
6
- require 'treevisitor'
7
- require "treevisitor/cli/cli_tree"
5
+ require "tree_rb/cli/cli_tree"
data/treevisitor.gemspec CHANGED
@@ -1,13 +1,14 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "treevisitor/version"
1
+ # -*- encoding: utf-8; mode: ruby -*-
4
2
 
5
3
  Gem::Specification.new do |gem|
6
4
  gem.name = "treevisitor"
7
- gem.version = TreeVisitor::VERSION
5
+ gem.version = "0.2.4"
6
+
8
7
  gem.platform = Gem::Platform::RUBY
9
8
  gem.summary = "Implementation of visitor design pattern"
10
9
  gem.description = <<-EOF
10
+ Gem renamed to tree.rb (https://rubygems.org/gems/tree.rb). Please update your dependencies.
11
+
11
12
  Implementation of visitor design pattern. It contains a 'tree.rb'
12
13
  command line clone of the tree unix tool.
13
14
  EOF
@@ -15,40 +16,27 @@ Gem::Specification.new do |gem|
15
16
  gem.authors = ["Tokiro"]
16
17
  gem.email = "tokiro.oyama@gmail.com"
17
18
  gem.homepage = "http://github.com/tokiro/treevisitor"
19
+ gem.require_paths = %w{ lib }
18
20
 
19
21
  #
20
22
  # dependencies
21
23
  #
22
24
 
23
- gem.add_runtime_dependency(%q<json>, [">= 0"])
24
- gem.add_development_dependency(%q<rake>, [">= 0"])
25
- gem.add_development_dependency(%q<yard>, [">= 0"])
26
- gem.add_development_dependency(%q<bundler>, [">= 0"])
27
- gem.add_development_dependency(%q<rspec>, [">= 0"])
28
-
29
- #
30
- # bin
31
- #
32
- # s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
33
- gem.executables = %w{ tree.rb }
25
+ gem.add_runtime_dependency(%q<tree.rb>, [">= 0"])
34
26
 
35
27
  #
36
28
  # files
37
29
  #
38
- # s.files = `git ls-files`.split("\n")
39
- gem.files = %w{LICENSE.txt README.md Rakefile treevisitor.gemspec .gemtest}
30
+ gem.files = %w{LICENSE.txt README.md Rakefile treevisitor.gemspec}
40
31
  gem.files.concat Dir['lib/**/*.rb']
41
- gem.files.concat Dir['tasks/**/*.rake']
42
- gem.files.concat Dir['examples/**/*']
43
32
 
44
- #
45
- # test files
46
- #
47
- # s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
48
- gem.test_files = Dir['spec/**/*.rb']
49
- gem.test_files.concat Dir['spec/fixtures/**/*']
50
- gem.test_files.concat Dir['spec/fixtures/**/.gitkeep']
51
- gem.test_files.concat Dir['spec/fixtures/**/.dir_with_dot/*']
33
+ gem.post_install_message =<<-EOS
34
+ #######################################################
35
+
36
+ WARNING This gem (treevisitor) was renamed to tree.rb, please update your dependencies.
37
+
38
+ #######################################################
39
+
40
+ EOS
52
41
 
53
- gem.require_paths = ["lib"]
54
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treevisitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-11 00:00:00.000000000 Z
12
+ date: 2012-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: json
15
+ name: tree.rb
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
@@ -27,75 +27,11 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rake
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
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: yard
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: bundler
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: rspec
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
- description: ! " Implementation of visitor design pattern. It contains a 'tree.rb'\n
95
- \ command line clone of the tree unix tool.\n"
30
+ description: ! " Gem renamed to tree.rb (https://rubygems.org/gems/tree.rb).
31
+ Please update your dependencies.\n\n Implementation of visitor design pattern.
32
+ It contains a 'tree.rb'\n command line clone of the tree unix tool.\n"
96
33
  email: tokiro.oyama@gmail.com
97
- executables:
98
- - tree.rb
34
+ executables: []
99
35
  extensions: []
100
36
  extra_rdoc_files: []
101
37
  files:
@@ -103,62 +39,14 @@ files:
103
39
  - README.md
104
40
  - Rakefile
105
41
  - treevisitor.gemspec
106
- - .gemtest
107
- - bin/tree.rb
108
- - lib/treevisitor/cli/cli_tree.rb
109
- - lib/treevisitor/util/dir_processor.rb
110
- - lib/treevisitor/directory_walker.rb
111
- - lib/treevisitor/visitors/print_dir_tree_visitor.rb
112
- - lib/treevisitor/visitors/build_dir_tree_visitor.rb
113
- - lib/treevisitor/visitors/depth_tree_node_visitor.rb
114
- - lib/treevisitor/visitors/print_tree_node_visitor.rb
115
- - lib/treevisitor/visitors/callback_tree_node_visitor2.rb
116
- - lib/treevisitor/visitors/directory_to_hash_visitor.rb
117
- - lib/treevisitor/visitors/flat_print_tree_node_visitors.rb
118
- - lib/treevisitor/visitors/block_tree_node_visitor.rb
119
- - lib/treevisitor/visitors/clone_tree_node_visitor.rb
120
- - lib/treevisitor/abs_node.rb
121
- - lib/treevisitor/leaf_node.rb
122
- - lib/treevisitor/tree_node_visitor.rb
123
- - lib/treevisitor/tree_node.rb
124
- - lib/treevisitor/basic_tree_node_visitor.rb
125
- - lib/treevisitor/version.rb
126
42
  - lib/treevisitor_cli.rb
127
43
  - lib/tree_visitor.rb
128
44
  - lib/treevisitor.rb
129
- - tasks/rspec.rake
130
- - tasks/yard.rake
131
- - examples/directory_walker/print_files.rb
132
- - examples/directory_walker/directory_without_subdirectory.rb
133
- - examples/directory_walker/find_files.rb
134
- - examples/protovis/treevisitor.png
135
- - examples/protovis/protovis-r3.2.js
136
- - examples/protovis/index.html
137
- - examples/protovis/treevisitor.js
138
- - examples/protovis/directory_to_json_visitor.rb
139
- - spec/treevisitor/cli/cli_tree_spec.rb
140
- - spec/treevisitor/util/dir_processor_spec.rb
141
- - spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
142
- - spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb
143
- - spec/treevisitor/visitors/block_tree_node_visitor_spec.rb
144
- - spec/treevisitor/visitors/tree_node_visitors_spec.rb
145
- - spec/treevisitor/tree_dsl_with_derived_class_spec.rb
146
- - spec/treevisitor/directory_walker_spec.rb
147
- - spec/treevisitor/tree_dsl_spec.rb
148
- - spec/treevisitor/tree_node_paths_spec.rb
149
- - spec/treevisitor/tree_dsl_with_derived_class1_spec.rb
150
- - spec/treevisitor/tree_node_visitor_delegate_spec.rb
151
- - spec/treevisitor/tree_node_spec.rb
152
- - spec/treevisitor/tree_node_visitor_dsl_spec.rb
153
- - spec/spec_helper.rb
154
- - spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1
155
- - spec/fixtures/test_dir_1/dir.1/file.1.1
156
- - spec/fixtures/test_dir_1/dir.2/file.2.1
157
- - spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep
158
- - spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt
159
45
  homepage: http://github.com/tokiro/treevisitor
160
46
  licenses: []
161
- post_install_message:
47
+ post_install_message: ! " #######################################################\n\n
48
+ \ WARNING This gem (treevisitor) was renamed to tree.rb, please update your dependencies.\n\n
49
+ \ #######################################################\n\n"
162
50
  rdoc_options: []
163
51
  require_paths:
164
52
  - lib
@@ -180,25 +68,5 @@ rubygems_version: 1.8.24
180
68
  signing_key:
181
69
  specification_version: 3
182
70
  summary: Implementation of visitor design pattern
183
- test_files:
184
- - spec/treevisitor/cli/cli_tree_spec.rb
185
- - spec/treevisitor/util/dir_processor_spec.rb
186
- - spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
187
- - spec/treevisitor/visitors/callback_tree_node_visitor2_spec.rb
188
- - spec/treevisitor/visitors/block_tree_node_visitor_spec.rb
189
- - spec/treevisitor/visitors/tree_node_visitors_spec.rb
190
- - spec/treevisitor/tree_dsl_with_derived_class_spec.rb
191
- - spec/treevisitor/directory_walker_spec.rb
192
- - spec/treevisitor/tree_dsl_spec.rb
193
- - spec/treevisitor/tree_node_paths_spec.rb
194
- - spec/treevisitor/tree_dsl_with_derived_class1_spec.rb
195
- - spec/treevisitor/tree_node_visitor_delegate_spec.rb
196
- - spec/treevisitor/tree_node_spec.rb
197
- - spec/treevisitor/tree_node_visitor_dsl_spec.rb
198
- - spec/spec_helper.rb
199
- - spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1
200
- - spec/fixtures/test_dir_1/dir.1/file.1.1
201
- - spec/fixtures/test_dir_1/dir.2/file.2.1
202
- - spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep
203
- - spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt
71
+ test_files: []
204
72
  has_rdoc:
data/.gemtest DELETED
File without changes
data/bin/tree.rb DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
-
4
- cwd = File.expand_path( File.join( File.dirname(__FILE__), "..", "lib" ) )
5
- $:.unshift(cwd) unless $:.include?(cwd)
6
- require 'treevisitor_cli'
7
-
8
- include TreeVisitor
9
- exit CliTree.run
@@ -1,37 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'ostruct'
3
-
4
- cwd = File.expand_path( File.join( File.dirname(__FILE__), "..", "..", "lib" ) )
5
- $:.unshift(cwd) unless $:.include?(cwd)
6
- require 'treevisitor'
7
-
8
- #
9
- # Find directories without subdirectories
10
- #
11
- class DirWithoutSubDir < TreeVisitor::BasicTreeNodeVisitor
12
-
13
- def initialize
14
- super
15
- @stack = []
16
- @nr = 0
17
- end
18
-
19
- def enter_node( pathname )
20
- @nr += 1
21
- info = OpenStruct.new(:nr => @nr, :pathname => pathname)
22
- @stack.push( info )
23
- end
24
-
25
- def exit_node( pathname )
26
- info = @stack.pop
27
- if info.nr == @nr
28
- puts "leaf: #{pathname}"
29
- end
30
- end
31
-
32
- end
33
-
34
- dtw = TreeVisitor::DirTreeWalker.new( ".." )
35
- dtw.ignore /^\./
36
- dtw.visit_file=false
37
- dtw.run( DirWithoutSubDir.new )
@@ -1,18 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- cwd = File.expand_path( File.join( File.dirname(__FILE__), "..", "..", "lib" ) )
4
- $:.unshift(cwd) unless $:.include?(cwd)
5
- require 'treevisitor'
6
- include TreeVisitor
7
-
8
- class MyVisitor < BasicTreeNodeVisitor
9
- def visit_leaf( pathname )
10
- puts pathname
11
- end
12
- end
13
-
14
- dtw = DirTreeWalker.new( File.join(File.dirname(__FILE__), "..", ".." ) )
15
- dtw.match "leaf_node.rb"
16
- dtw.match "abs_node.rb"
17
- dtw.run( MyVisitor.new )
18
-
@@ -1,12 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- cwd = File.expand_path( File.join( File.dirname(__FILE__), "..", "..", "lib" ) )
3
- $:.unshift(cwd) unless $:.include?(cwd)
4
- require 'treevisitor'
5
- include TreeVisitor
6
-
7
- dtw = DirTreeWalker.new( :ignore => ".git" )
8
- dtw.run ".." do
9
- on_leaf do |pathname|
10
- puts pathname
11
- end
12
- end