reap 6.0.2 → 9.2.0

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.
Files changed (174) hide show
  1. data/CHANGES +6 -0
  2. data/COPYING +666 -395
  3. data/MANIFEST +139 -0
  4. data/NOTES +12 -0
  5. data/README +19 -163
  6. data/bin/reap-announce +7 -0
  7. data/bin/reap-check-load +8 -0
  8. data/bin/reap-check-syntax +7 -0
  9. data/bin/reap-clean +7 -0
  10. data/bin/reap-clobber +7 -0
  11. data/bin/reap-doc +7 -0
  12. data/bin/reap-doc-rdoc +7 -0
  13. data/bin/reap-doc-ri +7 -0
  14. data/bin/reap-init +69 -0
  15. data/bin/reap-inspect +7 -0
  16. data/bin/reap-install +8 -0
  17. data/bin/reap-install-gem +8 -0
  18. data/bin/reap-log +7 -0
  19. data/bin/reap-log-changes +8 -0
  20. data/bin/reap-log-notes +8 -0
  21. data/bin/reap-make +7 -0
  22. data/bin/reap-make-clean +7 -0
  23. data/bin/reap-make-distclean +7 -0
  24. data/bin/reap-make-extconf +7 -0
  25. data/bin/reap-make-static +8 -0
  26. data/bin/reap-package +8 -0
  27. data/bin/reap-package-gem +7 -0
  28. data/bin/reap-package-tgz +7 -0
  29. data/bin/reap-package-zip +7 -0
  30. data/bin/reap-prepare +7 -0
  31. data/bin/reap-publish +7 -0
  32. data/bin/reap-release +7 -0
  33. data/bin/reap-scaffold +8 -0
  34. data/bin/reap-scm-branch +7 -0
  35. data/bin/reap-scm-tag +7 -0
  36. data/bin/reap-spec +7 -0
  37. data/bin/reap-spec-doc +8 -0
  38. data/bin/reap-stamp +7 -0
  39. data/bin/reap-stats +7 -0
  40. data/bin/reap-test +7 -0
  41. data/bin/reap-test-cross +7 -0
  42. data/bin/reap-test-load +9 -0
  43. data/bin/reap-test-solo +7 -0
  44. data/bin/reap-uninstall +7 -0
  45. data/bin/reap-uninstall-gem +7 -0
  46. data/data/reap/base/CHANGES +19 -0
  47. data/data/reap/base/COPYING +674 -0
  48. data/data/reap/base/NOTES +12 -0
  49. data/data/reap/base/README +8 -0
  50. data/data/reap/build/rake/Rakefile +130 -0
  51. data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
  52. data/data/reap/build/rake-lite/install.rb +79 -0
  53. data/data/reap/build/tasks/task/rdoc +211 -0
  54. data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
  55. data/data/reap/build/tasks/task/test +38 -0
  56. data/data/reap/init/meta/project.yaml +21 -0
  57. data/demo/README +15 -0
  58. data/demo/lib/foo/foo.rb +7 -0
  59. data/demo/meta/VERSION +1 -0
  60. data/demo/meta/project.yaml +21 -0
  61. data/lib/reap/application.rb +80 -0
  62. data/lib/reap/default.yaml +77 -0
  63. data/lib/reap/extensions/array.rb +50 -0
  64. data/lib/reap/extensions/hash.rb +63 -0
  65. data/lib/reap/extensions/string.rb +31 -0
  66. data/lib/reap/extensions.rb +6 -0
  67. data/lib/reap/iobject.rb +264 -0
  68. data/lib/reap/manager/announce.rb +193 -0
  69. data/lib/reap/manager/check.rb +109 -0
  70. data/lib/reap/manager/clean.rb +58 -0
  71. data/lib/reap/manager/gem.rb +200 -0
  72. data/lib/reap/manager/html.rb +69 -0
  73. data/lib/reap/manager/log.rb +214 -0
  74. data/lib/reap/manager/make.rb +109 -0
  75. data/lib/reap/manager/pack.rb +232 -0
  76. data/lib/reap/manager/publish.rb +72 -0
  77. data/lib/reap/manager/rdoc.rb +194 -0
  78. data/lib/reap/manager/release.rb +78 -0
  79. data/lib/reap/manager/rubyforge.rb +44 -0
  80. data/lib/reap/manager/scaffold.rb +138 -0
  81. data/lib/reap/manager/scm.rb +66 -0
  82. data/lib/reap/manager/site.rb +27 -0
  83. data/lib/reap/manager/spec.rb +94 -0
  84. data/lib/reap/manager/stats.rb +145 -0
  85. data/lib/reap/manager/svn.rb +76 -0
  86. data/lib/reap/manager/test.rb +389 -0
  87. data/lib/reap/manager.rb +74 -0
  88. data/lib/reap/metadata.rb +603 -0
  89. data/lib/reap/project.rb +165 -0
  90. data/lib/reap/settings.rb +67 -0
  91. data/lib/reap/systems/rubyforge.rb +737 -0
  92. data/lib/reap/systems/subversion.rb +333 -0
  93. data/lib/reap/utilities/fileutils.rb +304 -0
  94. data/lib/reap/utilities/netutils.rb +221 -0
  95. data/lib/reap/utilities/setuputils.rb +124 -0
  96. data/lib/reap/utilities/shellutils.rb +175 -0
  97. data/log/Changelog.txt +107 -0
  98. data/log/FIXME.txt +25 -0
  99. data/log/TODO.txt +72 -0
  100. data/meta/VERSION +1 -0
  101. data/meta/description +4 -0
  102. data/meta/project.yaml +20 -0
  103. data/task/man +14 -0
  104. data/task/rdoc +20 -0
  105. data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
  106. metadata +225 -153
  107. data/ProjectInfo +0 -105
  108. data/bin/reap +0 -5
  109. data/bin/rubytest +0 -5
  110. data/data/reap/install.rb +0 -62
  111. data/data/reap/scaffold/standard/COPYING +0 -403
  112. data/data/reap/scaffold/standard/ChangeLog +0 -0
  113. data/data/reap/scaffold/standard/INSTALL +0 -14
  114. data/data/reap/scaffold/standard/ProjectInfo +0 -77
  115. data/data/reap/scaffold/standard/README +0 -3
  116. data/data/reap/scaffold/standard/Rakefile +0 -10
  117. data/data/reap/scaffold/standard/TODO +0 -0
  118. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  119. data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
  120. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  121. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
  122. data/data/reap/scaffold/subversion/trunk/README +0 -3
  123. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  124. data/data/reap/scaffold/subversion/trunk/TODO +0 -0
  125. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  126. data/forge/ProjectInfo +0 -38
  127. data/forge/ProjectInfo.rb +0 -76
  128. data/forge/TODO +0 -10
  129. data/forge/installer.rb +0 -250
  130. data/forge/reference/Rakefile +0 -124
  131. data/forge/reference/Rakefile.htm +0 -69
  132. data/forge/reference/aRakefile +0 -60
  133. data/forge/reference/compositepublisher.rb +0 -24
  134. data/forge/reference/ftptools.rb +0 -139
  135. data/forge/reference/installers/package.rb +0 -629
  136. data/forge/reference/license-each.rb +0 -85
  137. data/forge/reference/publisher.rb +0 -75
  138. data/forge/reference/rubyforge.rb +0 -247
  139. data/forge/reference/rubyforgepublisher.rb +0 -18
  140. data/forge/reference/sshpublisher.rb +0 -47
  141. data/forge/reference/suby-cvs.rb +0 -46
  142. data/forge/scaffold.rb +0 -126
  143. data/forge/unit_runner/README +0 -6
  144. data/forge/unit_runner/commentrunner.rb +0 -62
  145. data/forge/unit_runner/cunit.rb +0 -17
  146. data/forge/unit_runner/forkedrunner.rb +0 -91
  147. data/forge/unit_runner/sample.rb +0 -16
  148. data/lib/reap/bin/reap.rb +0 -230
  149. data/lib/reap/bin/rubytest.rb +0 -53
  150. data/lib/reap/class/announce.rb +0 -220
  151. data/lib/reap/class/doap.rb +0 -80
  152. data/lib/reap/class/extest.rb +0 -146
  153. data/lib/reap/class/filer.rb +0 -62
  154. data/lib/reap/class/manifest.rb +0 -68
  155. data/lib/reap/class/package.rb +0 -576
  156. data/lib/reap/class/publish.rb +0 -152
  157. data/lib/reap/class/rdoc.rb +0 -123
  158. data/lib/reap/class/test.rb +0 -264
  159. data/lib/reap/projectinfo.rb +0 -208
  160. data/lib/reap/rake.rb +0 -42
  161. data/lib/reap/reap.rb +0 -89
  162. data/lib/reap/tasks.rb +0 -756
  163. data/lib/reap/taskutils.rb +0 -122
  164. data/note/LATEST +0 -44
  165. data/note/doap.xml +0 -28
  166. data/note/history/Rakefile-0.1 +0 -308
  167. data/sample/ProjectInfo +0 -96
  168. data/sample/Rakefile +0 -9
  169. data/sample/Reapfile +0 -11
  170. data/sample/task/demo.rb +0 -15
  171. data/setup.rb +0 -1568
  172. data/web/ProjectInfo.html +0 -75
  173. data/web/images/grape.jpg +0 -0
  174. data/web/index.html +0 -312
data/lib/reap/tasks.rb DELETED
@@ -1,756 +0,0 @@
1
- require 'reap/taskutils'
2
-
3
- # Tasks is the namespace in which to define task generators.
4
-
5
- module Tasks
6
-
7
- # Even task generators might use the task tools.
8
-
9
- include Reap::TaskUtils
10
-
11
- #--
12
- # Help system has been deprecated for the time being.
13
- #def self.help( name, text )
14
- # @help ||= {}
15
- # @help[name] = text
16
- #end
17
- #++
18
-
19
- # Used to determine task generator availablity.
20
- #--
21
- # TODO This is kind of a weak point in the design, I think.
22
- # And tasks themselves also need to have Rake's #needed? feature.
23
- #++
24
-
25
- def self.available
26
- @available ||= {}
27
- end
28
-
29
- # Used to set task generator availablity condition.
30
-
31
- def self.avail( name, &cond )
32
- available[name] = cond
33
- end
34
-
35
- # == Announce
36
- #
37
- # The announce task is intended for sending out a nice
38
- # formated email message to a mailing address, especially
39
- # mailing-lists.
40
- #
41
- # Announcement specific settings:
42
- #
43
- # server Email server to route message.
44
- # port Email server's port.
45
- # domain Email server's domain name.
46
- # account Email account name.
47
- # type Login type, either plain, cram_md5 or login.
48
- # secure Uses TLS security, true or false?
49
- # to Email address to send announcemnt.
50
- # from Email address sent from.
51
- # subject Subject of email message.
52
- # links Array of http links to related sites.
53
- # file File that contains announcement message.
54
- # memo Embedded announcement message.
55
- # slogan Motto for you project.
56
- #
57
- # Inherited settings:
58
- #
59
- # title Project title.
60
- # summary Brief one-line description.
61
- # description Long description of project.
62
- # homepage Project homepage web address.
63
- #
64
-
65
- def announce( name, &data )
66
-
67
- require 'reap/class/announce.rb'
68
-
69
- desc "Email project announcement" unless desc
70
-
71
- task name do
72
- data = data.to_openobject
73
- data.title ||= master.title
74
- data.description ||= master.description
75
- data.version ||= master.version
76
- data.from ||= master.email
77
- Reap::Announce.new( data ).write_and_email
78
- end
79
-
80
- end
81
-
82
- # == Backup
83
- #
84
- # Backup your project to a backup directory.
85
- # The location of the backup will be under the
86
- # backup +dir+ given in the backup section of the
87
- # ProjectInfo file, then under the name of the
88
- # project's dir and a subdirectory of today's date.
89
- # For example, today reap itself was backed up to:
90
- #
91
- # ../BACKUPS/reap/2006-06-21/reap
92
- #
93
- # Backup specific settings:
94
- #
95
- # dir The backup directory (eg. '../BACKUPS').
96
-
97
- def backup( name, &data )
98
-
99
- desc "Backup project folder" unless desc
100
-
101
- task name do
102
- data = data.to_openobject
103
- if data.dir
104
- bdir = ::File.join( ::File.basename(Dir.pwd), Time.now.strftime("%Y_%m_%d") )
105
- bdir = ::File.join( data.dir, bdir )
106
- if File.exist?( bdir ) and not $FORCE
107
- tell bdir
108
- tell "Backup folder already exists. Use -f to overwrite."
109
- else
110
- if $PRETEND
111
- puts "rm -r #{bdir}"
112
- puts "mkdir -p #{bdir}"
113
- puts "cp -r #{Dir.pwd} #{bdir}"
114
- else
115
- FileUtils.rm_r( bdir ) if File.exist?( bdir )
116
- FileUtils.mkdir_p( bdir )
117
- FileUtils.cp_r( Dir.pwd, bdir)
118
- end
119
- tell "Completed backup to '#{bdir}'."
120
- end
121
- else
122
- tell "No backup 'dir' setting given for backup task."
123
- end
124
- end
125
-
126
- end
127
-
128
- # == Doap
129
- #
130
- # This task generates an XML DOAP project file.
131
- #
132
- # DOAP is an XML/RTF format for describing a project. It contains
133
- # much of the same information as Reap's ProjectInfo file, but is
134
- # more suitable to RESTful interapplication communications, like
135
- # RSS/Atom feeds --useful to project tracking sites.
136
- #
137
- # The task gets almost all of the required parametes from the root
138
- # node (i.e. master) of ProjectInfo file.
139
-
140
- def doap( name, &data )
141
-
142
- require 'reap/class/doap.rb'
143
-
144
- desc "Generate DOAP project file" unless desc
145
-
146
- task name do
147
- data = data.to_openobject
148
- Reap::Doap.new( data.__merge__( master ) ).call
149
- end
150
-
151
- end
152
-
153
- avail :doap do
154
- ProjectInfo.exists?
155
- end
156
-
157
- # == ExTest (Extract Tests)
158
- #
159
- # This task scans every package script looking for sections of the form:
160
- #
161
- # =begin test
162
- # ...
163
- # =end
164
- #
165
- # With appropriate headers, it copies these sections to files in your
166
- # project's test/ dir, which then can be run using the Reap test task.
167
- # The exact directory layout of the files to be tested is reflected in
168
- # the test directory. You can then use Reap's test task to run the tests.
169
- #
170
- # Specific Settings:
171
- #
172
- # dir Specify the test directory. Default is 'test'.
173
- # files Specify files to extract. Default is 'lib/**/*.rb'.
174
- #
175
-
176
- def extest( name, &data )
177
-
178
- require 'reap/class/extest.rb'
179
-
180
- desc "Extract embedded unit tests from scripts" unless desc
181
-
182
- task name do
183
- data = data.to_openobject
184
- Reap::ExTest.new( data ).extract
185
- end
186
-
187
- end
188
-
189
- # == File
190
-
191
- def file( name, &exe )
192
-
193
- require 'reap/class/filer'
194
-
195
- name, source = preq_from_name( name )
196
-
197
- task name do
198
- Reap::Filer.new( name, source, &exe ).build
199
- end
200
-
201
- end
202
-
203
- # == Info
204
- #
205
- # Displays the ProjectInfo file. This task is of little use
206
- # --it's easy enough to look at a ProjectInfo file with
207
- # less or your favorite editor. Mainly this task serves as
208
- # a development example.
209
-
210
- def info( name )
211
-
212
- desc "Display ProjectInfo file" unless desc
213
-
214
- task name do
215
- puts ProjectInfo.instance.info_stream
216
- end
217
-
218
- end
219
-
220
- avail :info do
221
- ProjectInfo.exists?
222
- end
223
-
224
- #--
225
- # # == Installer
226
- # #
227
- # # The installer task generates a specialized
228
- # # install.rb script specifically for your
229
- # # project. It currently does not support c/c++
230
- # # ext/ compilation.
231
- # #
232
- # # template Template for installation. (See below)
233
- # # options Hash of variable options. Project name
234
- # # and version are automatically added this.
235
- # #
236
- # # The template is a special configuration for installation.
237
- # # It should be a literal string with each line containing
238
- # # four parts seprated by spaces.
239
- # #
240
- # # [type] [from] [glob] [to]
241
- # #
242
- # # There are five types: bin, lib, ext, etc (or conf) and data.
243
- # #
244
- # # The template use variables in the from of $name. These are filled
245
- # # in using the options hash.
246
- # #
247
- # # Here's a basic example of an entry:
248
- # #
249
- # # ins: !!installer
250
- # # template: |
251
- # # bin bin * .
252
- # # lib lib **/* $name/$version
253
- # #
254
- #
255
- # def installer( name, &data )
256
- #
257
- # require 'reap/class/installer'
258
- #
259
- # desc "Generate install.rb script" unless desc
260
- #
261
- # task name do
262
- # data = data.to_openobject
263
- #
264
- # data.name ||= master.name
265
- # data.version ||= master.version
266
- #
267
- # i = Reap::Installer.new( data )
268
- # puts i.compile #_and_write
269
- # end
270
- #
271
- # end
272
- #++
273
-
274
- # == Count
275
- #
276
- # Count the file and lines of code in your project.
277
- #
278
- # dir The directory of scripts to count.
279
- #
280
-
281
- def count( name, &data )
282
-
283
- desc "Line count project scripts" unless desc
284
-
285
- task name do
286
- data = data.to_openobject
287
- incl = data.include || 'lib/**/*'
288
-
289
- fc, l, c, t, bt, r, rb = 0, 0, 0, 0, false, 0, false
290
- Dir.glob( incl ).each do |fname|
291
- next unless fname =~ /.*rb/ # TODO should this be done?
292
- fc += 1
293
- File.open( fname ) do |f|
294
- while line = f.gets
295
- l += 1
296
- next if line =~ /^\s*$/
297
- case line
298
- when /^=begin\s+test/
299
- tb = true; t+=1
300
- when /^=begin/
301
- rb = true; r+=1
302
- when /^=end/
303
- r+=1 if !(rb or tb)
304
- (rb = false; r+=1) if rb
305
- (tb = false; t+=1) if tb
306
- when /^\s*#/
307
- r += 1
308
- else
309
- c+=1 if !(rb or tb)
310
- r+=1 if rb
311
- t+=1 if tb
312
- end
313
- end
314
- end
315
- end
316
- s = l - c - r
317
- puts "FILES: #{fc}, LINES: #{l}, CODE: #{c}, DOC: #{r}, TEST: #{t}, SPACE: #{s}"
318
- end
319
-
320
- end
321
-
322
- # == Manifest
323
- #
324
- # Create a manifest file for the package. Presently it is a very simple
325
- # md5 + filename manifest. In the future this will be exanded to build
326
- # a varity of manifest formats.
327
- #
328
- # Task specific settings:
329
- #
330
- # include Files to include
331
- # exclude Files to exclude from the included.
332
- #
333
-
334
- def manifest( name, &data )
335
-
336
- require 'reap/class/manifest'
337
-
338
- desc "Create a MANIFEST file for this package" unless desc
339
-
340
- task name do
341
- data = data.to_openobject
342
- Reap::Manifest.new( data ).generate
343
- end
344
-
345
- end
346
-
347
- # == Package
348
- #
349
- # This task creates standard .zip, .tgz, or .tbz
350
- # packages, plus .gem or .deb distributions.
351
- #
352
- # Builds distribution packages. The package task supports
353
- # tar.gz, tar.bz2, zip source packages and gem, pacman and
354
- # debian ditribution packages.
355
- #
356
- # Task specific settings:
357
- #
358
- # dir Directory in which to store distributions.
359
- # include Files to include in distribution.
360
- # exclude Files to exclude from those.
361
- # distribute List of distribution types desired. Eg.
362
- # tgz, tar.gz, tbz, tar.bz2, zip
363
- # gem, deb, pac
364
- # project Project name.
365
- # category Software category.
366
- # architecture Can be any, i368, i686, ppc, etc.
367
- # dependencies List of packages this program depends.
368
- # recommends List of packages that can be used with this package.
369
- # replaces List of packages this one replaces.
370
- # executables Executable files in this distribution.
371
- # rules (see below)
372
- #
373
- # RubyGems specific settings:
374
- #
375
- # autorequire
376
- # platform
377
- # require_paths
378
- #
379
- # The package task also has subsection for each type of distribution.
380
- # These can be used to override settings in the package information
381
- # if they in some way differ. Possible subsections are:
382
- #
383
- # gems
384
- # pacman
385
- # debian
386
- #
387
- # Finally there is one last parameter that you can use for creating packages
388
- # called 'rules'. The rules setting allows you to define how files are
389
- # copied into the distribution package, so instead of a one to one copy
390
- # of the included files, you can actually have a file placed in a different
391
- # location within the distribution. This can be very handy if you wish to
392
- # develop you project with one layout, but need to distribute it with another.
393
- #
394
- # The rules parameter is a literal string that consists of one rule per line.
395
- # A line consists three space separated entries.
396
- #
397
- # from_path, file_glob, to_path
398
- #
399
- # If no 'to_path' is given then it is considered the same as the 'from_path'.
400
- # It also supports two variables $name and $version which will be substitued
401
- # any of these entries. Here is a possible example:
402
- #
403
- # rules: |
404
- # lib **/* lib/$name/$version
405
- #
406
- # This will move any file under lib/ to the equivalent location under lib/$name/$version/.
407
- # The default set of rules is a mirror image transfer, spelled out it would be:
408
- #
409
- # rules: |
410
- # bin *
411
- # ext **/*
412
- # lib **/*
413
- # data **/*
414
- # conf **/*
415
- #
416
- # If your using Rolls against a normal project folder the alterntive is to create
417
- # versioned paths, probably as follows:
418
- #
419
- # rules: |
420
- # ext/$name **/* ext/$name/$version
421
- # lib/$name **/* lib/$name/$version
422
- # data/$name **/* ext/$name/$version
423
- # conf/$name **/* ext/$name/$version ?
424
- #
425
- # Please note that the rules parameter is a new feature and is still considered beta.
426
-
427
- def package( name, &data )
428
-
429
- require 'reap/class/package'
430
-
431
- desc "Create distribution packages" unless desc
432
-
433
- task name do
434
- data = data.to_openobject
435
-
436
- data.name ||= master.name
437
- data.title ||= master.title
438
- data.version ||= master.version
439
- data.status ||= master.status
440
- data.series ||= master.series
441
- data.author ||= master.author
442
- data.maintainer ||= master.maintainer
443
- data.email ||= master.email
444
- data.summary ||= master.summary
445
- data.architecture ||= master.architecture
446
- data.license ||= master.license
447
- data.project ||= master.project
448
- data.homepage ||= master.homepage
449
-
450
- Reap::Package.new( data ).generate_packages
451
- end
452
-
453
- end
454
-
455
- # == Publish
456
- #
457
- # Publish documents to hosting service. Three means of
458
- # publishing are current supported, ftp uploading, scp,
459
- # and web convenience option that recognizes particular
460
- # hosts (only RubyForge is currently supported).
461
- #
462
- # type Type of publishing, 'web', 'scp' or 'ftp'.
463
- # host Host server, default is 'rubyforge.org'
464
- # username Username for host.
465
- # dir Directory of files to publish. Or,
466
- # copy Files to publish using from and to.
467
- # project Project name (used for Rubyforge)
468
- #
469
- # If the type is 'scp' or 'ftp' you will also need to provide
470
- # the root directory parameter.
471
- #
472
- # root Document root directory at host.
473
- #
474
- # The dir parameter allows you to simply specify a local
475
- # directory, the contents of which will be published to
476
- # host's document root location (directory tree intact).
477
- #
478
- # If you need more control over which files to publish
479
- # where, you can use the copy parameter instead. Provide
480
- # an array of pattern strings in the form of "{from} {to}".
481
- # If the desitination is the host's document root you do
482
- # not need to specify the {to} part. For example:
483
- #
484
- # copy: [ 'web/*', 'doc/api/* doc/api' ]
485
- #
486
- # The first copies the files under your project's web directory
487
- # to the host's document root. The second copies your projects
488
- # doc/api files to the doc/api location on the host.
489
- #
490
- # When using the 'scp' type the internal template used for
491
- # the outbound destination is 'username@host:root/'.
492
-
493
- def publish( name, &data )
494
-
495
- require 'reap/class/publish.rb'
496
-
497
- desc "Publish documents to the web or host" unless desc
498
-
499
- task name do
500
- data = data.to_openobject
501
-
502
- data.project ||= master.rubyforge.project || master.name
503
- data.username ||= master.rubyforge.username
504
-
505
- Reap::Publish.new( data ).publish
506
- end
507
-
508
- end
509
-
510
- # == RDoc
511
- #
512
- # This task generates RDoc API documentation from source
513
- # comments.
514
- #
515
- # Task specific settings:
516
- #
517
- # dir Directory to store documentation [doc].
518
- # main File to use as main page of RDocs.
519
- # template Which RDoc template to use.
520
- # include Files to include in RDocs.
521
- # exclude Files to exclude from those.
522
- # options Pass-thru extra options to RDoc command.
523
- #
524
- # Inherited settings:
525
- #
526
- # title Project title to use in RDocs.
527
- #
528
-
529
- def rdoc( name, &data )
530
-
531
- require 'reap/class/rdoc'
532
-
533
- desc "Generate RDoc API documentation" unless desc
534
-
535
- task name do
536
- data = data.to_openobject
537
-
538
- data.title ||= master.title
539
-
540
- Reap::RDoc.new( data ).call
541
- end
542
-
543
- end
544
-
545
- # == Release
546
- #
547
- # This task releases files to RubyForge --it should work with other
548
- # GForge instaces or SourceForge clones too.
549
- #
550
- # While defaults are nice, you may want a little more control. You can
551
- # specify additional attributes:
552
- #
553
- # dir Distribution directory
554
- # exclude Distribution types to exclude
555
- # host URL of host service
556
- # username Username of host service
557
- # project Project name at host
558
- # package Package name
559
- # date Date of release (defaults to Time.now)
560
- # groupid Group id number
561
- # processor Processor/Architecture (Any, i386, PPC, etc.)
562
- # release Release name (default is "%s")
563
- # is_public Public release?
564
- # changelog Change log file
565
- # notelog Release notes file
566
- #
567
- # The release option can be a template by using %s in the
568
- # string. The version number of your project will be sub'd
569
- # in for the %s. This saves you from having to update
570
- # the release name before every release.
571
-
572
- def release( name, &data )
573
-
574
- require 'reap/class/release'
575
-
576
- desc "Release distribution files" unless desc
577
-
578
- task name do
579
- data = data.to_openobject
580
-
581
- data.version = master.version
582
- data.project ||= master.rubyforge.project || master.name
583
- data.username ||= master.rubyforge.username
584
- data.package ||= master.rubyforge.package
585
- data.groupid ||= master.rubyforge.groupid
586
-
587
- Reap::Release.new( data ).release
588
- end
589
-
590
- end
591
-
592
- # == Scaffold
593
- #
594
- # Generates a project directory layout within the current
595
- # directory. The scaffolding includes all the standard
596
- # features such as directories lib/ bin/ doc/
597
- # and files such as README.
598
- #
599
- # To use this task you should first create an empty
600
- # directory and than change into it. This command will
601
- # not create a new project directory. As a safegaurd, this
602
- # command will not generate scaffolding in a directory with
603
- # files already present, unless you use the -f (force) option.
604
- #
605
- # There are currently two types of supported scaffoldings:
606
- # 'standard', which is the default if no type is given,
607
- # and 'subversion' which creates a "trunk" hierarchy.
608
-
609
- def scaffold( name )
610
-
611
- desc "Generate a project directory layout" unless desc
612
-
613
- task name do |type|
614
- content = Dir.entries('.') - [ '.', '..' ]
615
- if not content.empty? and not $FORCE
616
- tell "Directory already has content. Use -f option to force scaffolding."
617
- return nil
618
- end
619
- type ||= 'standard'
620
- type = 'standard' if type == 'std'
621
- type = 'subversion' if type == 'svn'
622
- # gems workaround
623
- if dir = Gem.gempath('reap')
624
- dir = File.join( dir, 'data', 'reap', 'scaffold', type )
625
- else
626
- dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', type )
627
- end
628
- #
629
- unless File.directory?( dir )
630
- tell "Unrecognized project type."
631
- else
632
- #FileUtils.mkdir_p( name )
633
- FileUtils.cp_r( File.join( dir, '.'), '.' )
634
- tell "Project ready."
635
- end
636
- end
637
-
638
- end
639
-
640
- avail :scaffold do
641
- ! ProjectInfo.exists?
642
- end
643
-
644
- # == Setup
645
- #
646
- # This task manually installs a project using setup.rb.
647
- # If setup.rb doesn't exist it will be created.
648
-
649
- def setup( name, &data )
650
-
651
- desc "Locally install package using setup.rb" unless desc
652
-
653
- task name do
654
- data = data.to_openobject
655
-
656
- data.options ||= []
657
-
658
- unless provide_setup_rb
659
- puts "Setup.rb is missing. Forced to cancel task."
660
- return nil
661
- end
662
-
663
- puts "Reap is shelling out work to setup.rb..."
664
-
665
- #--
666
- # SHELL OUT! This will be fixed with swtich to Reap's installer instead of setup.rb.
667
- #++
668
- exe = %{ruby setup.rb}
669
- exe << ' -q ' unless $VERBOSE
670
- exe << data.options.join(' ')
671
- exe << ' all'
672
-
673
- #success = false
674
- success = sh( exe )
675
-
676
- puts "Setup complete!" if success
677
- end
678
-
679
- end
680
-
681
- # == Template
682
- #
683
- # Creates an empty ProjectInfo file in the current directory.
684
- # It will not overwrite a ProjectInfo file if one is already
685
- # present. Unlike 'scaffold', this is especially useful for
686
- # pre-existing projects.
687
-
688
- def template( name )
689
-
690
- require 'facet/gem/self/gempath'
691
-
692
- desc "Create a ProjectInfo template" unless desc
693
-
694
- task name do
695
- f = nil
696
- if ::ProjectInfo::INFO_FILES.any?{ |f| File.exists?(f) }
697
- puts "Project file '#{f}' already exists."
698
- return
699
- end
700
- filename = 'ProjectInfo'
701
- # if using gems
702
- if dir = Gem.gempath('reap')
703
- dir = File.join( dir, 'data', 'reap', 'scaffold', 'standard' )
704
- else
705
- dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', 'standard' )
706
- end
707
- f = File.join( dir, filename )
708
- raise "ProjectInfo template file #{f} is missing." unless File.file?( f )
709
- # copy
710
- FileUtils.install( f, '.' )
711
- tell "#{filename} created. You'll need to fill it out."
712
- end
713
-
714
- end
715
-
716
- avail :template do
717
- ! ProjectInfo.exists?
718
- end
719
-
720
- # == Test
721
- #
722
- # The Reap test class runs each test in it's own
723
- # proccess, making for a more pure test facility.
724
- # Reap runs each test in a separate proccess to aviod
725
- # potential conflicts between scripts.
726
- #
727
- # files Test files (eg. test/tc_**/*.rb)
728
- # Defaults to typcial selection.
729
- #
730
- # libs List of lookup directories to include in
731
- # load path. './lib' is always included.
732
- #
733
- # live Flag to quickly deactive use of local libs.
734
- # Test against installed files instead.
735
- #
736
- # requires List of any files to pre-require.
737
- #
738
- # NOTE This works well enough but it is a tad delicate.
739
- # It actually marshals test results across stdout->stdin
740
- # shell pipe. One consequence of this is that you can't
741
- # send debug info to stdout in your tests (including #p and #puts).
742
-
743
- def test( name, &data )
744
-
745
- require 'reap/class/test'
746
-
747
- desc "Run unit-tests (each in a separate process)" unless desc
748
-
749
- task name do
750
- data = data.to_openobject
751
- Reap::Test.new( data ).call
752
- end
753
-
754
- end
755
-
756
- end #module Tasks