reap 5.0.0 → 5.10.10
Sign up to get free protection for your applications and to get access to all the features.
- data/ANN +3 -0
- data/COPYING +11 -0
- data/ChangeLog +25 -0
- data/ProjectInfo +41 -66
- data/README +125 -0
- data/Rakefile +0 -10
- data/bin/reap +3 -4
- data/data/reap/scaffold/COPYING +11 -0
- data/data/reap/scaffold/{standard/ChangeLog → ChangeLog} +0 -0
- data/data/reap/scaffold/{standard/TODO → INSTALL} +0 -0
- data/data/reap/scaffold/{standard/ProjectInfo → ProjectInfo} +20 -20
- data/data/reap/scaffold/{subversion/trunk/ChangeLog → README} +0 -0
- data/data/reap/scaffold/Rakefile +146 -0
- data/data/reap/scaffold/{subversion/trunk/TODO → Todo} +0 -0
- data/{doc/note → data/reap/scaffold}/setup.rb +11 -18
- data/{doc/note/aRakefile → dev/Rakefile} +0 -0
- data/{doc/note → dev}/composite_task.rb +0 -0
- data/{doc/note → dev}/compositepublisher.rb +0 -0
- data/{doc/note → dev}/ftptools.rb +0 -0
- data/{doc/note → dev}/license-each.rb +0 -0
- data/{doc/note → dev}/publisher.rb +0 -0
- data/{doc/note → dev}/rubyforgepublisher.rb +0 -0
- data/{doc/note → dev}/sshpublisher.rb +0 -0
- data/{doc/note → dev}/suby-cvs.rb +0 -0
- data/{doc/note → dev}/template.rb +0 -0
- data/lib/reap/bin/reap.rb +67 -84
- data/{doc/note/interface/interface.rb → lib/reap/lint.rb} +0 -0
- data/lib/reap/projectinfo.rb +28 -206
- data/lib/reap/readymade.rb +21 -0
- data/lib/reap/task.rb +118 -184
- data/lib/reap/task/announce.rb +93 -181
- data/lib/reap/task/fileperm.rb +16 -46
- data/lib/reap/task/info.rb +7 -33
- data/lib/reap/task/install.rb +17 -52
- data/{task → lib/reap/task}/noop.rb +9 -4
- data/lib/reap/task/package.rb +102 -348
- data/lib/reap/task/publish.rb +29 -155
- data/lib/reap/task/rdoc.rb +40 -92
- data/lib/reap/task/scaffold.rb +98 -41
- data/lib/reap/task/test.rb +52 -147
- data/lib/reap/task/testext.rb +110 -0
- data/lib/reap/task/webpublish.rb +43 -0
- data/lib/reap/tasks.rb +13 -0
- data/lib/reap/test.rb +138 -0
- data/setup.rb +272 -287
- data/test/tc_reap.rb +1 -1
- data/web/ProjectInfo +57 -0
- data/web/images/appleboy.jpg +0 -0
- data/web/images/grape.jpg +0 -0
- data/web/index.html +124 -0
- data/web/rdoc/classes/Object.html +121 -0
- data/web/rdoc/classes/ProjectInfo.html +207 -0
- data/web/rdoc/classes/ProjectInfo.src/M000094.html +18 -0
- data/web/rdoc/classes/ProjectInfo.src/M000095.html +24 -0
- data/web/rdoc/classes/ProjectInfo.src/M000096.html +22 -0
- data/web/rdoc/classes/ProjectInfo.src/M000097.html +21 -0
- data/web/rdoc/classes/ProjectInfo.src/M000098.html +18 -0
- data/web/rdoc/classes/Reap.html +248 -0
- data/web/rdoc/classes/Reap.src/M000023.html +16 -0
- data/web/rdoc/classes/Reap.src/M000024.html +21 -0
- data/web/rdoc/classes/Reap.src/M000025.html +16 -0
- data/web/rdoc/classes/Reap.src/M000026.html +21 -0
- data/web/rdoc/classes/Reap/Announce.html +262 -0
- data/web/rdoc/classes/Reap/Announce.src/M000030.html +18 -0
- data/web/rdoc/classes/Reap/Announce.src/M000031.html +114 -0
- data/web/rdoc/classes/Reap/Announce.src/M000032.html +46 -0
- data/web/rdoc/classes/Reap/Info.html +176 -0
- data/web/rdoc/classes/Reap/Info.src/M000033.html +18 -0
- data/web/rdoc/classes/Reap/Info.src/M000034.html +17 -0
- data/web/rdoc/classes/Reap/Info.src/M000035.html +18 -0
- data/web/rdoc/classes/Reap/Install.html +193 -0
- data/web/rdoc/classes/Reap/Install.src/M000036.html +18 -0
- data/web/rdoc/classes/Reap/Install.src/M000037.html +20 -0
- data/web/rdoc/classes/Reap/Install.src/M000038.html +26 -0
- data/web/rdoc/classes/Reap/Noop.html +192 -0
- data/web/rdoc/classes/Reap/Noop.src/M000027.html +18 -0
- data/web/rdoc/classes/Reap/Noop.src/M000028.html +17 -0
- data/web/rdoc/classes/Reap/Noop.src/M000029.html +18 -0
- data/web/rdoc/classes/Reap/Package.html +310 -0
- data/web/rdoc/classes/Reap/Package.src/M000055.html +18 -0
- data/web/rdoc/classes/Reap/Package.src/M000056.html +68 -0
- data/web/rdoc/classes/Reap/Package.src/M000057.html +84 -0
- data/web/rdoc/classes/Reap/Package.src/M000058.html +61 -0
- data/web/rdoc/classes/Reap/Perm.html +236 -0
- data/web/rdoc/classes/Reap/Perm.src/M000078.html +18 -0
- data/web/rdoc/classes/Reap/Perm.src/M000079.html +21 -0
- data/web/rdoc/classes/Reap/Perm.src/M000080.html +42 -0
- data/web/rdoc/classes/Reap/Perm.src/M000081.html +26 -0
- data/web/rdoc/classes/Reap/Perm.src/M000082.html +18 -0
- data/web/rdoc/classes/Reap/Publish.html +213 -0
- data/web/rdoc/classes/Reap/Publish.src/M000070.html +18 -0
- data/web/rdoc/classes/Reap/Publish.src/M000071.html +22 -0
- data/web/rdoc/classes/Reap/Publish.src/M000072.html +37 -0
- data/web/rdoc/classes/Reap/RDoc.html +218 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000059.html +18 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000060.html +24 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000061.html +70 -0
- data/web/rdoc/classes/Reap/Task.html +396 -0
- data/web/rdoc/classes/Reap/Task.src/M000039.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000040.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000041.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000042.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000043.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000044.html +22 -0
- data/web/rdoc/classes/Reap/Task.src/M000045.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000046.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000047.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000048.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000049.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000050.html +27 -0
- data/web/rdoc/classes/Reap/Task.src/M000051.html +19 -0
- data/web/rdoc/classes/Reap/Task.src/M000052.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000053.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000054.html +19 -0
- data/web/rdoc/classes/Reap/Test.html +253 -0
- data/web/rdoc/classes/Reap/Test.src/M000062.html +18 -0
- data/web/rdoc/classes/Reap/Test.src/M000063.html +26 -0
- data/web/rdoc/classes/Reap/Test.src/M000064.html +77 -0
- data/web/rdoc/classes/Reap/Test.src/M000065.html +27 -0
- data/web/rdoc/classes/Reap/Test.src/M000066.html +50 -0
- data/web/rdoc/classes/Reap/Test/TestResults.html +205 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +21 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +21 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +23 -0
- data/web/rdoc/classes/Reap/TestExt.html +234 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000073.html +18 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000074.html +20 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000075.html +49 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000076.html +34 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000077.html +27 -0
- data/web/rdoc/classes/Reap/WebPublish.html +213 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +18 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +21 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +32 -0
- data/web/rdoc/classes/ReapCommand.html +425 -0
- data/web/rdoc/classes/ReapCommand.src/M000001.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000003.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000005.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000007.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000009.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000011.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000013.html +18 -0
- data/web/rdoc/classes/ReapCommand.src/M000014.html +19 -0
- data/web/rdoc/classes/ReapCommand.src/M000015.html +19 -0
- data/web/rdoc/classes/ReapCommand.src/M000016.html +24 -0
- data/web/rdoc/classes/ReapCommand.src/M000018.html +29 -0
- data/web/rdoc/classes/Scaffold.html +211 -0
- data/web/rdoc/classes/Scaffold.src/M000086.html +16 -0
- data/web/rdoc/classes/Scaffold.src/M000087.html +28 -0
- data/web/rdoc/classes/Scaffold.src/M000088.html +32 -0
- data/web/rdoc/classes/Scaffold.src/M000089.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.html +176 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000019.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000020.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000021.html +22 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000022.html +22 -0
- data/web/rdoc/classes/UnitTesting.html +165 -0
- data/web/rdoc/classes/UnitTesting.src/M000090.html +34 -0
- data/web/rdoc/classes/UnitTesting.src/M000091.html +18 -0
- data/web/rdoc/classes/UnitTesting/Failure.html +156 -0
- data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +18 -0
- data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +21 -0
- data/web/rdoc/created.rid +1 -0
- data/web/rdoc/files/ANN.html +107 -0
- data/web/rdoc/files/COPYING.html +119 -0
- data/web/rdoc/files/ChangeLog.html +144 -0
- data/web/rdoc/files/ProjectInfo.html +190 -0
- data/web/rdoc/files/README.html +274 -0
- data/web/rdoc/files/Rakefile.html +101 -0
- data/web/rdoc/files/lib/reap/bin/reap_rb.html +129 -0
- data/web/rdoc/files/lib/reap/lint_rb.html +101 -0
- data/web/rdoc/files/lib/reap/projectinfo_rb.html +110 -0
- data/web/rdoc/files/lib/reap/readymade_rb.html +123 -0
- data/web/rdoc/files/lib/reap/task/announce_rb.html +114 -0
- data/web/rdoc/files/lib/reap/task/fileperm_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/info_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/install_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/noop_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/package_rb.html +109 -0
- data/web/rdoc/files/lib/reap/task/publish_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/rdoc_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/scaffold_rb.html +107 -0
- data/web/rdoc/files/lib/reap/task/test_rb.html +110 -0
- data/web/rdoc/files/lib/reap/task/testext_rb.html +109 -0
- data/web/rdoc/files/lib/reap/task/webpublish_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task_rb.html +120 -0
- data/web/rdoc/files/lib/reap/tasks_rb.html +116 -0
- data/web/rdoc/files/lib/reap/test_rb.html +109 -0
- data/web/rdoc/fr_class_index.html +47 -0
- data/web/rdoc/fr_file_index.html +51 -0
- data/web/rdoc/fr_method_index.html +124 -0
- data/web/rdoc/index.html +24 -0
- data/web/rdoc/rdoc-style.css +208 -0
- metadata +257 -138
- data/bin/rubytest +0 -5
- data/data/reap/scaffold/standard/COPYING +0 -403
- data/data/reap/scaffold/standard/INSTALL +0 -14
- data/data/reap/scaffold/standard/README +0 -3
- data/data/reap/scaffold/standard/Rakefile +0 -10
- data/data/reap/scaffold/standard/setup.rb +0 -1568
- data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
- data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
- data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -78
- data/data/reap/scaffold/subversion/trunk/README +0 -3
- data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
- data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
- data/data/reap/setup.rb +0 -1568
- data/doc/COPYING +0 -403
- data/doc/ChangeLog +0 -18
- data/doc/LATEST +0 -29
- data/doc/README +0 -182
- data/doc/doap.xml +0 -27
- data/doc/note/ProjectInfo.rb +0 -88
- data/doc/note/Rakefile.0 +0 -118
- data/doc/note/Rakefile.htm +0 -69
- data/doc/note/application.rb +0 -124
- data/doc/note/interface/rubyforge.rb +0 -247
- data/doc/note/intro.txt +0 -42
- data/doc/note/package.rb +0 -629
- data/doc/note/package.rb.0 +0 -394
- data/doc/note/scaffold.rb +0 -123
- data/lib/reap/app.rb +0 -74
- data/lib/reap/bin/rubylint.rb +0 -1
- data/lib/reap/bin/rubytest.rb +0 -45
- data/lib/reap/rake.rb +0 -12
- data/lib/reap/rakeadapter.rb +0 -50
- data/lib/reap/reap.rb +0 -32
- data/lib/reap/task/custom.rb +0 -12
- data/lib/reap/task/doap.rb +0 -85
- data/lib/reap/task/extest.rb +0 -161
- data/lib/reap/task/manifest.rb +0 -70
- data/lib/reap/task/release.rb +0 -512
- data/lib/reap/task/template.rb +0 -46
- data/lib/reap/vendor/http-access2.rb +0 -1590
- data/lib/reap/vendor/http-access2/cookie.rb +0 -538
- 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 )
|
data/lib/reap/task.rb
CHANGED
@@ -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 '
|
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
|
15
|
+
# Here's an oh so simple example:
|
24
16
|
#
|
25
17
|
# class MyTask < Reap::Task
|
26
18
|
#
|
27
|
-
#
|
19
|
+
# register 'mytask'
|
28
20
|
#
|
29
|
-
#
|
21
|
+
# default_desc 'this is a custom reap task'
|
30
22
|
#
|
31
|
-
#
|
23
|
+
# attr_accessor :message
|
32
24
|
#
|
33
|
-
#
|
25
|
+
# def init
|
26
|
+
# @message ||= master['default'] || 'None Found!'
|
27
|
+
# end
|
34
28
|
#
|
35
|
-
#
|
36
|
-
# puts
|
37
|
-
# puts mytask.default #=> Yo! (inherited from master)
|
29
|
+
# def run
|
30
|
+
# puts @message
|
38
31
|
# end
|
39
32
|
# end
|
40
33
|
#
|
41
|
-
#
|
34
|
+
# The corresponding settings in the ProjectInfo file will then be:
|
42
35
|
#
|
43
|
-
# default:
|
36
|
+
# default: Default text, if any.
|
44
37
|
#
|
45
|
-
#
|
46
|
-
#
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
75
|
-
def registry
|
76
|
-
@registry ||= []
|
77
|
-
end
|
57
|
+
def self.tasks ; @tasks ; end
|
78
58
|
|
79
|
-
|
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
|
-
|
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
|
-
|
104
|
-
|
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
|
-
|
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
|
-
|
135
|
-
# a task is only made available if the
|
136
|
-
# ProjectInfo file has a task for it.
|
74
|
+
# class methods
|
137
75
|
|
138
|
-
|
139
|
-
|
140
|
-
end
|
76
|
+
def self.task_desc ; '(no desciption given)' ; end
|
77
|
+
def self.task_name ; basename.downcase ; end
|
141
78
|
|
142
|
-
|
143
|
-
|
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
|
-
|
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
|
-
|
153
|
-
def
|
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
|
159
|
-
def setting ; @task ; end
|
95
|
+
def master ; ::ProjectInfo.info ; end
|
160
96
|
|
161
|
-
|
97
|
+
def section ; @section ; end
|
162
98
|
|
163
|
-
def
|
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
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
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
|
-
|
109
|
+
section_parameters_set( sect || {} )
|
110
|
+
init
|
195
111
|
end
|
196
112
|
end
|
197
113
|
|
198
|
-
|
199
|
-
|
200
|
-
|
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
|
-
|
209
|
-
|
210
|
-
@section.send( *args, &block )
|
119
|
+
def init
|
120
|
+
raise "not implemented for '#{task_name}' task"
|
211
121
|
end
|
212
122
|
|
213
|
-
|
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
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
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
|
data/lib/reap/task/announce.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
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
|
-
|
110
|
-
puts "Reap announce task canceled."
|
111
|
-
return nil
|
112
|
-
end
|
44
|
+
@address = @to # TODO
|
113
45
|
|
114
|
-
#
|
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
|
-
|#{
|
53
|
+
|#{title}, v#{version}
|
149
54
|
|
|
150
|
-
|#{
|
55
|
+
|#{summary}
|
151
56
|
|
|
152
|
-
|#{anc.homepage}
|
153
57
|
}.margin.align_center(66)
|
154
58
|
|
155
59
|
# abstract
|
156
60
|
abstract = ''
|
157
|
-
if
|
61
|
+
if @description
|
158
62
|
abstract << "\n\n"
|
159
|
-
abstract << "ABSTRACT
|
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
|
166
|
-
info << "\n
|
167
|
-
info << "
|
168
|
-
|
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
|
79
|
+
if @slogan
|
175
80
|
slogan << "\n\n"
|
176
|
-
slogan <<
|
81
|
+
slogan << @slogan.center(67)
|
177
82
|
slogan << "\n\n"
|
178
83
|
end
|
179
84
|
|
180
85
|
# memo
|
181
86
|
memo = ''
|
182
|
-
if
|
87
|
+
if @memo
|
183
88
|
memo = ''
|
184
|
-
|
185
|
-
memo << "\
|
186
|
-
memo <<
|
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
|
193
|
-
msg << "\
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
msg << mg.
|
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 =
|
202
|
-
|
106
|
+
stamp = ''
|
107
|
+
stamp << "\n" << ("-" * 72) << "\n"
|
203
108
|
stamp << %Q{
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
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
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
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
|
-
|