rubytree 0.9.0 → 0.9.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac2fe1bd84044b1981f67b94bbf751f144d96afb
4
- data.tar.gz: 20ed672c1300c42447b483919a47fe8128d8ad05
3
+ metadata.gz: 04cb1c44d2c9f5c11c5f9202b0e24202e287579a
4
+ data.tar.gz: a6b6581c4b1bcc106896889a092ece86a93e3bb5
5
5
  SHA512:
6
- metadata.gz: eb12ccc374632de68c78121c70a8a0c3c7e42e3c062c78a179df542d2e459928464c0404a546ab14f06394c0db8b73e5baf21818a87f2b7dcddf5e58b37a783f
7
- data.tar.gz: 1249c16cf513a6f44e713338e7bd1eb38a8d3ee554d0584126fe093bc89013ca9efc06516be82cada869479da93d23aef84fe070f0efa94261255a5bb7525d01
6
+ metadata.gz: 9dcc9b36d0ca03c71c11658e637086ee9f2decbbe1429f296ea38afbc73c2902b5375387429c882329a64d2740ad43eb3abb0de34be03a4b58413c0098e36722
7
+ data.tar.gz: 33dc63cd509b22d768c29cca9dd7c75744add483b6003577df13ce3990541d38113420a17ad5b74c72993796b80e692164c1d7e580b91ccdf301505b4a1fb36a
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gemspec
5
5
 
6
6
  group :development, :test do
7
7
  gem "rake", "~> 10.1"
8
+ gem "coveralls", ">= 0.7", :require => false, :platforms => :mri_21
8
9
  end
9
10
 
10
11
  # Local Variables:
data/Gemfile.lock CHANGED
@@ -1,20 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubytree (0.9.0)
4
+ rubytree (0.9.2)
5
5
  json (~> 1.8)
6
6
  structured_warnings (~> 0.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ coveralls (0.7.0)
12
+ multi_json (~> 1.3)
13
+ rest-client
14
+ simplecov (>= 0.7)
15
+ term-ansicolor
16
+ thor
17
+ docile (1.1.1)
11
18
  json (1.8.1)
19
+ mime-types (2.0)
20
+ multi_json (1.8.2)
12
21
  rake (10.1.1)
13
22
  rdoc (4.1.0)
23
+ rest-client (1.6.7)
24
+ mime-types (>= 1.16)
14
25
  rtags (0.98)
15
26
  rtagstask (0.0.4)
16
27
  rtags (> 0.0.0)
28
+ simplecov (0.8.2)
29
+ docile (~> 1.1.0)
30
+ multi_json
31
+ simplecov-html (~> 0.8.0)
32
+ simplecov-html (0.8.0)
17
33
  structured_warnings (0.1.4)
34
+ term-ansicolor (1.2.2)
35
+ tins (~> 0.8)
36
+ thor (0.18.1)
37
+ tins (0.13.1)
18
38
  yard (0.8.7.3)
19
39
 
20
40
  PLATFORMS
@@ -22,6 +42,7 @@ PLATFORMS
22
42
 
23
43
  DEPENDENCIES
24
44
  bundler (~> 1.5)
45
+ coveralls (>= 0.7)
25
46
  rake (~> 10.1)
26
47
  rdoc (~> 4.1)
27
48
  rtagstask (~> 0.0)
data/History.rdoc CHANGED
@@ -2,7 +2,21 @@
2
2
 
3
3
  = History of Changes
4
4
 
5
- === 0.9.0 / 2013-12-31
5
+ === 0.9.2 / 2014-01-03
6
+
7
+ * Yanked R0.9.1 as the History file was not updated.
8
+
9
+ * Updated the gem description.
10
+
11
+ * Changed the travis-ci build to include coverall support.
12
+
13
+ === 0.9.1 / 2014-01-03
14
+
15
+ * Updated the Gem description.
16
+
17
+ * Incorporated code coverage using the coverall gem.
18
+
19
+ === 0.9.0 / 2014-01-02
6
20
 
7
21
  This is a feature and bug-fix release.
8
22
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Rakefile - This file is part of the RubyTree package.
4
4
  #
5
- # Copyright (c) 2006, 2007, 2009, 2010, 2011, 2012, 2013 Anupam Sengupta
5
+ # Copyright (c) 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014 Anupam Sengupta
6
6
  #
7
7
  # All rights reserved.
8
8
  #
@@ -40,7 +40,13 @@ PKG_VER = GEM_SPEC.version
40
40
  GEM_NAME = "#{PKG_NAME}-#{PKG_VER}.gem"
41
41
 
42
42
  desc "Default Task (Run the tests)"
43
- task :default => 'test:unit'
43
+ task :default do
44
+ if ENV["COVERAGE"]
45
+ Rake::Task["test:coverage"].invoke
46
+ else
47
+ Rake::Task["test:unit"].invoke
48
+ end
49
+ end
44
50
 
45
51
  desc "Display the current gem version"
46
52
  task :version do
@@ -108,6 +114,11 @@ namespace :test do # ................................ Test related
108
114
  example.warning = false
109
115
  end
110
116
 
117
+ desc "Run the code coverage"
118
+ task :coverage do
119
+ ruby 'test/run_test.rb'
120
+ end
121
+
111
122
  begin
112
123
  require 'rcov/rcovtask'
113
124
  Rcov::RcovTask.new(:rcov) do |t|
data/lib/tree/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Author:: Anupam Sengupta (anupamsg@gmail.com)
6
6
  #
7
- # Copyright (c) 2012, 2013 Anupam Sengupta
7
+ # Copyright (c) 2012, 2013, 2014 Anupam Sengupta
8
8
  #
9
9
  # All rights reserved.
10
10
  #
@@ -37,5 +37,5 @@
37
37
  #
38
38
  module Tree
39
39
  # Rubytree Package Version
40
- VERSION = '0.9.0'
40
+ VERSION = '0.9.2'
41
41
  end
data/test/run_test.rb ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # run_test.rb:: Run all the tests from the Ruby command line.
4
+ #
5
+ # Author: Anupam Sengupta
6
+ # Time-stamp: <2014-01-03 21:15:37 anupam>
7
+ # Copyright (C) 2014 Anupam Sengupta <anupamsg@gmail.com>
8
+ #
9
+ # Redistribution and use in source and binary forms, with or without modification,
10
+ # are permitted provided that the following conditions are met:
11
+ #
12
+ # - Redistributions of source code must retain the above copyright notice, this
13
+ # list of conditions and the following disclaimer.
14
+ #
15
+ # - Redistributions in binary form must reproduce the above copyright notice, this
16
+ # list of conditions and the following disclaimer in the documentation and/or
17
+ # other materials provided with the distribution.
18
+ #
19
+ # - Neither the name of the organization nor the names of its contributors may
20
+ # be used to endorse or promote products derived from this software without
21
+ # specific prior written permission.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
27
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ #
34
+
35
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
36
+ lib_dir = File.join(base_dir, "lib")
37
+ test_dir = File.join(base_dir, "test")
38
+
39
+ $LOAD_PATH.unshift(lib_dir)
40
+
41
+ if ENV["COVERAGE"]
42
+ begin
43
+ require 'simplecov'
44
+ require 'coveralls'
45
+
46
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
47
+
48
+ SimpleCov.start do
49
+ add_filter '/test/'
50
+ add_group 'Core Classes', '/lib/.*tree.rb'
51
+ add_group 'Internal Utilities', '/lib/tree/utils/.*.rb'
52
+ end
53
+ rescue LoadError => e
54
+ puts "Could not load simplecov; continuing without code coverage"
55
+ end
56
+ end
57
+
58
+ require 'test/unit'
59
+
60
+ exit Test::Unit::AutoRunner.run(true, test_dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anupam Sengupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2012-08-21 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: structured_warnings
@@ -94,15 +94,31 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.0'
97
- description: |2
98
- RubyTree is a Ruby implementation of the generic tree data structure.
99
- It provides a node-based model to store uniquely identifiable node-elements
100
- in the tree and simple APIs to access, modify and traverse the structure.
101
- RubyTree is node-centric, where individual nodes on the tree are the primary
102
- compositional and structural elements.
97
+ description: |2+
98
+
99
+ RubyTree is a pure Ruby implementation of the generic tree data structure. It
100
+ provides a node-based model to store named nodes in the tree, and provides
101
+ simple APIs to access, modify and traverse the structure.
102
+
103
+ The implementation is node-centric, where individual nodes in the tree are the
104
+ primary structural elements. All common tree-traversal methods (pre-order,
105
+ post-order, and breadth-first) are supported.
106
+
107
+ The library mixes in the Enumerable and Comparable modules to allow access to
108
+ the tree as a standard collection (iteration, comparison, etc.).
109
+
110
+ A Binary tree is also provided, which provides the in-order traversal in
111
+ addition to the other methods.
112
+
113
+ RubyTree supports importing from, and exporting to JSON, and also supports the
114
+ Ruby's standard object marshaling.
115
+
116
+ This is a BSD licensed open source project, and is hosted at
117
+ http://github.com/evolve75/RubyTree, and is available as a standard gem from
118
+ http://rubygems.org/gems/rubytree.
119
+
120
+ The home page for RubyTree is at http://rubytree.rubyforge.org.
103
121
 
104
- This implementation also mixes in the Enumerable module to allow standard
105
- access to the tree as a collection.
106
122
  email: anupamsg@gmail.com
107
123
  executables: []
108
124
  extensions: []
@@ -120,7 +136,6 @@ files:
120
136
  - LICENSE.md
121
137
  - README.md
122
138
  - Rakefile
123
- - TAGS
124
139
  - TODO.org
125
140
  - examples/example_basic.rb
126
141
  - lib/rubytree.rb
@@ -133,6 +148,7 @@ files:
133
148
  - lib/tree/utils/tree_merge_handler.rb
134
149
  - lib/tree/utils/utils.rb
135
150
  - lib/tree/version.rb
151
+ - test/run_test.rb
136
152
  - test/test_binarytree.rb
137
153
  - test/test_rubytree_require.rb
138
154
  - test/test_subclassed_node.rb
data/TAGS DELETED
@@ -1,218 +0,0 @@
1
-
2
- ../.dir-locals.el,0
3
-
4
- ../examples/example_basic.rb,0
5
-
6
- ../lib/rubytree.rb,0
7
-
8
- ../lib/tree/binarytree.rb,544
9
- module TreeTree43,1900
10
- class BinaryTreeNode < TreeNodeBinaryTreeNode52,2207
11
- def left_childleft_child62,2488
12
- def right_childright_child74,2879
13
- def is_left_child?is_left_child?83,3155
14
- def is_right_child?is_right_child?93,3486
15
- def add(child)add110,4143
16
- def inordered_each(&block)inordered_each128,4662
17
- def set_child_at(child, at_index)set_child_at159,5598
18
- def left_child=(child)left_child=178,6266
19
- def right_child=(child)right_child=190,6635
20
- def swap_childrenswap_children195,6781
21
-
22
- ../lib/tree/tree_deps.rb,0
23
-
24
- ../lib/tree/utils/camel_case_method_handler.rb,271
25
- module Tree::UtilsTree41,1848
26
- module CamelCaseMethodHandlerCamelCaseMethodHandler44,2002
27
- def self.included(base)included45,2034
28
- def method_missing(meth, *args, &blk)method_missing49,2180
29
- def to_snake_case(camel_cased_word)to_snake_case66,2792
30
-
31
- ../lib/tree/utils/json_converter.rb,263
32
- module Tree::Utils::JSONConverterTree42,1899
33
- def self.included(base)included44,1934
34
- def as_json(options = {})as_json61,2385
35
- def to_json(*a)to_json89,3093
36
- module ClassMethodsClassMethods94,3243
37
- def json_create(json_hash)json_create113,3956
38
-
39
- ../lib/tree/utils/metrics_methods.rb,451
40
- module Tree::UtilsTree41,1833
41
- module TreeMetricsHandlerTreeMetricsHandler43,1916
42
- def self.included(base)included44,1944
43
- def sizesize56,2311
44
- def lengthlength67,2655
45
- def node_heightnode_height80,3072
46
- def node_depthnode_depth96,3683
47
- def levellevel105,3869
48
- def depthdepth124,4554
49
- def breadthbreadth140,5191
50
- def in_degreein_degree154,5654
51
- def out_degreeout_degree165,5967
52
-
53
- ../lib/tree/utils/tree_merge_handler.rb,259
54
- module Tree::Utils::TreeMergeHandlerTree40,1769
55
- def merge(other_tree)merge57,2498
56
- def merge!(other_tree)merge!72,3132
57
- def check_merge_prerequisites(other_tree)check_merge_prerequisites85,3439
58
- def merge_trees(tree1, tree2)merge_trees102,4084
59
-
60
- ../lib/tree/utils/utils.rb,32
61
- module Tree::UtilsTree39,1838
62
-
63
- ../lib/tree/version.rb,25
64
- module TreeTree38,1717
65
-
66
- ../lib/tree.rb,2022
67
- module TreeTree53,2335
68
- class TreeNodeTreeNode90,3884
69
- def rootroot131,5161
70
- def is_root?is_root?142,5467
71
- def has_content?has_content?150,5650
72
- def is_leaf?is_leaf?161,5904
73
- def parentageparentage173,6279
74
- def has_children?has_children?191,6705
75
- def initialize(name, content = nil)initialize214,7531
76
- def detached_copydetached_copy232,8148
77
- def detached_subtree_copydetached_subtree_copy242,8434
78
- def marshal_dumpmarshal_dump256,8873
79
- def create_dump_rep # :nodoc:create_dump_rep262,9041
80
- def marshal_load(dumped_tree_array)marshal_load277,9579
81
- def to_sto_s302,10363
82
- def <<(child)<<325,11134
83
- def add(child, at_index = -1)add360,12640
84
- def insertion_rangeinsertion_range379,13509
85
- def remove!(child)remove!401,14296
86
- def parent=(parent) # :nodoc:parent=416,14699
87
- def remove_from_parent!remove_from_parent!429,15084
88
- def remove_all!remove_all!440,15456
89
- def set_as_root! # :nodoc:set_as_root!451,15685
90
- def freeze_tree!freeze_tree!461,16011
91
- def [](name_or_index, num_as_name=false)[]501,17529
92
- def each(&block) # :yields: nodeeach526,18496
93
- def preordered_each(&block) # :yields: nodepreordered_each554,19456
94
- def postordered_each(&block)postordered_each566,19868
95
- def breadth_each(&block)breadth_each602,21294
96
- def childrenchildren628,22232
97
- def each_leaf &blockeach_leaf649,22853
98
- def first_childfirst_child666,23275
99
- def last_childlast_child674,23486
100
- def first_siblingfirst_sibling690,23933
101
- def is_first_sibling?is_first_sibling?700,24207
102
- def last_siblinglast_sibling714,24623
103
- def is_last_sibling?is_last_sibling?724,24893
104
- def siblingssiblings740,25446
105
- def is_only_child?is_only_child?759,25998
106
- def next_siblingnext_sibling772,26401
107
- def previous_siblingprevious_sibling788,26875
108
- def <=>(other)<=>804,27386
109
- def print_tree(level = 0)print_tree812,27615
110
-
111
- ../test/test_binarytree.rb,798
112
- module TestTreeTestTree39,1717
113
- class TestBinaryTreeNode < Test::Unit::TestCaseTestBinaryTreeNode41,1774
114
- def setupsetup44,1864
115
- def teardownteardown52,2167
116
- def test_initializetest_initialize59,2326
117
- def test_addtest_add67,2715
118
- def test_inordered_eachtest_inordered_each90,3629
119
- def test_left_childtest_left_child134,5097
120
- def test_right_childtest_right_child142,5410
121
- def test_left_child_equalstest_left_child_equals150,5723
122
- def test_right_child_equalstest_right_child_equals169,6713
123
- def test_is_left_child_ehtest_is_left_child_eh189,7830
124
- def test_is_right_child_ehtest_is_right_child_eh204,8369
125
- def test_swap_childrentest_swap_children218,8915
126
- def test_old_camelCase_method_namestest_old_camelCase_method_names236,9798
127
-
128
- ../test/test_rubytree_require.rb,180
129
- module TestTreeTestTree38,1678
130
- class TestRequireRubytree < Test::Unit::TestCaseTestRequireRubytree41,1757
131
- def test_create_a_simple_nodetest_create_a_simple_node44,1880
132
-
133
- ../test/test_subclassed_node.rb,301
134
- module TestTreeTestTree39,1688
135
- class TestSubclassedTreeNode < Test::Unit::TestCaseTestSubclassedTreeNode42,1739
136
- class MyNode < Tree::TreeNodeMyNode45,1864
137
- def my_dummy_methodmy_dummy_method47,1961
138
- def test_subclassed_camelcase_methodstest_subclassed_camelcase_methods52,2022
139
-
140
- ../test/test_thread_and_fiber.rb,331
141
- module TestTreeTestTree39,1695
142
- class TestFiberAndThreadOnNode < Test::Unit::TestCaseTestFiberAndThreadOnNode41,1745
143
- def create_long_depth_trees(depth=100)create_long_depth_trees44,1839
144
- def test_fiber_for_recursiontest_fiber_for_recursion59,2256
145
- def test_thread_for_recursiontest_thread_for_recursion73,2803
146
-
147
- ../test/test_tree.rb,3873
148
- module TestTreeTestTree39,1719
149
- class TestTreeNode < Test::Unit::TestCaseTestTreeNode41,1769
150
- def setupsetup65,2600
151
- def setup_test_treesetup_test_tree77,3020
152
- def teardownteardown84,3170
153
- def test_has_version_numbertest_has_version_number89,3262
154
- def test_root_setuptest_root_setup94,3413
155
- def test_roottest_root111,4463
156
- def test_has_content_ehtest_has_content_eh124,5013
157
- def test_length_is_sizetest_length_is_size135,5471
158
- def test_spaceshiptest_spaceship141,5661
159
- def test_is_comparabletest_is_comparable167,6444
160
- def test_to_stest_to_s185,7226
161
- def test_first_siblingtest_first_sibling218,8944
162
- def test_is_first_sibling_ehtest_is_first_sibling_eh231,9672
163
- def test_is_last_sibling_ehtest_is_last_sibling_eh242,10155
164
- def test_last_siblingtest_last_sibling253,10623
165
- def test_siblingstest_siblings265,11277
166
- def test_is_only_child_ehtest_is_only_child_eh293,12200
167
- def test_next_siblingtest_next_sibling304,12636
168
- def test_previous_siblingtest_previous_sibling315,13136
169
- def test_addtest_add326,13665
170
- def test_add_at_specific_positiontest_add_at_specific_position350,14474
171
- def test_remove_bangtest_remove_bang414,17527
172
- def test_remove_all_bangtest_remove_all_bang446,18490
173
- def test_remove_from_parent_bangtest_remove_from_parent_bang456,18796
174
- def test_childrentest_children475,19511
175
- def test_first_childtest_first_child511,21100
176
- def test_last_childtest_last_child520,21428
177
- def test_findtest_find529,21744
178
- def test_parentagetest_parentage544,22339
179
- def test_eachtest_each553,22671
180
- def test_each_leaftest_each_leaf572,23355
181
- def test_parenttest_parent599,24550
182
- def test_indexed_accesstest_indexed_access610,24969
183
- def test_print_treetest_print_tree621,25342
184
- def test_marshal_dumptest_marshal_dump628,25502
185
- def test_collecttest_collect673,27745
186
- def test_freeze_tree_bangtest_freeze_tree_bang683,28011
187
- def test_contenttest_content697,28533
188
- def test_depthtest_depth705,28924
189
- def do_deprecated_depthdo_deprecated_depth716,29297
190
- def test_node_heighttest_node_height734,29865
191
- def test_node_depthtest_node_depth759,31074
192
- def test_leveltest_level772,31511
193
- def test_breadthtest_breadth787,32054
194
- def test_breadth_eachtest_breadth_each806,32701
195
- def test_preordered_eachtest_preordered_each847,34007
196
- def test_postordered_eachtest_postordered_each886,35261
197
- def test_detached_copytest_detached_copy925,36516
198
- def test_detached_subtree_copytest_detached_subtree_copy942,37244
199
- def test_has_children_ehtest_has_children_eh976,39496
200
- def test_is_leaf_ehtest_is_leaf_eh982,39658
201
- def test_is_root_ehtest_is_root_eh989,39864
202
- def test_content_equalstest_content_equals995,40027
203
- def test_sizetest_size1003,40292
204
- def test_lt2 # Test the << methodtest_lt21012,40556
205
- def test_index # Test the [] methodtest_index1023,41048
206
- def test_in_degreetest_in_degree1044,42144
207
- def test_out_degreetest_out_degree1055,42611
208
- def test_json_serializationtest_json_serialization1066,43098
209
- def test_json_deserializationtest_json_deserialization1090,43898
210
- def test_json_roundtriptest_json_roundtrip1118,45084
211
- def test_old_camelCase_method_namestest_old_camelCase_method_names1134,45825
212
- def test_integer_node_namestest_integer_node_names1165,46893
213
- def test_add_node_to_self_as_childtest_add_node_to_self_as_child1196,48123
214
- def test_single_node_becomes_leaftest_single_node_becomes_leaf1208,48548
215
- def test_unique_node_namestest_unique_node_names1219,48895
216
- def setup_other_test_treesetup_other_test_tree1227,49139
217
- def test_mergetest_merge1255,50128
218
- def test_merge_bangtest_merge_bang1284,51566