author | Mahlon E. Smith <mahlon@martini.nu> |
Thu, 25 Dec 2008 07:33:20 +0000 | |
branch | mahlon-misc |
changeset 10 | b1426511fb64 |
parent 9 | 4c51ebe6e9b6 |
permissions | -rw-r--r-- |
0 | 1 |
#!rake |
2 |
# |
|
3 |
# jparallel rakefile |
|
4 |
# |
|
5 |
# Based on various other Rakefiles, especially one by Ben Bleything |
|
6 |
# |
|
7 |
# Copyright (c) 2008 The FaerieMUD Consortium |
|
8 |
# |
|
9 |
# Authors: |
|
9
4c51ebe6e9b6
* Add a mkrf monkeypatch so BSD build flags are generated correctly.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
10 |
# * Michael Granger and Mahlon Smith <ged@FaerieMUD.org, mahlon@martini.nu> |
0 | 11 |
# |
12 |
||
13 |
BEGIN { |
|
14 |
require 'pathname' |
|
15 |
basedir = Pathname.new( __FILE__ ).dirname |
|
16 |
||
17 |
libdir = basedir + "lib" |
|
18 |
extdir = basedir + "ext" |
|
19 |
||
20 |
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s ) |
|
21 |
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s ) |
|
22 |
} |
|
23 |
||
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
24 |
require 'rubygems' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
25 |
gem 'rake', '>= 0.8.3' |
0 | 26 |
|
27 |
require 'rbconfig' |
|
28 |
require 'rake' |
|
29 |
require 'rake/rdoctask' |
|
30 |
require 'rake/testtask' |
|
31 |
require 'rake/packagetask' |
|
32 |
require 'rake/clean' |
|
33 |
||
34 |
$dryrun = false |
|
35 |
||
36 |
### Config constants |
|
37 |
BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd ) |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
38 |
BINDIR = BASEDIR + 'bin' |
0 | 39 |
LIBDIR = BASEDIR + 'lib' |
40 |
EXTDIR = BASEDIR + 'ext' |
|
41 |
DOCSDIR = BASEDIR + 'docs' |
|
42 |
PKGDIR = BASEDIR + 'pkg' |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
43 |
DATADIR = BASEDIR + 'data' |
0 | 44 |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
45 |
PROJECT_NAME = 'jparallel' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
46 |
PKG_NAME = PROJECT_NAME.downcase |
0 | 47 |
PKG_SUMMARY = 'A "parallel jail shell" written in Ruby' |
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
48 |
|
0 | 49 |
VERSION_FILE = LIBDIR + 'jparallel.rb' |
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
50 |
if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL'] |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
51 |
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
52 |
elsif VERSION_FILE.exist? |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
53 |
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
54 |
else |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
55 |
PKG_VERSION = '0.0.0' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
56 |
end |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
57 |
|
0 | 58 |
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}" |
59 |
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem" |
|
60 |
||
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
61 |
EXTCONF = EXTDIR + 'extconf.rb' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
62 |
|
0 | 63 |
ARTIFACTS_DIR = Pathname.new( ENV['CC_BUILD_ARTIFACTS'] || 'artifacts' ) |
64 |
||
65 |
TEXT_FILES = %w( Rakefile ChangeLog README LICENSE ).collect {|filename| BASEDIR + filename } |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
66 |
BIN_FILES = Pathname.glob( BINDIR + '*' ).delete_if {|item| item =~ /\.svn/ } |
0 | 67 |
LIB_FILES = Pathname.glob( LIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ } |
68 |
EXT_FILES = Pathname.glob( EXTDIR + '**/*.{c,h,rb}' ).delete_if {|item| item =~ /\.svn/ } |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
69 |
DATA_FILES = Pathname.glob( DATADIR + '**/*' ).delete_if {|item| item =~ /\.svn/ } |
0 | 70 |
|
71 |
SPECDIR = BASEDIR + 'spec' |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
72 |
SPECLIBDIR = SPECDIR + 'lib' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
73 |
SPEC_FILES = Pathname.glob( SPECDIR + '**/*_spec.rb' ).delete_if {|item| item =~ /\.svn/ } + |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
74 |
Pathname.glob( SPECLIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ } |
0 | 75 |
|
76 |
TESTDIR = BASEDIR + 'tests' |
|
77 |
TEST_FILES = Pathname.glob( TESTDIR + '**/*.tests.rb' ).delete_if {|item| item =~ /\.svn/ } |
|
78 |
||
79 |
RAKE_TASKDIR = BASEDIR + 'rake' |
|
80 |
RAKE_TASKLIBS = Pathname.glob( RAKE_TASKDIR + '*.rb' ) |
|
81 |
||
82 |
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local' |
|
83 |
||
84 |
EXTRA_PKGFILES = [] |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
85 |
EXTRA_PKGFILES.concat Pathname.glob( BASEDIR + 'examples/*.{c,rb}' ).delete_if {|item| item =~ /\.svn/ } |
9
4c51ebe6e9b6
* Add a mkrf monkeypatch so BSD build flags are generated correctly.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
86 |
EXTRA_PKGFILES.concat Pathname.glob( BASEDIR + 'misc/monkeypatches.rb' ).delete_if {|item| item =~ /\.svn/ } |
0 | 87 |
|
88 |
RELEASE_FILES = TEXT_FILES + |
|
89 |
SPEC_FILES + |
|
90 |
TEST_FILES + |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
91 |
BIN_FILES + |
0 | 92 |
LIB_FILES + |
93 |
EXT_FILES + |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
94 |
DATA_FILES + |
0 | 95 |
RAKE_TASKLIBS + |
96 |
EXTRA_PKGFILES |
|
97 |
||
98 |
RELEASE_FILES << LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist? |
|
99 |
||
100 |
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0 |
|
101 |
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib' |
|
102 |
RCOV_OPTS = [ |
|
103 |
'--exclude', RCOV_EXCLUDES, |
|
104 |
'--xrefs', |
|
105 |
'--save', |
|
106 |
'--callsites', |
|
107 |
#'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0 |
|
108 |
] |
|
109 |
||
110 |
||
111 |
# Subversion constants -- directory names for releases and tags |
|
112 |
SVN_TRUNK_DIR = 'trunk' |
|
113 |
SVN_RELEASES_DIR = 'releases' |
|
114 |
SVN_BRANCHES_DIR = 'branches' |
|
115 |
SVN_TAGS_DIR = 'tags' |
|
116 |
||
117 |
SVN_DOTDIR = BASEDIR + '.svn' |
|
118 |
SVN_ENTRIES = SVN_DOTDIR + 'entries' |
|
119 |
||
120 |
||
121 |
### Load some task libraries that need to be loaded early |
|
122 |
require RAKE_TASKDIR + 'helpers.rb' |
|
123 |
require RAKE_TASKDIR + 'svn.rb' |
|
124 |
require RAKE_TASKDIR + 'verifytask.rb' |
|
125 |
||
126 |
# Define some constants that depend on the 'svn' tasklib |
|
127 |
PKG_BUILD = get_svn_rev( BASEDIR ) || 0 |
|
128 |
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}" |
|
129 |
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem" |
|
130 |
||
131 |
# Documentation constants |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
132 |
RDOCDIR = DOCSDIR + 'api' |
0 | 133 |
RDOC_OPTIONS = [ |
134 |
'-w', '4', |
|
135 |
'-SHN', |
|
136 |
'-i', '.', |
|
137 |
'-m', 'README', |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
138 |
'-W', 'http://deveiate.org/projects/jParallel//browser/trunk/' |
0 | 139 |
] |
140 |
||
141 |
# Release constants |
|
142 |
SMTP_HOST = 'mail.faeriemud.org' |
|
143 |
SMTP_PORT = 465 # SMTP + SSL |
|
144 |
||
145 |
# Project constants |
|
146 |
PROJECT_HOST = 'deveiate.org' |
|
147 |
PROJECT_PUBDIR = "/usr/local/www/public/code" |
|
148 |
PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}" |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
149 |
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}" |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
150 |
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}" |
0 | 151 |
|
152 |
# Rubyforge stuff |
|
153 |
RUBYFORGE_GROUP = 'deveiate' |
|
154 |
RUBYFORGE_PROJECT = 'jparallel' |
|
155 |
||
156 |
# Gem dependencies: gemname => version |
|
157 |
DEPENDENCIES = { |
|
158 |
} |
|
159 |
||
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
160 |
# Developer Gem dependencies: gemname => version |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
161 |
DEVELOPMENT_DEPENDENCIES = { |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
162 |
'amatch' => '>= 0.2.3', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
163 |
'rake' => '>= 0.8.1', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
164 |
'rcodetools' => '>= 0.7.0.0', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
165 |
'rcov' => '>= 0', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
166 |
'RedCloth' => '>= 4.0.3', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
167 |
'rspec' => '>= 0', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
168 |
'rubyforge' => '>= 0', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
169 |
'termios' => '>= 0', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
170 |
'text-format' => '>= 1.0.0', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
171 |
'tmail' => '>= 1.2.3.1', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
172 |
'ultraviolet' => '>= 0.10.2', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
173 |
'libxml-ruby' => '>= 0.8.3', |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
174 |
} |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
175 |
|
0 | 176 |
# Non-gem requirements: packagename => version |
177 |
REQUIREMENTS = { |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
178 |
'FreeBSD' => '>= 5.0', |
0 | 179 |
} |
180 |
||
181 |
# RubyGem specification |
|
182 |
GEMSPEC = Gem::Specification.new do |gem| |
|
183 |
gem.name = PKG_NAME.downcase |
|
184 |
gem.version = PKG_VERSION |
|
185 |
||
186 |
gem.summary = PKG_SUMMARY |
|
187 |
gem.description = <<-EOD |
|
188 |
This is shell that can be used to interact with multiple FreeBSD jail instances |
|
189 |
simultaneously. It includes a Ruby binding to the FreeBSD jail(2) functions. |
|
190 |
EOD |
|
191 |
||
9
4c51ebe6e9b6
* Add a mkrf monkeypatch so BSD build flags are generated correctly.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
192 |
gem.authors = 'Michael Granger and Mahlon Smith' |
0 | 193 |
gem.email = 'ged@FaerieMUD.org, mahlon@martini.nu' |
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
194 |
gem.homepage = 'http://deveiate.org/projects/jParallel/' |
0 | 195 |
gem.rubyforge_project = RUBYFORGE_PROJECT |
196 |
||
197 |
gem.has_rdoc = true |
|
198 |
gem.rdoc_options = RDOC_OPTIONS |
|
199 |
||
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
200 |
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
201 |
|
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
202 |
if EXTCONF.exist? |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
203 |
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
204 |
end |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
205 |
|
0 | 206 |
gem.files = RELEASE_FILES. |
207 |
collect {|f| f.relative_path_from(BASEDIR).to_s } |
|
208 |
gem.test_files = SPEC_FILES. |
|
209 |
collect {|f| f.relative_path_from(BASEDIR).to_s } |
|
210 |
||
211 |
DEPENDENCIES.each do |name, version| |
|
212 |
version = '>= 0' if version.length.zero? |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
213 |
gem.add_runtime_dependency( name, version ) |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
214 |
end |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
215 |
|
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
216 |
# Developmental dependencies don't work as of RubyGems 1.2.0 |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
217 |
unless Gem::Version.new( Gem::RubyGemsVersion ) <= Gem::Version.new( "1.2.0" ) |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
218 |
DEVELOPMENT_DEPENDENCIES.each do |name, version| |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
219 |
version = '>= 0' if version.length.zero? |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
220 |
gem.add_development_dependency( name, version ) |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
221 |
end |
0 | 222 |
end |
223 |
||
224 |
REQUIREMENTS.each do |name, version| |
|
225 |
gem.requirements << [ name, version ].compact.join(' ') |
|
226 |
end |
|
227 |
end |
|
228 |
||
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
229 |
# Manual-generation config |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
230 |
MANUALDIR = DOCSDIR + 'manual' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
231 |
|
0 | 232 |
$trace = Rake.application.options.trace ? true : false |
233 |
$dryrun = Rake.application.options.dryrun ? true : false |
|
234 |
||
235 |
||
236 |
# Load any remaining task libraries |
|
237 |
RAKE_TASKLIBS.each do |tasklib| |
|
238 |
next if tasklib =~ %r{/(helpers|svn|verifytask)\.rb$} |
|
239 |
begin |
|
240 |
require tasklib |
|
241 |
rescue ScriptError => err |
|
242 |
fail "Task library '%s' failed to load: %s: %s" % |
|
243 |
[ tasklib, err.class.name, err.message ] |
|
244 |
trace "Backtrace: \n " + err.backtrace.join( "\n " ) |
|
245 |
rescue => err |
|
246 |
log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." % |
|
247 |
[ tasklib, err.class.name, err.message ] |
|
248 |
trace "Backtrace: \n " + err.backtrace.join( "\n " ) |
|
249 |
end |
|
250 |
end |
|
251 |
||
252 |
# Load any project-specific rules defined in 'Rakefile.local' if it exists |
|
253 |
import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist? |
|
254 |
||
255 |
||
256 |
##################################################################### |
|
257 |
### T A S K S |
|
258 |
##################################################################### |
|
259 |
||
260 |
### Default task |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
261 |
task :default => [:clean, :local, :spec, :rdoc, :package] |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
262 |
|
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
263 |
### Task the local Rakefile can append to -- no-op by default |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
264 |
task :local |
0 | 265 |
|
266 |
||
267 |
### Task: clean |
|
268 |
CLEAN.include 'coverage' |
|
269 |
CLOBBER.include 'artifacts', 'coverage.info', PKGDIR |
|
270 |
||
271 |
# Target to hinge on ChangeLog updates |
|
272 |
file SVN_ENTRIES |
|
273 |
||
274 |
### Task: changelog |
|
275 |
file 'ChangeLog' => SVN_ENTRIES.to_s do |task| |
|
276 |
log "Updating #{task.name}" |
|
277 |
||
278 |
changelog = make_svn_changelog() |
|
279 |
File.open( task.name, 'w' ) do |fh| |
|
280 |
fh.print( changelog ) |
|
281 |
end |
|
282 |
end |
|
283 |
||
284 |
||
285 |
### Task: cruise (Cruisecontrol task) |
|
286 |
desc "Cruisecontrol build" |
|
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
287 |
task :cruise => [:clean, 'spec:quiet', :package] do |task| |
0 | 288 |
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty? |
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
289 |
artifact_dir = ARTIFACTS_DIR.cleanpath + ENV['CC_BUILD_LABEL'] |
0 | 290 |
artifact_dir.mkpath |
291 |
||
10
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
292 |
coverage = BASEDIR + 'coverage' |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
293 |
if coverage.exist? && coverage.directory? |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
294 |
$stderr.puts "Copying coverage stats..." |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
295 |
FileUtils.cp_r( 'coverage', artifact_dir ) |
b1426511fb64
Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
296 |
end |
0 | 297 |
|
298 |
$stderr.puts "Copying packages..." |
|
299 |
FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir ) |
|
300 |
end |
|
301 |
||
302 |
||
303 |
desc "Update the build system to the latest version" |
|
304 |
task :update_build do |
|
305 |
log "Updating the build system" |
|
306 |
sh 'svn', 'up', RAKE_TASKDIR |
|
307 |
log "Updating the Rakefile" |
|
308 |
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile' |
|
309 |
end |
|
310 |