Permalink
Browse files

Merge 792f0ae into db48c35

  • Loading branch information...
evolve75 committed Dec 21, 2017
2 parents db48c35 + 792f0ae commit 40ba3bd1ce5861e9e2ed85bff4e24b7fc971ed40
View
@@ -4,10 +4,10 @@ source 'https://rubygems.org'
gemspec
group :development, :test do
gem "rake", "~> 10.4"
gem "test-unit", "~> 3.0"
gem "coveralls", ">= 0.7", :require => false, :platforms => :mri_21
gem "rspec", ">= 3.4"
gem 'rake', '~> 10.4'
gem 'test-unit', '~> 3.0'
gem 'coveralls', '>= 0.7', :require => false, :platforms => :mri_21
gem 'rspec', '>= 3.4'
end
# Local Variables:
View
@@ -2,82 +2,67 @@ PATH
remote: .
specs:
rubytree (0.9.7)
json (~> 1.8)
structured_warnings (~> 0.2)
json (~> 2.1)
structured_warnings (~> 0.3)
GEM
remote: https://rubygems.org/
specs:
coveralls (0.8.10)
json (~> 1.8)
rest-client (>= 1.6.8, < 2)
simplecov (~> 0.11.0)
coveralls (0.8.21)
json (>= 1.8, < 3)
simplecov (~> 0.14.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
tins (~> 1.6.0)
diff-lcs (1.2.5)
thor (~> 0.19.4)
tins (~> 1.6)
diff-lcs (1.3)
docile (1.1.5)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
json (1.8.3)
mime-types (2.99)
netrc (0.11.0)
power_assert (0.2.6)
rake (10.4.2)
rdoc (4.2.1)
json (~> 1.4)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.1)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
json (2.1.0)
power_assert (1.1.1)
rake (10.5.0)
rdoc (6.0.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
rtags (0.97)
rtagstask (0.0.4)
rtags (> 0.0.0)
simplecov (0.11.1)
simplecov (0.14.1)
docile (~> 1.1.0)
json (~> 1.8)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
structured_warnings (0.2.0)
term-ansicolor (1.3.2)
simplecov-html (0.10.2)
structured_warnings (0.3.0)
term-ansicolor (1.6.0)
tins (~> 1.0)
test-unit (3.1.5)
test-unit (3.2.7)
power_assert
thor (0.19.1)
tins (1.6.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
yard (0.8.7.6)
thor (0.19.4)
tins (1.16.3)
yard (0.9.12)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.7)
bundler (~> 1.10)
coveralls (>= 0.7)
rake (~> 10.4)
rdoc (~> 4.2)
rdoc (~> 6.0)
rspec (>= 3.4)
rtagstask (~> 0.0)
rubytree!
test-unit (~> 3.0)
yard (~> 0.8)
yard (~> 0.9)
BUNDLED WITH
1.10.2
View
@@ -1,7 +1,7 @@
<!--
README.md
Copyright (C) 2006-2015 Anupam Sengupta (anupamsg@gmail.com)
Copyright (C) 2006-2015, 2017 Anupam Sengupta (anupamsg@gmail.com)
-->
# **RubyTree** #
@@ -120,7 +120,7 @@ This example can also be found at
## REQUIREMENTS: ##
* [Ruby][] 1.8.x, 1.9.x, 2.0.x, or 2.1.x.
* [Ruby][] 1.8.x, 1.9.x, 2.0.x, 2.1.x or 2.4.x.x
* Run-time Dependencies:
View
@@ -33,23 +33,23 @@
#
require 'rubygems'
GEM_SPEC = eval(File.read("rubytree.gemspec")) # Load the gemspec.
GEM_SPEC = eval(File.read('./rubytree.gemspec')) # Load the gemspec.
PKG_NAME = GEM_SPEC.name
PKG_VER = GEM_SPEC.version
GEM_NAME = "#{PKG_NAME}-#{PKG_VER}.gem"
desc "Default Task (Run the tests)"
desc 'Default Task (Run the tests)'
task :default do
if ENV["COVERAGE"]
Rake::Task["test:coverage"].invoke
if ENV['COVERAGE']
Rake::Task['test:coverage'].invoke
else
Rake::Task["test:unit"].invoke
Rake::Task["spec"].invoke
Rake::Task['test:unit'].invoke
Rake::Task['spec'].invoke
end
end
desc "Display the current gem version"
desc 'Display the current gem version'
task :version do
puts "Current Version: #{GEM_NAME}"
end
@@ -59,21 +59,21 @@ task :clean => 'gem:clobber_package'
CLEAN.include('coverage')
task :clobber => [:clean, 'doc:clobber_rdoc', 'doc:clobber_yard']
desc "Open an irb session preloaded with this library"
desc 'Open an irb session preloaded with this library'
task :console do
sh "irb -rubygems -r ./lib/tree.rb"
sh 'irb -rubygems -r ./lib/tree.rb'
end
namespace :doc do # ................................ Documentation
begin
gem 'rdoc', ">= 2.4.2" # To get around a stupid bug in Ruby 1.9.2 Rake.
gem 'rdoc', '>= 2.4.2' # To get around a stupid bug in Ruby 1.9.2 Rake.
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "#{PKG_NAME}-#{PKG_VER}"
rdoc.main = 'README.rdoc'
rdoc.rdoc_files.include(GEM_SPEC.extra_rdoc_files)
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.include('./lib/**/*.rb')
end
rescue LoadError
# Oh well.
@@ -83,19 +83,19 @@ namespace :doc do # ................................ Documentation
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', '-', GEM_SPEC.extra_rdoc_files]
t.options = ['--no-private', '--embed-mixins']
t.options = %w(--no-private --embed-mixins)
end
rescue LoadError
# Oh well.
end
desc "Remove YARD Documentation"
desc 'Remove YARD Documentation'
task :clobber_yard do
rm_rf 'doc'
end
end
desc "Run the test cases"
desc 'Run the test cases'
task :test => 'test:unit'
namespace :test do # ................................ Test related
@@ -107,23 +107,23 @@ namespace :test do # ................................ Test related
test.verbose = false
end
desc "Run the examples"
desc 'Run the examples'
Rake::TestTask.new(:examples) do |example|
example.libs << 'lib' << 'examples'
example.pattern = 'examples/**/example_*.rb'
example.verbose = true
example.warning = false
end
desc "Run the code coverage"
desc 'Run the code coverage'
task :coverage do
ruby 'test/run_test.rb'
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new(:rcov) do |t|
t.libs << "test"
t.libs << 'test'
t.test_files = FileList['test/**/test_*.rb']
t.verbose = true
t.rcov_opts << '--exclude /gems/,/Library/,/usr/,spec,lib/tasks'
@@ -139,7 +139,7 @@ begin # ................................ rspec tests
RSpec::Core::RakeTask.new(:spec) do |t|
t.fail_on_error = false
t.rspec_opts = ["--color", "--format doc"]
t.rspec_opts = ['--color', '--format doc']
end
rescue LoadError
# Cannot load rspec.
@@ -164,7 +164,7 @@ namespace :gem do # ................................ Gem related
pkg.need_tar = true
end
desc "Push the gem into the Rubygems repository"
desc 'Push the gem into the Rubygems repository'
task :push => :gem do
sh "gem push pkg/#{GEM_NAME}"
end
View
@@ -26,19 +26,19 @@
require 'tree' # Load the library
# ..... Create the root node first. Note that every node has a name and an optional content payload.
root_node = Tree::TreeNode.new("ROOT", "Root Content")
root_node = Tree::TreeNode.new('ROOT', 'Root Content')
root_node.print_tree
# ..... Now insert the child nodes. Note that you can "chain" the child insertions for a given path to any depth.
root_node << Tree::TreeNode.new("CHILD1", "Child1 Content") << Tree::TreeNode.new("GRANDCHILD1", "GrandChild1 Content")
root_node << Tree::TreeNode.new("CHILD2", "Child2 Content")
root_node << Tree::TreeNode.new('CHILD1', 'Child1 Content') << Tree::TreeNode.new('GRANDCHILD1', 'GrandChild1 Content')
root_node << Tree::TreeNode.new('CHILD2', 'Child2 Content')
# ..... Lets print the representation to stdout. This is primarily used for debugging purposes.
root_node.print_tree
# ..... Lets directly access children and grandchildren of the root. The can be "chained" for a given path to any depth.
child1 = root_node["CHILD1"]
grand_child1 = root_node["CHILD1"]["GRANDCHILD1"]
child1 = root_node['CHILD1']
grand_child1 = root_node['CHILD1']['GRANDCHILD1']
# ..... Now lets retrieve siblings of the current node as an array.
siblings_of_child1 = child1.siblings
View
@@ -38,4 +38,4 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
require "tree.rb"
require 'tree.rb'
Oops, something went wrong.

0 comments on commit 40ba3bd

Please sign in to comment.