elliottcable-echoe 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/CHANGELOG +69 -0
  2. data/LICENSE +184 -0
  3. data/MIT-LICENSE +21 -0
  4. data/Manifest +113 -0
  5. data/README +114 -0
  6. data/Rakefile +15 -0
  7. data/TODO +4 -0
  8. data/echoe.gemspec +37 -0
  9. data/lib/echoe/client.rb +25 -0
  10. data/lib/echoe/extensions.rb +57 -0
  11. data/lib/echoe/platform.rb +36 -0
  12. data/lib/echoe/rubygems.rb +41 -0
  13. data/lib/echoe.rb +717 -0
  14. data/vendor/rake/CHANGES +400 -0
  15. data/vendor/rake/MIT-LICENSE +21 -0
  16. data/vendor/rake/README +285 -0
  17. data/vendor/rake/Rakefile +418 -0
  18. data/vendor/rake/TODO +20 -0
  19. data/vendor/rake/bin/rake +31 -0
  20. data/vendor/rake/doc/example/Rakefile1 +38 -0
  21. data/vendor/rake/doc/example/Rakefile2 +35 -0
  22. data/vendor/rake/doc/example/a.c +6 -0
  23. data/vendor/rake/doc/example/b.c +6 -0
  24. data/vendor/rake/doc/example/main.c +11 -0
  25. data/vendor/rake/doc/glossary.rdoc +51 -0
  26. data/vendor/rake/doc/jamis.rb +591 -0
  27. data/vendor/rake/doc/proto_rake.rdoc +127 -0
  28. data/vendor/rake/doc/rake.1.gz +0 -0
  29. data/vendor/rake/doc/rakefile.rdoc +534 -0
  30. data/vendor/rake/doc/rational.rdoc +151 -0
  31. data/vendor/rake/doc/release_notes/rake-0.4.14.rdoc +23 -0
  32. data/vendor/rake/doc/release_notes/rake-0.4.15.rdoc +35 -0
  33. data/vendor/rake/doc/release_notes/rake-0.5.0.rdoc +53 -0
  34. data/vendor/rake/doc/release_notes/rake-0.5.3.rdoc +78 -0
  35. data/vendor/rake/doc/release_notes/rake-0.5.4.rdoc +46 -0
  36. data/vendor/rake/doc/release_notes/rake-0.6.0.rdoc +141 -0
  37. data/vendor/rake/doc/release_notes/rake-0.7.0.rdoc +119 -0
  38. data/vendor/rake/doc/release_notes/rake-0.7.1.rdoc +59 -0
  39. data/vendor/rake/doc/release_notes/rake-0.7.2.rdoc +121 -0
  40. data/vendor/rake/doc/release_notes/rake-0.7.3.rdoc +47 -0
  41. data/vendor/rake/doc/release_notes/rake-0.8.0.rdoc +114 -0
  42. data/vendor/rake/doc/release_notes/rake-0.8.2.rdoc +165 -0
  43. data/vendor/rake/doc/release_notes/rake-0.8.3.rdoc +112 -0
  44. data/vendor/rake/install.rb +88 -0
  45. data/vendor/rake/lib/rake/classic_namespace.rb +8 -0
  46. data/vendor/rake/lib/rake/clean.rb +33 -0
  47. data/vendor/rake/lib/rake/contrib/compositepublisher.rb +24 -0
  48. data/vendor/rake/lib/rake/contrib/ftptools.rb +153 -0
  49. data/vendor/rake/lib/rake/contrib/publisher.rb +75 -0
  50. data/vendor/rake/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  51. data/vendor/rake/lib/rake/contrib/sshpublisher.rb +47 -0
  52. data/vendor/rake/lib/rake/contrib/sys.rb +209 -0
  53. data/vendor/rake/lib/rake/gempackagetask.rb +103 -0
  54. data/vendor/rake/lib/rake/loaders/makefile.rb +35 -0
  55. data/vendor/rake/lib/rake/packagetask.rb +185 -0
  56. data/vendor/rake/lib/rake/rake_test_loader.rb +5 -0
  57. data/vendor/rake/lib/rake/rdoctask.rb +147 -0
  58. data/vendor/rake/lib/rake/ruby182_test_unit_fix.rb +23 -0
  59. data/vendor/rake/lib/rake/runtest.rb +23 -0
  60. data/vendor/rake/lib/rake/tasklib.rb +23 -0
  61. data/vendor/rake/lib/rake/testtask.rb +161 -0
  62. data/vendor/rake/lib/rake/win32.rb +54 -0
  63. data/vendor/rake/lib/rake.rb +2468 -0
  64. data/vendor/rake/test/capture_stdout.rb +26 -0
  65. data/vendor/rake/test/check_expansion.rb +5 -0
  66. data/vendor/rake/test/contrib/test_sys.rb +47 -0
  67. data/vendor/rake/test/data/chains/Rakefile +15 -0
  68. data/vendor/rake/test/data/default/Rakefile +19 -0
  69. data/vendor/rake/test/data/dryrun/Rakefile +22 -0
  70. data/vendor/rake/test/data/file_creation_task/Rakefile +33 -0
  71. data/vendor/rake/test/data/imports/Rakefile +19 -0
  72. data/vendor/rake/test/data/imports/deps.mf +1 -0
  73. data/vendor/rake/test/data/multidesc/Rakefile +17 -0
  74. data/vendor/rake/test/data/namespace/Rakefile +57 -0
  75. data/vendor/rake/test/data/rakelib/test1.rb +3 -0
  76. data/vendor/rake/test/data/rbext/rakefile.rb +3 -0
  77. data/vendor/rake/test/data/sample.mf +12 -0
  78. data/vendor/rake/test/data/statusreturn/Rakefile +8 -0
  79. data/vendor/rake/test/data/unittest/Rakefile +1 -0
  80. data/vendor/rake/test/filecreation.rb +32 -0
  81. data/vendor/rake/test/functional.rb +15 -0
  82. data/vendor/rake/test/in_environment.rb +30 -0
  83. data/vendor/rake/test/rake_test_setup.rb +10 -0
  84. data/vendor/rake/test/reqfile.rb +3 -0
  85. data/vendor/rake/test/reqfile2.rb +3 -0
  86. data/vendor/rake/test/session_functional.rb +337 -0
  87. data/vendor/rake/test/shellcommand.rb +3 -0
  88. data/vendor/rake/test/test_application.rb +694 -0
  89. data/vendor/rake/test/test_clean.rb +14 -0
  90. data/vendor/rake/test/test_definitions.rb +82 -0
  91. data/vendor/rake/test/test_earlytime.rb +35 -0
  92. data/vendor/rake/test/test_extension.rb +63 -0
  93. data/vendor/rake/test/test_file_creation_task.rb +62 -0
  94. data/vendor/rake/test/test_file_task.rb +139 -0
  95. data/vendor/rake/test/test_filelist.rb +618 -0
  96. data/vendor/rake/test/test_fileutils.rb +250 -0
  97. data/vendor/rake/test/test_ftp.rb +59 -0
  98. data/vendor/rake/test/test_invocation_chain.rb +75 -0
  99. data/vendor/rake/test/test_makefile_loader.rb +25 -0
  100. data/vendor/rake/test/test_multitask.rb +45 -0
  101. data/vendor/rake/test/test_namespace.rb +36 -0
  102. data/vendor/rake/test/test_package_task.rb +116 -0
  103. data/vendor/rake/test/test_pathmap.rb +209 -0
  104. data/vendor/rake/test/test_rake.rb +41 -0
  105. data/vendor/rake/test/test_require.rb +33 -0
  106. data/vendor/rake/test/test_rules.rb +347 -0
  107. data/vendor/rake/test/test_task_arguments.rb +89 -0
  108. data/vendor/rake/test/test_task_manager.rb +170 -0
  109. data/vendor/rake/test/test_tasklib.rb +12 -0
  110. data/vendor/rake/test/test_tasks.rb +371 -0
  111. data/vendor/rake/test/test_test_task.rb +75 -0
  112. data/vendor/rake/test/test_top_level_functions.rb +84 -0
  113. data/vendor/rake/test/test_win32.rb +57 -0
  114. metadata +195 -0
@@ -0,0 +1,418 @@
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', '**/.*.rbc')
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
+ dot_rakes =
99
+ t.rcov_opts = [
100
+ '-xRakefile', '-xrakefile', '-xpublish.rf',
101
+ '-xlib/rake/contrib', '-x/Library',
102
+ '--text-report',
103
+ '--sort coverage'
104
+ ] + FileList['rakelib/*.rake'].pathmap("-x%p")
105
+ t.test_files = FileList[
106
+ 'test/test*.rb', 'test/functional.rb'
107
+ ]
108
+ t.output_dir = 'coverage'
109
+ t.verbose = true
110
+ end
111
+ rescue LoadError
112
+ puts "RCov is not available"
113
+ end
114
+
115
+ directory 'testdata'
116
+ [:test_all, :test_units, :test_contribs, :test_functional].each do |t|
117
+ task t => ['testdata']
118
+ end
119
+
120
+ # CVS Tasks ----------------------------------------------------------
121
+
122
+ # Install rake using the standard install.rb script.
123
+
124
+ desc "Install the application"
125
+ task :install do
126
+ ruby "install.rb"
127
+ end
128
+
129
+ # Create a task to build the RDOC documentation tree.
130
+
131
+ rd = Rake::RDocTask.new("rdoc") { |rdoc|
132
+ rdoc.rdoc_dir = 'html'
133
+ # rdoc.template = 'kilmer'
134
+ # rdoc.template = 'css2'
135
+ rdoc.template = 'doc/jamis.rb'
136
+ rdoc.title = "Rake -- Ruby Make"
137
+ rdoc.options << '--line-numbers' << '--inline-source' <<
138
+ '--main' << 'README' <<
139
+ '--title' << 'Rake -- Ruby Make'
140
+ rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
141
+ rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
142
+ rdoc.rdoc_files.exclude(/\bcontrib\b/)
143
+ }
144
+
145
+ # ====================================================================
146
+ # Create a task that will package the Rake software into distributable
147
+ # tar, zip and gem files.
148
+
149
+ PKG_FILES = FileList[
150
+ 'install.rb',
151
+ '[A-Z]*',
152
+ 'bin/**/*',
153
+ 'lib/**/*.rb',
154
+ 'test/**/*.rb',
155
+ 'test/**/*.rf',
156
+ 'test/**/*.mf',
157
+ 'test/**/Rakefile',
158
+ 'test/**/subdir',
159
+ 'doc/**/*'
160
+ ]
161
+ PKG_FILES.exclude('doc/example/*.o')
162
+ PKG_FILES.exclude(%r{doc/example/main$})
163
+
164
+ if ! defined?(Gem)
165
+ puts "Package Target requires RubyGEMs"
166
+ else
167
+ SPEC = Gem::Specification.new do |s|
168
+
169
+ #### Basic information.
170
+
171
+ s.name = 'rake'
172
+ s.version = $package_version
173
+ s.summary = "Ruby based make-like utility."
174
+ s.description = <<-EOF
175
+ Rake is a Make-like program implemented in Ruby. Tasks
176
+ and dependencies are specified in standard Ruby syntax.
177
+ EOF
178
+
179
+ #### Dependencies and requirements.
180
+
181
+ #s.add_dependency('log4r', '> 1.0.4')
182
+ #s.requirements << ""
183
+
184
+ #### Which files are to be included in this gem? Everything! (Except CVS directories.)
185
+
186
+ s.files = PKG_FILES.to_a
187
+
188
+ #### C code extensions.
189
+
190
+ #s.extensions << "ext/rmagic/extconf.rb"
191
+
192
+ #### Load-time details: library and application (you will need one or both).
193
+
194
+ s.require_path = 'lib' # Use these for libraries.
195
+
196
+ s.bindir = "bin" # Use these for applications.
197
+ s.executables = ["rake"]
198
+ s.default_executable = "rake"
199
+
200
+ #### Documentation and testing.
201
+
202
+ s.has_rdoc = true
203
+ s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
204
+ s.rdoc_options = rd.options
205
+
206
+ #### Author and project details.
207
+
208
+ s.author = "Jim Weirich"
209
+ s.email = "jim@weirichhouse.org"
210
+ s.homepage = "http://rake.rubyforge.org"
211
+ s.rubyforge_project = "rake"
212
+ # if ENV['CERT_DIR']
213
+ # s.signing_key = File.join(ENV['CERT_DIR'], 'gem-private_key.pem')
214
+ # s.cert_chain = [File.join(ENV['CERT_DIR'], 'gem-public_cert.pem')]
215
+ # end
216
+ end
217
+
218
+ package_task = Rake::GemPackageTask.new(SPEC) do |pkg|
219
+ pkg.need_zip = true
220
+ pkg.need_tar = true
221
+ end
222
+
223
+ file "rake.gemspec" => ["Rakefile", "lib/rake.rb"] do |t|
224
+ require 'yaml'
225
+ open(t.name, "w") { |f| f.puts SPEC.to_yaml }
226
+ end
227
+
228
+ desc "Create a stand-alone gemspec"
229
+ task :gemspec => "rake.gemspec"
230
+ end
231
+
232
+ # Misc tasks =========================================================
233
+
234
+ def count_lines(filename)
235
+ lines = 0
236
+ codelines = 0
237
+ open(filename) { |f|
238
+ f.each do |line|
239
+ lines += 1
240
+ next if line =~ /^\s*$/
241
+ next if line =~ /^\s*#/
242
+ codelines += 1
243
+ end
244
+ }
245
+ [lines, codelines]
246
+ end
247
+
248
+ def show_line(msg, lines, loc)
249
+ printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
250
+ end
251
+
252
+ desc "Count lines in the main rake file"
253
+ task :lines do
254
+ total_lines = 0
255
+ total_code = 0
256
+ show_line("File Name", "LINES", "LOC")
257
+ SRC_RB.each do |fn|
258
+ lines, codelines = count_lines(fn)
259
+ show_line(fn, lines, codelines)
260
+ total_lines += lines
261
+ total_code += codelines
262
+ end
263
+ show_line("TOTAL", total_lines, total_code)
264
+ end
265
+
266
+ # Define an optional publish target in an external file. If the
267
+ # publish.rf file is not found, the publish targets won't be defined.
268
+
269
+ load "publish.rf" if File.exist? "publish.rf"
270
+
271
+ # Support Tasks ------------------------------------------------------
272
+
273
+ RUBY_FILES = FileList['**/*.rb'].exclude('pkg')
274
+
275
+ desc "Look for TODO and FIXME tags in the code"
276
+ task :todo do
277
+ RUBY_FILES.egrep(/#.*(FIXME|TODO|TBD)/)
278
+ end
279
+
280
+ desc "Look for Debugging print lines"
281
+ task :dbg do
282
+ RUBY_FILES.egrep(/\bDBG|\bbreakpoint\b/)
283
+ end
284
+
285
+ desc "List all ruby files"
286
+ task :rubyfiles do
287
+ puts RUBY_FILES
288
+ puts FileList['bin/*'].exclude('bin/*.rb')
289
+ end
290
+ task :rf => :rubyfiles
291
+
292
+ desc "Create a TAGS file"
293
+ task :tags => "TAGS"
294
+
295
+ TAGS = 'xctags -e'
296
+
297
+ file "TAGS" => RUBY_FILES do
298
+ puts "Makings TAGS"
299
+ sh "#{TAGS} #{RUBY_FILES}", :verbose => false
300
+ end
301
+
302
+ # --------------------------------------------------------------------
303
+ # Creating a release
304
+
305
+ def plugin(plugin_name)
306
+ require "rake/plugins/#{plugin_name}"
307
+ end
308
+
309
+ task :noop
310
+ #plugin "release_manager"
311
+
312
+ desc "Make a new release"
313
+ task :release, :rel, :reuse, :reltest,
314
+ :needs => [
315
+ :prerelease,
316
+ :clobber,
317
+ :test_all,
318
+ :update_version,
319
+ :package,
320
+ :tag
321
+ ] do
322
+ announce
323
+ announce "**************************************************************"
324
+ announce "* Release #{$package_version} Complete."
325
+ announce "* Packages ready to upload."
326
+ announce "**************************************************************"
327
+ announce
328
+ end
329
+
330
+ # Validate that everything is ready to go for a release.
331
+ task :prerelease, :rel, :reuse, :reltest do |t, args|
332
+ $package_version = args.rel
333
+ announce
334
+ announce "**************************************************************"
335
+ announce "* Making RubyGem Release #{$package_version}"
336
+ announce "* (current version #{CURRENT_VERSION})"
337
+ announce "**************************************************************"
338
+ announce
339
+
340
+ # Is a release number supplied?
341
+ unless args.rel
342
+ fail "Usage: rake release[X.Y.Z] [REUSE=tag_suffix]"
343
+ end
344
+
345
+ # Is the release different than the current release.
346
+ # (or is REUSE set?)
347
+ if $package_version == CURRENT_VERSION && ! args.reuse
348
+ fail "Current version is #{$package_version}, must specify REUSE=tag_suffix to reuse version"
349
+ end
350
+
351
+ # Are all source files checked in?
352
+ if args.reltest
353
+ announce "Release Task Testing, skipping checked-in file test"
354
+ else
355
+ announce "Checking for unchecked-in files..."
356
+ data = `svn st`
357
+ unless data =~ /^$/
358
+ abort "svn status is not clean ... do you have unchecked-in files?"
359
+ end
360
+ announce "No outstanding checkins found ... OK"
361
+ end
362
+ end
363
+
364
+ task :update_version, :rel, :reuse, :reltest,
365
+ :needs => [:prerelease] do |t, args|
366
+ if args.rel == CURRENT_VERSION
367
+ announce "No version change ... skipping version update"
368
+ else
369
+ announce "Updating Rake version to #{args.rel}"
370
+ open("lib/rake.rb") do |rakein|
371
+ open("lib/rake.rb.new", "w") do |rakeout|
372
+ rakein.each do |line|
373
+ if line =~ /^RAKEVERSION\s*=\s*/
374
+ rakeout.puts "RAKEVERSION = '#{args.rel}'"
375
+ else
376
+ rakeout.puts line
377
+ end
378
+ end
379
+ end
380
+ end
381
+ mv "lib/rake.rb.new", "lib/rake.rb"
382
+ if args.reltest
383
+ announce "Release Task Testing, skipping commiting of new version"
384
+ else
385
+ sh %{svn commit -m "Updated to version #{args.rel}" lib/rake.rb} # "
386
+ end
387
+ end
388
+ end
389
+
390
+ desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
391
+ task :tag, :rel, :reuse, :reltest,
392
+ :needs => [:prerelease] do |t, args|
393
+ reltag = "REL_#{args.rel.gsub(/\./, '_')}"
394
+ reltag << args.reuse.gsub(/\./, '_') if args.reuse
395
+ announce "Tagging Repository with [#{reltag}]"
396
+ if args.reltest
397
+ announce "Release Task Testing, skipping CVS tagging"
398
+ else
399
+ sh %{svn copy svn+ssh://rubyforge.org/var/svn/rake/trunk svn+ssh://rubyforge.org/var/svn/rake/tags/#{reltag} -m 'Commiting release #{reltag}'} ###'
400
+ end
401
+ end
402
+
403
+ desc "Install the jamis RDoc template"
404
+ task :install_jamis_template do
405
+ require 'rbconfig'
406
+ dest_dir = File.join(Config::CONFIG['rubylibdir'], "rdoc/generators/template/html")
407
+ fail "Unabled to write to #{dest_dir}" unless File.writable?(dest_dir)
408
+ install "doc/jamis.rb", dest_dir, :verbose => true
409
+ end
410
+
411
+ # Require experimental XForge/Metaproject support.
412
+
413
+ load 'xforge.rf' if File.exist?('xforge.rf')
414
+
415
+ desc "Where is the current directory. This task displays\nthe current rake directory"
416
+ task :where_am_i do
417
+ puts Rake.original_dir
418
+ end
data/vendor/rake/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)
@@ -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
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void a()
4
+ {
5
+ printf ("In function a\n");
6
+ }
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void b()
4
+ {
5
+ printf ("In function b\n");
6
+ }
@@ -0,0 +1,11 @@
1
+ #include <stdio.h>
2
+
3
+ extern void a();
4
+ extern void b();
5
+
6
+ int main ()
7
+ {
8
+ a();
9
+ b();
10
+ return 0;
11
+ }
@@ -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
+