reap 4.3.4 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/manifest'
5
+
6
+ module Rake
7
+ ReapManifest = ::Reap::RakeAdapter( ::Reap::Manifest )
8
+ end
9
+
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/package'
5
+
6
+ module Rake
7
+
8
+ ReapPackage = ::Reap::RakeAdapter( ::Reap::Package )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/publish'
5
+
6
+ module Rake
7
+
8
+ ReapPublish = ::Reap::RakeAdapter( ::Reap::Publish )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/rdoc'
5
+
6
+ module Rake
7
+
8
+ ReapRDoc = ::Reap::RakeAdapter( ::Reap::RDoc )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/release'
5
+
6
+ module Rake
7
+
8
+ ReapRelease = ::Reap::RakeAdapter( ::Reap::Release )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/test'
5
+
6
+ module Rake
7
+
8
+ ReapTest = ::Reap::RakeAdapter( ::Reap::Test )
9
+
10
+ end
@@ -4,9 +4,8 @@ require 'reap/projectinfo'
4
4
  require 'reap/task'
5
5
 
6
6
  # Reap tasks
7
- require 'reap/task/fileperm'
8
7
  require 'reap/task/test'
9
- require 'reap/task/testext'
8
+ require 'reap/task/extest'
10
9
  require 'reap/task/rdoc'
11
10
  require 'reap/task/announce'
12
11
  require 'reap/task/package'
@@ -15,12 +14,14 @@ require 'reap/task/info'
15
14
  require 'reap/task/install'
16
15
  require 'reap/task/release'
17
16
  require 'reap/task/doap'
17
+ require 'reap/task/manifest'
18
+ require 'reap/task/fileperm' # needs work
18
19
  #require 'reap/task/noop'
19
20
 
20
21
 
21
22
  module Reap
22
23
 
23
- Version = "4.3.4"
24
+ Version = "4.3.5"
24
25
 
25
26
  # Hash of all possible tasks
26
27
  # { task name => task class }
@@ -41,8 +42,8 @@ module Reap
41
42
  @tasks
42
43
  end
43
44
 
44
- def self.register( alternative_project_file=nil )
45
- $PROJECT_INFO = ProjectInfo.new( alternative_project_file )
45
+ def self.register #( alternative_project_file=nil )
46
+ $PROJECT_INFO = ProjectInfo.load( nil, true )
46
47
  $PROJECT_INFO.exists?
47
48
  end
48
49
 
@@ -7,7 +7,7 @@ require 'facet/string/tabto'
7
7
  require 'facet/module/basename'
8
8
  require 'facet/module/attr_setter'
9
9
 
10
- require 'facet/filelist'
10
+ require 'facet/filelist' unless defined?( FileList )
11
11
  require 'facet/openobject'
12
12
 
13
13
  # _____ _ ___ ___ _
@@ -49,10 +49,10 @@ module Reap
49
49
 
50
50
  class Task
51
51
 
52
- include ::Config
52
+ #include ::Config
53
53
  include ::FileUtils
54
54
 
55
- RUBY = CONFIG['ruby_install_name']
55
+ RUBY = ::Config::CONFIG['ruby_install_name']
56
56
 
57
57
  class << self
58
58
 
@@ -66,6 +66,11 @@ module Reap
66
66
  @task_list ||= {}
67
67
  end
68
68
 
69
+ # task dsl
70
+
71
+ def section_required( val ) ; @section_required = val ; end
72
+ def section_required? ; @section_required ; end
73
+
69
74
  def task_name
70
75
  basename.downcase
71
76
  end
@@ -75,7 +80,6 @@ module Reap
75
80
  return @task_desc = block if block_given?
76
81
  return @task_desc.call
77
82
  end
78
- #def task_desc ; '(no desciption given)' ; end
79
83
 
80
84
  def task_help( text=nil, &block )
81
85
  return @task_help = proc { text } if text
@@ -87,8 +91,6 @@ module Reap
87
91
  define_method(name) { @task }
88
92
  end
89
93
 
90
- def section_required( val ) ; @section_required = val ; end
91
- def section_required? ; @section_required ; end
92
94
 
93
95
  def verify?
94
96
  if section_required?
@@ -101,15 +103,6 @@ module Reap
101
103
  @master ||= CascadingOpenObject.new( $PROJECT_INFO )
102
104
  end
103
105
 
104
- # def master_attributes ; @master_attributes ||= [] ; end
105
- #
106
- # # Use this DSL method to define master task attributes.
107
- # def attr_master( *names )
108
- # attr_accessor *names
109
- # @master_attributes ||= []
110
- # @master_attributes |= names.collect { |n| n.to_s }
111
- # end
112
-
113
106
  # properties not to be looked up in master
114
107
  # if they are not in regular task section
115
108
 
@@ -136,7 +129,13 @@ module Reap
136
129
 
137
130
  def initialize( *args )
138
131
  #@master = CascadingOpenObject.new( $PROJECT_INFO )
139
- section = master[task_name]
132
+ @args = args
133
+ end
134
+
135
+ # Run task for each section entires given.
136
+
137
+ def execute( section=nil )
138
+ section = section || master[task_name]
140
139
  case section
141
140
  when Array
142
141
  section.each do |s|
@@ -147,39 +146,38 @@ module Reap
147
146
  end
148
147
  end
149
148
 
150
- # Per section
149
+ # Per section entry execution of task.
151
150
 
152
151
  def initiate( section )
153
152
  @section = CascadingOpenObject.new( section )
154
153
 
155
- task_properties = {}
154
+ task_properties = {} # needed?
156
155
  #self.class.task_only_properties.each { |t| section[t] ||= nil }
157
156
  task_properties = CascadingOpenObject.new( section )
158
157
  task_properties.__parent__ = master
159
158
  @task = task_properties
160
159
 
161
- init #task
162
- run #task
163
- end
160
+ # deprecate init ?
161
+ if respond_to?( :init )
162
+ if method(:init).arity == 0
163
+ init
164
+ else
165
+ init( *@args )
166
+ end
167
+ end
164
168
 
165
- # def set( sec )
166
- #
167
- # #@task = @section #TaskProperties.new( @master, @section )
168
- #
169
- # #self.class.master_attributes.each do |k,v|
170
- # # send( "#{k}=", @master[k] )
171
- # #end
172
- #
173
- # #@section.each do |k,v|
174
- # # send( "#{k}=", v )
175
- # #end
176
- # end
169
+ if method(:run).arity == 0
170
+ run
171
+ else
172
+ run( *@args )
173
+ end
174
+ end
177
175
 
178
- # the two primary methods
176
+ # interface
179
177
 
180
- def init
181
- raise "not implemented for '#{task_name}' task"
182
- end
178
+ #def init
179
+ # raise "not implemented for '#{task_name}' task"
180
+ #end
183
181
 
184
182
  def run
185
183
  raise "no action defined for task #{task_name}"
@@ -200,9 +198,20 @@ module Reap
200
198
  system arg unless $PRETEND
201
199
  end
202
200
 
201
+ def ask( question, answers=nil )
202
+ print "#{question}"
203
+ print " [#{answers}] " if answers
204
+ until inp = $stdin.gets[0,1] ; sleep 1 ; end ; puts
205
+ inp
206
+ end
207
+
208
+ def tell( statement )
209
+ puts statement
210
+ end
211
+
203
212
  def provide_setup_rb
204
213
  return true if File.exists?( 'setup.rb')
205
- # copy from data dir to current directory
214
+ # copy from data dir to current directory (Won't work with Gem!)
206
215
  f = File.join( Config::CONFIG['datadir'], 'reap', 'setup_rb', 'setup.rb' )
207
216
  if File.exists?(f)
208
217
  File.cp( f, '.' )
@@ -15,12 +15,35 @@ require 'facet/string/word_wrap'
15
15
  #
16
16
 
17
17
  # = Announcement Task
18
-
18
+ #
19
+ # The announce task is intended for sending out a nice
20
+ # formated email message to a mailing address, especially
21
+ # mailing-lists. ProjectInfo uses these parameters:
22
+ #
23
+ # announce:
24
+ # server Email server to route message.
25
+ # port Email server's port.
26
+ # domain Email server's domain name.
27
+ # account Email account name.
28
+ # type Login type, either plain, cram_md5 or login.
29
+ # secure Uses TLS security, true or false?
30
+ # to Email address to send announcemnt.
31
+ # from Email address sent from.
32
+ # subject Subject of email message.
33
+ # title Project title.
34
+ # summary Brief onl-liner description.
35
+ # description Long description of project.
36
+ # homespage Project homepage web address.
37
+ # links Array of http links to related sites.
38
+ # file File that contains announcement message.
39
+ # memo Embedded announcement message.
40
+ # slogan: Motto for you project.
41
+ #
19
42
  class Reap::Announce < Reap::Task
20
43
 
21
44
  section_required true
22
45
 
23
- task_desc "Send announcement email to ruby-talk or other address."
46
+ task_desc "Email project announcement."
24
47
 
25
48
  task_help %{
26
49
 
@@ -28,9 +51,8 @@ class Reap::Announce < Reap::Task
28
51
 
29
52
  Send an announcement to a mailaing list or other email address.
30
53
 
31
- to Email address to send announcemnt.
32
- from Email address sent from.
33
- subject Subject of email message.
54
+ Server settings are
55
+
34
56
  server Email server to route message.
35
57
  port Email server's port.
36
58
  domain Email server's domain name.
@@ -38,38 +60,46 @@ class Reap::Announce < Reap::Task
38
60
  type Login type, either plain, cram_md5 or login.
39
61
  secure Uses TLS security, true or false?
40
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
+
41
71
  }
42
72
 
43
- task_attr :ann
73
+ alias_method :anc, :task
44
74
 
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
75
+ def run
49
76
 
50
- def init
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
77
+ # setup
58
78
 
59
- raise "server is a require announce field" if ann.server.empty?
60
- raise "account is a require announce field" if ann.account.empty?
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
61
86
 
62
- ann.title ||= master.title
63
- ann.version ||= master.version || master.date
64
- ann.links ||= []
65
- ann.subject ||= "[ANN] #{ann.title}, v#{ann.version}"
87
+ raise "server is a require announce field" if anc.server.empty?
88
+ raise "account is a require announce field" if anc.account.empty?
66
89
 
67
- ann.address = ann.to # TODO
90
+ anc.title ||= master.title
91
+ anc.version ||= master.version || master.date
92
+ anc.links ||= []
93
+ anc.subject ||= "[ANN] #{anc.title}, v#{anc.version}"
68
94
 
69
- #raise "DOMAIN is a required field" if ann.domain.empty?
70
- end
95
+ anc.address = anc.to # TODO
96
+
97
+ # validate
98
+
99
+ #raise "DOMAIN is a required field" if anc.domain.empty?
100
+
101
+ # announce
71
102
 
72
- def run
73
103
  message = build_message
74
104
 
75
105
  puts "\n#{message}\n\n"
@@ -78,27 +108,27 @@ class Reap::Announce < Reap::Task
78
108
 
79
109
  unless inp.downcase == 'y'
80
110
  puts "Reap announce task canceled."
81
- exit 0
111
+ return nil
82
112
  end
83
113
 
84
114
  # ask for password
85
- print "Password for #{ann.account}: "
115
+ print "Password for #{anc.account}: "
86
116
  until passwd = $stdin.gets.strip ; sleep 1 ; end
87
117
 
88
118
  mail = %Q{
89
- |From: #{ann.from}
90
- |To: #{ann.address}
91
- |Subject: #{ann.subject}
119
+ |From: #{anc.from}
120
+ |To: #{anc.address}
121
+ |Subject: #{anc.subject}
92
122
  |
93
123
  |#{message}
94
124
  }.margin
95
125
  begin
96
126
  # --- 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
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
100
130
  end
101
- puts "Email sent successfully to #{ann.address}."
131
+ puts "Email sent successfully to #{anc.address}."
102
132
  rescue => e
103
133
  puts "Email delivery failed."
104
134
  puts e
@@ -115,55 +145,55 @@ private
115
145
  |
116
146
  |A N N O U N C I N G
117
147
  |
118
- |#{ann.title}, v#{ann.version}
148
+ |#{anc.title}, v#{anc.version}
119
149
  |
120
- |#{ann.summary}
150
+ |#{anc.summary}
121
151
  |
122
- |#{ann.homepage}
152
+ |#{anc.homepage}
123
153
  }.margin.align_center(66)
124
154
 
125
155
  # abstract
126
156
  abstract = ''
127
- if ann.description
157
+ if anc.description
128
158
  abstract << "\n\n"
129
- abstract << "ABSTRACT\n------------->\n\n#{ann.description}"
159
+ abstract << "ABSTRACT\n------------->\n\n#{anc.description}"
130
160
  abstract << "\n"
131
161
  end
132
162
 
133
163
  # more info
134
164
  info = ''
135
- unless ann.links.empty?
165
+ unless anc.links.empty?
136
166
  info << "\n\n"
137
167
  info << "\nRELATED LINKS\n------------------>\n\n" #.center(67)
138
- ann.links.each{ |mi| info << "#{mi}" << "\n" } #.center(67) << "\n" }
168
+ anc.links.each{ |mi| info << "#{mi}" << "\n" } #.center(67) << "\n" }
139
169
  info << "\n"
140
170
  end
141
171
 
142
172
  # slogan
143
173
  slogan = ''
144
- if ann.slogan
174
+ if anc.slogan
145
175
  slogan << "\n\n"
146
- slogan << ann.slogan.center(67)
176
+ slogan << anc.slogan.center(67)
147
177
  slogan << "\n\n"
148
178
  end
149
179
 
150
180
  # memo
151
181
  memo = ''
152
- if ann.memo
182
+ if anc.memo
153
183
  memo = ''
154
184
  #memo << "\n---\n" #<< ('-' * 72) << "\n"
155
185
  memo << "\nRELEASE MEMO\n----------------->\n\n"
156
- memo << ann.memo.strip.fold(true) #.word_wrap(67)
186
+ memo << anc.memo.strip.fold(true) #.word_wrap(67)
157
187
  #memo << "\n"
158
188
  end
159
189
 
160
190
  # msg file
161
191
  msg = ''
162
- if ann.file and File.file?( ann.file )
192
+ if anc.file and File.file?( anc.file )
163
193
  msg << "\nRELEASE MEMO\n----------------->\n\n"
164
194
  #msg << "\n---\n" #<< ("-" * 68) << "\n"
165
- #msg << "(from #{ann.file})\n\n"
166
- mg = File.read( ann.file )
195
+ #msg << "(from #{anc.file})\n\n"
196
+ mg = File.read( anc.file )
167
197
  msg << mg.strip.fold(true) #.word_wrap(67)
168
198
  end
169
199