jimweirich-rake 0.8.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +364 -0
- data/MIT-LICENSE +21 -0
- data/README +242 -0
- data/Rakefile +413 -0
- data/TODO +20 -0
- data/bin/rake +31 -0
- data/doc/example/Rakefile1 +38 -0
- data/doc/example/Rakefile2 +35 -0
- data/doc/example/a.c +6 -0
- data/doc/example/b.c +6 -0
- data/doc/example/main.c +11 -0
- data/doc/glossary.rdoc +51 -0
- data/doc/jamis.rb +591 -0
- data/doc/proto_rake.rdoc +127 -0
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +411 -0
- data/doc/rational.rdoc +151 -0
- data/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/install.rb +88 -0
- data/lib/rake/classic_namespace.rb +8 -0
- data/lib/rake/clean.rb +33 -0
- data/lib/rake/contrib/compositepublisher.rb +24 -0
- data/lib/rake/contrib/ftptools.rb +153 -0
- data/lib/rake/contrib/publisher.rb +75 -0
- data/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/lib/rake/contrib/sshpublisher.rb +47 -0
- data/lib/rake/contrib/sys.rb +209 -0
- data/lib/rake/gempackagetask.rb +103 -0
- data/lib/rake/loaders/makefile.rb +40 -0
- data/lib/rake/packagetask.rb +184 -0
- data/lib/rake/rake_test_loader.rb +5 -0
- data/lib/rake/rdoctask.rb +147 -0
- data/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/lib/rake/runtest.rb +23 -0
- data/lib/rake/tasklib.rb +18 -0
- data/lib/rake/testtask.rb +161 -0
- data/lib/rake.rb +2312 -0
- data/test/capture_stdout.rb +26 -0
- data/test/contrib/testsys.rb +47 -0
- data/test/data/chains/Rakefile +15 -0
- data/test/data/default/Rakefile +19 -0
- data/test/data/dryrun/Rakefile +22 -0
- data/test/data/file_creation_task/Rakefile +30 -0
- data/test/data/imports/Rakefile +19 -0
- data/test/data/imports/deps.mf +1 -0
- data/test/data/multidesc/Rakefile +17 -0
- data/test/data/namespace/Rakefile +57 -0
- data/test/data/rakelib/test1.rb +3 -0
- data/test/data/rbext/rakefile.rb +3 -0
- data/test/data/sample.mf +9 -0
- data/test/data/statusreturn/Rakefile +8 -0
- data/test/data/unittest/Rakefile +1 -0
- data/test/filecreation.rb +32 -0
- data/test/functional.rb +15 -0
- data/test/rake_test_setup.rb +5 -0
- data/test/reqfile.rb +3 -0
- data/test/reqfile2.rb +3 -0
- data/test/session_functional.rb +267 -0
- data/test/shellcommand.rb +3 -0
- data/test/test_application.rb +504 -0
- data/test/test_clean.rb +14 -0
- data/test/test_definitions.rb +82 -0
- data/test/test_earlytime.rb +35 -0
- data/test/test_extension.rb +63 -0
- data/test/test_file_creation_task.rb +62 -0
- data/test/test_file_task.rb +139 -0
- data/test/test_filelist.rb +618 -0
- data/test/test_fileutils.rb +239 -0
- data/test/test_ftp.rb +59 -0
- data/test/test_invocation_chain.rb +75 -0
- data/test/test_makefile_loader.rb +23 -0
- data/test/test_multitask.rb +45 -0
- data/test/test_namespace.rb +36 -0
- data/test/test_package_task.rb +116 -0
- data/test/test_pathmap.rb +209 -0
- data/test/test_rake.rb +34 -0
- data/test/test_require.rb +33 -0
- data/test/test_rules.rb +347 -0
- data/test/test_task_arguments.rb +76 -0
- data/test/test_task_manager.rb +148 -0
- data/test/test_tasks.rb +372 -0
- data/test/test_test_task.rb +75 -0
- data/test/test_top_level_functions.rb +84 -0
- metadata +173 -0
data/Rakefile
ADDED
@@ -0,0 +1,413 @@
|
|
1
|
+
# Rakefile for rake -*- ruby -*-
|
2
|
+
|
3
|
+
# Copyright 2003, 2004, 2005 by Jim Weirich (jim@weirichhouse.org)
|
4
|
+
# All rights reserved.
|
5
|
+
|
6
|
+
# This file may be distributed under an MIT style license. See
|
7
|
+
# MIT-LICENSE for details.
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'rubygems'
|
11
|
+
require 'rake/gempackagetask'
|
12
|
+
rescue Exception
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
require 'rake/clean'
|
16
|
+
require 'rake/testtask'
|
17
|
+
require 'rake/rdoctask'
|
18
|
+
|
19
|
+
CLEAN.include('**/*.o', '*.dot')
|
20
|
+
CLOBBER.include('doc/example/main', 'testdata')
|
21
|
+
CLOBBER.include('test/data/**/temp_*')
|
22
|
+
CLOBBER.include('test/data/chains/play.*')
|
23
|
+
CLOBBER.include('test/data/file_creation_task/build')
|
24
|
+
CLOBBER.include('test/data/file_creation_task/src')
|
25
|
+
CLOBBER.include('TAGS')
|
26
|
+
CLOBBER.include('coverage', 'rcov_aggregate')
|
27
|
+
|
28
|
+
# Prevent OS X from including extended attribute junk in the tar output
|
29
|
+
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
|
30
|
+
|
31
|
+
def announce(msg='')
|
32
|
+
STDERR.puts msg
|
33
|
+
end
|
34
|
+
|
35
|
+
# Determine the current version of the software
|
36
|
+
|
37
|
+
if `ruby -Ilib ./bin/rake --version` =~ /rake, version ([0-9.]+)$/
|
38
|
+
CURRENT_VERSION = $1
|
39
|
+
else
|
40
|
+
CURRENT_VERSION = "0.0.0"
|
41
|
+
end
|
42
|
+
|
43
|
+
$package_version = CURRENT_VERSION
|
44
|
+
|
45
|
+
SRC_RB = FileList['lib/**/*.rb']
|
46
|
+
|
47
|
+
# The default task is run if rake is given no explicit arguments.
|
48
|
+
|
49
|
+
desc "Default Task"
|
50
|
+
task :default => :test_all
|
51
|
+
|
52
|
+
# Test Tasks ---------------------------------------------------------
|
53
|
+
task :dbg do |t|
|
54
|
+
puts "Arguments are: #{t.args.join(', ')}"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Common Abbreviations ...
|
58
|
+
|
59
|
+
task :ta => :test_all
|
60
|
+
task :tf => :test_functional
|
61
|
+
task :tu => :test_units
|
62
|
+
task :tc => :test_contribs
|
63
|
+
task :test => :test_units
|
64
|
+
|
65
|
+
Rake::TestTask.new(:test_all) do |t|
|
66
|
+
t.test_files = FileList[
|
67
|
+
'test/test*.rb',
|
68
|
+
'test/contrib/test*.rb',
|
69
|
+
'test/fun*.rb'
|
70
|
+
]
|
71
|
+
t.warning = true
|
72
|
+
t.verbose = false
|
73
|
+
end
|
74
|
+
|
75
|
+
Rake::TestTask.new(:test_units) do |t|
|
76
|
+
t.test_files = FileList['test/test*.rb']
|
77
|
+
t.warning = true
|
78
|
+
t.verbose = false
|
79
|
+
end
|
80
|
+
|
81
|
+
Rake::TestTask.new(:test_functional) do |t|
|
82
|
+
t.test_files = FileList['test/fun*.rb']
|
83
|
+
t.warning = true
|
84
|
+
t.verbose = false
|
85
|
+
end
|
86
|
+
|
87
|
+
Rake::TestTask.new(:test_contribs) do |t|
|
88
|
+
t.test_files = FileList['test/contrib/test*.rb']
|
89
|
+
t.warning = true
|
90
|
+
t.verbose = false
|
91
|
+
end
|
92
|
+
|
93
|
+
begin
|
94
|
+
require 'rcov/rcovtask'
|
95
|
+
|
96
|
+
Rcov::RcovTask.new do |t|
|
97
|
+
t.libs << "test"
|
98
|
+
t.rcov_opts = [
|
99
|
+
'-xRakefile', '-xrakefile', '-xpublish.rf', '--text-report',
|
100
|
+
]
|
101
|
+
t.test_files = FileList[
|
102
|
+
'test/test*.rb', 'test/functional.rb'
|
103
|
+
]
|
104
|
+
t.output_dir = 'coverage'
|
105
|
+
t.verbose = true
|
106
|
+
end
|
107
|
+
rescue LoadError
|
108
|
+
puts "RCov is not available"
|
109
|
+
end
|
110
|
+
|
111
|
+
directory 'testdata'
|
112
|
+
[:test_all, :test_units, :test_contribs, :test_functional].each do |t|
|
113
|
+
task t => ['testdata']
|
114
|
+
end
|
115
|
+
|
116
|
+
# CVS Tasks ----------------------------------------------------------
|
117
|
+
|
118
|
+
# Install rake using the standard install.rb script.
|
119
|
+
|
120
|
+
desc "Install the application"
|
121
|
+
task :install do
|
122
|
+
ruby "install.rb"
|
123
|
+
end
|
124
|
+
|
125
|
+
# Create a task to build the RDOC documentation tree.
|
126
|
+
|
127
|
+
rd = Rake::RDocTask.new("rdoc") { |rdoc|
|
128
|
+
rdoc.rdoc_dir = 'html'
|
129
|
+
# rdoc.template = 'kilmer'
|
130
|
+
# rdoc.template = 'css2'
|
131
|
+
rdoc.template = 'doc/jamis.rb'
|
132
|
+
rdoc.title = "Rake -- Ruby Make"
|
133
|
+
rdoc.options << '--line-numbers' << '--inline-source' <<
|
134
|
+
'--main' << 'README' <<
|
135
|
+
'--title' << 'Rake -- Ruby Make'
|
136
|
+
rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
|
137
|
+
rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
|
138
|
+
rdoc.rdoc_files.exclude(/\bcontrib\b/)
|
139
|
+
}
|
140
|
+
|
141
|
+
# ====================================================================
|
142
|
+
# Create a task that will package the Rake software into distributable
|
143
|
+
# tar, zip and gem files.
|
144
|
+
|
145
|
+
PKG_FILES = FileList[
|
146
|
+
'install.rb',
|
147
|
+
'[A-Z]*',
|
148
|
+
'bin/**/*',
|
149
|
+
'lib/**/*.rb',
|
150
|
+
'test/**/*.rb',
|
151
|
+
'test/**/*.rf',
|
152
|
+
'test/**/*.mf',
|
153
|
+
'test/**/Rakefile',
|
154
|
+
'test/**/subdir',
|
155
|
+
'doc/**/*'
|
156
|
+
]
|
157
|
+
PKG_FILES.exclude('doc/example/*.o')
|
158
|
+
PKG_FILES.exclude(%r{doc/example/main$})
|
159
|
+
|
160
|
+
if ! defined?(Gem)
|
161
|
+
puts "Package Target requires RubyGEMs"
|
162
|
+
else
|
163
|
+
SPEC = Gem::Specification.new do |s|
|
164
|
+
|
165
|
+
#### Basic information.
|
166
|
+
|
167
|
+
s.name = 'rake'
|
168
|
+
s.version = $package_version
|
169
|
+
s.summary = "Ruby based make-like utility."
|
170
|
+
s.description = <<-EOF
|
171
|
+
Rake is a Make-like program implemented in Ruby. Tasks
|
172
|
+
and dependencies are specified in standard Ruby syntax.
|
173
|
+
EOF
|
174
|
+
|
175
|
+
#### Dependencies and requirements.
|
176
|
+
|
177
|
+
#s.add_dependency('log4r', '> 1.0.4')
|
178
|
+
#s.requirements << ""
|
179
|
+
|
180
|
+
#### Which files are to be included in this gem? Everything! (Except CVS directories.)
|
181
|
+
|
182
|
+
s.files = PKG_FILES.to_a
|
183
|
+
|
184
|
+
#### C code extensions.
|
185
|
+
|
186
|
+
#s.extensions << "ext/rmagic/extconf.rb"
|
187
|
+
|
188
|
+
#### Load-time details: library and application (you will need one or both).
|
189
|
+
|
190
|
+
s.require_path = 'lib' # Use these for libraries.
|
191
|
+
|
192
|
+
s.bindir = "bin" # Use these for applications.
|
193
|
+
s.executables = ["rake"]
|
194
|
+
s.default_executable = "rake"
|
195
|
+
|
196
|
+
#### Documentation and testing.
|
197
|
+
|
198
|
+
s.has_rdoc = true
|
199
|
+
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
|
200
|
+
s.rdoc_options = rd.options
|
201
|
+
|
202
|
+
#### Author and project details.
|
203
|
+
|
204
|
+
s.author = "Jim Weirich"
|
205
|
+
s.email = "jim@weirichhouse.org"
|
206
|
+
s.homepage = "http://rake.rubyforge.org"
|
207
|
+
s.rubyforge_project = "rake"
|
208
|
+
# if ENV['CERT_DIR']
|
209
|
+
# s.signing_key = File.join(ENV['CERT_DIR'], 'gem-private_key.pem')
|
210
|
+
# s.cert_chain = [File.join(ENV['CERT_DIR'], 'gem-public_cert.pem')]
|
211
|
+
# end
|
212
|
+
end
|
213
|
+
|
214
|
+
package_task = Rake::GemPackageTask.new(SPEC) do |pkg|
|
215
|
+
pkg.need_zip = true
|
216
|
+
pkg.need_tar = true
|
217
|
+
end
|
218
|
+
|
219
|
+
file "rake.gemspec" => "Rakefile" do |t|
|
220
|
+
require 'yaml'
|
221
|
+
open(t.name, "w") { |f| f.puts SPEC.to_yaml }
|
222
|
+
end
|
223
|
+
|
224
|
+
task :gemspec => "rake.gemspec"
|
225
|
+
end
|
226
|
+
|
227
|
+
# Misc tasks =========================================================
|
228
|
+
|
229
|
+
def count_lines(filename)
|
230
|
+
lines = 0
|
231
|
+
codelines = 0
|
232
|
+
open(filename) { |f|
|
233
|
+
f.each do |line|
|
234
|
+
lines += 1
|
235
|
+
next if line =~ /^\s*$/
|
236
|
+
next if line =~ /^\s*#/
|
237
|
+
codelines += 1
|
238
|
+
end
|
239
|
+
}
|
240
|
+
[lines, codelines]
|
241
|
+
end
|
242
|
+
|
243
|
+
def show_line(msg, lines, loc)
|
244
|
+
printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
|
245
|
+
end
|
246
|
+
|
247
|
+
desc "Count lines in the main rake file"
|
248
|
+
task :lines do
|
249
|
+
total_lines = 0
|
250
|
+
total_code = 0
|
251
|
+
show_line("File Name", "LINES", "LOC")
|
252
|
+
SRC_RB.each do |fn|
|
253
|
+
lines, codelines = count_lines(fn)
|
254
|
+
show_line(fn, lines, codelines)
|
255
|
+
total_lines += lines
|
256
|
+
total_code += codelines
|
257
|
+
end
|
258
|
+
show_line("TOTAL", total_lines, total_code)
|
259
|
+
end
|
260
|
+
|
261
|
+
# Define an optional publish target in an external file. If the
|
262
|
+
# publish.rf file is not found, the publish targets won't be defined.
|
263
|
+
|
264
|
+
load "publish.rf" if File.exist? "publish.rf"
|
265
|
+
|
266
|
+
# Support Tasks ------------------------------------------------------
|
267
|
+
|
268
|
+
RUBY_FILES = FileList['**/*.rb'].exclude('pkg')
|
269
|
+
|
270
|
+
desc "Look for TODO and FIXME tags in the code"
|
271
|
+
task :todo do
|
272
|
+
RUBY_FILES.egrep(/#.*(FIXME|TODO|TBD)/)
|
273
|
+
end
|
274
|
+
|
275
|
+
desc "Look for Debugging print lines"
|
276
|
+
task :dbg do
|
277
|
+
RUBY_FILES.egrep(/\bDBG|\bbreakpoint\b/)
|
278
|
+
end
|
279
|
+
|
280
|
+
desc "List all ruby files"
|
281
|
+
task :rubyfiles do
|
282
|
+
puts RUBY_FILES
|
283
|
+
puts FileList['bin/*'].exclude('bin/*.rb')
|
284
|
+
end
|
285
|
+
task :rf => :rubyfiles
|
286
|
+
|
287
|
+
desc "Create a TAGS file"
|
288
|
+
task :tags => "TAGS"
|
289
|
+
|
290
|
+
TAGS = 'xctags -e'
|
291
|
+
|
292
|
+
file "TAGS" => RUBY_FILES do
|
293
|
+
puts "Makings TAGS"
|
294
|
+
sh "#{TAGS} #{RUBY_FILES}", :verbose => false
|
295
|
+
end
|
296
|
+
|
297
|
+
# --------------------------------------------------------------------
|
298
|
+
# Creating a release
|
299
|
+
|
300
|
+
def plugin(plugin_name)
|
301
|
+
require "rake/plugins/#{plugin_name}"
|
302
|
+
end
|
303
|
+
|
304
|
+
task :noop
|
305
|
+
#plugin "release_manager"
|
306
|
+
|
307
|
+
desc "Make a new release"
|
308
|
+
task :release, :rel, :reuse, :reltest,
|
309
|
+
:needs => [
|
310
|
+
:prerelease,
|
311
|
+
:clobber,
|
312
|
+
:test_all,
|
313
|
+
:update_version,
|
314
|
+
:package,
|
315
|
+
:tag
|
316
|
+
] do
|
317
|
+
announce
|
318
|
+
announce "**************************************************************"
|
319
|
+
announce "* Release #{$package_version} Complete."
|
320
|
+
announce "* Packages ready to upload."
|
321
|
+
announce "**************************************************************"
|
322
|
+
announce
|
323
|
+
end
|
324
|
+
|
325
|
+
# Validate that everything is ready to go for a release.
|
326
|
+
task :prerelease, :rel, :reuse, :reltest do |t, args|
|
327
|
+
$package_version = args.rel
|
328
|
+
announce
|
329
|
+
announce "**************************************************************"
|
330
|
+
announce "* Making RubyGem Release #{$package_version}"
|
331
|
+
announce "* (current version #{CURRENT_VERSION})"
|
332
|
+
announce "**************************************************************"
|
333
|
+
announce
|
334
|
+
|
335
|
+
# Is a release number supplied?
|
336
|
+
unless args.rel
|
337
|
+
fail "Usage: rake release[X.Y.Z] [REUSE=tag_suffix]"
|
338
|
+
end
|
339
|
+
|
340
|
+
# Is the release different than the current release.
|
341
|
+
# (or is REUSE set?)
|
342
|
+
if $package_version == CURRENT_VERSION && ! args.reuse
|
343
|
+
fail "Current version is #{$package_version}, must specify REUSE=tag_suffix to reuse version"
|
344
|
+
end
|
345
|
+
|
346
|
+
# Are all source files checked in?
|
347
|
+
if args.reltest
|
348
|
+
announce "Release Task Testing, skipping checked-in file test"
|
349
|
+
else
|
350
|
+
announce "Checking for unchecked-in files..."
|
351
|
+
data = `svn st`
|
352
|
+
unless data =~ /^$/
|
353
|
+
abort "svn status is not clean ... do you have unchecked-in files?"
|
354
|
+
end
|
355
|
+
announce "No outstanding checkins found ... OK"
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
task :update_version, :rel, :reuse, :reltest,
|
360
|
+
:needs => [:prerelease] do |t, args|
|
361
|
+
if args.rel == CURRENT_VERSION
|
362
|
+
announce "No version change ... skipping version update"
|
363
|
+
else
|
364
|
+
announce "Updating Rake version to #{args.rel}"
|
365
|
+
open("lib/rake.rb") do |rakein|
|
366
|
+
open("lib/rake.rb.new", "w") do |rakeout|
|
367
|
+
rakein.each do |line|
|
368
|
+
if line =~ /^RAKEVERSION\s*=\s*/
|
369
|
+
rakeout.puts "RAKEVERSION = '#{args.rel}'"
|
370
|
+
else
|
371
|
+
rakeout.puts line
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
mv "lib/rake.rb.new", "lib/rake.rb"
|
377
|
+
if args.reltest
|
378
|
+
announce "Release Task Testing, skipping commiting of new version"
|
379
|
+
else
|
380
|
+
sh %{svn commit -m "Updated to version #{args.rel}" lib/rake.rb} # "
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
|
386
|
+
task :tag, :rel, :reuse, :reltest,
|
387
|
+
:needs => [:prerelease] do |t, args|
|
388
|
+
reltag = "REL_#{args.rel.gsub(/\./, '_')}"
|
389
|
+
reltag << args.reuse.gsub(/\./, '_') if args.reuse
|
390
|
+
announce "Tagging Repository with [#{reltag}]"
|
391
|
+
if args.reltest
|
392
|
+
announce "Release Task Testing, skipping CVS tagging"
|
393
|
+
else
|
394
|
+
sh %{svn copy svn+ssh://rubyforge.org/var/svn/rake/trunk svn+ssh://rubyforge.org/var/svn/rake/tags/#{reltag} -m 'Commiting release #{reltag}'} ###'
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
desc "Install the jamis RDoc template"
|
399
|
+
task :install_jamis_template do
|
400
|
+
require 'rbconfig'
|
401
|
+
dest_dir = File.join(Config::CONFIG['rubylibdir'], "rdoc/generators/template/html")
|
402
|
+
fail "Unabled to write to #{dest_dir}" unless File.writable?(dest_dir)
|
403
|
+
install "doc/jamis.rb", dest_dir, :verbose => true
|
404
|
+
end
|
405
|
+
|
406
|
+
# Require experimental XForge/Metaproject support.
|
407
|
+
|
408
|
+
load 'xforge.rf' if File.exist?('xforge.rf')
|
409
|
+
|
410
|
+
desc "Where is the current directory. This task displays\nthe current rake directory"
|
411
|
+
task :where_am_i do
|
412
|
+
puts Rake.original_dir
|
413
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= Rake Project -- To Do List
|
2
|
+
|
3
|
+
Send suggestions for this list to mailto:jim@weirichhouse.org or on
|
4
|
+
the rake-devel@rubyforge.org mailing list.
|
5
|
+
|
6
|
+
=== To Do
|
7
|
+
* Need a nice API for accessing tasks in namespaces, namespaces in an app, etc.
|
8
|
+
* Provide a way to disable -w warning mode.
|
9
|
+
* Define a set of default rules that work in the absense of any Rakefile
|
10
|
+
* What about cyclic dependencies?
|
11
|
+
* Java support utilities
|
12
|
+
* Installation support utilities
|
13
|
+
* Check out installpkg.rb
|
14
|
+
* Autogenerate Dependencies
|
15
|
+
* Rules should apply to existing tasks if no actions are defined.
|
16
|
+
* How to create multiple package tasks without task name collision?
|
17
|
+
* Trap "ln -s" commands that fail and use "cp" instead (SMB mounted
|
18
|
+
drives have problems with "ln -s".
|
19
|
+
|
20
|
+
(moved DONE list to CHANGES file)
|
data/bin/rake
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2003, 2004, 2005, 2006, 2007 Jim Weirich
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to
|
8
|
+
# deal in the Software without restriction, including without limitation the
|
9
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
22
|
+
# IN THE SOFTWARE.
|
23
|
+
#++
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rake'
|
27
|
+
rescue LoadError
|
28
|
+
require 'rubygems'
|
29
|
+
require 'rake'
|
30
|
+
end
|
31
|
+
Rake.application.run
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Example Rakefile -*- ruby -*-
|
2
|
+
|
3
|
+
task :default => [:main]
|
4
|
+
|
5
|
+
file "a.o" => ["a.c"] do |t|
|
6
|
+
src = t.name.sub(/\.o$/, '.c')
|
7
|
+
sh "gcc #{src} -c -o #{t.name}"
|
8
|
+
end
|
9
|
+
|
10
|
+
file "b.o" => ["b.c"] do |t|
|
11
|
+
src = t.name.sub(/\.o$/, '.c')
|
12
|
+
sh "gcc #{src} -c -o #{t.name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
file "main.o" => ["main.c"] do |t|
|
16
|
+
src = t.name.sub(/\.o$/, '.c')
|
17
|
+
sh "gcc #{src} -c -o #{t.name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
OBJFILES = ["a.o", "b.o", "main.o"]
|
21
|
+
task :obj => OBJFILES
|
22
|
+
|
23
|
+
file "main" => OBJFILES do |t|
|
24
|
+
sh "gcc -o #{t.name} main.o a.o b.o"
|
25
|
+
end
|
26
|
+
|
27
|
+
task :clean do
|
28
|
+
rm_f FileList['*.o']
|
29
|
+
Dir['*~'].each { |fn| rm_f fn }
|
30
|
+
end
|
31
|
+
|
32
|
+
task :clobber => [:clean] do
|
33
|
+
rm_f "main"
|
34
|
+
end
|
35
|
+
|
36
|
+
task :run => ["main"] do
|
37
|
+
sh "./main"
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Example Rakefile -*- ruby -*-
|
2
|
+
# Using the power of Ruby
|
3
|
+
|
4
|
+
task :default => [:main]
|
5
|
+
|
6
|
+
def ext(fn, newext)
|
7
|
+
fn.sub(/\.[^.]+$/, newext)
|
8
|
+
end
|
9
|
+
|
10
|
+
SRCFILES = Dir['*.c']
|
11
|
+
OBJFILES = SRCFILES.collect { |fn| ext(fn,".o") }
|
12
|
+
|
13
|
+
OBJFILES.each do |objfile|
|
14
|
+
srcfile = ext(objfile, ".c")
|
15
|
+
file objfile => [srcfile] do |t|
|
16
|
+
sh "gcc #{srcfile} -c -o #{t.name}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
file "main" => OBJFILES do |t|
|
21
|
+
sh "gcc -o #{t.name} main.o a.o b.o"
|
22
|
+
end
|
23
|
+
|
24
|
+
task :clean do
|
25
|
+
rm_f FileList['*.o']
|
26
|
+
Dir['*~'].each { |fn| rm_f fn }
|
27
|
+
end
|
28
|
+
|
29
|
+
task :clobber => [:clean] do
|
30
|
+
rm_f "main"
|
31
|
+
end
|
32
|
+
|
33
|
+
task :run => ["main"] do
|
34
|
+
sh "./main"
|
35
|
+
end
|
data/doc/example/a.c
ADDED
data/doc/example/b.c
ADDED
data/doc/example/main.c
ADDED
data/doc/glossary.rdoc
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
= Glossary
|
2
|
+
|
3
|
+
[<b>action</b>]
|
4
|
+
Code to be executed in order to perform a task. Actions in a
|
5
|
+
rakefile are specified in a code block (usually delimited by
|
6
|
+
+do+/+end+ pairs.
|
7
|
+
|
8
|
+
[<b>execute</b>]
|
9
|
+
When a task is executed, all of its actions are performed, in
|
10
|
+
the order they were defined. Note that unlike
|
11
|
+
<tt>invoke</tt>, <tt>execute</tt> always executes the actions
|
12
|
+
(without invoking or executing the prerequisites).
|
13
|
+
|
14
|
+
[<b>file task</b> (FileTask)]
|
15
|
+
A file task is a task whose purpose is to create a file
|
16
|
+
(which has the same name as the task). When invoked, a file
|
17
|
+
task will only execute if one or more of the following
|
18
|
+
conditions are true.
|
19
|
+
|
20
|
+
1. The associated file does not exist.
|
21
|
+
2. A prerequisite has a later time stamp than the existing file.
|
22
|
+
|
23
|
+
Because normal Tasks always have the current time as
|
24
|
+
timestamp, a FileTask that has a normal Task prerequisite
|
25
|
+
will always execute.
|
26
|
+
|
27
|
+
[<b>invoke</b>]
|
28
|
+
When a task is invoked, first we check to see if it has been
|
29
|
+
invoked before. if it has been, then nothing else is done.
|
30
|
+
If this is the first time its been invoked, then we invoke
|
31
|
+
each of its prerequisites. Finally, we check to see if we
|
32
|
+
need to execute the actions of this task by calling
|
33
|
+
<tt>needed?</tt>. Finally, if the task is needed, we execute
|
34
|
+
its actions.
|
35
|
+
|
36
|
+
NOTE: Currently prerequisites are invoked even if the task is
|
37
|
+
not needed. This may change in the future.
|
38
|
+
|
39
|
+
[<b>prerequisites</b>]
|
40
|
+
Every task has a set (possiblity empty) of prerequisites. A
|
41
|
+
prerequisite P to Task T is itself a task that must be invoked
|
42
|
+
before Task T.
|
43
|
+
|
44
|
+
[<b>rule</b>]
|
45
|
+
A rule is a recipe for synthesizing a task when no task is
|
46
|
+
explicitly defined. Rules generally synthesize file tasks.
|
47
|
+
|
48
|
+
[<b>task</b> (Task)]
|
49
|
+
Basic unit of work in a rakefile. A task has a name, a set of
|
50
|
+
prerequisites and a list of actions to be performed.
|
51
|
+
|