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