reap 6.0.2 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. data/CHANGES +6 -0
  2. data/COPYING +666 -395
  3. data/MANIFEST +139 -0
  4. data/NOTES +12 -0
  5. data/README +19 -163
  6. data/bin/reap-announce +7 -0
  7. data/bin/reap-check-load +8 -0
  8. data/bin/reap-check-syntax +7 -0
  9. data/bin/reap-clean +7 -0
  10. data/bin/reap-clobber +7 -0
  11. data/bin/reap-doc +7 -0
  12. data/bin/reap-doc-rdoc +7 -0
  13. data/bin/reap-doc-ri +7 -0
  14. data/bin/reap-init +69 -0
  15. data/bin/reap-inspect +7 -0
  16. data/bin/reap-install +8 -0
  17. data/bin/reap-install-gem +8 -0
  18. data/bin/reap-log +7 -0
  19. data/bin/reap-log-changes +8 -0
  20. data/bin/reap-log-notes +8 -0
  21. data/bin/reap-make +7 -0
  22. data/bin/reap-make-clean +7 -0
  23. data/bin/reap-make-distclean +7 -0
  24. data/bin/reap-make-extconf +7 -0
  25. data/bin/reap-make-static +8 -0
  26. data/bin/reap-package +8 -0
  27. data/bin/reap-package-gem +7 -0
  28. data/bin/reap-package-tgz +7 -0
  29. data/bin/reap-package-zip +7 -0
  30. data/bin/reap-prepare +7 -0
  31. data/bin/reap-publish +7 -0
  32. data/bin/reap-release +7 -0
  33. data/bin/reap-scaffold +8 -0
  34. data/bin/reap-scm-branch +7 -0
  35. data/bin/reap-scm-tag +7 -0
  36. data/bin/reap-spec +7 -0
  37. data/bin/reap-spec-doc +8 -0
  38. data/bin/reap-stamp +7 -0
  39. data/bin/reap-stats +7 -0
  40. data/bin/reap-test +7 -0
  41. data/bin/reap-test-cross +7 -0
  42. data/bin/reap-test-load +9 -0
  43. data/bin/reap-test-solo +7 -0
  44. data/bin/reap-uninstall +7 -0
  45. data/bin/reap-uninstall-gem +7 -0
  46. data/data/reap/base/CHANGES +19 -0
  47. data/data/reap/base/COPYING +674 -0
  48. data/data/reap/base/NOTES +12 -0
  49. data/data/reap/base/README +8 -0
  50. data/data/reap/build/rake/Rakefile +130 -0
  51. data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
  52. data/data/reap/build/rake-lite/install.rb +79 -0
  53. data/data/reap/build/tasks/task/rdoc +211 -0
  54. data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
  55. data/data/reap/build/tasks/task/test +38 -0
  56. data/data/reap/init/meta/project.yaml +21 -0
  57. data/demo/README +15 -0
  58. data/demo/lib/foo/foo.rb +7 -0
  59. data/demo/meta/VERSION +1 -0
  60. data/demo/meta/project.yaml +21 -0
  61. data/lib/reap/application.rb +80 -0
  62. data/lib/reap/default.yaml +77 -0
  63. data/lib/reap/extensions/array.rb +50 -0
  64. data/lib/reap/extensions/hash.rb +63 -0
  65. data/lib/reap/extensions/string.rb +31 -0
  66. data/lib/reap/extensions.rb +6 -0
  67. data/lib/reap/iobject.rb +264 -0
  68. data/lib/reap/manager/announce.rb +193 -0
  69. data/lib/reap/manager/check.rb +109 -0
  70. data/lib/reap/manager/clean.rb +58 -0
  71. data/lib/reap/manager/gem.rb +200 -0
  72. data/lib/reap/manager/html.rb +69 -0
  73. data/lib/reap/manager/log.rb +214 -0
  74. data/lib/reap/manager/make.rb +109 -0
  75. data/lib/reap/manager/pack.rb +232 -0
  76. data/lib/reap/manager/publish.rb +72 -0
  77. data/lib/reap/manager/rdoc.rb +194 -0
  78. data/lib/reap/manager/release.rb +78 -0
  79. data/lib/reap/manager/rubyforge.rb +44 -0
  80. data/lib/reap/manager/scaffold.rb +138 -0
  81. data/lib/reap/manager/scm.rb +66 -0
  82. data/lib/reap/manager/site.rb +27 -0
  83. data/lib/reap/manager/spec.rb +94 -0
  84. data/lib/reap/manager/stats.rb +145 -0
  85. data/lib/reap/manager/svn.rb +76 -0
  86. data/lib/reap/manager/test.rb +389 -0
  87. data/lib/reap/manager.rb +74 -0
  88. data/lib/reap/metadata.rb +603 -0
  89. data/lib/reap/project.rb +165 -0
  90. data/lib/reap/settings.rb +67 -0
  91. data/lib/reap/systems/rubyforge.rb +737 -0
  92. data/lib/reap/systems/subversion.rb +333 -0
  93. data/lib/reap/utilities/fileutils.rb +304 -0
  94. data/lib/reap/utilities/netutils.rb +221 -0
  95. data/lib/reap/utilities/setuputils.rb +124 -0
  96. data/lib/reap/utilities/shellutils.rb +175 -0
  97. data/log/Changelog.txt +107 -0
  98. data/log/FIXME.txt +25 -0
  99. data/log/TODO.txt +72 -0
  100. data/meta/VERSION +1 -0
  101. data/meta/description +4 -0
  102. data/meta/project.yaml +20 -0
  103. data/task/man +14 -0
  104. data/task/rdoc +20 -0
  105. data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
  106. metadata +225 -153
  107. data/ProjectInfo +0 -105
  108. data/bin/reap +0 -5
  109. data/bin/rubytest +0 -5
  110. data/data/reap/install.rb +0 -62
  111. data/data/reap/scaffold/standard/COPYING +0 -403
  112. data/data/reap/scaffold/standard/ChangeLog +0 -0
  113. data/data/reap/scaffold/standard/INSTALL +0 -14
  114. data/data/reap/scaffold/standard/ProjectInfo +0 -77
  115. data/data/reap/scaffold/standard/README +0 -3
  116. data/data/reap/scaffold/standard/Rakefile +0 -10
  117. data/data/reap/scaffold/standard/TODO +0 -0
  118. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  119. data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
  120. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  121. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
  122. data/data/reap/scaffold/subversion/trunk/README +0 -3
  123. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  124. data/data/reap/scaffold/subversion/trunk/TODO +0 -0
  125. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  126. data/forge/ProjectInfo +0 -38
  127. data/forge/ProjectInfo.rb +0 -76
  128. data/forge/TODO +0 -10
  129. data/forge/installer.rb +0 -250
  130. data/forge/reference/Rakefile +0 -124
  131. data/forge/reference/Rakefile.htm +0 -69
  132. data/forge/reference/aRakefile +0 -60
  133. data/forge/reference/compositepublisher.rb +0 -24
  134. data/forge/reference/ftptools.rb +0 -139
  135. data/forge/reference/installers/package.rb +0 -629
  136. data/forge/reference/license-each.rb +0 -85
  137. data/forge/reference/publisher.rb +0 -75
  138. data/forge/reference/rubyforge.rb +0 -247
  139. data/forge/reference/rubyforgepublisher.rb +0 -18
  140. data/forge/reference/sshpublisher.rb +0 -47
  141. data/forge/reference/suby-cvs.rb +0 -46
  142. data/forge/scaffold.rb +0 -126
  143. data/forge/unit_runner/README +0 -6
  144. data/forge/unit_runner/commentrunner.rb +0 -62
  145. data/forge/unit_runner/cunit.rb +0 -17
  146. data/forge/unit_runner/forkedrunner.rb +0 -91
  147. data/forge/unit_runner/sample.rb +0 -16
  148. data/lib/reap/bin/reap.rb +0 -230
  149. data/lib/reap/bin/rubytest.rb +0 -53
  150. data/lib/reap/class/announce.rb +0 -220
  151. data/lib/reap/class/doap.rb +0 -80
  152. data/lib/reap/class/extest.rb +0 -146
  153. data/lib/reap/class/filer.rb +0 -62
  154. data/lib/reap/class/manifest.rb +0 -68
  155. data/lib/reap/class/package.rb +0 -576
  156. data/lib/reap/class/publish.rb +0 -152
  157. data/lib/reap/class/rdoc.rb +0 -123
  158. data/lib/reap/class/test.rb +0 -264
  159. data/lib/reap/projectinfo.rb +0 -208
  160. data/lib/reap/rake.rb +0 -42
  161. data/lib/reap/reap.rb +0 -89
  162. data/lib/reap/tasks.rb +0 -756
  163. data/lib/reap/taskutils.rb +0 -122
  164. data/note/LATEST +0 -44
  165. data/note/doap.xml +0 -28
  166. data/note/history/Rakefile-0.1 +0 -308
  167. data/sample/ProjectInfo +0 -96
  168. data/sample/Rakefile +0 -9
  169. data/sample/Reapfile +0 -11
  170. data/sample/task/demo.rb +0 -15
  171. data/setup.rb +0 -1568
  172. data/web/ProjectInfo.html +0 -75
  173. data/web/images/grape.jpg +0 -0
  174. data/web/index.html +0 -312
@@ -1,91 +0,0 @@
1
- require 'drb'
2
- require 'test/unit/collector'
3
- require 'test/unit/collector/objectspace'
4
- require 'test/unit/ui/testrunnermediator'
5
-
6
- class Test::Unit::UI::ForkedTestRunner
7
-
8
- def initialize(suite) #, output_level=NORMAL, io=STDOUT)
9
- if (suite.respond_to?(:suite))
10
- @suite = suite.suite
11
- else
12
- @suite = suite
13
- end
14
- #@output_level = output_level
15
- #@io = io
16
- #@already_outputted = false
17
- #@faults = []
18
- end
19
-
20
- def start
21
-
22
- serialized_tests = Marshal.dump(@test)
23
-
24
- src = %{
25
- $output = STDOUT.dup
26
- STDOUT.reopen( PLATFORM =~ /mswin/ ? "NUL" : "/dev/null" )
27
-
28
- tests = Marshal.load <<HERE_TESTS_HERE
29
- #{serialized_tests}
30
- HERE_TESTS_HERE
31
-
32
- runner = TestRunnerMediator.new( tests )
33
-
34
- result = runner.run_suite
35
-
36
- output << Marshal.dump(result)
37
-
38
- STDOUT.reopen($output)
39
- $output.close
40
-
41
- exit 0
42
- }
43
-
44
- result = IO.popen("ruby","w+") do |ruby|
45
- ruby.puts src
46
- ruby.close_write
47
- ruby.read
48
- end
49
-
50
- p testfile if $VERBOSE
51
-
52
- return Marshal.load(result)
53
-
54
- end
55
-
56
- private
57
- def load_comment_tests( filepath )
58
- rbfile = File.read( filepath )
59
- rblines = rbfile.split("\n")
60
-
61
- tests = []
62
- intest = nil
63
- comment = nil
64
- hcomment = nil
65
-
66
- rblines.each_with_index do |l,i|
67
- if /^(\ *#\ *)?=\ *begin testing/ =~ l
68
- intest = true
69
- comment = true unless $1
70
- next
71
- elsif intest and /^(\ *#\ *)?=\ *end/ =~ l
72
- intest = false
73
- comment = false
74
- next
75
- end
76
- hcomment = true if /^\ *#/ =~ l
77
-
78
- if intest and (comment or hcomment)
79
- l.pull if hcomment
80
- tests << l
81
- end
82
- end
83
-
84
- tests = tests.join("\n")
85
- tests.gsub!( %r{^([ ]*)testcase[ ]+(\w+)} ) { "#{$1}class TC_#{$2} < Test::Unit::TestCase" }
86
- tests.gsub!( %r{^([ ]*)test[ ]+(\w+)} ) { |md| "#{$1}def test_#{$2}" }
87
-
88
- tests
89
- end
90
-
91
- end
@@ -1,16 +0,0 @@
1
-
2
- # Here's a sample of commentary unit testcase.
3
- #
4
- # =begin testing
5
- #
6
- # testcase Sample
7
- # test one
8
- # assert ( Sample.one == 1 )
9
- # end
10
- # end
11
- #
12
- # =end
13
-
14
- class Sample
15
- def self.one ; 1 ; end
16
- end
data/lib/reap/bin/reap.rb DELETED
@@ -1,230 +0,0 @@
1
-
2
- require 'rbconfig'
3
- require 'fileutils'
4
-
5
- require 'facets' # Next two may be moved in the future to:
6
- require 'command' # 'console/command'
7
- require 'ansicode' # 'console/ansicode'
8
- require 'string/tabto'
9
- require 'gem/self/gempath'
10
-
11
- require 'reap/reap'
12
-
13
- # ReapCommand is the CLI interface to Reap.
14
-
15
- class ReapCommand < Console::Command
16
-
17
- INFO_FILES = [ 'ProjectInfo', 'projectinfo' ]
18
-
19
- # Options
20
-
21
- # verbose mode
22
- def __verbose ; $VERBOSE = true ; end
23
- alias_method :_V, :__verbose
24
-
25
- # force mode
26
- def __force ; $FORCE = true ; end
27
- alias_method :_f, :__force
28
-
29
- # pretend mode (under construction)
30
- #--
31
- # A few tasks have some support for pretending
32
- # but this has to be developed much more
33
- # before it can be commonly avaialble.
34
- # Notice it is not mentioned in the Help.
35
- #++
36
- def __pretend; $PRETEND = true ; end
37
- alias_method :_P, :__pretend
38
-
39
- # debug mode (under construction)
40
- def __debug; $DEBUG = true ; end
41
- alias_method :_D, :__debug
42
-
43
- def __password( pass ); $PASSWORD = pass ; end
44
- alias_method :_p, :__password
45
-
46
- # display reap version
47
- def __version ; version ; end
48
- alias_method :_v, :__version
49
-
50
- # option to display help
51
- def __help ; help ; end
52
- alias_method :_h, :__help
53
-
54
- # option to display tasks
55
- def __tasks; tasks ; end
56
- alias_method :_t, :__tasks
57
- alias_method :_T, :__tasks
58
-
59
- #option for build version (only for package task)
60
- def _b ; $BUILD_VERSION = true ; end
61
-
62
- #def _f( pif ) ; $PROJECT_FILE = pif ; end
63
- #alias_method :_f, :__file
64
-
65
- # Default subcommand is to display tasks.
66
-
67
- def default
68
- tasks
69
- end
70
-
71
- # Display version.
72
-
73
- def version
74
- puts "Reap v#{Reap::Version}"
75
- exit 0 # shortcuts execution when called via the --version option.
76
- end
77
-
78
- # Display help.
79
-
80
- def help
81
- puts HELP
82
- exit 0 # shortcuts execution when called via the --help option.
83
- end
84
-
85
- # list available tasks
86
-
87
- def tasks
88
- # TODO How to deal with windows or other ansi not support?
89
- hi = Console::ANSICode.bold #+ Console::ANSICode.yellow
90
- lo = Console::ANSICode.reset #+ Console::ANSICode.blue
91
- re = Console::ANSICode.reset
92
-
93
- tasklist = TaskSpace.visible_tasks
94
- if tasklist.empty?
95
- puts "No tasks available."
96
- else
97
- sorted = tasklist.collect{ |e| e.to_s }.sort
98
- outlist = []
99
- margin = sorted.collect{ |t| t.size }.max + 2
100
- sorted.each do |name|
101
- outlist << hi + " #{name}".ljust(margin) + lo + " #{TaskSpace.instance_task(name).description}" + re
102
- end
103
- puts "[from #{Dir.pwd}]"
104
- #puts
105
- puts outlist.join("\n")
106
- #puts
107
- end
108
- end
109
-
110
- # Command shows task dependencies.
111
-
112
- def prerequisite
113
- Reap.tasks.each { |name, t|
114
- print name
115
- print " => "
116
- puts TaskSpace.instance_task(name.to_sym).prerequisite.inspect
117
- }
118
- end
119
-
120
- # Define a CLI callable method for each described tasks.
121
- #
122
- # NOTE The use of the launcher class seems a touch hackish,
123
- # and indicates to me that there might be a better
124
- # way to organize the tasks, but as long as it works!
125
-
126
- launcher = Class.new{ include TaskSpace }.new()
127
-
128
- TaskSpace.visible_tasks.each do |t|
129
- define_method(t) do |*args|
130
- launcher.send(t, *args)
131
- end
132
- end
133
-
134
- # Help text
135
-
136
- HELP = <<-HERE.tabto(2)
137
-
138
- reap [options...] <command> [arguments...]
139
-
140
- COMMANDS:
141
-
142
- tasks
143
- List all the current tasks with descriptions.
144
- (This is the default if no command is given.)
145
-
146
- help [type]
147
- Displays this help information. If a task type is given, it
148
- will provide help information specific to that kind of task.
149
-
150
- OPTIONS:
151
-
152
- -h --help Display this help information.
153
- -v --version Display the current version.
154
- -V --verbose Provides extra verbose processing information.
155
- -f --force Forces certain operations to be performed.
156
- -D --debug Provides extra verbose processing information.
157
- -f --file Specify alternate project file.
158
-
159
- HERE
160
-
161
- #--
162
- #
163
- # HELP = <<-HERE.tabto(2)
164
- #
165
- # reap [options...] <command> [arguments...]
166
- #
167
- # COMMANDS:
168
- #
169
- # tasks
170
- # List all the current tasks with descriptions.
171
- # (This is the default if no command is given.)
172
- #
173
- # scaffold [type]
174
- # Generates a project directory layout within the current
175
- # directory. For more details type 'reap help scaffold'.
176
- #
177
- # template | projectinfo
178
- # Create a ProjectInfo template file in the current directory
179
- # Unlike 'scaffold', this is especially useful for pre-existing
180
- # projects.
181
- #
182
- # help [type]
183
- # Displays this help information. If a task type is given, it
184
- # will provide help information specific to that kind of task.
185
- #
186
- # OPTIONS:
187
- #
188
- # -h --help Display this help information.
189
- # -v --version Display the current version.
190
- # -V --verbose Provides extra verbose processing information.
191
- # -f --force Forces certain operations to be performed.
192
- # -D --debug Provides extra verbose processing information.
193
- # -f --file Specify alternate project file.
194
- #
195
- # HERE
196
- #
197
- # HELP_SCAFFOLD = <<-HERE.tabto(2)
198
- #
199
- # reap scaffold [type]
200
- #
201
- # Generates a project directory layout within the current
202
- # directory. The scaffolding includes all the standard
203
- # features such as directories lib/ bin/ doc/ and files
204
- # like README.
205
- #
206
- # To use this task you should first create an empty
207
- # directory and than change into it. This command will
208
- # not create a new project directory. As a safegaurd, this
209
- # command will not generate scaffolding in a directory with
210
- # files already present, unless you use the -f (force) option.
211
- #
212
- # There are currently two types of supported scaffoldings:
213
- # 'standard', which is the default if no type is given,
214
- # and 'subversion' which creates a "trunk" hierarchy.
215
- #
216
- # HERE
217
- #
218
- # HELP_TEMPLATE = <<-HERE.tabto(2)
219
- #
220
- # reap template | reap projectinfo
221
- #
222
- # Create a ProjectInfo template file in the current directory
223
- # Unlike 'scaffold', this is especially useful for pre-existing
224
- # projects.
225
- #
226
- # HERE
227
- #
228
- #++
229
-
230
- end
@@ -1,53 +0,0 @@
1
-
2
- require 'test/unit'
3
- require 'facet/consoleapp'
4
-
5
- # Run commented tests.
6
- #
7
- #--
8
- # One wonders if this should be built as a Test::Unit::CommentAutoRunner
9
- #++
10
-
11
- class RubyCommentTester < Console::Command
12
-
13
- RETEST = /^=begin\s+test.*?\n(.*)\n=end/mi
14
-
15
- # option to display help
16
- def __verbose ; $VERBOSE = true ; end
17
- alias_method :_v, :__verbose
18
-
19
- # option to display help
20
- def __help
21
- puts HELP
22
- exit 0
23
- end
24
- alias_method :_h, :__help
25
-
26
- def main( *filepaths )
27
- filepaths.each { |fp|
28
- run_comment_test( fp )
29
- }
30
- end
31
-
32
- private
33
-
34
- def run_comment_test( filepath )
35
- code = File.read( filepath )
36
- test_code = nil
37
- md = RETEST.match( code )
38
- test_code = md[1] if md
39
- unless test_code
40
- puts "No test found for #{filepath}."
41
- return nil
42
- end
43
- offset = code.split(/\n/).size - test_code.split(/\n/).size - 1
44
-
45
- require filepath
46
- eval test_code, TOPLEVEL_BINDING, File.basename(filepath), offset
47
- end
48
-
49
- end
50
-
51
- HELP = <<-EOS
52
- rubytest filename [filename ...]
53
- EOS
@@ -1,220 +0,0 @@
1
- #--
2
- # _
3
- # /_\ _ _ _ _ ___ _ _ _ _ __ ___
4
- # / _ \| ' \| ' \/ _ \ || | ' \/ _/ -_)
5
- # /_/ \_\_||_|_||_\___/\_,_|_||_\__\___|
6
- #
7
- #++
8
-
9
- require 'net/smtp'
10
-
11
- require 'facet/string/margin'
12
- require 'facet/string/tab'
13
- require 'facet/string/align_center'
14
- require 'facet/string/fold'
15
- require 'facet/string/word_wrap'
16
-
17
- module Reap
18
-
19
- # = Announce
20
- #
21
- # The announce task is intended for sending out a nice
22
- # formated email message to a mailing address, especially
23
- # mailing-lists.
24
- #
25
- # Announcement specific settings:
26
- #
27
- # server Email server to route message.
28
- # port Email server's port.
29
- # domain Email server's domain name.
30
- # account Email account name.
31
- # type Login type, either plain, cram_md5 or login.
32
- # secure Uses TLS security, true or false?
33
- # to Email address to send announcemnt.
34
- # from Email address sent from.
35
- # subject Subject of email message.
36
- # links Array of http links to related sites.
37
- # file File that contains announcement message.
38
- # memo Embedded announcement message.
39
- # slogan Motto for you project.
40
- #
41
- # Inherited settings:
42
- #
43
- # title Project title.
44
- # summary Brief one-line description.
45
- # description Long description of project.
46
- # homepage Project homepage web address.
47
- #
48
-
49
- class Announce
50
-
51
- include TaskUtils
52
-
53
- attr :anc
54
-
55
- def initialize( anc )
56
- @anc = anc.to_openobject
57
-
58
- anc.to = (anc.to || 'ruby-talk@ruby-lang.org').to_s.strip
59
- anc.from = anc.from.to_s.strip
60
- anc.server = anc.server.to_s.strip
61
- anc.port = (anc.port || 25).to_i
62
- anc.domain = anc.domain.to_s.strip if anc.domain
63
- anc.account = anc.account.to_s.strip
64
- anc.type = (anc.type || 'plain').to_s.strip #cram_md5 #plain #login
65
-
66
- #anc.title ||= master.title
67
- #anc.version ||= master.version || master.date
68
- anc.links ||= []
69
- anc.subject ||= "[ANN] #{anc.title}, v#{anc.version}"
70
-
71
- anc.address = anc.to # TODO
72
- end
73
-
74
- # Validate data.
75
-
76
- def valid?
77
- return false, "server is a require announce field" if anc.server.empty?
78
- return false, "account is a require announce field" if anc.account.empty?
79
- #return false, "DOMAIN is a required field" if anc.domain.empty?
80
- true
81
- end
82
-
83
- def call ; write_and_email ; end
84
-
85
- # Generate announcement and email it.
86
-
87
- def write_and_email
88
-
89
- message = build_message
90
-
91
- puts "\n#{message}\n\n"
92
- print "Send? [y/N] "
93
- until inp = $stdin.gets[0,1] ; sleep 1 ; end
94
-
95
- unless inp.downcase == 'y'
96
- puts "Reap announce task canceled."
97
- return nil
98
- end
99
-
100
- # ask for password
101
- print "Password for #{anc.account}: "
102
- until passwd = $stdin.gets.strip ; sleep 1 ; end
103
-
104
- mail = %Q{
105
- |From: #{anc.from}
106
- |To: #{anc.address}
107
- |Subject: #{anc.subject}
108
- |
109
- |#{message}
110
- }.margin
111
- begin
112
- # --- Send using SMTP object and an adaptor
113
- Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and anc.secure # == :tls
114
- Net::SMTP.start(anc.server, anc.port, anc.domain, anc.account, passwd, anc.type) do |s|
115
- s.send_message mail, anc.from, anc.address
116
- end
117
- puts "Email sent successfully to #{anc.address}."
118
- rescue => e
119
- puts "Email delivery failed."
120
- puts e
121
- end
122
-
123
- end
124
-
125
- private
126
-
127
- def build_message
128
-
129
- ver = anc.version.chomp('.0').chomp('.0')
130
-
131
- # header
132
- announce = %Q{
133
- |
134
- |A N N O U N C I N G
135
- |
136
- |#{anc.title} #{ver}
137
- |
138
- |#{anc.summary}
139
- |
140
- |#{anc.homepage}
141
- }.margin.align_center(66)
142
-
143
- # abstract
144
- abstract = ''
145
- if anc.description
146
- abstract << "\n\n"
147
- abstract << "= ABSTRACT\n\n#{anc.description}"
148
- abstract << "\n"
149
- end
150
-
151
- # more info
152
- info = ''
153
- unless anc.links.empty?
154
- info << "\n\n"
155
- info << "\n= RELATED LINKS\n\n" #.center(67)
156
- anc.links.each{ |mi| info << "#{mi}" << "\n" } #.center(67) << "\n" }
157
- info << "\n"
158
- end
159
-
160
- # slogan
161
- slogan = ''
162
- if anc.slogan
163
- slogan << "\n\n"
164
- slogan << anc.slogan.center(67)
165
- slogan << "\n\n"
166
- end
167
-
168
- # memo
169
- memo = ''
170
- if anc.memo
171
- memo = ''
172
- #memo << "\n---\n" #<< ('-' * 72) << "\n"
173
- memo << "\n= MEMO\n\n"
174
- memo << anc.memo.strip.fold(true) #.word_wrap(67)
175
- #memo << "\n"
176
- end
177
-
178
- # msg file
179
- msg = ''
180
- if anc.file and File.file?( anc.file )
181
- msg << "\n= LATEST NEWS\n\n"
182
- #msg << "\n---\n" #<< ("-" * 68) << "\n"
183
- #msg << "(from #{anc.file})\n\n"
184
- mg = File.read( anc.file )
185
- msg << mg.strip.fold(true) #.word_wrap(67)
186
- end
187
-
188
- # stamp
189
- stamp = "\n\n\n"
190
- #stamp << "\n\n---\n" #<< ("-" * 68) << "\n"
191
- stamp << %q{
192
- ! Generated by
193
- ! ___
194
- ! | _ \___ __ _ _ __
195
- ! | ) -_) _` | '_ \
196
- ! |_|_\___\__,_| .__)
197
- ! |_|
198
- !
199
- ! The Ruby Project Assistant
200
- !
201
- ! Do you Ruby? (http://www.ruby-lang.org)
202
- }.margin(12) #.indent(12)
203
- stamp << "\n"
204
-
205
- message = ''
206
- message << announce
207
- message << slogan
208
- message << abstract
209
- message << memo
210
- message << msg
211
- message << info
212
- message << stamp
213
-
214
- message
215
- end
216
-
217
- end
218
-
219
- end #module Reap
220
-
@@ -1,80 +0,0 @@
1
-
2
- module Reap
3
-
4
- # = Doap
5
-
6
- class Doap
7
-
8
- include TaskUtils
9
-
10
- attr_accessor :dir
11
-
12
- attr_accessor :title,
13
- :name,
14
- :created,
15
- :summary,
16
- :description,
17
- :maintainer,
18
- :email,
19
- :homepage,
20
- :wiki
21
-
22
- def initalize( prj )
23
- super
24
-
25
- @dir ||= '.'
26
- end
27
-
28
- def call
29
- write( generate )
30
- puts "DOAP file created at '#{File.join( @dir, "doap.xml" )}'."
31
- end
32
-
33
- # Generate a doap file.
34
-
35
- def generate
36
- x = ''
37
- x << %{
38
- |<Project xmlns="http://usefulinc.com/ns/doap#"\n
39
- | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n
40
- | xmlns:foaf="http://xmlns.com/foaf/0.1/">
41
- | <name>#{@title}</name>
42
- | <shortname>#{@name}</shortname>
43
- | <homepage rdf:resource="#{@homepage}" />
44
- | <wiki rdf:resource="#{@wiki}" />
45
- | <created>#{@created}</created>
46
- | <shortdesc xml:lang="en">
47
- }.margin
48
- x << "\n" << @summary.word_wrap(50).indent(6)
49
- x << %{
50
- | </shortdesc>
51
- | <description xml:lang="en">
52
- }.margin
53
- x << "\n" << @description.word_wrap(50).indent(6)
54
- x << %{
55
- | </description>
56
- | <maintainer>
57
- | <foaf:Person>
58
- | <foaf:name>#{@maintainer}</foaf:name>
59
- | <foaf:email>#{@email}</foaf:name>
60
- | <foaf:homepage rdf:resource="#{@homepage}" />
61
- | </foaf:Person>
62
- | </maintainer>
63
- | </Project>
64
- }.margin
65
-
66
- return x
67
- end
68
-
69
- private
70
-
71
- # Write the doap file.
72
-
73
- def write( doap )
74
- file = File.join( @dir, "doap.xml" )
75
- File.open( file, 'w' ) { |f| f << doap }
76
- end
77
-
78
- end
79
-
80
- end #module Reap