summaryrefslogtreecommitdiffstats
path: root/vendor/gems/rubytree-0.5.2/Rakefile
blob: 814fb026ec467423c2d80b09c1f1d4162e86fd69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# 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.
#