Chris@0: # Rakefile Chris@0: # Chris@0: # $Revision: 1.27 $ by $Author: anupamsg $ Chris@0: # $Name: $ Chris@0: # Chris@0: # Copyright (c) 2006, 2007 Anupam Sengupta Chris@0: # Chris@0: # All rights reserved. Chris@0: # Chris@0: # Redistribution and use in source and binary forms, with or without modification, Chris@0: # are permitted provided that the following conditions are met: Chris@0: # Chris@0: # - Redistributions of source code must retain the above copyright notice, this Chris@0: # list of conditions and the following disclaimer. Chris@0: # Chris@0: # - Redistributions in binary form must reproduce the above copyright notice, this Chris@0: # list of conditions and the following disclaimer in the documentation and/or Chris@0: # other materials provided with the distribution. Chris@0: # Chris@0: # - Neither the name of the organization nor the names of its contributors may Chris@0: # be used to endorse or promote products derived from this software without Chris@0: # specific prior written permission. Chris@0: # Chris@0: # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" Chris@0: # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Chris@0: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE Chris@0: # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR Chris@0: # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES Chris@0: # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; Chris@0: # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON Chris@0: # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT Chris@0: # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS Chris@0: # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Chris@0: # Chris@0: Chris@0: require 'rubygems' Chris@0: require 'rake/gempackagetask' Chris@0: Chris@0: require 'rake/clean' Chris@0: require 'rake/packagetask' Chris@0: require 'rake/testtask' Chris@0: require 'rake/rdoctask' Chris@0: Chris@0: require 'fileutils' Chris@0: Chris@0: # General Stuff #################################################### Chris@0: Chris@0: $:.insert 0, File.expand_path( File.join( File.dirname(__FILE__), 'lib' ) ) Chris@0: require 'tree' # To read the version information. Chris@0: Chris@0: PKG_NAME = "rubytree" Chris@0: PKG_VERSION = Tree::VERSION Chris@0: PKG_FULLNAME = PKG_NAME + "-" + PKG_VERSION Chris@0: PKG_SUMMARY = "Ruby implementation of the Tree data structure." Chris@0: PKG_DESCRIPTION = <<-END Chris@0: Provides a generic tree data-structure with ability to Chris@0: store keyed node-elements in the tree. The implementation Chris@0: mixes in the Enumerable module. Chris@0: Chris@0: Website: http://rubytree.rubyforge.org/ Chris@0: END Chris@0: Chris@0: PKG_FILES = FileList[ Chris@0: '[A-Z]*', Chris@0: '*.rb', Chris@0: 'lib/**/*.rb', Chris@0: 'test/**/*.rb' Chris@0: ] Chris@0: Chris@0: # Default is to create a rubygem. Chris@0: desc "Default Task" Chris@0: task :default => :gem Chris@0: Chris@0: begin # Try loading hoe Chris@0: require 'hoe' Chris@0: # If Hoe is found, use it to define tasks Chris@0: # ======================================= Chris@0: Hoe.new(PKG_NAME, PKG_VERSION) do |p| Chris@0: p.rubyforge_name = PKG_NAME Chris@0: p.author = "Anupam Sengupta" Chris@0: p.email = "anupamsg@gmail.com" Chris@0: p.summary = PKG_SUMMARY Chris@0: p.description = PKG_DESCRIPTION Chris@0: p.url = "http://rubytree.rubyforge.org/" Chris@0: p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") Chris@0: p.remote_rdoc_dir = 'rdoc' Chris@0: p.need_tar = true Chris@0: p.need_zip = true Chris@0: p.test_globs = ['test/test_*.rb'] Chris@0: p.spec_extras = { Chris@0: :has_rdoc => true, Chris@0: :platform => Gem::Platform::RUBY, Chris@0: :has_rdoc => true, Chris@0: :extra_rdoc_files => ['README', 'COPYING', 'ChangeLog', 'History.txt'], Chris@0: :rdoc_options => ['--main', 'README'], Chris@0: :autorequire => 'tree' Chris@0: } Chris@0: end Chris@0: Chris@0: rescue LoadError # If Hoe is not found Chris@0: # If Hoe is not found, then use the usual Gemspec based Rake tasks Chris@0: # ================================================================ Chris@0: spec = Gem::Specification.new do |s| Chris@0: s.name = PKG_NAME Chris@0: s.version = PKG_VERSION Chris@0: s.platform = Gem::Platform::RUBY Chris@0: s.author = "Anupam Sengupta" Chris@0: s.email = "anupamsg@gmail.com" Chris@0: s.homepage = "http://rubytree.rubyforge.org/" Chris@0: s.rubyforge_project = 'rubytree' Chris@0: s.summary = PKG_SUMMARY Chris@0: s.add_dependency('rake', '>= 0.7.2') Chris@0: s.description = PKG_DESCRIPTION Chris@0: s.has_rdoc = true Chris@0: s.extra_rdoc_files = ['README', 'COPYING', 'ChangeLog'] Chris@0: s.autorequire = "tree" Chris@0: s.files = PKG_FILES.to_a Chris@0: s.test_files = Dir.glob('test/test*.rb') Chris@0: end Chris@0: Chris@0: desc "Prepares for installation" Chris@0: task :prepare do Chris@0: ruby "setup.rb config" Chris@0: ruby "setup.rb setup" Chris@0: end Chris@0: Chris@0: desc "Installs the package #{PKG_NAME}" Chris@0: task :install => [:prepare] do Chris@0: ruby "setup.rb install" Chris@0: end Chris@0: Chris@0: Rake::GemPackageTask.new(spec) do |pkg| Chris@0: pkg.need_zip = true Chris@0: pkg.need_tar = true Chris@0: end Chris@0: Chris@0: Rake::TestTask.new do |t| Chris@0: t.libs << "test" Chris@0: t.test_files = FileList['test/test*.rb'] Chris@0: t.verbose = true Chris@0: end Chris@0: Chris@0: end # End loading Hoerc Chris@0: # ================================================================ Chris@0: Chris@0: Chris@0: # The following tasks are loaded independently of Hoe Chris@0: Chris@0: # Hoe's rdoc task is ugly. Chris@0: Rake::RDocTask.new(:docs) do |rd| Chris@0: rd.rdoc_files.include("README", "COPYING", "ChangeLog", "lib/**/*.rb") Chris@0: rd.rdoc_dir = 'doc' Chris@0: rd.title = "#{PKG_FULLNAME} Documentation" Chris@0: Chris@0: # Use the template only if it is present, otherwise, the standard template is Chris@0: # used. Chris@0: template = "../allison/allison.rb" Chris@0: rd.template = template if File.file?(template) Chris@0: Chris@0: rd.options << '--line-numbers' << '--inline-source' Chris@0: end Chris@0: Chris@0: # Optional TAGS Task. Chris@0: # Needs https://rubyforge.org/projects/rtagstask/ Chris@0: begin Chris@0: require 'rtagstask' Chris@0: RTagsTask.new do |rd| Chris@0: rd.vi = false Chris@0: end Chris@0: rescue LoadError Chris@0: end Chris@0: Chris@0: # Optional RCOV Task Chris@0: # Needs http://eigenclass.org/hiki/rcov Chris@0: begin Chris@0: require 'rcov/rcovtask' Chris@0: Rcov::RcovTask.new do |t| Chris@0: t.test_files = FileList['test/test*.rb'] Chris@0: t.rcov_opts << "--exclude 'rcov.rb'" # rcov itself should not be profiled Chris@0: # t.verbose = true # uncomment to see the executed commands Chris@0: end Chris@0: rescue LoadError Chris@0: end Chris@0: Chris@0: #Rakefile,v $ Chris@0: # Revision 1.21 2007/07/21 05:14:43 anupamsg Chris@0: # Added a VERSION constant to the Tree module, Chris@0: # and using the same in the Rakefile. Chris@0: # Chris@0: # Revision 1.20 2007/07/21 03:24:25 anupamsg Chris@0: # Minor edits to parameter names. User visible functionality does not change. Chris@0: # Chris@0: # Revision 1.19 2007/07/19 02:16:01 anupamsg Chris@0: # Release 0.4.0 (and minor fix in Rakefile). Chris@0: # Chris@0: # Revision 1.18 2007/07/18 20:15:06 anupamsg Chris@0: # Added two predicate methods in BinaryTreeNode to determine whether a node Chris@0: # is a left or a right node. Chris@0: # Chris@0: # Revision 1.17 2007/07/18 07:17:34 anupamsg Chris@0: # Fixed a issue where TreeNode.ancestors was shadowing Module.ancestors. This method Chris@0: # has been renamed to TreeNode.parentage. Chris@0: # Chris@0: # Revision 1.16 2007/07/17 05:34:03 anupamsg Chris@0: # Added an optional tags Rake-task for generating the TAGS file for Emacs. Chris@0: # Chris@0: # Revision 1.15 2007/07/17 04:42:45 anupamsg Chris@0: # Minor fixes to the Rakefile. Chris@0: # Chris@0: # Revision 1.14 2007/07/17 03:39:28 anupamsg Chris@0: # Moved the CVS Log keyword to end of the files. Chris@0: #