tree.rb 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tree_rb_cli.rb CHANGED
@@ -14,3 +14,4 @@ require 'optparse'
14
14
  #
15
15
  require 'tree_rb'
16
16
  require 'tree_rb/cli/cli_tree'
17
+ require 'tree_rb/cli/cli_json'
@@ -0,0 +1 @@
1
+ {"a":1,"b":2}
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
3
+
4
+ describe CliJson do
5
+
6
+ it "should accepts --help switch" do
7
+ captured = capture_output do
8
+ args = %w{--help}
9
+ # args << File.join(FIXTURES, "test_dir_1")
10
+ CliJson.new.parse_args(args)
11
+ end
12
+ captured.out.should match /Usage:/
13
+ end
14
+
15
+ it "should accept --version switch" do
16
+ captured = capture_output do
17
+ args = %w{--version}
18
+ CliJson.new.parse_args(args)
19
+ end
20
+ version = TreeRb::VERSION
21
+ captured.out.should match version
22
+ end
23
+
24
+ it "should format simple json file" do
25
+ captured = capture_output do
26
+ args = []
27
+ args << File.join(FIXTURES, "test_json", "1.json")
28
+ CliJson.new.parse_args(args)
29
+ end
30
+
31
+ certified_out=<<-EOS
32
+ {
33
+ "a": 1,
34
+ "b": 2
35
+ }
36
+ EOS
37
+ captured.out.should == certified_out
38
+ end
39
+
40
+ end
@@ -26,7 +26,7 @@ describe "Tree Node Dsl Derived Class with no-arg constructor " do
26
26
  end
27
27
  end
28
28
 
29
- puts tree.to_str
29
+ # puts tree.to_str
30
30
  out =<<EOS
31
31
  dt: root
32
32
  |-- dl: l1
@@ -9,7 +9,7 @@ describe DirProcessor do
9
9
  dp.process(FIXTURES)
10
10
 
11
11
  # puts files
12
- files.length.should == 3
12
+ files.length.should == 4
13
13
  end
14
14
 
15
15
  end
@@ -0,0 +1,22 @@
1
+ namespace :tree_rb do
2
+ #
3
+ # examples
4
+ #
5
+ desc 'run all tree.rb example'
6
+ task :examples do
7
+
8
+ Dir['examples/*.rb'].sort.each do |filename|
9
+ next unless filename =~ /\d\d.+\.rb$/
10
+ unless system "ruby #{filename}"
11
+ exit
12
+ end
13
+ end
14
+ puts "All examples run successfully"
15
+
16
+ end
17
+
18
+ desc "Start an IRB shell"
19
+ task :shell do
20
+ sh 'IRBRC=`pwd`/config/irbrc.rb irb'
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tree.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-19 00:00:00.000000000 Z
12
+ date: 2012-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -134,6 +134,7 @@ executables:
134
134
  - rtree
135
135
  - tree.rb
136
136
  - tree_rb
137
+ - rjson.rb
137
138
  extensions: []
138
139
  extra_rdoc_files: []
139
140
  files:
@@ -145,12 +146,14 @@ files:
145
146
  - ext/mkrf_conf.rb
146
147
  - lib/treevisitor_cli.rb
147
148
  - lib/tree_visitor.rb
149
+ - lib/tree_rb/cli/cli_json.rb
148
150
  - lib/tree_rb/cli/cli_tree.rb
149
151
  - lib/tree_rb/util/dir_processor.rb
150
152
  - lib/tree_rb/directory_walker.rb
151
153
  - lib/tree_rb/visitors/print_dir_tree_visitor.rb
152
154
  - lib/tree_rb/visitors/build_dir_tree_visitor.rb
153
155
  - lib/tree_rb/visitors/depth_tree_node_visitor.rb
156
+ - lib/tree_rb/visitors/directory_to_hash2_visitor.rb
154
157
  - lib/tree_rb/visitors/print_tree_node_visitor.rb
155
158
  - lib/tree_rb/visitors/callback_tree_node_visitor2.rb
156
159
  - lib/tree_rb/visitors/sqlite_dir_tree_visitor.rb
@@ -169,11 +172,20 @@ files:
169
172
  - lib/treevisitor.rb
170
173
  - lib/tree_rb.rb
171
174
  - lib/tree_rb_cli.rb
175
+ - tasks/tree_rb.rake
172
176
  - tasks/rspec.rake
173
177
  - tasks/yard.rake
178
+ - examples/prova/prova.html
179
+ - examples/prova/flare.js
174
180
  - examples/directory_walker/print_files.rb
175
181
  - examples/directory_walker/directory_without_subdirectory.rb
176
182
  - examples/directory_walker/find_files.rb
183
+ - examples/d3_treemap/d3.js
184
+ - examples/d3_treemap/style.css
185
+ - examples/d3_treemap/d3_treemap.html
186
+ - examples/d3_treemap/prova.html
187
+ - examples/d3_treemap/d3_tree_rb_output.json
188
+ - examples/d3_treemap/d3.layout.js
177
189
  - examples/protovis/treevisitor.png
178
190
  - examples/protovis/protovis-r3.2.js
179
191
  - examples/protovis/index.html
@@ -183,6 +195,7 @@ files:
183
195
  - spec/tree_rb/cli/cli_tree_sqlite_spec.rb
184
196
  - spec/tree_rb/cli/cli_tree_digest_spec.rb
185
197
  - spec/tree_rb/cli/cli_tree_generic_spec.rb
198
+ - spec/tree_rb/cli/cli_json_spec.rb
186
199
  - spec/tree_rb/util/dir_processor_spec.rb
187
200
  - spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
188
201
  - spec/tree_rb/visitors/callback_tree_node_visitor2_spec.rb
@@ -201,11 +214,13 @@ files:
201
214
  - spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1
202
215
  - spec/fixtures/test_dir_1/dir.1/file.1.1
203
216
  - spec/fixtures/test_dir_1/dir.2/file.2.1
217
+ - spec/fixtures/test_json/1.json
204
218
  - spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep
205
219
  - spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt
206
220
  - bin/rtree
207
221
  - bin/tree.rb
208
222
  - bin/tree_rb
223
+ - bin/rjson.rb
209
224
  homepage: http://github.com/tokiro/tree.rb
210
225
  licenses: []
211
226
  post_install_message: Thank you to have installed tree.rb, any feedback is appreciated.
@@ -218,12 +233,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
233
  - - ! '>='
219
234
  - !ruby/object:Gem::Version
220
235
  version: '0'
236
+ segments:
237
+ - 0
238
+ hash: 3743714857926214739
221
239
  required_rubygems_version: !ruby/object:Gem::Requirement
222
240
  none: false
223
241
  requirements:
224
242
  - - ! '>='
225
243
  - !ruby/object:Gem::Version
226
244
  version: '0'
245
+ segments:
246
+ - 0
247
+ hash: 3743714857926214739
227
248
  requirements: []
228
249
  rubyforge_project:
229
250
  rubygems_version: 1.8.24
@@ -236,6 +257,7 @@ test_files:
236
257
  - spec/tree_rb/cli/cli_tree_sqlite_spec.rb
237
258
  - spec/tree_rb/cli/cli_tree_digest_spec.rb
238
259
  - spec/tree_rb/cli/cli_tree_generic_spec.rb
260
+ - spec/tree_rb/cli/cli_json_spec.rb
239
261
  - spec/tree_rb/util/dir_processor_spec.rb
240
262
  - spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
241
263
  - spec/tree_rb/visitors/callback_tree_node_visitor2_spec.rb
@@ -254,6 +276,7 @@ test_files:
254
276
  - spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1
255
277
  - spec/fixtures/test_dir_1/dir.1/file.1.1
256
278
  - spec/fixtures/test_dir_1/dir.2/file.2.1
279
+ - spec/fixtures/test_json/1.json
257
280
  - spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep
258
281
  - spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt
259
282
  has_rdoc: