To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / vendor / gems / rubytree-0.5.2 / Rakefile @ 442:753f1380d6bc
History | View | Annotate | Download (6.69 KB)
| 1 |
# Rakefile
|
|---|---|
| 2 |
#
|
| 3 |
# $Revision: 1.27 $ by $Author: anupamsg $
|
| 4 |
# $Name: $
|
| 5 |
#
|
| 6 |
# Copyright (c) 2006, 2007 Anupam Sengupta
|
| 7 |
#
|
| 8 |
# All rights reserved.
|
| 9 |
#
|
| 10 |
# Redistribution and use in source and binary forms, with or without modification,
|
| 11 |
# are permitted provided that the following conditions are met:
|
| 12 |
#
|
| 13 |
# - Redistributions of source code must retain the above copyright notice, this
|
| 14 |
# list of conditions and the following disclaimer.
|
| 15 |
#
|
| 16 |
# - Redistributions in binary form must reproduce the above copyright notice, this
|
| 17 |
# list of conditions and the following disclaimer in the documentation and/or
|
| 18 |
# other materials provided with the distribution.
|
| 19 |
#
|
| 20 |
# - Neither the name of the organization nor the names of its contributors may
|
| 21 |
# be used to endorse or promote products derived from this software without
|
| 22 |
# specific prior written permission.
|
| 23 |
#
|
| 24 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 25 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 26 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 27 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
| 28 |
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 29 |
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 30 |
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
| 31 |
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 32 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 33 |
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 34 |
#
|
| 35 |
|
| 36 |
require 'rubygems'
|
| 37 |
require 'rake/gempackagetask'
|
| 38 |
|
| 39 |
require 'rake/clean'
|
| 40 |
require 'rake/packagetask'
|
| 41 |
require 'rake/testtask'
|
| 42 |
require 'rake/rdoctask'
|
| 43 |
|
| 44 |
require 'fileutils'
|
| 45 |
|
| 46 |
# General Stuff ####################################################
|
| 47 |
|
| 48 |
$:.insert 0, File.expand_path( File.join( File.dirname(__FILE__), 'lib' ) ) |
| 49 |
require 'tree' # To read the version information. |
| 50 |
|
| 51 |
PKG_NAME = "rubytree" |
| 52 |
PKG_VERSION = Tree::VERSION |
| 53 |
PKG_FULLNAME = PKG_NAME + "-" + PKG_VERSION |
| 54 |
PKG_SUMMARY = "Ruby implementation of the Tree data structure." |
| 55 |
PKG_DESCRIPTION = <<-END |
| 56 |
Provides a generic tree data-structure with ability to
|
| 57 |
store keyed node-elements in the tree. The implementation
|
| 58 |
mixes in the Enumerable module.
|
| 59 |
|
| 60 |
Website: http://rubytree.rubyforge.org/
|
| 61 |
END
|
| 62 |
|
| 63 |
PKG_FILES = FileList[ |
| 64 |
'[A-Z]*',
|
| 65 |
'*.rb',
|
| 66 |
'lib/**/*.rb',
|
| 67 |
'test/**/*.rb'
|
| 68 |
] |
| 69 |
|
| 70 |
# Default is to create a rubygem.
|
| 71 |
desc "Default Task"
|
| 72 |
task :default => :gem |
| 73 |
|
| 74 |
begin # Try loading hoe |
| 75 |
require 'hoe'
|
| 76 |
# If Hoe is found, use it to define tasks
|
| 77 |
# =======================================
|
| 78 |
Hoe.new(PKG_NAME, PKG_VERSION) do |p| |
| 79 |
p.rubyforge_name = PKG_NAME
|
| 80 |
p.author = "Anupam Sengupta"
|
| 81 |
p.email = "anupamsg@gmail.com"
|
| 82 |
p.summary = PKG_SUMMARY
|
| 83 |
p.description = PKG_DESCRIPTION
|
| 84 |
p.url = "http://rubytree.rubyforge.org/"
|
| 85 |
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") |
| 86 |
p.remote_rdoc_dir = 'rdoc'
|
| 87 |
p.need_tar = true
|
| 88 |
p.need_zip = true
|
| 89 |
p.test_globs = ['test/test_*.rb']
|
| 90 |
p.spec_extras = {
|
| 91 |
:has_rdoc => true, |
| 92 |
:platform => Gem::Platform::RUBY, |
| 93 |
:has_rdoc => true, |
| 94 |
:extra_rdoc_files => ['README', 'COPYING', 'ChangeLog', 'History.txt'], |
| 95 |
:rdoc_options => ['--main', 'README'], |
| 96 |
:autorequire => 'tree' |
| 97 |
} |
| 98 |
end
|
| 99 |
|
| 100 |
rescue LoadError # If Hoe is not found |
| 101 |
# If Hoe is not found, then use the usual Gemspec based Rake tasks
|
| 102 |
# ================================================================
|
| 103 |
spec = Gem::Specification.new do |s| |
| 104 |
s.name = PKG_NAME
|
| 105 |
s.version = PKG_VERSION
|
| 106 |
s.platform = Gem::Platform::RUBY |
| 107 |
s.author = "Anupam Sengupta"
|
| 108 |
s.email = "anupamsg@gmail.com"
|
| 109 |
s.homepage = "http://rubytree.rubyforge.org/"
|
| 110 |
s.rubyforge_project = 'rubytree'
|
| 111 |
s.summary = PKG_SUMMARY
|
| 112 |
s.add_dependency('rake', '>= 0.7.2') |
| 113 |
s.description = PKG_DESCRIPTION
|
| 114 |
s.has_rdoc = true
|
| 115 |
s.extra_rdoc_files = ['README', 'COPYING', 'ChangeLog'] |
| 116 |
s.autorequire = "tree"
|
| 117 |
s.files = PKG_FILES.to_a
|
| 118 |
s.test_files = Dir.glob('test/test*.rb') |
| 119 |
end
|
| 120 |
|
| 121 |
desc "Prepares for installation"
|
| 122 |
task :prepare do |
| 123 |
ruby "setup.rb config"
|
| 124 |
ruby "setup.rb setup"
|
| 125 |
end
|
| 126 |
|
| 127 |
desc "Installs the package #{PKG_NAME}"
|
| 128 |
task :install => [:prepare] do |
| 129 |
ruby "setup.rb install"
|
| 130 |
end
|
| 131 |
|
| 132 |
Rake::GemPackageTask.new(spec) do |pkg| |
| 133 |
pkg.need_zip = true
|
| 134 |
pkg.need_tar = true
|
| 135 |
end
|
| 136 |
|
| 137 |
Rake::TestTask.new do |t| |
| 138 |
t.libs << "test"
|
| 139 |
t.test_files = FileList['test/test*.rb'] |
| 140 |
t.verbose = true
|
| 141 |
end
|
| 142 |
|
| 143 |
end # End loading Hoerc |
| 144 |
# ================================================================
|
| 145 |
|
| 146 |
|
| 147 |
# The following tasks are loaded independently of Hoe
|
| 148 |
|
| 149 |
# Hoe's rdoc task is ugly.
|
| 150 |
Rake::RDocTask.new(:docs) do |rd| |
| 151 |
rd.rdoc_files.include("README", "COPYING", "ChangeLog", "lib/**/*.rb") |
| 152 |
rd.rdoc_dir = 'doc'
|
| 153 |
rd.title = "#{PKG_FULLNAME} Documentation"
|
| 154 |
|
| 155 |
# Use the template only if it is present, otherwise, the standard template is
|
| 156 |
# used.
|
| 157 |
template = "../allison/allison.rb"
|
| 158 |
rd.template = template if File.file?(template) |
| 159 |
|
| 160 |
rd.options << '--line-numbers' << '--inline-source' |
| 161 |
end
|
| 162 |
|
| 163 |
# Optional TAGS Task.
|
| 164 |
# Needs https://rubyforge.org/projects/rtagstask/
|
| 165 |
begin
|
| 166 |
require 'rtagstask'
|
| 167 |
RTagsTask.new do |rd| |
| 168 |
rd.vi = false
|
| 169 |
end
|
| 170 |
rescue LoadError |
| 171 |
end
|
| 172 |
|
| 173 |
# Optional RCOV Task
|
| 174 |
# Needs http://eigenclass.org/hiki/rcov
|
| 175 |
begin
|
| 176 |
require 'rcov/rcovtask'
|
| 177 |
Rcov::RcovTask.new do |t| |
| 178 |
t.test_files = FileList['test/test*.rb'] |
| 179 |
t.rcov_opts << "--exclude 'rcov.rb'" # rcov itself should not be profiled |
| 180 |
# t.verbose = true # uncomment to see the executed commands
|
| 181 |
end
|
| 182 |
rescue LoadError |
| 183 |
end
|
| 184 |
|
| 185 |
#Rakefile,v $
|
| 186 |
# Revision 1.21 2007/07/21 05:14:43 anupamsg
|
| 187 |
# Added a VERSION constant to the Tree module,
|
| 188 |
# and using the same in the Rakefile.
|
| 189 |
#
|
| 190 |
# Revision 1.20 2007/07/21 03:24:25 anupamsg
|
| 191 |
# Minor edits to parameter names. User visible functionality does not change.
|
| 192 |
#
|
| 193 |
# Revision 1.19 2007/07/19 02:16:01 anupamsg
|
| 194 |
# Release 0.4.0 (and minor fix in Rakefile).
|
| 195 |
#
|
| 196 |
# Revision 1.18 2007/07/18 20:15:06 anupamsg
|
| 197 |
# Added two predicate methods in BinaryTreeNode to determine whether a node
|
| 198 |
# is a left or a right node.
|
| 199 |
#
|
| 200 |
# Revision 1.17 2007/07/18 07:17:34 anupamsg
|
| 201 |
# Fixed a issue where TreeNode.ancestors was shadowing Module.ancestors. This method
|
| 202 |
# has been renamed to TreeNode.parentage.
|
| 203 |
#
|
| 204 |
# Revision 1.16 2007/07/17 05:34:03 anupamsg
|
| 205 |
# Added an optional tags Rake-task for generating the TAGS file for Emacs.
|
| 206 |
#
|
| 207 |
# Revision 1.15 2007/07/17 04:42:45 anupamsg
|
| 208 |
# Minor fixes to the Rakefile.
|
| 209 |
#
|
| 210 |
# Revision 1.14 2007/07/17 03:39:28 anupamsg
|
| 211 |
# Moved the CVS Log keyword to end of the files.
|
| 212 |
#
|