reap 4.3.2 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ANN +6 -1
- data/ProjectInfo +9 -7
- data/README +44 -13
- data/data/reap/setup-3.4.1/COPYING +515 -0
- data/data/reap/setup-3.4.1/ChangeLog +732 -0
- data/data/reap/setup-3.4.1/Makefile +56 -0
- data/data/reap/setup-3.4.1/NEWS.en +155 -0
- data/data/reap/setup-3.4.1/NEWS.ja +152 -0
- data/data/reap/setup-3.4.1/README.en +30 -0
- data/data/reap/setup-3.4.1/README.ja +34 -0
- data/data/reap/setup-3.4.1/TODO +14 -0
- data/data/reap/setup-3.4.1/Template.README.en +41 -0
- data/data/reap/setup-3.4.1/Template.README.ja +46 -0
- data/data/reap/setup-3.4.1/Usage_en.txt +231 -0
- data/data/reap/setup-3.4.1/Usage_ja.txt +250 -0
- data/data/reap/setup-3.4.1/doc.en/hookapi.html +91 -0
- data/data/reap/setup-3.4.1/doc.en/index.html +28 -0
- data/data/reap/setup-3.4.1/doc.en/metaconfapi.html +79 -0
- data/data/reap/setup-3.4.1/doc.en/news.html +189 -0
- data/data/reap/setup-3.4.1/doc.en/usage.html +297 -0
- data/data/reap/setup-3.4.1/doc.ja/hookapi.html +84 -0
- data/data/reap/setup-3.4.1/doc.ja/index.html +28 -0
- data/data/reap/setup-3.4.1/doc.ja/metaconfapi.html +80 -0
- data/data/reap/setup-3.4.1/doc.ja/news.html +186 -0
- data/data/reap/setup-3.4.1/doc.ja/usage.html +319 -0
- data/data/reap/setup-3.4.1/sample/add-task.rb +15 -0
- data/data/reap/setup-3.4.1/setup.rb +1585 -0
- data/data/reap/setup-3.4.1/test/test_installer.rb +136 -0
- data/lib/reap/{lint.rb → bin/lint.rb} +0 -0
- data/lib/reap/bin/reap.rb +3 -2
- data/lib/reap/projectinfo.rb +4 -0
- data/lib/reap/task.rb +84 -74
- data/lib/reap/task/announce.rb +137 -91
- data/lib/reap/task/fileperm.rb +26 -9
- data/lib/reap/task/info.rb +19 -3
- data/lib/reap/task/install.rb +9 -7
- data/lib/reap/task/noop.rb +3 -5
- data/lib/reap/task/package.rb +247 -105
- data/lib/reap/task/publish.rb +40 -14
- data/lib/reap/task/rdoc.rb +53 -27
- data/lib/reap/task/release.rb +275 -73
- data/lib/reap/task/scaffold.rb +14 -6
- data/lib/reap/task/test.rb +67 -48
- data/lib/reap/task/testext.rb +38 -11
- data/lib/reap/vendor/http-access2.rb +1590 -0
- data/lib/reap/vendor/http-access2/cookie.rb +538 -0
- data/lib/reap/vendor/http-access2/http.rb +542 -0
- data/{lib/reap → note}/interface/interface.rb +0 -0
- data/{lib/reap → note}/interface/rubyforge.rb +0 -0
- data/note/package.rb.0 +394 -0
- metadata +43 -8
- data/lib/reap/reap.rb +0 -0
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'setup'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'stringio'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class DummyConfig
|
7
|
+
def initialize(config)
|
8
|
+
@config = config
|
9
|
+
end
|
10
|
+
|
11
|
+
def [](key)
|
12
|
+
@config[key]
|
13
|
+
end
|
14
|
+
|
15
|
+
def no_harm?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def verbose?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class TestInstaller < Test::Unit::TestCase
|
25
|
+
|
26
|
+
include FileUtils
|
27
|
+
|
28
|
+
def setup
|
29
|
+
rm_rf %w(srcdir objdir)
|
30
|
+
mkdir %w(srcdir objdir)
|
31
|
+
Dir.chdir 'objdir'
|
32
|
+
$stderr, $orig_stderr = StringIO.new, $stderr
|
33
|
+
end
|
34
|
+
|
35
|
+
def teardown
|
36
|
+
$stderr = $orig_stderr
|
37
|
+
Dir.chdir '..'
|
38
|
+
rm_rf %w(srcdir objdir)
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_installer(config = {})
|
42
|
+
@installer = Installer.new(DummyConfig.new(config), '../srcdir', '.')
|
43
|
+
end
|
44
|
+
|
45
|
+
def do_update_shebang_line(id, str)
|
46
|
+
create id, str
|
47
|
+
@installer.update_shebang_line "../srcdir/#{id}"
|
48
|
+
read(id)
|
49
|
+
end
|
50
|
+
|
51
|
+
def create(filename, content)
|
52
|
+
File.open("../srcdir/#{filename}", 'wb') {|f|
|
53
|
+
f.write content
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def read(filename)
|
58
|
+
path = File.exist?(filename) ? filename : "../srcdir/#{filename}"
|
59
|
+
File.open(path, 'rb') {|f|
|
60
|
+
return f.read
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_update_shebang_line__never
|
65
|
+
setup_installer 'shebang' => 'never', 'rubypath' => 'ERROR'
|
66
|
+
assert_equal "#!/usr/local/bin/ruby\nprogram",
|
67
|
+
do_update_shebang_line('ruby', "#!/usr/local/bin/ruby\nprogram")
|
68
|
+
assert_equal "#! /usr/local/bin/ruby\nprogram",
|
69
|
+
do_update_shebang_line('ruby-sp', "#! /usr/local/bin/ruby\nprogram")
|
70
|
+
assert_equal "#!/usr/local/bin/ruby -Ke\nprogram",
|
71
|
+
do_update_shebang_line('ruby-arg', "#!/usr/local/bin/ruby -Ke\nprogram")
|
72
|
+
assert_equal "#!/usr/bin/ruby -n -p\nprogram",
|
73
|
+
do_update_shebang_line('ruby-args', "#!/usr/bin/ruby -n -p\nprogram")
|
74
|
+
assert_equal "#!/usr/bin/env ruby\nprogram",
|
75
|
+
do_update_shebang_line('env-ruby', "#!/usr/bin/env ruby\nprogram")
|
76
|
+
assert_equal "#!/usr/bin/env perl\nprogram",
|
77
|
+
do_update_shebang_line('env-noruby', "#!/usr/bin/env perl\nprogram")
|
78
|
+
assert_equal "#!/bin/sh\nprogram",
|
79
|
+
do_update_shebang_line('interp', "#!/bin/sh\nprogram")
|
80
|
+
assert_equal "#!/bin/sh -l -r -\nprogram",
|
81
|
+
do_update_shebang_line('interp-args', "#!/bin/sh -l -r -\nprogram")
|
82
|
+
assert_equal "program",
|
83
|
+
do_update_shebang_line('bare', "program")
|
84
|
+
assert_equal "\001\002\003\n\004\005\006",
|
85
|
+
do_update_shebang_line('binary', "\001\002\003\n\004\005\006")
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_update_shebang_line__all
|
89
|
+
setup_installer 'shebang' => 'all', 'rubypath' => 'RUBYPATH'
|
90
|
+
assert_equal "#! RUBYPATH\nprogram",
|
91
|
+
do_update_shebang_line('ruby', "#!/usr/local/bin/ruby\nprogram")
|
92
|
+
assert_equal "#! RUBYPATH\nprogram",
|
93
|
+
do_update_shebang_line('ruby-sp', "#! /usr/local/bin/ruby\nprogram")
|
94
|
+
assert_equal "#! RUBYPATH -Ke\nprogram",
|
95
|
+
do_update_shebang_line('ruby-arg', "#!/usr/local/bin/ruby -Ke\nprogram")
|
96
|
+
assert_equal "#! RUBYPATH -n -p\nprogram",
|
97
|
+
do_update_shebang_line('ruby-args', "#!/usr/bin/ruby -n -p\nprogram")
|
98
|
+
assert_equal "#! RUBYPATH\nprogram",
|
99
|
+
do_update_shebang_line('env-ruby', "#!/usr/bin/env ruby\nprogram")
|
100
|
+
assert_equal "#! RUBYPATH\nprogram",
|
101
|
+
do_update_shebang_line('env-noruby', "#!/usr/bin/env perl\nprogram")
|
102
|
+
assert_equal "#! RUBYPATH\nprogram",
|
103
|
+
do_update_shebang_line('interp', "#!/bin/sh\nprogram")
|
104
|
+
assert_equal "#! RUBYPATH\nprogram", # args removed
|
105
|
+
do_update_shebang_line('interp-args', "#!/bin/sh -l -r -\nprogram")
|
106
|
+
assert_equal "#! RUBYPATH\nprogram",
|
107
|
+
do_update_shebang_line('bare', "program")
|
108
|
+
assert_equal "#! RUBYPATH\n\001\002\003\n\004\005\006",
|
109
|
+
do_update_shebang_line('binary', "\001\002\003\n\004\005\006")
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_update_shebang_line__ruby
|
113
|
+
setup_installer 'shebang' => 'ruby', 'rubypath' => 'RUBYPATH'
|
114
|
+
assert_equal "#! RUBYPATH\nprogram",
|
115
|
+
do_update_shebang_line('ruby', "#!/usr/local/bin/ruby\nprogram")
|
116
|
+
assert_equal "#! RUBYPATH\nprogram",
|
117
|
+
do_update_shebang_line('ruby-sp', "#! /usr/local/bin/ruby\nprogram")
|
118
|
+
assert_equal "#! RUBYPATH -Ke\nprogram",
|
119
|
+
do_update_shebang_line('ruby-arg', "#!/usr/local/bin/ruby -Ke\nprogram")
|
120
|
+
assert_equal "#! RUBYPATH -n -p\nprogram",
|
121
|
+
do_update_shebang_line('ruby-args', "#!/usr/bin/ruby -n -p\nprogram")
|
122
|
+
assert_equal "#! RUBYPATH\nprogram",
|
123
|
+
do_update_shebang_line('env-ruby', "#!/usr/bin/env ruby\nprogram")
|
124
|
+
assert_equal "#!/usr/bin/env perl\nprogram",
|
125
|
+
do_update_shebang_line('env-noruby', "#!/usr/bin/env perl\nprogram")
|
126
|
+
assert_equal "#!/bin/sh\nprogram",
|
127
|
+
do_update_shebang_line('interp', "#!/bin/sh\nprogram")
|
128
|
+
assert_equal "#!/bin/sh -l -r -\nprogram",
|
129
|
+
do_update_shebang_line('interp-args', "#!/bin/sh -l -r -\nprogram")
|
130
|
+
assert_equal "program",
|
131
|
+
do_update_shebang_line('bare', "program")
|
132
|
+
assert_equal "\001\002\003\n\004\005\006",
|
133
|
+
do_update_shebang_line('binary', "\001\002\003\n\004\005\006")
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
File without changes
|
data/lib/reap/bin/reap.rb
CHANGED
@@ -18,8 +18,9 @@ require 'reap/task/package'
|
|
18
18
|
require 'reap/task/publish'
|
19
19
|
require 'reap/task/info'
|
20
20
|
require 'reap/task/install'
|
21
|
-
require 'reap/task/
|
22
|
-
#require 'reap/task/
|
21
|
+
require 'reap/task/release'
|
22
|
+
#require 'reap/task/noop'
|
23
|
+
|
23
24
|
|
24
25
|
Reap.register
|
25
26
|
|
data/lib/reap/projectinfo.rb
CHANGED
data/lib/reap/task.rb
CHANGED
@@ -8,7 +8,13 @@ require 'facet/module/basename'
|
|
8
8
|
require 'facet/module/attr_setter'
|
9
9
|
|
10
10
|
require 'facet/filelist'
|
11
|
+
require 'facet/openobject'
|
11
12
|
|
13
|
+
# _____ _ ___ ___ _
|
14
|
+
# |_ _|_ _ __| |__ | _ ) __ _ ___ ___ / __| |__ _ ______
|
15
|
+
# | |/ _` (_-< / / | _ \/ _` (_-</ -_) | (__| / _` (_-<_-<
|
16
|
+
# |_|\__,_/__/_\_\ |___/\__,_/__/\___| \___|_\__,_/__/__/
|
17
|
+
#
|
12
18
|
|
13
19
|
# Base class for reap tasks.
|
14
20
|
#
|
@@ -39,6 +45,7 @@ require 'facet/filelist'
|
|
39
45
|
# TASK: mytask
|
40
46
|
# message: Message text, if any.
|
41
47
|
#
|
48
|
+
|
42
49
|
module Reap
|
43
50
|
|
44
51
|
@registry ||= {}
|
@@ -87,30 +94,30 @@ module Reap
|
|
87
94
|
|
88
95
|
class << self
|
89
96
|
|
97
|
+
def inherited( base )
|
98
|
+
Reap.registry[base.task_name] = base
|
99
|
+
end
|
100
|
+
|
101
|
+
def task_name ; basename.downcase ; end
|
102
|
+
|
90
103
|
def task_desc( text=nil, &block )
|
91
|
-
if text
|
92
|
-
|
93
|
-
|
94
|
-
@task_desc = block
|
95
|
-
else
|
96
|
-
@task_desc.call
|
97
|
-
end
|
104
|
+
return @task_desc = proc { text } if text
|
105
|
+
return @task_desc = block if block_given?
|
106
|
+
return @task_desc.call
|
98
107
|
end
|
108
|
+
#def task_desc ; '(no desciption given)' ; end
|
99
109
|
|
100
110
|
def task_help( text=nil, &block )
|
101
|
-
if text
|
102
|
-
|
103
|
-
|
104
|
-
@task_help = block
|
105
|
-
else
|
106
|
-
@task_help.call
|
107
|
-
end
|
111
|
+
return @task_help = proc { text } if text
|
112
|
+
return @task_help = block if block_given?
|
113
|
+
return @task_help.call
|
108
114
|
end
|
109
115
|
|
110
|
-
|
111
|
-
|
116
|
+
def task_attr( name )
|
117
|
+
define_method(name) { @task }
|
118
|
+
end
|
112
119
|
|
113
|
-
def section_required( val ) ; @section_required = val ;end
|
120
|
+
def section_required( val ) ; @section_required = val ; end
|
114
121
|
def section_required? ; @section_required ; end
|
115
122
|
|
116
123
|
def verify?
|
@@ -120,62 +127,82 @@ module Reap
|
|
120
127
|
true
|
121
128
|
end
|
122
129
|
|
123
|
-
|
124
|
-
|
125
|
-
|
130
|
+
# def master_attributes ; @master_attributes ||= [] ; end
|
131
|
+
#
|
132
|
+
# # Use this DSL method to define master task attributes.
|
133
|
+
# def attr_master( *names )
|
134
|
+
# attr_accessor *names
|
135
|
+
# @master_attributes ||= []
|
136
|
+
# @master_attributes |= names.collect { |n| n.to_s }
|
137
|
+
# end
|
126
138
|
|
127
|
-
|
139
|
+
# properties not to be looked up in master
|
140
|
+
# if they are not in regular task section
|
128
141
|
|
129
|
-
|
130
|
-
def
|
131
|
-
|
132
|
-
@
|
133
|
-
@master_attributes |= names.collect { |n| n.to_s }
|
142
|
+
def task_only_properties ; @task_only_properties ||= [] ; end
|
143
|
+
def task_only_property( *names )
|
144
|
+
@task_only_properties ||= []
|
145
|
+
@task_only_properties |= names.collect { |n| n.to_s }
|
134
146
|
end
|
135
147
|
|
136
|
-
end
|
148
|
+
end #<< class
|
137
149
|
|
138
150
|
# instance methods
|
139
151
|
|
140
152
|
def task_name ; self.class.task_name ; end
|
141
153
|
def task_desc ; self.class.task_desc ; end
|
154
|
+
def task_help ; self.class.task_help ; end
|
142
155
|
|
143
156
|
def section_required? ; self.class.section_required? ; end
|
144
157
|
|
145
158
|
#def master ; ::ProjectInfo.info ; end
|
146
|
-
def master
|
159
|
+
def master ; @master ; end
|
147
160
|
def section ; @section ; end
|
161
|
+
def task ; @task ; end
|
148
162
|
|
149
|
-
#
|
150
163
|
def initialize( *args )
|
151
|
-
@master = $PROJECT_INFO
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
init
|
158
|
-
run
|
164
|
+
@master = CascadingOpenObject.new( $PROJECT_INFO )
|
165
|
+
section = @master[task_name]
|
166
|
+
case section
|
167
|
+
when Array
|
168
|
+
section.each do |s|
|
169
|
+
initiate( s )
|
159
170
|
end
|
160
171
|
else
|
161
|
-
|
162
|
-
init
|
163
|
-
run
|
172
|
+
initiate( section )
|
164
173
|
end
|
165
174
|
end
|
166
175
|
|
167
|
-
|
168
|
-
@section = sec
|
176
|
+
# Per section
|
169
177
|
|
170
|
-
|
171
|
-
|
172
|
-
end
|
178
|
+
def initiate( section )
|
179
|
+
@section = CascadingOpenObject.new( section )
|
173
180
|
|
174
|
-
|
175
|
-
|
176
|
-
|
181
|
+
task_properties = {}
|
182
|
+
#self.class.task_only_properties.each { |t| section[t] ||= nil }
|
183
|
+
task_properties = CascadingOpenObject.new( section )
|
184
|
+
task_properties.__parent__ = @master
|
185
|
+
@task = task_properties
|
186
|
+
|
187
|
+
init #task
|
188
|
+
run #task
|
177
189
|
end
|
178
190
|
|
191
|
+
# def set( sec )
|
192
|
+
#
|
193
|
+
# #@task = @section #TaskProperties.new( @master, @section )
|
194
|
+
#
|
195
|
+
# #self.class.master_attributes.each do |k,v|
|
196
|
+
# # send( "#{k}=", @master[k] )
|
197
|
+
# #end
|
198
|
+
#
|
199
|
+
# #@section.each do |k,v|
|
200
|
+
# # send( "#{k}=", v )
|
201
|
+
# #end
|
202
|
+
# end
|
203
|
+
|
204
|
+
# the two primary methods
|
205
|
+
|
179
206
|
def init
|
180
207
|
raise "not implemented for '#{task_name}' task"
|
181
208
|
end
|
@@ -184,7 +211,15 @@ module Reap
|
|
184
211
|
raise "no action defined for task #{task_name}"
|
185
212
|
end
|
186
213
|
|
187
|
-
#
|
214
|
+
# Task support methods
|
215
|
+
|
216
|
+
def use_subsection( name )
|
217
|
+
subsection = @section.__send__(name)
|
218
|
+
if subsection
|
219
|
+
subsection.__parent__ = @section
|
220
|
+
@task = subsection
|
221
|
+
end
|
222
|
+
end
|
188
223
|
|
189
224
|
def sh( arg )
|
190
225
|
puts arg
|
@@ -194,28 +229,3 @@ module Reap
|
|
194
229
|
end #class Task
|
195
230
|
|
196
231
|
end #module Reap
|
197
|
-
|
198
|
-
|
199
|
-
##
|
200
|
-
# Convenience methods for built-in rake tasks
|
201
|
-
##
|
202
|
-
# module RakeTask
|
203
|
-
# extend self
|
204
|
-
#
|
205
|
-
# def gem_package_task(*args,&blk)
|
206
|
-
# ::Rake::GemPackageTask.new(*args,&blk)
|
207
|
-
# end
|
208
|
-
#
|
209
|
-
# def package_task(*args,&blk)
|
210
|
-
# ::Rake::PackageTask.new(*args,&blk)
|
211
|
-
# end
|
212
|
-
#
|
213
|
-
# def test_task(*args,&blk)
|
214
|
-
# ::Rake::TestTask.new(*args,&blk)
|
215
|
-
# end
|
216
|
-
#
|
217
|
-
# def rdoc_task(*args,&blk)
|
218
|
-
# ::Rake::RDocTask.new(*args,&blk)
|
219
|
-
# end
|
220
|
-
#
|
221
|
-
# end
|
data/lib/reap/task/announce.rb
CHANGED
@@ -8,147 +8,193 @@ require 'facet/string/align_center'
|
|
8
8
|
require 'facet/string/fold'
|
9
9
|
require 'facet/string/word_wrap'
|
10
10
|
|
11
|
+
# _ _____ _
|
12
|
+
# /_\ _ _ _ _ ___ _ _ _ _ __ ___ |_ _|_ _ __| |__
|
13
|
+
# / _ \| ' \| ' \/ _ \ || | ' \/ _/ -_) | |/ _` (_-< / /
|
14
|
+
# /_/ \_\_||_|_||_\___/\_,_|_||_\__\___| |_|\__,_/__/_\_\
|
15
|
+
#
|
16
|
+
|
17
|
+
# = Announcement Task
|
18
|
+
|
11
19
|
class Reap::Announce < Reap::Task
|
12
20
|
|
21
|
+
section_required true
|
22
|
+
|
13
23
|
task_desc "Send announcement email to ruby-talk or other address."
|
14
24
|
|
15
|
-
|
25
|
+
task_help %{
|
26
|
+
|
27
|
+
reap announce
|
16
28
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
29
|
+
Send an announcement to a mailaing list or other email address.
|
30
|
+
|
31
|
+
to Email address to send announcemnt.
|
32
|
+
from Email address sent from.
|
33
|
+
subject Subject of email message.
|
34
|
+
server Email server to route message.
|
35
|
+
port Email server's port.
|
36
|
+
domain Email server's domain name.
|
37
|
+
account Email account name.
|
38
|
+
type Login type, either plain, cram_md5 or login.
|
39
|
+
secure Uses TLS security, true or false?
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
task_attr :ann
|
44
|
+
|
45
|
+
#attr_accessor :title, :version, :summary, :description, :subject
|
46
|
+
#attr_accessor :to, :from, :server, :port, :domain, :account
|
47
|
+
#attr_accessor :type, :secure
|
48
|
+
#attr_accessor :links, :slogan, :memo, :file
|
21
49
|
|
22
50
|
def init
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
51
|
+
ann.to = (ann.to || 'ruby-talk@ruby-lang.org').to_s.strip
|
52
|
+
ann.from = (ann.from || master['email']).to_s.strip
|
53
|
+
ann.server = ann.server.to_s.strip
|
54
|
+
ann.port = (ann.port || 25).to_i
|
55
|
+
ann.domain = ann.domain.to_s.strip if ann.domain
|
56
|
+
ann.account = ann.account.to_s.strip
|
57
|
+
ann.type = (ann.type || 'plain').to_s.strip #cram_md5 #plain #login
|
58
|
+
|
59
|
+
raise "server is a require announce field" if ann.server.empty?
|
60
|
+
raise "account is a require announce field" if ann.account.empty?
|
31
61
|
|
32
|
-
|
33
|
-
|
62
|
+
ann.title ||= master.title
|
63
|
+
ann.version ||= master.version || master.date
|
64
|
+
ann.links ||= []
|
65
|
+
ann.subject ||= "[ANN] #{ann.title}, v#{ann.version}"
|
34
66
|
|
35
|
-
|
36
|
-
@version ||= master['version'] || master['date']
|
37
|
-
@summary ||= master['summary']
|
38
|
-
@description ||= master['description']
|
39
|
-
@links ||= []
|
40
|
-
@subject ||= "[ANN] #{@title}, v#{@version}"
|
67
|
+
ann.address = ann.to # TODO
|
41
68
|
|
42
|
-
|
69
|
+
#raise "DOMAIN is a required field" if ann.domain.empty?
|
70
|
+
end
|
71
|
+
|
72
|
+
def run
|
73
|
+
message = build_message
|
43
74
|
|
44
|
-
|
75
|
+
puts "\n#{message}\n\n"
|
76
|
+
print "Send? [y/N] "
|
77
|
+
until inp = $stdin.gets[0,1] ; sleep 1 ; end
|
78
|
+
|
79
|
+
unless inp.downcase == 'y'
|
80
|
+
puts "Reap announce task canceled."
|
81
|
+
exit 0
|
82
|
+
end
|
83
|
+
|
84
|
+
# ask for password
|
85
|
+
print "Password for #{ann.account}: "
|
86
|
+
until passwd = $stdin.gets.strip ; sleep 1 ; end
|
87
|
+
|
88
|
+
mail = %Q{
|
89
|
+
|From: #{ann.from}
|
90
|
+
|To: #{ann.address}
|
91
|
+
|Subject: #{ann.subject}
|
92
|
+
|
|
93
|
+
|#{message}
|
94
|
+
}.margin
|
95
|
+
begin
|
96
|
+
# --- Send using SMTP object and an adaptor
|
97
|
+
Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and ann.secure # == :tls
|
98
|
+
Net::SMTP.start(ann.server, ann.port, ann.domain, ann.account, passwd, ann.type) do |s|
|
99
|
+
s.send_message mail, ann.from, ann.address
|
100
|
+
end
|
101
|
+
puts "Email sent successfully to #{ann.address}."
|
102
|
+
rescue => e
|
103
|
+
puts "Email delivery failed."
|
104
|
+
puts e
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def build_message
|
45
112
|
|
46
113
|
# header
|
47
114
|
announce = %Q{
|
48
115
|
|
|
49
116
|
|A N N O U N C I N G
|
50
117
|
|
|
51
|
-
|#{title}, v#{version}
|
118
|
+
|#{ann.title}, v#{ann.version}
|
52
119
|
|
|
53
|
-
|#{summary}
|
120
|
+
|#{ann.summary}
|
54
121
|
|
|
122
|
+
|#{ann.homepage}
|
55
123
|
}.margin.align_center(66)
|
56
124
|
|
57
125
|
# abstract
|
58
126
|
abstract = ''
|
59
|
-
if
|
127
|
+
if ann.description
|
60
128
|
abstract << "\n\n"
|
61
|
-
abstract << "ABSTRACT
|
129
|
+
abstract << "ABSTRACT\n------------->\n\n#{ann.description}"
|
62
130
|
abstract << "\n"
|
63
131
|
end
|
64
132
|
|
65
133
|
# more info
|
66
134
|
info = ''
|
67
|
-
unless
|
68
|
-
info << "\n"
|
69
|
-
info << "
|
70
|
-
info << "\n"
|
71
|
-
@links.each{ |mi| info << "#{mi}".center(67) << "\n" }
|
135
|
+
unless ann.links.empty?
|
136
|
+
info << "\n\n"
|
137
|
+
info << "\nRELATED LINKS\n------------------>\n\n" #.center(67)
|
138
|
+
ann.links.each{ |mi| info << "#{mi}" << "\n" } #.center(67) << "\n" }
|
72
139
|
info << "\n"
|
73
140
|
end
|
74
141
|
|
75
142
|
# slogan
|
76
143
|
slogan = ''
|
77
|
-
if
|
144
|
+
if ann.slogan
|
78
145
|
slogan << "\n\n"
|
79
|
-
slogan <<
|
146
|
+
slogan << ann.slogan.center(67)
|
80
147
|
slogan << "\n\n"
|
81
148
|
end
|
82
149
|
|
83
150
|
# memo
|
84
151
|
memo = ''
|
85
|
-
if
|
152
|
+
if ann.memo
|
86
153
|
memo = ''
|
87
|
-
memo << "\n---\n" #<< ('-' * 72) << "\n"
|
88
|
-
memo << "
|
89
|
-
memo <<
|
154
|
+
#memo << "\n---\n" #<< ('-' * 72) << "\n"
|
155
|
+
memo << "\nRELEASE MEMO\n----------------->\n\n"
|
156
|
+
memo << ann.memo.strip.fold(true) #.word_wrap(67)
|
90
157
|
#memo << "\n"
|
91
158
|
end
|
92
159
|
|
93
160
|
# msg file
|
94
161
|
msg = ''
|
95
|
-
if
|
96
|
-
msg << "\n
|
97
|
-
msg << "(
|
98
|
-
|
99
|
-
File.
|
100
|
-
msg << mg.fold(true) #.word_wrap(67)
|
162
|
+
if ann.file and File.file?( ann.file )
|
163
|
+
msg << "\nRELEASE MEMO\n----------------->\n\n"
|
164
|
+
#msg << "\n---\n" #<< ("-" * 68) << "\n"
|
165
|
+
#msg << "(from #{ann.file})\n\n"
|
166
|
+
mg = File.read( ann.file )
|
167
|
+
msg << mg.strip.fold(true) #.word_wrap(67)
|
101
168
|
end
|
102
169
|
|
103
170
|
# stamp
|
104
|
-
stamp =
|
105
|
-
stamp << "\n---\n" #<< ("-" * 68) << "\n"
|
171
|
+
stamp = "\n\n\n"
|
172
|
+
#stamp << "\n\n---\n" #<< ("-" * 68) << "\n"
|
106
173
|
stamp << %Q{
|
107
|
-
|Generated by
|
108
|
-
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|From: #{@from}
|
132
|
-
|To: #{@address}
|
133
|
-
|Subject: #{@subject}
|
134
|
-
|
|
135
|
-
|#{@message}
|
136
|
-
}.margin
|
137
|
-
begin
|
138
|
-
# --- Send using SMTP object and an adaptor
|
139
|
-
Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and @tls
|
140
|
-
Net::SMTP.start(@server, @port, @domain, @account, passwd, @authtype) do |s|
|
141
|
-
s.send_message mail, @from, @address
|
142
|
-
end
|
143
|
-
puts "Email sent successfully to #{@address}."
|
144
|
-
rescue => e
|
145
|
-
puts "Email delivery failed."
|
146
|
-
puts e
|
147
|
-
end
|
148
|
-
else
|
149
|
-
puts "Reap announce task canceled."
|
150
|
-
exit 0
|
151
|
-
end
|
174
|
+
| Generated by
|
175
|
+
|
|
176
|
+
| o)o)o) o)o)o)o) o)o) o)o)o)
|
177
|
+
| o) o) o) o) o) o) o)
|
178
|
+
| o)o)o) o)o)o) o)o)o)o) o)o)o)
|
179
|
+
| o) o) o) o) o) o)
|
180
|
+
| o) o) o)o)o)o) o) o) o)
|
181
|
+
|
|
182
|
+
| The Ruby Project Assistant
|
183
|
+
|
|
184
|
+
| Do you Ruby? (http://www.ruby-lang.org)
|
185
|
+
}.margin.indent(12)
|
186
|
+
stamp << "\n"
|
187
|
+
|
188
|
+
message = ''
|
189
|
+
message << announce
|
190
|
+
message << slogan
|
191
|
+
message << abstract
|
192
|
+
message << memo
|
193
|
+
message << msg
|
194
|
+
message << info
|
195
|
+
message << stamp
|
196
|
+
|
197
|
+
message
|
152
198
|
end
|
153
199
|
|
154
200
|
end
|