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