Redmine/vendor/gems/rubytree-0.5.2/Rakefile

213 lines
6.7 KiB
Ruby

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