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
@@ -0,0 +1,21 @@
1
+
2
+ # This loads in the reap tasks and setsup
3
+ # some tasks that are typically ready to go
4
+ # without additional paramaters.
5
+
6
+ require 'reap/task/announce'
7
+ require 'reap/task/extract_tests'
8
+ require 'reap/task/fileperm'
9
+ require 'reap/task/info'
10
+ require 'reap/task/install'
11
+ require 'reap/task/package'
12
+ require 'reap/task/publish'
13
+ require 'reap/task/rdoc'
14
+ require 'reap/task/test'
15
+
16
+ rdoc_task( :rdoc )
17
+ tests_task( :test )
18
+ install_task( :install )
19
+ info_task( :info )
20
+ package_task( :package )
21
+ extract_tests_task( :exttests )
@@ -5,249 +5,183 @@ require 'fileutils'
5
5
  require 'facet/fileutils/safe_ln'
6
6
  require 'facet/string/tabto'
7
7
  require 'facet/module/basename'
8
- require 'facet/module/attr_setter'
9
8
 
10
- require 'facet/filelist' unless defined?( FileList )
11
- require 'facet/openobject'
9
+ require 'carat/filelist'
12
10
 
13
11
  require 'reap/projectinfo'
14
12
 
15
- # _____ _ ___ ___ _
16
- # |_ _|_ _ __| |__ | _ ) __ _ ___ ___ / __| |__ _ ______
17
- # | |/ _` (_-< / / | _ \/ _` (_-</ -_) | (__| / _` (_-<_-<
18
- # |_|\__,_/__/_\_\ |___/\__,_/__/\___| \___|_\__,_/__/__/
19
- #
20
-
21
13
  # Base class for reap tasks.
22
14
  #
23
- # Here's a simple example:
15
+ # Here's an oh so simple example:
24
16
  #
25
17
  # class MyTask < Reap::Task
26
18
  #
27
- # task_desc 'this is a custom reap task'
19
+ # register 'mytask'
28
20
  #
29
- # task_attr :mytask
21
+ # default_desc 'this is a custom reap task'
30
22
  #
31
- # def run
23
+ # attr_accessor :message
32
24
  #
33
- # mytask.message ||= 'None Found!'
25
+ # def init
26
+ # @message ||= master['default'] || 'None Found!'
27
+ # end
34
28
  #
35
- # puts mytask.message #=> Hello!
36
- # puts master.default #=> Yo!
37
- # puts mytask.default #=> Yo! (inherited from master)
29
+ # def run
30
+ # puts @message
38
31
  # end
39
32
  # end
40
33
  #
41
- # With the corresponding settings in the ProjectInfo file as:
34
+ # The corresponding settings in the ProjectInfo file will then be:
42
35
  #
43
- # default: Yo!
36
+ # default: Default text, if any.
44
37
  #
45
- # mytask:
46
- # message: Hello!
38
+ # myname:
39
+ # TASK: mytask
40
+ # message: Message text, if any.
47
41
  #
48
-
49
42
  module Reap
50
43
 
51
- def self.registry
52
- Task.registry
53
- end
54
-
55
- # Task base class.
44
+ def self.registry ; @registry ; end
56
45
 
57
- class Task
58
-
59
- #include ::Config
60
- include ::FileUtils
61
-
62
- RUBY = ::Config::CONFIG['ruby_install_name']
63
-
64
- class << self
65
-
66
- # When this class is inherited the new task is registered.
67
- def inherited( base )
68
- registry << base
69
- YAML.add_private_type( base.basename.downcase ) do |type, val|
70
- base.new( val )
46
+ def self.register
47
+ @registry ||= {}
48
+ ObjectSpace.each_object(Class) { |klass|
49
+ if klass < ::Reap::Task
50
+ if klass.verify
51
+ @registry[klass.basename.downcase] = klass
71
52
  end
72
53
  end
54
+ }
55
+ end
73
56
 
74
- # List of task classes.
75
- def registry
76
- @registry ||= []
77
- end
57
+ def self.tasks ; @tasks ; end
78
58
 
79
- # Task DSL
59
+ def self.initialize
60
+ @tasks ||= {}
61
+ registry.each do |name, klass|
62
+ @tasks[name] = klass.new
63
+ end
64
+ end
80
65
 
81
- # Provides tasks type.
82
- def task_class
83
- basename.downcase
84
- end
85
66
 
86
- # Short one-line description of the task.
87
- def task_desc( text=nil, &block )
88
- return @task_desc = proc { text } if text
89
- return @task_desc = block if block_given?
90
- return @task_desc.call
91
- end
92
- alias_method :desc, :task_desc
93
-
94
- # Takes a string or a block the evaluates to a string
95
- # providing detailed help information about the task.
96
- def task_help( text=nil, &block )
97
- return @task_help = proc { text } if text
98
- return @task_help = block if block_given?
99
- return @task_help.call
100
- end
101
- alias_method :help, :task_help
67
+ class Task
102
68
 
103
- # Set alias for 'task' attribute, which provides
104
- # inherited (from master) access to section data.
105
- # (Deprecate? You can use "alias_method name, :task")
106
- def task_attr( name )
107
- define_method(name) { @task }
108
- end
69
+ include ::Config
70
+ include ::FileUtils
109
71
 
110
- # How to determine if a task is available for use.
111
- # By default a taks is only available if the Project
112
- # file exists and the task's section also exists.
113
- # Common was to loosen this resriction are to
114
- # only require the file, not the seciton:
115
- #
116
- # task_available { Reap.projectfile? }
117
- #
118
- # Or have no restrictions:
119
- #
120
- # task_available true
121
- #
122
- def task_available( bool=false, &block )
123
- if bool
124
- (class << self; self; end).class_eval {
125
- define_method( :available? ){ |app| true }
126
- }
127
- else
128
- (class << self; self; end).class_eval {
129
- define_method( :available?, &block )
130
- }
131
- end
132
- end
72
+ RUBY = CONFIG['ruby_install_name']
133
73
 
134
- # Is the task available for use? By default
135
- # a task is only made available if the
136
- # ProjectInfo file has a task for it.
74
+ # class methods
137
75
 
138
- def available?(app)
139
- false
140
- end
76
+ def self.task_desc ; '(no desciption given)' ; end
77
+ def self.task_name ; basename.downcase ; end
141
78
 
142
- # Class-level access to Project file's master data
143
- # provided via a CascadingOpenObject.
144
- def master
145
- @master ||= ProjectInfo.instance.to_cascading_open_object
146
- end
79
+ def self.section_required( val ) ; @section_required = val ;end
80
+ def self.section_required? ; @section_required ; end
147
81
 
148
- end #<< class
82
+ def self.verify
83
+ assume = true
84
+ if section_required?
85
+ assume = ::ProjectInfo.info.key?(task_name)
86
+ end
87
+ assume
88
+ end
149
89
 
150
90
  # instance methods
151
91
 
152
- attr_accessor :task_name
153
- def name ; task_name ; end
154
-
155
- def task_desc ; @section[:desc] || self.class.task_desc ; end
156
- def task_help ; self.class.task_help ; end
92
+ def task_name ; self.class.task_name ; end
93
+ def task_desc ; self.class.task_desc ; end
157
94
 
158
- def master ; self.class.master ; end
159
- def setting ; @task ; end
95
+ def master ; ::ProjectInfo.info ; end
160
96
 
161
- attr :section
97
+ def section ; @section ; end
162
98
 
163
- def initialize( section )
164
- case section when Hash, nil
165
- @section = CascadingOpenObject.new( section || {} )
166
- else
167
- @section = section
168
- end
169
- end
170
-
171
- # Run task.
99
+ def section_required? ; self.class.section_required? ; end
172
100
 
173
- def execute( *args )
174
- #@section = CascadingOpenObject.new( section )
175
-
176
- task = section.dup
177
- if task.respond_to?(:__parent__)
178
- task.__parent__ = master
179
- end
180
- @task = task
181
-
182
- # deprecate init ?
183
- if respond_to?( :init )
184
- if method(:init).arity == 0
101
+ def initialize
102
+ sect = master[task_name]
103
+ if sect.is_a?(Array)
104
+ sect.each do |s|
105
+ section_parameters_set( s )
185
106
  init
186
- else
187
- init( *args )
188
107
  end
189
- end
190
-
191
- if method(:run).arity == 0
192
- run
193
108
  else
194
- run( *args )
109
+ section_parameters_set( sect || {} )
110
+ init
195
111
  end
196
112
  end
197
113
 
198
- # interface
199
-
200
- #def init
201
- # raise "not implemented for '#{name}' task"
202
- #end
203
-
204
- def run
205
- raise "no action defined for task #{task_name}"
114
+ def section_parameters_set( s )
115
+ @section = s
116
+ @section.each { |k,v| send("#{k}=", v) }
206
117
  end
207
118
 
208
- # delegate to section hash
209
- def method_missing( *args, &block )
210
- @section.send( *args, &block )
119
+ def init
120
+ raise "not implemented for '#{task_name}' task"
211
121
  end
212
122
 
213
- # Task support methods
214
-
215
- def use_subsection( name )
216
- subsection = @section.__send__(task_name)
217
- if subsection
218
- subsection.__parent__ = @section
219
- @task = subsection
220
- end
123
+ def run( *args )
124
+ raise "no action defined for task #{task_name}"
221
125
  end
222
126
 
127
+ # task support methods
128
+
223
129
  def sh( arg )
224
130
  puts arg
225
131
  system arg unless $PRETEND
226
132
  end
227
133
 
228
- def ask( question, answers=nil )
229
- print "#{question}"
230
- print " [#{answers}] " if answers
231
- until inp = $stdin.gets[0,1] ; sleep 1 ; end ; puts
232
- inp
233
- end
234
-
235
- def tell( statement )
236
- puts statement
237
- end
238
-
239
- def provide_setup_rb
240
- return true if File.exists?( 'setup.rb')
241
- # copy from data dir to current directory (Won't work with Gem!)
242
- f = File.join( Config::CONFIG['datadir'], 'reap', 'setup_rb', 'setup.rb' )
243
- if File.exists?(f)
244
- File.cp( f, '.' )
245
- true
246
- else
247
- nil
248
- end
249
- end
134
+ # o = nil
135
+ # o = yld.call(self) if yld
136
+ # if String === o
137
+ # begin
138
+ # section( o ).each { |k,v| send("#{k}=", v ) }
139
+ # end
140
+ # end
141
+ #
142
+ # init
143
+ #
144
+ # task_name ||= default_name
145
+ # task_desc = @desc || default_desc
146
+ #
147
+ # if subtask
148
+ # desc task_desc
149
+ # task task_name => subtask do
150
+ # run
151
+ # end
152
+ # else
153
+ # desc task_desc
154
+ # task task_name do
155
+ # run
156
+ # end
157
+ # end
158
+ # end
250
159
 
251
160
  end #class Task
252
161
 
253
162
  end #module Reap
163
+
164
+
165
+ ##
166
+ # Convenience methods for built-in rake tasks
167
+ ##
168
+ # module RakeTask
169
+ # extend self
170
+ #
171
+ # def gem_package_task(*args,&blk)
172
+ # ::Rake::GemPackageTask.new(*args,&blk)
173
+ # end
174
+ #
175
+ # def package_task(*args,&blk)
176
+ # ::Rake::PackageTask.new(*args,&blk)
177
+ # end
178
+ #
179
+ # def test_task(*args,&blk)
180
+ # ::Rake::TestTask.new(*args,&blk)
181
+ # end
182
+ #
183
+ # def rdoc_task(*args,&blk)
184
+ # ::Rake::RDocTask.new(*args,&blk)
185
+ # end
186
+ #
187
+ # end
@@ -2,243 +2,155 @@
2
2
  require 'reap/task'
3
3
 
4
4
  require 'net/smtp'
5
-
6
5
  require 'facet/string/margin'
7
6
  require 'facet/string/tab'
8
7
  require 'facet/string/align_center'
9
8
  require 'facet/string/fold'
10
9
  require 'facet/string/word_wrap'
11
10
 
12
-
13
- # _ _____ _
14
- # /_\ _ _ _ _ ___ _ _ _ _ __ ___ |_ _|_ _ __| |__
15
- # / _ \| ' \| ' \/ _ \ || | ' \/ _/ -_) | |/ _` (_-< / /
16
- # /_/ \_\_||_|_||_\___/\_,_|_||_\__\___| |_|\__,_/__/_\_\
17
- #
18
-
19
- # = Announcement Task
20
- #
21
- # The announce task is intended for sending out a nice
22
- # formated email message to a mailing address, especially
23
- # mailing-lists. ProjectInfo uses these parameters:
24
- #
25
- # announce:
26
- # server Email server to route message.
27
- # port Email server's port.
28
- # domain Email server's domain name.
29
- # account Email account name.
30
- # type Login type, either plain, cram_md5 or login.
31
- # secure Uses TLS security, true or false?
32
- # to Email address to send announcemnt.
33
- # from Email address sent from.
34
- # subject Subject of email message.
35
- # title Project title.
36
- # summary Brief onl-liner description.
37
- # description Long description of project.
38
- # homespage Project homepage web address.
39
- # links Array of http links to related sites.
40
- # file File that contains announcement message.
41
- # memo Embedded announcement message.
42
- # slogan: Motto for you project.
43
- #
44
11
  class Reap::Announce < Reap::Task
45
12
 
46
- task_desc "Email project announcement."
47
-
48
- task_help %{
49
-
50
- reap announce
51
-
52
- Send an announcement to a mailaing list or other email address.
53
-
54
- Server settings are
55
-
56
- server Email server to route message.
57
- port Email server's port.
58
- domain Email server's domain name.
59
- account Email account name.
60
- type Login type, either plain, cram_md5 or login.
61
- secure Uses TLS security, true or false?
62
-
63
- Message settings are
64
-
65
- to Email address to send announcemnt.
66
- from Email address sent from.
67
- subject Subject of email message.
68
- file File that contains announcement message.
69
- memo Embedded announcement message.
70
-
71
- }
72
-
73
- task_attr :anc
74
-
75
- def run
13
+ section_required true
76
14
 
77
- # setup
78
-
79
- anc.to = (anc.to || 'ruby-talk@ruby-lang.org').to_s.strip
80
- anc.from = (anc.from || master['email']).to_s.strip
81
- anc.server = anc.server.to_s.strip
82
- anc.port = (anc.port || 25).to_i
83
- anc.domain = anc.domain.to_s.strip if anc.domain
84
- anc.account = anc.account.to_s.strip
85
- anc.type = (anc.type || 'plain').to_s.strip #cram_md5 #plain #login
86
-
87
- raise "server is a require announce field" if anc.server.empty?
88
- raise "account is a require announce field" if anc.account.empty?
89
-
90
- anc.title ||= master.title
91
- anc.version ||= master.version || master.date
92
- anc.links ||= []
93
- anc.subject ||= "[ANN] #{anc.title}, v#{anc.version}"
94
-
95
- anc.address = anc.to # TODO
96
-
97
- # validate
15
+ def task_desc
16
+ "Send announcement email to ruby-talk or other address."
17
+ end
98
18
 
99
- #raise "DOMAIN is a required field" if anc.domain.empty?
19
+ attr_accessor :title, :version, :summary, :description, :subject
20
+ attr_accessor :to, :from, :server, :port, :domain, :account
21
+ attr_accessor :authtype, :sectype
22
+ attr_accessor :links, :slogan, :memo, :file
100
23
 
101
- # announce
24
+ def init
25
+ @to = (@to || 'ruby-talk@ruby-lang.org').to_s.strip
26
+ @from = (@from || master['email']).to_s.strip
27
+ @server = @server.to_s.strip
28
+ @port = (@port || 25).to_i
29
+ @domain = @domain.to_s.strip if @domain
30
+ @account = @account.to_s.strip
31
+ @authtype = (@authtype || 'plain').to_s.strip #cram_md5 #plain #login
32
+ #@sectype = @sectype
102
33
 
103
- message = build_message
34
+ raise "server is a require announce field" if @server.empty?
35
+ raise "account is a require announce field" if @account.empty?
104
36
 
105
- puts "\n#{message}\n\n"
106
- print "Send? [y/N] "
107
- until inp = $stdin.gets[0,1] ; sleep 1 ; end
37
+ @title ||= master['title']
38
+ @version ||= master['version']
39
+ @summary ||= master['summary']
40
+ @description ||= master['description']
41
+ @links ||= []
42
+ @subject ||= "[ANN] #{@title}, v#{@version}"
108
43
 
109
- unless inp.downcase == 'y'
110
- puts "Reap announce task canceled."
111
- return nil
112
- end
44
+ @address = @to # TODO
113
45
 
114
- # ask for password
115
- print "Password for #{anc.account}: "
116
- until passwd = $stdin.gets.strip ; sleep 1 ; end
117
-
118
- mail = %Q{
119
- |From: #{anc.from}
120
- |To: #{anc.address}
121
- |Subject: #{anc.subject}
122
- |
123
- |#{message}
124
- }.margin
125
- begin
126
- # --- Send using SMTP object and an adaptor
127
- Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and anc.secure # == :tls
128
- Net::SMTP.start(anc.server, anc.port, anc.domain, anc.account, passwd, anc.type) do |s|
129
- s.send_message mail, anc.from, anc.address
130
- end
131
- puts "Email sent successfully to #{anc.address}."
132
- rescue => e
133
- puts "Email delivery failed."
134
- puts e
135
- end
136
-
137
- end
138
-
139
- private
140
-
141
- def build_message
46
+ #raise "DOMAIN is a required field" if @domain.empty?
142
47
 
143
48
  # header
144
49
  announce = %Q{
145
50
  |
146
51
  |A N N O U N C I N G
147
52
  |
148
- |#{anc.title}, v#{anc.version}
53
+ |#{title}, v#{version}
149
54
  |
150
- |#{anc.summary}
55
+ |#{summary}
151
56
  |
152
- |#{anc.homepage}
153
57
  }.margin.align_center(66)
154
58
 
155
59
  # abstract
156
60
  abstract = ''
157
- if anc.description
61
+ if @description
158
62
  abstract << "\n\n"
159
- abstract << "ABSTRACT\n------------->\n\n#{anc.description}"
63
+ abstract << "ABSTRACT: #{@description}".word_wrap(72)
160
64
  abstract << "\n"
161
65
  end
162
66
 
163
67
  # more info
164
68
  info = ''
165
- unless anc.links.empty?
166
- info << "\n\n"
167
- info << "\nRELATED LINKS\n------------------>\n\n" #.center(67)
168
- anc.links.each{ |mi| info << "#{mi}" << "\n" } #.center(67) << "\n" }
69
+ unless @links.empty?
70
+ info << "\n"
71
+ info << "For More Information".center(67)
72
+ info << "\n"
73
+ @links.each{ |mi| info << "#{mi}".center(67) << "\n" }
169
74
  info << "\n"
170
75
  end
171
76
 
172
77
  # slogan
173
78
  slogan = ''
174
- if anc.slogan
79
+ if @slogan
175
80
  slogan << "\n\n"
176
- slogan << anc.slogan.center(67)
81
+ slogan << @slogan.center(67)
177
82
  slogan << "\n\n"
178
83
  end
179
84
 
180
85
  # memo
181
86
  memo = ''
182
- if anc.memo
87
+ if @memo
183
88
  memo = ''
184
- #memo << "\n---\n" #<< ('-' * 72) << "\n"
185
- memo << "\nRELEASE MEMO\n----------------->\n\n"
186
- memo << anc.memo.strip.fold(true) #.word_wrap(67)
89
+ memo << "\n" << ('-' * 72) << "\n"
90
+ memo << "(Memo)\n\n"
91
+ memo << @memo.fold.word_wrap(72)
187
92
  #memo << "\n"
188
93
  end
189
94
 
190
95
  # msg file
191
96
  msg = ''
192
- if anc.file and File.file?( anc.file )
193
- msg << "\nRELEASE MEMO\n----------------->\n\n"
194
- #msg << "\n---\n" #<< ("-" * 68) << "\n"
195
- #msg << "(from #{anc.file})\n\n"
196
- mg = File.read( anc.file )
197
- msg << mg.strip.fold(true) #.word_wrap(67)
97
+ if @file and File.file?( @file )
98
+ msg << "\n" << ("-" * 72) << "\n"
99
+ msg << "(from #{@file})\n\n"
100
+ mg = ''
101
+ File.open( @file ) { |f| mg << f.gets(nil) }
102
+ msg << mg.fold.word_wrap(72)
198
103
  end
199
104
 
200
105
  # stamp
201
- stamp = "\n\n\n"
202
- #stamp << "\n\n---\n" #<< ("-" * 68) << "\n"
106
+ stamp = ''
107
+ stamp << "\n" << ("-" * 72) << "\n"
203
108
  stamp << %Q{
204
- | Generated by
205
- |
206
- | o)o)o) o)o)o)o) o)o) o)o)o)
207
- | o) o) o) o) o) o) o)
208
- | o)o)o) o)o)o) o)o)o)o) o)o)o)
209
- | o) o) o) o) o) o)
210
- | o) o) o)o)o)o) o) o) o)
211
- |
212
- | The Ruby Project Assistant
213
- |
214
- | Do you Ruby? (http://www.ruby-lang.org)
215
- }.margin.indent(12)
216
- stamp << "\n"
217
-
218
- message = ''
219
- message << announce
220
- message << slogan
221
- message << abstract
222
- message << memo
223
- message << msg
224
- message << info
225
- message << stamp
226
-
227
- message
109
+ |Generated by Reap, a Rake-based Ruby Project Assistant.
110
+ |Do you Ruby? (http://www.ruby-lang.org)
111
+ }.margin
112
+ stamp << "\n\n"
113
+
114
+ @message = ''
115
+ @message << announce
116
+ @message << abstract
117
+ @message << info
118
+ @message << slogan
119
+ @message << memo
120
+ @message << msg
121
+ @message << stamp
228
122
  end
229
123
 
230
- end
231
-
232
-
233
- # Rake interface.
234
-
235
- if defined?(Rake)
236
-
237
- #require 'reap/rake/adapter'
238
-
239
- module Rake
240
- ReapAnnounce = ::Reap::RakeAdapter( ::Reap::Announce )
124
+ def run
125
+ puts "\n#{@message}\n\n"
126
+ print "Send? [Y/n] "
127
+ until inp = $stdin.gets[0,1] ; sleep 1 ; end
128
+ if (inp || 'y').downcase == 'y'
129
+ # ask for password
130
+ print "Password for #{@account}: "
131
+ until passwd = $stdin.gets.strip ; sleep 1 ; end
132
+ mail = %Q{
133
+ |From: #{@from}
134
+ |To: #{@address}
135
+ |Subject: #{@subject}
136
+ |
137
+ |#{@message}
138
+ }.margin
139
+ begin
140
+ # --- Send using SMTP object and an adaptor
141
+ Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and @tls
142
+ Net::SMTP.start(@server, @port, @domain, @account, passwd, @authtype) do |s|
143
+ s.send_message mail, @from, @address
144
+ end
145
+ puts "Email sent successfully to #{@address}."
146
+ rescue => e
147
+ puts "Email delivery failed."
148
+ puts e
149
+ end
150
+ else
151
+ puts "Reap announce task canceled."
152
+ exit 0
153
+ end
241
154
  end
242
155
 
243
156
  end
244
-