reap 5.0.0 → 5.10.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/ANN +3 -0
  2. data/COPYING +11 -0
  3. data/ChangeLog +25 -0
  4. data/ProjectInfo +41 -66
  5. data/README +125 -0
  6. data/Rakefile +0 -10
  7. data/bin/reap +3 -4
  8. data/data/reap/scaffold/COPYING +11 -0
  9. data/data/reap/scaffold/{standard/ChangeLog → ChangeLog} +0 -0
  10. data/data/reap/scaffold/{standard/TODO → INSTALL} +0 -0
  11. data/data/reap/scaffold/{standard/ProjectInfo → ProjectInfo} +20 -20
  12. data/data/reap/scaffold/{subversion/trunk/ChangeLog → README} +0 -0
  13. data/data/reap/scaffold/Rakefile +146 -0
  14. data/data/reap/scaffold/{subversion/trunk/TODO → Todo} +0 -0
  15. data/{doc/note → data/reap/scaffold}/setup.rb +11 -18
  16. data/{doc/note/aRakefile → dev/Rakefile} +0 -0
  17. data/{doc/note → dev}/composite_task.rb +0 -0
  18. data/{doc/note → dev}/compositepublisher.rb +0 -0
  19. data/{doc/note → dev}/ftptools.rb +0 -0
  20. data/{doc/note → dev}/license-each.rb +0 -0
  21. data/{doc/note → dev}/publisher.rb +0 -0
  22. data/{doc/note → dev}/rubyforgepublisher.rb +0 -0
  23. data/{doc/note → dev}/sshpublisher.rb +0 -0
  24. data/{doc/note → dev}/suby-cvs.rb +0 -0
  25. data/{doc/note → dev}/template.rb +0 -0
  26. data/lib/reap/bin/reap.rb +67 -84
  27. data/{doc/note/interface/interface.rb → lib/reap/lint.rb} +0 -0
  28. data/lib/reap/projectinfo.rb +28 -206
  29. data/lib/reap/readymade.rb +21 -0
  30. data/lib/reap/task.rb +118 -184
  31. data/lib/reap/task/announce.rb +93 -181
  32. data/lib/reap/task/fileperm.rb +16 -46
  33. data/lib/reap/task/info.rb +7 -33
  34. data/lib/reap/task/install.rb +17 -52
  35. data/{task → lib/reap/task}/noop.rb +9 -4
  36. data/lib/reap/task/package.rb +102 -348
  37. data/lib/reap/task/publish.rb +29 -155
  38. data/lib/reap/task/rdoc.rb +40 -92
  39. data/lib/reap/task/scaffold.rb +98 -41
  40. data/lib/reap/task/test.rb +52 -147
  41. data/lib/reap/task/testext.rb +110 -0
  42. data/lib/reap/task/webpublish.rb +43 -0
  43. data/lib/reap/tasks.rb +13 -0
  44. data/lib/reap/test.rb +138 -0
  45. data/setup.rb +272 -287
  46. data/test/tc_reap.rb +1 -1
  47. data/web/ProjectInfo +57 -0
  48. data/web/images/appleboy.jpg +0 -0
  49. data/web/images/grape.jpg +0 -0
  50. data/web/index.html +124 -0
  51. data/web/rdoc/classes/Object.html +121 -0
  52. data/web/rdoc/classes/ProjectInfo.html +207 -0
  53. data/web/rdoc/classes/ProjectInfo.src/M000094.html +18 -0
  54. data/web/rdoc/classes/ProjectInfo.src/M000095.html +24 -0
  55. data/web/rdoc/classes/ProjectInfo.src/M000096.html +22 -0
  56. data/web/rdoc/classes/ProjectInfo.src/M000097.html +21 -0
  57. data/web/rdoc/classes/ProjectInfo.src/M000098.html +18 -0
  58. data/web/rdoc/classes/Reap.html +248 -0
  59. data/web/rdoc/classes/Reap.src/M000023.html +16 -0
  60. data/web/rdoc/classes/Reap.src/M000024.html +21 -0
  61. data/web/rdoc/classes/Reap.src/M000025.html +16 -0
  62. data/web/rdoc/classes/Reap.src/M000026.html +21 -0
  63. data/web/rdoc/classes/Reap/Announce.html +262 -0
  64. data/web/rdoc/classes/Reap/Announce.src/M000030.html +18 -0
  65. data/web/rdoc/classes/Reap/Announce.src/M000031.html +114 -0
  66. data/web/rdoc/classes/Reap/Announce.src/M000032.html +46 -0
  67. data/web/rdoc/classes/Reap/Info.html +176 -0
  68. data/web/rdoc/classes/Reap/Info.src/M000033.html +18 -0
  69. data/web/rdoc/classes/Reap/Info.src/M000034.html +17 -0
  70. data/web/rdoc/classes/Reap/Info.src/M000035.html +18 -0
  71. data/web/rdoc/classes/Reap/Install.html +193 -0
  72. data/web/rdoc/classes/Reap/Install.src/M000036.html +18 -0
  73. data/web/rdoc/classes/Reap/Install.src/M000037.html +20 -0
  74. data/web/rdoc/classes/Reap/Install.src/M000038.html +26 -0
  75. data/web/rdoc/classes/Reap/Noop.html +192 -0
  76. data/web/rdoc/classes/Reap/Noop.src/M000027.html +18 -0
  77. data/web/rdoc/classes/Reap/Noop.src/M000028.html +17 -0
  78. data/web/rdoc/classes/Reap/Noop.src/M000029.html +18 -0
  79. data/web/rdoc/classes/Reap/Package.html +310 -0
  80. data/web/rdoc/classes/Reap/Package.src/M000055.html +18 -0
  81. data/web/rdoc/classes/Reap/Package.src/M000056.html +68 -0
  82. data/web/rdoc/classes/Reap/Package.src/M000057.html +84 -0
  83. data/web/rdoc/classes/Reap/Package.src/M000058.html +61 -0
  84. data/web/rdoc/classes/Reap/Perm.html +236 -0
  85. data/web/rdoc/classes/Reap/Perm.src/M000078.html +18 -0
  86. data/web/rdoc/classes/Reap/Perm.src/M000079.html +21 -0
  87. data/web/rdoc/classes/Reap/Perm.src/M000080.html +42 -0
  88. data/web/rdoc/classes/Reap/Perm.src/M000081.html +26 -0
  89. data/web/rdoc/classes/Reap/Perm.src/M000082.html +18 -0
  90. data/web/rdoc/classes/Reap/Publish.html +213 -0
  91. data/web/rdoc/classes/Reap/Publish.src/M000070.html +18 -0
  92. data/web/rdoc/classes/Reap/Publish.src/M000071.html +22 -0
  93. data/web/rdoc/classes/Reap/Publish.src/M000072.html +37 -0
  94. data/web/rdoc/classes/Reap/RDoc.html +218 -0
  95. data/web/rdoc/classes/Reap/RDoc.src/M000059.html +18 -0
  96. data/web/rdoc/classes/Reap/RDoc.src/M000060.html +24 -0
  97. data/web/rdoc/classes/Reap/RDoc.src/M000061.html +70 -0
  98. data/web/rdoc/classes/Reap/Task.html +396 -0
  99. data/web/rdoc/classes/Reap/Task.src/M000039.html +18 -0
  100. data/web/rdoc/classes/Reap/Task.src/M000040.html +16 -0
  101. data/web/rdoc/classes/Reap/Task.src/M000041.html +16 -0
  102. data/web/rdoc/classes/Reap/Task.src/M000042.html +16 -0
  103. data/web/rdoc/classes/Reap/Task.src/M000043.html +16 -0
  104. data/web/rdoc/classes/Reap/Task.src/M000044.html +22 -0
  105. data/web/rdoc/classes/Reap/Task.src/M000045.html +16 -0
  106. data/web/rdoc/classes/Reap/Task.src/M000046.html +16 -0
  107. data/web/rdoc/classes/Reap/Task.src/M000047.html +16 -0
  108. data/web/rdoc/classes/Reap/Task.src/M000048.html +16 -0
  109. data/web/rdoc/classes/Reap/Task.src/M000049.html +16 -0
  110. data/web/rdoc/classes/Reap/Task.src/M000050.html +27 -0
  111. data/web/rdoc/classes/Reap/Task.src/M000051.html +19 -0
  112. data/web/rdoc/classes/Reap/Task.src/M000052.html +18 -0
  113. data/web/rdoc/classes/Reap/Task.src/M000053.html +18 -0
  114. data/web/rdoc/classes/Reap/Task.src/M000054.html +19 -0
  115. data/web/rdoc/classes/Reap/Test.html +253 -0
  116. data/web/rdoc/classes/Reap/Test.src/M000062.html +18 -0
  117. data/web/rdoc/classes/Reap/Test.src/M000063.html +26 -0
  118. data/web/rdoc/classes/Reap/Test.src/M000064.html +77 -0
  119. data/web/rdoc/classes/Reap/Test.src/M000065.html +27 -0
  120. data/web/rdoc/classes/Reap/Test.src/M000066.html +50 -0
  121. data/web/rdoc/classes/Reap/Test/TestResults.html +205 -0
  122. data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +21 -0
  123. data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +21 -0
  124. data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +23 -0
  125. data/web/rdoc/classes/Reap/TestExt.html +234 -0
  126. data/web/rdoc/classes/Reap/TestExt.src/M000073.html +18 -0
  127. data/web/rdoc/classes/Reap/TestExt.src/M000074.html +20 -0
  128. data/web/rdoc/classes/Reap/TestExt.src/M000075.html +49 -0
  129. data/web/rdoc/classes/Reap/TestExt.src/M000076.html +34 -0
  130. data/web/rdoc/classes/Reap/TestExt.src/M000077.html +27 -0
  131. data/web/rdoc/classes/Reap/WebPublish.html +213 -0
  132. data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +18 -0
  133. data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +21 -0
  134. data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +32 -0
  135. data/web/rdoc/classes/ReapCommand.html +425 -0
  136. data/web/rdoc/classes/ReapCommand.src/M000001.html +16 -0
  137. data/web/rdoc/classes/ReapCommand.src/M000003.html +16 -0
  138. data/web/rdoc/classes/ReapCommand.src/M000005.html +16 -0
  139. data/web/rdoc/classes/ReapCommand.src/M000007.html +16 -0
  140. data/web/rdoc/classes/ReapCommand.src/M000009.html +16 -0
  141. data/web/rdoc/classes/ReapCommand.src/M000011.html +16 -0
  142. data/web/rdoc/classes/ReapCommand.src/M000013.html +18 -0
  143. data/web/rdoc/classes/ReapCommand.src/M000014.html +19 -0
  144. data/web/rdoc/classes/ReapCommand.src/M000015.html +19 -0
  145. data/web/rdoc/classes/ReapCommand.src/M000016.html +24 -0
  146. data/web/rdoc/classes/ReapCommand.src/M000018.html +29 -0
  147. data/web/rdoc/classes/Scaffold.html +211 -0
  148. data/web/rdoc/classes/Scaffold.src/M000086.html +16 -0
  149. data/web/rdoc/classes/Scaffold.src/M000087.html +28 -0
  150. data/web/rdoc/classes/Scaffold.src/M000088.html +32 -0
  151. data/web/rdoc/classes/Scaffold.src/M000089.html +18 -0
  152. data/web/rdoc/classes/UnitTestKernel.html +176 -0
  153. data/web/rdoc/classes/UnitTestKernel.src/M000019.html +18 -0
  154. data/web/rdoc/classes/UnitTestKernel.src/M000020.html +18 -0
  155. data/web/rdoc/classes/UnitTestKernel.src/M000021.html +22 -0
  156. data/web/rdoc/classes/UnitTestKernel.src/M000022.html +22 -0
  157. data/web/rdoc/classes/UnitTesting.html +165 -0
  158. data/web/rdoc/classes/UnitTesting.src/M000090.html +34 -0
  159. data/web/rdoc/classes/UnitTesting.src/M000091.html +18 -0
  160. data/web/rdoc/classes/UnitTesting/Failure.html +156 -0
  161. data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +18 -0
  162. data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +21 -0
  163. data/web/rdoc/created.rid +1 -0
  164. data/web/rdoc/files/ANN.html +107 -0
  165. data/web/rdoc/files/COPYING.html +119 -0
  166. data/web/rdoc/files/ChangeLog.html +144 -0
  167. data/web/rdoc/files/ProjectInfo.html +190 -0
  168. data/web/rdoc/files/README.html +274 -0
  169. data/web/rdoc/files/Rakefile.html +101 -0
  170. data/web/rdoc/files/lib/reap/bin/reap_rb.html +129 -0
  171. data/web/rdoc/files/lib/reap/lint_rb.html +101 -0
  172. data/web/rdoc/files/lib/reap/projectinfo_rb.html +110 -0
  173. data/web/rdoc/files/lib/reap/readymade_rb.html +123 -0
  174. data/web/rdoc/files/lib/reap/task/announce_rb.html +114 -0
  175. data/web/rdoc/files/lib/reap/task/fileperm_rb.html +108 -0
  176. data/web/rdoc/files/lib/reap/task/info_rb.html +108 -0
  177. data/web/rdoc/files/lib/reap/task/install_rb.html +108 -0
  178. data/web/rdoc/files/lib/reap/task/noop_rb.html +108 -0
  179. data/web/rdoc/files/lib/reap/task/package_rb.html +109 -0
  180. data/web/rdoc/files/lib/reap/task/publish_rb.html +108 -0
  181. data/web/rdoc/files/lib/reap/task/rdoc_rb.html +108 -0
  182. data/web/rdoc/files/lib/reap/task/scaffold_rb.html +107 -0
  183. data/web/rdoc/files/lib/reap/task/test_rb.html +110 -0
  184. data/web/rdoc/files/lib/reap/task/testext_rb.html +109 -0
  185. data/web/rdoc/files/lib/reap/task/webpublish_rb.html +108 -0
  186. data/web/rdoc/files/lib/reap/task_rb.html +120 -0
  187. data/web/rdoc/files/lib/reap/tasks_rb.html +116 -0
  188. data/web/rdoc/files/lib/reap/test_rb.html +109 -0
  189. data/web/rdoc/fr_class_index.html +47 -0
  190. data/web/rdoc/fr_file_index.html +51 -0
  191. data/web/rdoc/fr_method_index.html +124 -0
  192. data/web/rdoc/index.html +24 -0
  193. data/web/rdoc/rdoc-style.css +208 -0
  194. metadata +257 -138
  195. data/bin/rubytest +0 -5
  196. data/data/reap/scaffold/standard/COPYING +0 -403
  197. data/data/reap/scaffold/standard/INSTALL +0 -14
  198. data/data/reap/scaffold/standard/README +0 -3
  199. data/data/reap/scaffold/standard/Rakefile +0 -10
  200. data/data/reap/scaffold/standard/setup.rb +0 -1568
  201. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  202. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  203. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -78
  204. data/data/reap/scaffold/subversion/trunk/README +0 -3
  205. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  206. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  207. data/data/reap/setup.rb +0 -1568
  208. data/doc/COPYING +0 -403
  209. data/doc/ChangeLog +0 -18
  210. data/doc/LATEST +0 -29
  211. data/doc/README +0 -182
  212. data/doc/doap.xml +0 -27
  213. data/doc/note/ProjectInfo.rb +0 -88
  214. data/doc/note/Rakefile.0 +0 -118
  215. data/doc/note/Rakefile.htm +0 -69
  216. data/doc/note/application.rb +0 -124
  217. data/doc/note/interface/rubyforge.rb +0 -247
  218. data/doc/note/intro.txt +0 -42
  219. data/doc/note/package.rb +0 -629
  220. data/doc/note/package.rb.0 +0 -394
  221. data/doc/note/scaffold.rb +0 -123
  222. data/lib/reap/app.rb +0 -74
  223. data/lib/reap/bin/rubylint.rb +0 -1
  224. data/lib/reap/bin/rubytest.rb +0 -45
  225. data/lib/reap/rake.rb +0 -12
  226. data/lib/reap/rakeadapter.rb +0 -50
  227. data/lib/reap/reap.rb +0 -32
  228. data/lib/reap/task/custom.rb +0 -12
  229. data/lib/reap/task/doap.rb +0 -85
  230. data/lib/reap/task/extest.rb +0 -161
  231. data/lib/reap/task/manifest.rb +0 -70
  232. data/lib/reap/task/release.rb +0 -512
  233. data/lib/reap/task/template.rb +0 -46
  234. data/lib/reap/vendor/http-access2.rb +0 -1590
  235. data/lib/reap/vendor/http-access2/cookie.rb +0 -538
  236. data/lib/reap/vendor/http-access2/http.rb +0 -542
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  #
4
2
  # setup.rb
5
3
  #
@@ -57,7 +55,7 @@ class ConfigTable
57
55
  @config_opt = nil
58
56
  @verbose = true
59
57
  @no_harm = false
60
- @libsrc_pattern = '*.rb' # THIS IS NOT GOOD!!!
58
+ @libsrc_pattern = '*.rb'
61
59
  end
62
60
 
63
61
  attr_accessor :install_prefix
@@ -637,8 +635,8 @@ module FileOperations
637
635
  f.write str
638
636
  }
639
637
  File.chmod mode, realdest
640
- # 0777
641
- File.open("#{objdir_root()}/InstalledFiles", 'a', 0777) {|f|
638
+
639
+ File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
642
640
  if prefix
643
641
  f.puts realdest.sub(prefix, '')
644
642
  else
@@ -662,7 +660,7 @@ module FileOperations
662
660
  def ruby(*args)
663
661
  command config('rubyprog'), *args
664
662
  end
665
-
663
+
666
664
  def make(task = nil)
667
665
  command(*[config('makeprog'), task].compact)
668
666
  end
@@ -725,7 +723,7 @@ module HookScriptAPI
725
723
  def srcdirectory?(path)
726
724
  File.dir?(srcfile(path))
727
725
  end
728
-
726
+
729
727
  def srcfile?(path)
730
728
  File.file?(srcfile(path))
731
729
  end
@@ -773,13 +771,11 @@ class ToplevelInstaller
773
771
  config.load_multipackage_entries if multipackage?
774
772
  config.fixup
775
773
  klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller)
776
- #klass.new(File.dirname($setup_pwd), config).invoke
777
- klass.new($setup_pwd, config).invoke
774
+ klass.new(File.dirname($0), config).invoke
778
775
  end
779
776
 
780
777
  def ToplevelInstaller.multipackage?
781
- #File.dir?(File.dirname($setup_pwd) + '/packages')
782
- File.dir?($setup_pwd + '/packages')
778
+ File.dir?(File.dirname($0) + '/packages')
783
779
  end
784
780
 
785
781
  def ToplevelInstaller.load_rbconfig
@@ -831,7 +827,7 @@ class ToplevelInstaller
831
827
  __send__ "exec_#{task}"
832
828
  end
833
829
  end
834
-
830
+
835
831
  def run_metaconfigs
836
832
  @config.load_script "#{@ardir}/metaconfig"
837
833
  end
@@ -873,9 +869,9 @@ class ToplevelInstaller
873
869
  when '--help'
874
870
  print_usage $stdout
875
871
  exit 0
876
- #when '--version'
877
- # puts "#{File.basename($setup_pwd)} version #{Version}"
878
- # exit 0
872
+ when '--version'
873
+ puts "#{File.basename($0)} version #{Version}"
874
+ exit 0
879
875
  when '--copyright'
880
876
  puts Copyright
881
877
  exit 0
@@ -1310,7 +1306,6 @@ class Installer
1310
1306
  end
1311
1307
 
1312
1308
  def install_dir_lib(rel)
1313
- p rubyscripts(), "#{config('rbdir')}/#{rel}", 0644
1314
1309
  install_files rubyscripts(), "#{config('rbdir')}/#{rel}", 0644
1315
1310
  end
1316
1311
 
@@ -1544,7 +1539,6 @@ def setup_rb_error(msg)
1544
1539
  raise SetupError, msg
1545
1540
  end
1546
1541
 
1547
- =begin
1548
1542
  if $0 == __FILE__
1549
1543
  begin
1550
1544
  ToplevelInstaller.invoke
@@ -1555,4 +1549,3 @@ if $0 == __FILE__
1555
1549
  exit 1
1556
1550
  end
1557
1551
  end
1558
- =end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,19 +1,18 @@
1
1
 
2
- # Support libraries
2
+ require 'facets'
3
3
  require 'rbconfig'
4
+ require 'carat/shellcommand'
5
+ require 'reap/tasks'
4
6
 
5
- require 'facets'
6
- require 'consoleapp'
7
- #require 'console/command'
7
+ INFO_FILES = [ 'ProjectInfo', 'Reapfile', 'projectinfo', 'reapfile' ]
8
8
 
9
- require 'reap/reap'
9
+ Reap.register
10
10
 
11
- class ReapCommand < Console::Command
11
+ module Reap
12
+ Version = "2005-10-06"
13
+ end
12
14
 
13
- # to do first for every task
14
- #def command_setup
15
- # $PROJECT_INFO = ProjectInfo.new( $PROJECT_FILE )
16
- #end
15
+ class ReapCommand < ShellCommand
17
16
 
18
17
  # Options
19
18
 
@@ -21,22 +20,15 @@ class ReapCommand < Console::Command
21
20
  def __verbose ; $VERBOSE = true ; end
22
21
  alias_method :_V, :__verbose
23
22
 
24
- # option to display help
25
- def __force ; $FORCE = true ; end
26
- alias_method :_f, :__force
27
-
28
- # pretend mode (under construction)
29
- def __pretend; $PRETEND = true ; end
30
- alias_method :_P, :__pretend
31
-
32
23
  # debug mode (under construction)
33
24
  def __debug; $DEBUG = true ; end
34
25
  alias_method :_D, :__debug
35
26
 
36
- def __password( pass ); $PASSWORD = pass ; end
37
- alias_method :_p, :__password
27
+ # pretend mode (under construction)
28
+ def __pretend; $PRETEND = true ; end
29
+ alias_method :_P, :__pretend
38
30
 
39
- # display reap version
31
+ # option to display version
40
32
  def __version ; version ; end
41
33
  alias_method :_v, :__version
42
34
 
@@ -48,78 +40,61 @@ class ReapCommand < Console::Command
48
40
  def __tasks; tasks ; end
49
41
  alias_method :_t, :__tasks
50
42
 
51
- #option for build version (only for package task)
52
- def _b ; $BUILD_VERSION = true ; end
43
+ # option for require
44
+ #def __require(r); @require = r ; end
45
+ #alias_method :_r, :__require
53
46
 
54
- #def _f( pif ) ; $PROJECT_FILE = pif ; end
55
- #alias_method :_f, :__file
47
+ # Commands
56
48
 
57
49
  # default action
58
-
59
50
  def default
60
51
  tasks
61
52
  end
62
53
 
63
54
  # display version
64
-
65
55
  def version
66
- puts "Reap v#{Reap::Version}"
56
+ puts "Reap v.#{Reap::Version}"
67
57
  exit 0
68
58
  end
69
59
 
70
60
  # display help
71
-
72
- def help(tsk=nil)
73
- if tsk
74
- t = Reap.application.tasks[tsk]
75
- unless t
76
- puts "Unknown task '#{tsk}'."
77
- exit 0
78
- end
79
- s = "\n"
80
- s << "#{args[0]}: "
81
- s << t.task_desc.sub(/^\n+/, '').rstrip
82
- s << "\n\n"
83
- if thelp = t.task_help
84
- s << thelp.sub(/^\n+/, '').rstrip
85
- end
86
- s << "\n\n"
87
- puts s
88
- else
89
- puts HELP
90
- end
61
+ def help
62
+ puts HELP
91
63
  exit 0
92
64
  end
93
65
 
94
66
  # list available tasks
95
-
96
67
  def tasks
97
- app = Reap.application
98
- tasklist = []
99
- if app.tasks.empty?
100
- puts "No tasks available."
101
- else
102
- sorted = app.tasks.keys.sort
103
- margin = sorted.collect{ |t| t.size }.max + 6
104
- sorted.each do |name|
105
- tasklist << " #{name}".ljust(margin) + "#{app.tasks[name].task_desc}"
106
- end
107
- puts "(#{Dir.pwd})"
108
- puts
109
- puts tasklist.join("\n")
110
- puts
68
+ Reap.initialize #_all
69
+ puts
70
+ Reap.tasks.each do |name,task|
71
+ puts " #{name}".ljust(20) + "#{task.task_desc}"
111
72
  end
73
+ puts
74
+ exit 0
112
75
  end
113
- #alias_method :ls, :tasks
76
+ alias_method :ls, :tasks
114
77
 
115
- # Add all the reap tasks.
78
+ # copy the file from lib/data to the current dir.
79
+ def template
80
+ if INFO_FILES.any?{ |f| File.exists?(f) }
81
+ puts "Project file already exists."
82
+ exit 0
83
+ end
84
+ filename = 'ProjectInfo'
85
+ dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold' )
86
+ f = File.join( dir, filename )
87
+ raise "ProjectInfo template file #{f} is missing." unless File.file?( f )
88
+ # copy
89
+ FileUtils.cp( f, filename )
90
+ puts "#{filename} created. You'll need to fill it out."
91
+ exit 0
92
+ end
116
93
 
117
- app = Reap.application
118
- app.tasks.each do |name, task|
119
- define_method(name) { |*args|
120
- #puts "(#{Dir.pwd})"
121
- task.execute( *args )
122
- }
94
+ Reap.registry.each do |sym,taskclass|
95
+ define_method(sym) do |*args|
96
+ taskclass.new.run(*args)
97
+ end
123
98
  end
124
99
 
125
100
  end
@@ -127,25 +102,33 @@ end
127
102
 
128
103
  HELP = <<-HERE
129
104
 
130
- reap [options...] <command> [arguments...]
105
+ reap v#{::Reap::Version}
106
+
107
+ USAGE: reap [options...] <command> [arguments...]
131
108
 
132
109
  COMMANDS:
133
110
 
134
- tasks
135
- List all the current tasks with descriptions.
136
- (This is the default if no command is given.)
111
+ scaffold
112
+ Copies a ProjectInfo template into the current
113
+ directory, if it doesn't already exist. If it does
114
+ exist will build the project directory based on it.
115
+ This will not destroy any structure already in place!
137
116
 
138
- help [task]
139
- Displays this help information. If a task name is given,
140
- it will provide help information specific to that task.
117
+ help
118
+ Displays this help information.
141
119
 
142
120
  OPTIONS:
143
121
 
144
- -h --help Display this help information.
145
- -v --version Display the current version.
146
- -V --verbose Provides extra verbose processing information.
147
- -f --force Forces certain operations to be performed.
148
- -D --debug Provides extra verbose processing information.
149
- -f --file Specify alternate project file.
122
+ -v --version
123
+ Display the current version.
124
+
125
+ -V --verbose
126
+ Provides extra verbose processing information.
127
+
128
+ -D --debug
129
+ Provides extra verbose processing information.
130
+
131
+ -h --help
132
+ Display this help information.
150
133
 
151
134
  HERE
@@ -1,229 +1,51 @@
1
1
 
2
2
  require 'yaml'
3
-
4
3
  require 'facet/hash/traverse'
5
4
  require 'facet/string/tabto'
6
5
  require 'facet/dir/self/ascend'
7
- require 'facet/kernel/require_all'
8
-
9
- require 'facet/basicobject'
10
-
11
-
12
- # Project information, generally read from a file.
13
- # Simply by calling 'ProjectInfo.load'.
14
- #
15
- # ProjectInfo is a Singleton. Access it via the
16
- # ProjectInfo.instance method.
17
-
18
- class ProjectInfo
19
-
20
- INFO_FILES = [
21
- 'ProjectInfo',
22
- 'ReapFile',
23
- 'projectinfo',
24
- 'reapfile'
25
- ]
26
-
27
- class << self
28
-
29
- # Singelton Pattern.
30
-
31
- private :new
32
-
33
- def instance( *args, &block )
34
- @instance ||= new( *args, &block )
35
- end
36
-
37
- # Find project information file.
38
-
39
- def find
40
- info_dir, info_file = nil, nil
41
- Dir.ascend(Dir.pwd) do |info_dir|
42
- info_file = INFO_FILES.find{ |f| File.file?( File.join( info_dir, f ) ) }
43
- break if info_file
44
- end
45
- return nil unless info_file
46
- return File.join( info_dir, info_file )
47
- end
48
6
 
49
- # Load the project information from a file. Generally
50
- # no file needs to be specified; the file will be found
51
- # by ascending up the current path until a default
52
- # file name is found (eg. ProjectInfo or Reapfile).
7
+ module ProjectInfo
8
+ extend self
53
9
 
54
- def load( fpath=nil )
55
- instance.read( fpath )
56
- end
10
+ INFO_FILES = [ 'ProjectInfo', 'ReapFile', 'projectinfo', 'reapfile' ]
57
11
 
12
+ def add_info_file( f )
13
+ INFO_FILES.unshift( f )
58
14
  end
59
15
 
60
-
61
- attr_reader :info, :info_stream, :info_dir, :info_file
62
-
63
- def initialize( &block )
64
- @info = {}
65
- @info_stream = nil
66
-
67
- define( &block ) if block_given?
68
-
69
- #$PROJECT_INFO = self
70
- end
71
-
72
- # Define project information programmatically.
73
-
74
- def define( &block )
75
- return unless block
76
-
77
- @info = HashBuilder.new( &block ).to_h
78
- @info_stream = @info.to_yaml
79
- @info_dir = Dir.pwd #?
80
- @info_file = nil
81
-
82
- #validate
83
- defaults
84
-
85
- self
86
- end
87
-
88
- # Load project information from YAML file.
89
-
90
- def read( fpath )
91
- return unless fpath
92
-
93
- @info_dir = File.dirname( fpath )
94
- @info_file = fpath #File.basename( fpath )
95
- @info_stream = File.read( fpath ).strip
96
- @info = YAML::load( info_stream ).traverse{ |k,v| [k.to_s.downcase, v] }
97
-
98
- #validate
99
- defaults
100
-
101
- @info.each do |key, value|
102
- case value when Reap::Task
103
- value.task_name = key
16
+ def info_stream
17
+ dir = Dir.pwd
18
+ unless @info_stream
19
+ Dir.ascend(Dir.pwd) do |d|
20
+ Dir.chdir(d)
21
+ info_file = INFO_FILES.find{ |f| File.file?( f ) }
22
+ if info_file
23
+ @info_stream = File.read( info_file )
24
+ puts "(in #{d})" unless dir == Dir.pwd
25
+ break
26
+ end
104
27
  end
105
28
  end
106
-
107
- self
29
+ @info_stream
108
30
  end
109
31
 
110
- # Update project information.
111
-
112
- def update( info=nil, &block )
113
- if info
114
- @info.update( info.traverse{ |k,v| [k.to_s.downcase, v] } )
115
- end
116
- if block_given?
117
- @info.update( HashBuilder.new( &block ).to_h )
32
+ def info
33
+ if info_stream
34
+ @info ||= YAML::load(info_stream).traverse{ |k,v| [k.downcase, v] }
35
+ else
36
+ {}
118
37
  end
119
- @info_stream = @info.to_yaml
120
-
121
- #validate
122
- defaults
123
-
124
- self
125
38
  end
126
39
 
127
- # Project information file exists? (may need to change to info exists?)
128
-
129
- #def exists?
130
- # @info_file
131
- #end
132
-
133
- # Validate project information.
134
-
135
- def validate #( *fields )
136
- val = true
137
- (puts "NAME is required in project information file."; val=false) unless info['name']
138
- (puts "VERSION is required in project information file."; val=false) unless info['version']
139
- exit -1 unless val
140
- end
141
-
142
- # Project information defaults.
143
-
144
- def defaults
145
- self['title'] ||= self['name'].capitalize
146
- self['series'] ||= '1'
147
- self['date'] ||= Time.now.strftime("%Y-%m-%d")
148
- self['author'] ||= "Anonymous"
149
- self['maintainer'] ||= self['author']
150
- self['arch'] ||= 'Any'
151
- self['license'] ||= 'Ruby/GPL'
152
- self['status'] ||= 'Beta'
153
- self['project'] ||= self['rubyforge'] ? self['rubyforge']['project'] : nil
154
- self['homepage'] ||= self['rubyforge'] ? self['rubyforge']['homepage'] : nil
40
+ # not using at the moment
41
+ def validate
42
+ # required main parameters
43
+ #raise "TITLE is a required configuration field" unless info['title']
44
+ raise "NAME is a required piece of information" unless info['name']
45
+ raise "VERSION is a required piece of informatiomn" unless info['version']
155
46
  end
156
47
 
157
- # Convert to a CascadinOpenObject.
158
-
159
- def to_cascading_open_object
160
- CascadingOpenObject.new( @info )
161
- end
162
-
163
- # Information fetch.
164
-
165
48
  def [](name)
166
49
  info[name]
167
50
  end
168
-
169
- # Information store.
170
-
171
- def []=(name, x)
172
- info[name] = x
173
- end
174
-
175
- def each( &block )
176
- @info.each( &block )
177
- end
178
-
179
- # Information to hash.
180
-
181
- def to_h
182
- @info.dup
183
- end
184
-
185
- end
186
-
187
-
188
- # Build a hash from missing method calls.
189
-
190
- class ProjectInfo::HashBuilder < BasicObject
191
-
192
- def initialize( blockstr=nil, &block )
193
- @hash = {}
194
- @flag = {}
195
- raise "both string and block given" if blockstr and block_given?
196
- if blockstr
197
- instance_eval blockstr
198
- else
199
- instance_eval &block
200
- end
201
- end
202
-
203
- def to_h ; @hash ; end
204
-
205
- def method_missing( sym, *args, &block )
206
- sym = sym.to_s.downcase
207
-
208
- if @hash.key?(sym)
209
- unless @flag[sym]
210
- @hash[sym] = [ @hash[sym] ]
211
- @flag[sym] = true
212
- end
213
- if block_given?
214
- @hash[sym] << self.__class__.new( &block ).to_h
215
- else
216
- @hash[sym] << args[0]
217
- end
218
- else
219
- if block_given?
220
- @hash[sym] = self.__class__.new( &block ).to_h
221
- else
222
- @hash[sym] = args[0]
223
- end
224
- end
225
-
226
- end
227
-
228
51
  end
229
-