Skip to content

Commit

Permalink
Merge pull request #68 from evolve75/cleanup_and_gemfile_update
Browse files Browse the repository at this point in the history
Cleanup and gemfile update. Releasing 1.0.0
  • Loading branch information
evolve75 authored Dec 21, 2017
2 parents db48c35 + f8ff7df commit 01a50f9
Show file tree
Hide file tree
Showing 28 changed files with 821 additions and 824 deletions.
16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@ before_install:
bundler_args: --without development

rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- 2.2.1
# - ruby-head # The latest Ruby, whatever version it happens to be.
# - jruby-18mode
# - jruby-19mode

- 2.2.9
- 2.3.6
- 2.4.3

matrix:
allow_failures:
- rvm: rbx # rbx is still troublesome.
include:
- rvm: rbx
gemfile: gemfiles/Gemfile.rbx
- rvm: 2.1.5
env: COVERAGE=true
# - rvm: 2.4.3 #
# env: COVERAGE=true #
exclude:
- rvm: rbx
gemfile: Gemfile
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
89 changes: 37 additions & 52 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,83 +1,68 @@
PATH
remote: .
specs:
rubytree (0.9.7)
json (~> 1.8)
structured_warnings (~> 0.2)
rubytree (1.0.0)
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.16)
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
1.16.0
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
README.md
Copyright (C) 2006-2015 Anupam Sengupta ([email protected])
Copyright (C) 2006-2017 Anupam Sengupta ([email protected])
-->
# **RubyTree** #
Expand Down Expand Up @@ -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][] 2.2.x, 2.3.x or 2.4.x


* Run-time Dependencies:
Expand Down Expand Up @@ -244,8 +244,8 @@ A big thanks to the following contributors for helping improve **RubyTree**:
[BSD]: http://opensource.org/licenses/bsd-license.php "BSD License"
[Binary tree]: http://en.wikipedia.org/wiki/Binary_tree "Binary Tree Data Structure"
[Bundler]: http://bundler.io "Bundler"
[Comparable]: http://ruby-doc.org/core-1.8.7/Comparable.html "Comparable mix-in"
[Enumerable]: http://ruby-doc.org/core-1.9.3/Enumerable.html "Enumerable mix-in"
[Comparable]: http://ruby-doc.org/core-2.4.2/Comparable.html "Comparable mix-in"
[Enumerable]: http://ruby-doc.org/core-2.4.2/Enumerable.html "Enumerable mix-in"
[JSON]: http://flori.github.com/json "JSON"
[Rake]: https://rubygems.org/gems/rake "Rake"
[Ruby]: http://www.ruby-lang.org "Ruby Programming Language"
Expand All @@ -254,7 +254,7 @@ A big thanks to the following contributors for helping improve **RubyTree**:
[breadth-first]: http://en.wikipedia.org/wiki/Breadth-first_search "Breadth-first (level-first) Traversal"
[git]: http://git-scm.com "Git SCM"
[in-order]: http://en.wikipedia.org/wiki/Tree_traversal#In-order "In-order (symmetric) Traversal"
[marshaling]: http://ruby-doc.org/core-1.8.7/Marshal.html "Marshaling in Ruby"
[marshaling]: http://ruby-doc.org/core-2.4.2/Marshal.html "Marshaling in Ruby"
[post-order]: http://en.wikipedia.org/wiki/Tree_traversal#Post-order "Post-ordered Traversal"
[pre-order]: http://en.wikipedia.org/wiki/Tree_traversal#Pre-order "Pre-ordered Traversal"
[rt@github]: http://github.com/evolve75/RubyTree "RubyTree Project Page on Github"
Expand Down
38 changes: 19 additions & 19 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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.
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions examples/example_basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/rubytree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

require "tree.rb"
require 'tree.rb'
Loading

0 comments on commit 01a50f9

Please sign in to comment.