reap 4.0 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/ProjectInfo +18 -6
  2. data/lib/reap/bin/reap.rb +47 -16
  3. data/lib/reap/interface/interface.rb +0 -0
  4. data/lib/reap/interface/rubyforge.rb +247 -0
  5. data/lib/reap/lint.rb +1 -0
  6. data/lib/reap/projectinfo.rb +47 -18
  7. data/lib/reap/reap.rb +0 -0
  8. data/lib/reap/task/announce.rb +11 -13
  9. data/lib/reap/task/fileperm.rb +2 -5
  10. data/lib/reap/task/info.rb +2 -4
  11. data/lib/reap/task/install.rb +1 -3
  12. data/lib/reap/task/noop.rb +1 -3
  13. data/lib/reap/task/package.rb +163 -65
  14. data/lib/reap/task/publish.rb +2 -4
  15. data/lib/reap/task/rdoc.rb +1 -3
  16. data/lib/reap/task/release.rb +273 -0
  17. data/lib/reap/task/test.rb +19 -5
  18. data/lib/reap/task/testext.rb +5 -5
  19. data/lib/reap/task.rb +94 -69
  20. metadata +70 -256
  21. data/dev/Rakefile +0 -60
  22. data/dev/composite_task.rb +0 -27
  23. data/dev/compositepublisher.rb +0 -24
  24. data/dev/ftptools.rb +0 -139
  25. data/dev/license-each.rb +0 -85
  26. data/dev/publisher.rb +0 -75
  27. data/dev/rubyforgepublisher.rb +0 -18
  28. data/dev/sshpublisher.rb +0 -47
  29. data/dev/suby-cvs.rb +0 -46
  30. data/dev/template.rb +0 -72
  31. data/lib/reap/readymade.rb +0 -21
  32. data/lib/reap/task/webpublish.rb +0 -43
  33. data/lib/reap/tasks.rb +0 -13
  34. data/lib/reap/test.rb +0 -138
  35. data/web/ProjectInfo +0 -57
  36. data/web/images/appleboy.jpg +0 -0
  37. data/web/images/grape.jpg +0 -0
  38. data/web/index.html +0 -124
  39. data/web/rdoc/classes/Object.html +0 -121
  40. data/web/rdoc/classes/ProjectInfo.html +0 -207
  41. data/web/rdoc/classes/ProjectInfo.src/M000094.html +0 -18
  42. data/web/rdoc/classes/ProjectInfo.src/M000095.html +0 -24
  43. data/web/rdoc/classes/ProjectInfo.src/M000096.html +0 -22
  44. data/web/rdoc/classes/ProjectInfo.src/M000097.html +0 -21
  45. data/web/rdoc/classes/ProjectInfo.src/M000098.html +0 -18
  46. data/web/rdoc/classes/Reap/Announce.html +0 -262
  47. data/web/rdoc/classes/Reap/Announce.src/M000030.html +0 -18
  48. data/web/rdoc/classes/Reap/Announce.src/M000031.html +0 -114
  49. data/web/rdoc/classes/Reap/Announce.src/M000032.html +0 -46
  50. data/web/rdoc/classes/Reap/Info.html +0 -176
  51. data/web/rdoc/classes/Reap/Info.src/M000033.html +0 -18
  52. data/web/rdoc/classes/Reap/Info.src/M000034.html +0 -17
  53. data/web/rdoc/classes/Reap/Info.src/M000035.html +0 -18
  54. data/web/rdoc/classes/Reap/Install.html +0 -193
  55. data/web/rdoc/classes/Reap/Install.src/M000036.html +0 -18
  56. data/web/rdoc/classes/Reap/Install.src/M000037.html +0 -20
  57. data/web/rdoc/classes/Reap/Install.src/M000038.html +0 -26
  58. data/web/rdoc/classes/Reap/Noop.html +0 -192
  59. data/web/rdoc/classes/Reap/Noop.src/M000027.html +0 -18
  60. data/web/rdoc/classes/Reap/Noop.src/M000028.html +0 -17
  61. data/web/rdoc/classes/Reap/Noop.src/M000029.html +0 -18
  62. data/web/rdoc/classes/Reap/Package.html +0 -310
  63. data/web/rdoc/classes/Reap/Package.src/M000055.html +0 -18
  64. data/web/rdoc/classes/Reap/Package.src/M000056.html +0 -68
  65. data/web/rdoc/classes/Reap/Package.src/M000057.html +0 -84
  66. data/web/rdoc/classes/Reap/Package.src/M000058.html +0 -61
  67. data/web/rdoc/classes/Reap/Perm.html +0 -236
  68. data/web/rdoc/classes/Reap/Perm.src/M000078.html +0 -18
  69. data/web/rdoc/classes/Reap/Perm.src/M000079.html +0 -21
  70. data/web/rdoc/classes/Reap/Perm.src/M000080.html +0 -42
  71. data/web/rdoc/classes/Reap/Perm.src/M000081.html +0 -26
  72. data/web/rdoc/classes/Reap/Perm.src/M000082.html +0 -18
  73. data/web/rdoc/classes/Reap/Publish.html +0 -213
  74. data/web/rdoc/classes/Reap/Publish.src/M000070.html +0 -18
  75. data/web/rdoc/classes/Reap/Publish.src/M000071.html +0 -22
  76. data/web/rdoc/classes/Reap/Publish.src/M000072.html +0 -37
  77. data/web/rdoc/classes/Reap/RDoc.html +0 -218
  78. data/web/rdoc/classes/Reap/RDoc.src/M000059.html +0 -18
  79. data/web/rdoc/classes/Reap/RDoc.src/M000060.html +0 -24
  80. data/web/rdoc/classes/Reap/RDoc.src/M000061.html +0 -70
  81. data/web/rdoc/classes/Reap/Task.html +0 -396
  82. data/web/rdoc/classes/Reap/Task.src/M000039.html +0 -18
  83. data/web/rdoc/classes/Reap/Task.src/M000040.html +0 -16
  84. data/web/rdoc/classes/Reap/Task.src/M000041.html +0 -16
  85. data/web/rdoc/classes/Reap/Task.src/M000042.html +0 -16
  86. data/web/rdoc/classes/Reap/Task.src/M000043.html +0 -16
  87. data/web/rdoc/classes/Reap/Task.src/M000044.html +0 -22
  88. data/web/rdoc/classes/Reap/Task.src/M000045.html +0 -16
  89. data/web/rdoc/classes/Reap/Task.src/M000046.html +0 -16
  90. data/web/rdoc/classes/Reap/Task.src/M000047.html +0 -16
  91. data/web/rdoc/classes/Reap/Task.src/M000048.html +0 -16
  92. data/web/rdoc/classes/Reap/Task.src/M000049.html +0 -16
  93. data/web/rdoc/classes/Reap/Task.src/M000050.html +0 -27
  94. data/web/rdoc/classes/Reap/Task.src/M000051.html +0 -19
  95. data/web/rdoc/classes/Reap/Task.src/M000052.html +0 -18
  96. data/web/rdoc/classes/Reap/Task.src/M000053.html +0 -18
  97. data/web/rdoc/classes/Reap/Task.src/M000054.html +0 -19
  98. data/web/rdoc/classes/Reap/Test/TestResults.html +0 -205
  99. data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +0 -21
  100. data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +0 -21
  101. data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +0 -23
  102. data/web/rdoc/classes/Reap/Test.html +0 -253
  103. data/web/rdoc/classes/Reap/Test.src/M000062.html +0 -18
  104. data/web/rdoc/classes/Reap/Test.src/M000063.html +0 -26
  105. data/web/rdoc/classes/Reap/Test.src/M000064.html +0 -77
  106. data/web/rdoc/classes/Reap/Test.src/M000065.html +0 -27
  107. data/web/rdoc/classes/Reap/Test.src/M000066.html +0 -50
  108. data/web/rdoc/classes/Reap/TestExt.html +0 -234
  109. data/web/rdoc/classes/Reap/TestExt.src/M000073.html +0 -18
  110. data/web/rdoc/classes/Reap/TestExt.src/M000074.html +0 -20
  111. data/web/rdoc/classes/Reap/TestExt.src/M000075.html +0 -49
  112. data/web/rdoc/classes/Reap/TestExt.src/M000076.html +0 -34
  113. data/web/rdoc/classes/Reap/TestExt.src/M000077.html +0 -27
  114. data/web/rdoc/classes/Reap/WebPublish.html +0 -213
  115. data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +0 -18
  116. data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +0 -21
  117. data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +0 -32
  118. data/web/rdoc/classes/Reap.html +0 -248
  119. data/web/rdoc/classes/Reap.src/M000023.html +0 -16
  120. data/web/rdoc/classes/Reap.src/M000024.html +0 -21
  121. data/web/rdoc/classes/Reap.src/M000025.html +0 -16
  122. data/web/rdoc/classes/Reap.src/M000026.html +0 -21
  123. data/web/rdoc/classes/ReapCommand.html +0 -425
  124. data/web/rdoc/classes/ReapCommand.src/M000001.html +0 -16
  125. data/web/rdoc/classes/ReapCommand.src/M000003.html +0 -16
  126. data/web/rdoc/classes/ReapCommand.src/M000005.html +0 -16
  127. data/web/rdoc/classes/ReapCommand.src/M000007.html +0 -16
  128. data/web/rdoc/classes/ReapCommand.src/M000009.html +0 -16
  129. data/web/rdoc/classes/ReapCommand.src/M000011.html +0 -16
  130. data/web/rdoc/classes/ReapCommand.src/M000013.html +0 -18
  131. data/web/rdoc/classes/ReapCommand.src/M000014.html +0 -19
  132. data/web/rdoc/classes/ReapCommand.src/M000015.html +0 -19
  133. data/web/rdoc/classes/ReapCommand.src/M000016.html +0 -24
  134. data/web/rdoc/classes/ReapCommand.src/M000018.html +0 -29
  135. data/web/rdoc/classes/Scaffold.html +0 -211
  136. data/web/rdoc/classes/Scaffold.src/M000086.html +0 -16
  137. data/web/rdoc/classes/Scaffold.src/M000087.html +0 -28
  138. data/web/rdoc/classes/Scaffold.src/M000088.html +0 -32
  139. data/web/rdoc/classes/Scaffold.src/M000089.html +0 -18
  140. data/web/rdoc/classes/UnitTestKernel.html +0 -176
  141. data/web/rdoc/classes/UnitTestKernel.src/M000019.html +0 -18
  142. data/web/rdoc/classes/UnitTestKernel.src/M000020.html +0 -18
  143. data/web/rdoc/classes/UnitTestKernel.src/M000021.html +0 -22
  144. data/web/rdoc/classes/UnitTestKernel.src/M000022.html +0 -22
  145. data/web/rdoc/classes/UnitTesting/Failure.html +0 -156
  146. data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +0 -18
  147. data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +0 -21
  148. data/web/rdoc/classes/UnitTesting.html +0 -165
  149. data/web/rdoc/classes/UnitTesting.src/M000090.html +0 -34
  150. data/web/rdoc/classes/UnitTesting.src/M000091.html +0 -18
  151. data/web/rdoc/created.rid +0 -1
  152. data/web/rdoc/files/ANN.html +0 -107
  153. data/web/rdoc/files/COPYING.html +0 -119
  154. data/web/rdoc/files/ChangeLog.html +0 -144
  155. data/web/rdoc/files/ProjectInfo.html +0 -190
  156. data/web/rdoc/files/README.html +0 -274
  157. data/web/rdoc/files/Rakefile.html +0 -101
  158. data/web/rdoc/files/lib/reap/bin/reap_rb.html +0 -129
  159. data/web/rdoc/files/lib/reap/lint_rb.html +0 -101
  160. data/web/rdoc/files/lib/reap/projectinfo_rb.html +0 -110
  161. data/web/rdoc/files/lib/reap/readymade_rb.html +0 -123
  162. data/web/rdoc/files/lib/reap/task/announce_rb.html +0 -114
  163. data/web/rdoc/files/lib/reap/task/fileperm_rb.html +0 -108
  164. data/web/rdoc/files/lib/reap/task/info_rb.html +0 -108
  165. data/web/rdoc/files/lib/reap/task/install_rb.html +0 -108
  166. data/web/rdoc/files/lib/reap/task/noop_rb.html +0 -108
  167. data/web/rdoc/files/lib/reap/task/package_rb.html +0 -109
  168. data/web/rdoc/files/lib/reap/task/publish_rb.html +0 -108
  169. data/web/rdoc/files/lib/reap/task/rdoc_rb.html +0 -108
  170. data/web/rdoc/files/lib/reap/task/scaffold_rb.html +0 -107
  171. data/web/rdoc/files/lib/reap/task/test_rb.html +0 -110
  172. data/web/rdoc/files/lib/reap/task/testext_rb.html +0 -109
  173. data/web/rdoc/files/lib/reap/task/webpublish_rb.html +0 -108
  174. data/web/rdoc/files/lib/reap/task_rb.html +0 -120
  175. data/web/rdoc/files/lib/reap/tasks_rb.html +0 -116
  176. data/web/rdoc/files/lib/reap/test_rb.html +0 -109
  177. data/web/rdoc/fr_class_index.html +0 -47
  178. data/web/rdoc/fr_file_index.html +0 -51
  179. data/web/rdoc/fr_method_index.html +0 -124
  180. data/web/rdoc/index.html +0 -24
  181. data/web/rdoc/rdoc-style.css +0 -208
@@ -3,7 +3,7 @@ require 'reap/task'
3
3
 
4
4
  begin
5
5
  require 'rubygems'
6
- rescue
6
+ rescue LoadError
7
7
  # no rubygems
8
8
  end
9
9
 
@@ -15,90 +15,115 @@ end
15
15
  #
16
16
  class Reap::Package < Reap::Task
17
17
 
18
- attr_accessor :dir, :name, :date, :series, :status,
19
- :author, :email, :summary, :project, :homepage,
20
- :exclude, :types, :platform, :autorequire,
21
- :dependencies, :requirements, :executables
18
+ task_desc do
19
+ disttypes = $PROJECT_INFO['distribute'] || [ 'gem', 'tar.bz2', 'zip' ]
20
+ "Build distribution packages (#{disttypes.join(', ')})."
21
+ end
22
22
 
23
- attr_reader :package_name, :include
23
+ MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~', 'dist', 'pkg' ]
24
+ LOCATIONS = [ '../leaf', '../dist', '../pkg', 'dist', 'pkg' ]
24
25
 
25
- MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~' ]
26
+ attr_master :name, :version, :date, :series, :status,
27
+ :author, :maintainer, :email, :homepage,
28
+ :summary, :description,
29
+ :dependencies, :executables, :requirements, :architecture,
30
+ :category, :recommends
26
31
 
27
- def task_desc
28
- "Build distribution packages (#{(types||[]).join(', ')})."
29
- end
32
+ attr_accessor :dir, :project, :exclude, :include, :format,
33
+ :autorequire, :platform, :require_paths
30
34
 
31
- def init
32
- @dir ||= ( File.directory?('../leaf') ? '../leaf' : 'pkg')
35
+ attr_reader :package_name, :series_versioning
33
36
 
34
- @name ||= master['name']
35
- @status ||= master['status'] || 'beta/stable'
36
- @date ||= master['date'] || Time.now.strftime("%Y-%m-%d")
37
37
 
38
- @series ||= master['series']
39
- @version ||= master['version']
38
+ def init( options={} )
39
+ @dir ||= LOCATIONS.find { |f| File.directory?(f) } || 'dist'
40
40
 
41
- unless @series || @version
42
- puts "Series or Version is a required field."
43
- exit 0
41
+ #@name ||= master['name']
42
+ #@status ||= master['status'] || 'beta/stable'
43
+ #@date ||= master['date'] || Time.now.strftime("%Y-%m-%d")
44
+ #@series ||= master['series'] || '1'
45
+
46
+ @maintainer ||= @author
47
+ @status ||= 'beta/stable'
48
+ @date ||= Time.now.strftime("%Y-%m-%d")
49
+ @series ||= '1'
50
+ @architecture ||= 'any'
51
+
52
+ d = @date.split('-').collect{ |e| e.to_i }
53
+ #d[0] = d[0] - 2000 # No need to keep the 2000
54
+ @version ||= d.join('.')
55
+
56
+ if $BUILD_VERSION
57
+ buildno = eval(Time.now.strftime("%H*60+%M"))
58
+ @version += ".#{buildno}"
44
59
  end
45
60
 
46
- if @version
47
- @package_name ||= @name + '-' + @version
48
- else
49
- @package_name ||= @name + ',' + @date
61
+ unless @series
62
+ puts "Series is required."
63
+ exit 0
50
64
  end
51
65
 
52
- @author ||= master['author']
53
- @email ||= master['email']
54
- @summary ||= master['summary']
66
+ @package_name ||= @name + '-' + @version
67
+ #@package_name ||= @name + ',' + @date # rubyforge doesn't allow commas
68
+
69
+ #@author ||= master['author']
70
+ #@email ||= master['email']
71
+ #@summary ||= master['summary']
55
72
  @project ||= master['rubyforge']['project']
56
- @homepage ||= master['homepage'] || master['rubyforge']['homepage']
73
+ #@homepage ||= master['homepage'] || master['rubyforge']['homepage']
74
+ @homepage ||= master['rubyforge']['homepage']
57
75
 
58
76
  @exclude ||= []
59
77
  @exclude |= MUST_EXCLUDE
60
78
 
61
- # types include 'tgz', 'tbz', 'zip', 'tar.gz' 'tar.bz2' and 'gem'.
62
- @types ||= master['distribute'] || [ 'gem', 'tar.gz', 'zip' ]
63
- @types.collect! { |t| t.to_s.strip.downcase }
64
-
65
- # not setable
66
79
  @include ||= ['**/*']
67
80
 
81
+ # format types include 'tgz', 'tbz', 'zip', 'tar.gz' 'tar.bz2', 'gem' and 'deb'.
82
+ @format ||= master['distribute'] || [ 'gem', 'tar.bz2', 'zip' ]
83
+ @format = [@format].flatten
84
+ @format.collect! { |t| t.to_s.strip.downcase }
85
+
86
+ @dependencies ||= []
87
+ @executables ||= []
88
+ @requirements ||= []
89
+ @recommends ||= []
90
+
68
91
  # gem specific (at least in this context)
69
92
  if defined?(Gem)
70
93
  if @platform
71
94
  begin
72
- @gem_platform = ::Gem.const_get(@platform)
95
+ @platform = ::Gem.const_get(@platform)
73
96
  rescue NameError
74
- @platform = nil
97
+ @platform = ::Gem::Platform::RUBY
75
98
  end
99
+ else
100
+ @platform ||= ::Gem::Platform::RUBY
76
101
  end
77
- @platform = ::Gem::Platform::RUBY unless @plaform
78
102
  #@autorequire
79
- @requirements ||= master['requirements'] || []
80
- @dependencies ||= master['dependencies'] || []
81
- @executables ||= master['executables'] || []
82
103
  end
104
+
83
105
  end
84
106
 
85
- def run
107
+ def run( options={} )
108
+ puts "Creating #{@format.join(',')} packages..."
109
+
86
110
  # create package image
87
- package_dir_path = "#{@dir}/#{@package_name}"
111
+ group_dir_path = File.join( @dir, @package_name )
112
+ package_dir_path = File.join( @dir, @package_name, @package_name )
88
113
 
89
- if FileTest.directory?(package_dir_path)
90
- print "Package '#{package_name}' already exists. Clobber? [y/N] "
114
+ if FileTest.directory?(group_dir_path)
115
+ print "Package directory '#{package_name}' already exists. Conitnue anyway or [R]emove and continue? [y/r/N] "
91
116
  until inp = $stdin.gets[0,1] ; sleep 1 ; end
92
- if (inp || 'y').downcase == 'y'
93
- puts "Removing old directory '#{File.expand_path(package_dir_path)}'..."
94
- FileUtils.rm_r(package_dir_path)
95
- #FileUtils.rm("#{package_dir_path}/*")
96
- #trash_dir = ".trash/#{File.basename(@dir)}"
97
- #FileUtils.mkdir_p(".trash") unless FileTest.directory?(".trash")
98
- #FileUtils.mv(@dir, trash_dir)
117
+ inp = inp.to_s.downcase
118
+ case inp
119
+ when 'y'
120
+ # continue...
121
+ when 'r'
122
+ puts "Removing old directory '#{File.expand_path(group_dir_path)}'..."
123
+ FileUtils.rm_r(group_dir_path)
99
124
  else
100
125
  puts "Reap package task canceled."
101
- exit 0
126
+ return nil
102
127
  end
103
128
  end
104
129
  package_files = FileList.new
@@ -118,8 +143,8 @@ class Reap::Package < Reap::Task
118
143
  end
119
144
 
120
145
  # create standard package files
121
- FileUtils.chdir(@dir) do
122
- @types.each do |t|
146
+ FileUtils.chdir( File.join( @dir, @package_name ) ) do
147
+ @format.each do |t|
123
148
  sh_cmd = nil
124
149
  prefix = 'ERROR' # in case of unforseen bug
125
150
  case t
@@ -135,7 +160,7 @@ class Reap::Package < Reap::Task
135
160
  prefix = 'zip'
136
161
  sh_cmd = 'zip -r'
137
162
  puts "\nReap is shelling out work to zip..."
138
- when 'gem'
163
+ when 'gem', 'deb'
139
164
  sh_cmd = nil
140
165
  else
141
166
  puts "Unknown package type '#{t}' skipped."
@@ -147,23 +172,38 @@ class Reap::Package < Reap::Task
147
172
  end
148
173
 
149
174
  # create gem package
150
- run_gem if defined?(Gem) and @types.include?('gem')
175
+ if @format.include?('gem')
176
+ if defined?(Gem)
177
+ run_gem
178
+ else
179
+ puts "Package .gem requested, but rubygems not found (skipped)."
180
+ end
181
+ end
182
+
183
+ # create debian package
184
+ if @format.include?('deb')
185
+ if true # TODO ensure required debian tools here
186
+ run_deb
187
+ else
188
+ puts "Package .deb requested, but debian tools not found (skipped)."
189
+ end
190
+ end
151
191
 
152
192
  return true
153
193
  end
154
194
 
195
+ # support methods -------------------------------------------
196
+
197
+ private
198
+
199
+ # This builds the gem package.
200
+
155
201
  def run_gem
156
202
  spec = Gem::Specification.new { |s|
157
-
158
203
  s.name = @name
159
-
160
- if @version
161
- s.version = @version
162
- else
163
- s.version = @series
164
- end
204
+ s.version = @version
165
205
 
166
- @dependencies.each{ |d,v|
206
+ @dependencies.each { |d,v|
167
207
  if v
168
208
  s.add_dependency(d, v)
169
209
  else
@@ -189,14 +229,72 @@ class Reap::Package < Reap::Task
189
229
  s.rubyforge_project = @project
190
230
  s.homepage = @homepage
191
231
  s.executables = @executables
232
+ s.require_paths = @require_paths if @require_paths
192
233
  s.bindir = "bin"
193
-
234
+ s.has_rdoc = true
194
235
  }
195
236
 
196
237
  puts "Reap is shelling out work to the Gem Package Manager..."
197
238
  Gem.manage_gems
198
239
  Gem::Builder.new(spec).build
199
- sh %{mv ./*.gem #{@dir}/}
240
+ gems = Dir.glob( './*.gem' )
241
+ gems.each{ |f|
242
+ FileUtils.mv( f, File.join( @dir, @package_name ) )
243
+ }
244
+ #sh %{mv ./*.gem #{@dir}/}
245
+ end
246
+
247
+
248
+ # This build the Debiam package.
249
+
250
+ def run_deb
251
+
252
+ # build the debian control file
253
+
254
+ dep = dependencies.collect{ |d, v|
255
+ if v
256
+ "#{d} (#{v})"
257
+ else
258
+ d
259
+ end
260
+ }.join(', ')
261
+
262
+ # Some debian fields not yet used:
263
+ # Installed-Size: 1024
264
+ # Conflicts: wile-e-coyote, ...
265
+ # Replaces: sam-sheepdog
266
+ # Pre-Depends: perl, ...
267
+ # Suggests: docbook
268
+
269
+ ctrl = %{
270
+ Package: #{name}
271
+ Version: #{version}
272
+ Priority: optional
273
+ Architecture: #{architecture}
274
+ Essential: no
275
+ }.tabto(0)
276
+ ctrl << "Section: #{category}" if category
277
+ ctrl << "Depends: #{dep}" unless dep.empty?
278
+ ctrl << "Recommends: #{recommends.join(' | ')}" unless recommends.empty?
279
+ ctrl << %{
280
+ Maintainer: #{maintainer} [#{email}]
281
+ Provides: #{name}
282
+ Description: #{summary}
283
+ .
284
+ #{description}
285
+ }.tabto(0)
286
+
287
+ debname = architecture == 'any' ? "ruby_#{name}_#{version}.deb" : "ruby_#{name}_#{version}_#{architecture}.deb"
288
+ debdir = File.join( @dir, @package_name, 'debian' )
289
+ debdebdir = File.join( debdir, 'DEBIAN' )
290
+ debfile = File.join( debdir, debname )
291
+
292
+ puts "Reap is shelling out work to the deb-pkg..."
293
+ FileUtils.mkdir_p(debdir)
294
+ sh %{ruby setup.rb all --prefix=#{debdir}}
295
+ FileUtils.mkdir_p(debdebdir)
296
+ File.open( File.join(debdebdir, 'control'), 'w') { |f| f << ctrl }
297
+ #sh %{dpkg-deb -b #{debdir} #{debfile}}
200
298
  end
201
299
 
202
300
  end
@@ -6,11 +6,9 @@ require 'reap/task'
6
6
  #
7
7
  class Reap::Publish < Reap::Task
8
8
 
9
- section_required true
9
+ task_desc "Publish documents to the web."
10
10
 
11
- def task_desc
12
- "Publish documents to the web."
13
- end
11
+ section_required true
14
12
 
15
13
  attr_accessor :host, :type, :dir, :project, :username
16
14
  attr_accessor :exclude # not using yet
@@ -6,9 +6,7 @@ require 'reap/task'
6
6
  #
7
7
  class Reap::RDoc < Reap::Task
8
8
 
9
- def task_desc
10
- "Generate RDocs (in #{dir})."
11
- end
9
+ task_desc "Generate RDocs."
12
10
 
13
11
  attr_accessor :dir, :main, :title, :template,
14
12
  :include, :exclude, :options
@@ -0,0 +1,273 @@
1
+ require 'reap/task'
2
+
3
+ require "enumerator"
4
+ require "http-access2"
5
+
6
+
7
+ #
8
+ # Release Task
9
+ #
10
+
11
+ # This Rake task releases files to RubyForge and other GForge instaces
12
+ # or SourceForge clones. In its most simple usage it looks like:
13
+ #
14
+ # project = MetaProject::Project::XForge::RubyForge.new('xforge')
15
+ # # Create a new release of the xforge project on Rubyforge.
16
+ # task :release => [:gem] do
17
+ # Rake::XForge::Release.new(project) {}
18
+ # end
19
+ #
20
+ # The previous example will use defaults where it can. It will prompt
21
+ # you for your xForge user name and password before it uploads all
22
+ # gems under the pkg folder and creates a RubyForge release.
23
+ #
24
+ # While defaults are nice, you may want a little more control. You can
25
+ # specify additional attributes:
26
+ #
27
+ # * #user_name
28
+ # * #password
29
+ # * #changes_file
30
+ # * #version
31
+ # * #files
32
+ # * #release_name
33
+ # * #release_notes
34
+ # * #release_changes
35
+ # * #package_name
36
+ #
37
+ # Example:
38
+ # project = MetaProject::Project::XForge::RubyForge.new('xforge')
39
+ # task :release => [:gem] do
40
+ # release_files = FileList[ 'pkg/*.gem', 'CHANGES' ]
41
+ #
42
+ # Rake::XForge::Release.new(project) do |xf|
43
+ # # Never hardcode user name and password in the Rakefile!
44
+ # xf.user_name = ENV['RUBYFORGE_USER']
45
+ # xf.password = ENV['RUBYFORGE_PASSWORD']
46
+ # xf.files = release_files.to_a
47
+ # xf.release_name = "XForge 0.1"
48
+ # end
49
+ #
50
+ # This can be invoked from the command line:
51
+ #
52
+ # rake release RUBYFORGE_USER=myuser \
53
+ # RUBYFORGE_PASSWORD=mypassword
54
+ #
55
+ # If you don't like blocks, you can do like this:
56
+ #
57
+ # project = MetaProject::Project::XForge::RubyForge.new('xforge')
58
+ # task :release => [:gem] do
59
+ # xf = Rake::XForge::Release.new(project)
60
+ # ... # Set additional attributes
61
+ # xf.execute
62
+ # end
63
+
64
+ class Reap::Release < Reap::Task
65
+
66
+ task_desc "Release distribution files."
67
+
68
+ section_required true
69
+
70
+ attr_accessor :project, :version
71
+ attr_accessor :host, :username, :password
72
+ attr_accessor :package, :packageid, :groupid, :private, :processor
73
+ attr_accessor :name, :changes, :notes, :changelog, :notelog
74
+ attr_accessor :cookiejar
75
+
76
+ def init
77
+ @project ||= master['rubyforge']['project'] || master['name']
78
+ @version ||= master['version'] || master['date']
79
+
80
+ @host ||= 'rubyforge.org'
81
+ @username ||= master['rubyforge']['username']
82
+ @password ||= master['rubyforge']['password']
83
+
84
+ @package ||= master['rubyforge']['package']
85
+ @packageid ||= master['rubyforge']['packageid']
86
+ @groupid ||= master['rubyforge']['groupid']
87
+ @private ||= false
88
+ @processor ||= 'Any'
89
+
90
+ #@files ||= section['files']
91
+ @name ||= master['version'] || master['date']
92
+ @date ||= master['date'] || Time::now.strftime('%Y-%m-%d %H:%M')
93
+
94
+ @cookiejar ||= File::join(File::expand_path("~"), ".rubyforge.cookie_jar")
95
+ end
96
+
97
+ # run task
98
+
99
+ def run
100
+ abort "missing field -- package" unless @package
101
+ abort "missing field -- packageid" unless @packageid
102
+ abort "missing field -- groupid" unless @groupid
103
+ # add more...
104
+
105
+ case @host
106
+ when 'rubyforge', 'rubyforge.org'
107
+ else
108
+ puts %{Unrecognized release host '#{@host}'. Skipped.}
109
+ skip = true
110
+ end
111
+
112
+ unless skip
113
+ puts "Reap is preparing release ..."
114
+ @password = get_password
115
+ login
116
+ #create_package (doesn't fit)
117
+ add_release( @file.unshift )
118
+ @files.each { |f| add_file( f ) }
119
+ add_release
120
+ end
121
+ end
122
+
123
+ FILETYPES = {
124
+ ".deb" => 1000,
125
+ ".rpm" => 2000,
126
+ ".zip" => 3000,
127
+ ".bz2" => 3100,
128
+ ".gz" => 3110,
129
+ ".src.zip" => 5000,
130
+ ".src.bz2" => 5010,
131
+ ".src.gz" => 5020,
132
+ ".src.rpm" => 5100,
133
+ ".src" => 5900,
134
+ ".jpg" => 8000,
135
+ ".txt" => 8100,
136
+ ".text" => 8100,
137
+ ".htm" => 8200,
138
+ ".html" => 8200,
139
+ ".pdf" => 8300,
140
+ ".oth" => 9999,
141
+ ".ebuild" => 1300,
142
+ ".exe" => 1100,
143
+ ".dmg" => 1200,
144
+ ".tar.gz" => 5000,
145
+ ".tgz" => 5000,
146
+ ".gem" => 1400,
147
+ ".pgp" => 8150,
148
+ ".sig" => 8150,
149
+ }
150
+
151
+ PROCESSORS = {
152
+ "i386" => 1000,
153
+ "IA64" => 6000,
154
+ "Alpha" => 7000,
155
+ "Any" => 8000,
156
+ "PPC" => 2000,
157
+ "MIPS" => 3000,
158
+ "Sparc" => 4000,
159
+ "UltraSparc" => 5000,
160
+ "Other" => 9999,
161
+ }
162
+
163
+
164
+ # login
165
+
166
+ def login
167
+ page = "/account/login.php"
168
+ method = "post_content"
169
+ form = {
170
+ "return_to" => "",
171
+ "form_loginname" => @username,
172
+ "form_pw" => @password,
173
+ "login" => "Login"
174
+ }
175
+ http_transaction( page, method, form )
176
+ end
177
+
178
+ # create a new package ( should be another task )
179
+
180
+ def create_package
181
+ page = "/frs/admin/index.php"
182
+ method = "post_content"
183
+ form = {
184
+ "group_id" => @groupid,
185
+ "package_name" => @package,
186
+ "func" => "add_package",
187
+ "is_public" => (@private ? 0 : 1),
188
+ "submit" => "Create This Package",
189
+ }
190
+ http_transaction( page, method, form )
191
+ end
192
+
193
+ # add a new release
194
+
195
+ def add_release( userfile )
196
+ page = "/frs/admin/qrs.php"
197
+ method = "post_content"
198
+
199
+ type_id = @type || userfile[%r|\.[^\./]+$|]
200
+ type_id = FILETYPES[type_id]
201
+
202
+ proc_id = PROCESSORS[@processor]
203
+
204
+ # how to use these?
205
+ notes = @notes ? @notes : ( @notelog ? open(@notelog) : nil )
206
+ changes = @changes ? @changes : ( @changelog ? open(@changelog) : nil )
207
+
208
+ userfile = open(userfile)
209
+
210
+ preformatted = '1'
211
+
212
+ form = {
213
+ "group_id" => @groupid,
214
+ "package_id" => @packageid,
215
+ "release_name" => @name,
216
+ "release_date" => @date,
217
+ "type_id" => type_id,
218
+ "processor_id" => proc_id,
219
+ "preformatted" => preformatted,
220
+ "userfile" => userfile,
221
+ "submit" => "Release File"
222
+ }
223
+
224
+ boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__')
225
+ extheader = { 'content-type'=>"multipart/form-data; boundary=___#{ boundary }___" }
226
+
227
+ http_transaction( page, method, form, extheader )
228
+ end
229
+
230
+ # add file to release
231
+
232
+ def add_file( userfile )
233
+
234
+ # to do
235
+
236
+ end
237
+
238
+ # http transaction
239
+
240
+ def http_transaction( page, method, form, extheader={} )
241
+ client = HTTPAccess2::Client::new ENV['HTTP_PROXY']
242
+ client.debug_dev = STDERR if ENV['DEBUG']
243
+ client.set_cookie_store cookie_jar
244
+ # fixes http-access2 bug
245
+ client.redirect_uri_callback = lambda do |res|
246
+ page = res.header['location'].first
247
+ page = page =~ %r/http/ ? page : "#{ config['uri'] }/#{ page }"
248
+ page
249
+ end
250
+ response = client.send "#{ method }", "#{ config['uri'] }/#{ page }", form, extheader
251
+ client.save_cookie_store
252
+ end
253
+
254
+
255
+ # fixes http-access2 bug
256
+ BEGIN {
257
+ require "http-access2"
258
+ module WebAgent::CookieUtils
259
+ def domain_match(host, domain)
260
+ case domain
261
+ when /\d+\.\d+\.\d+\.\d+/
262
+ return (host == domain)
263
+ when '.'
264
+ return true
265
+ when /^\./
266
+ #return tail_match?(domain, host)
267
+ return tail_match?(host, domain)
268
+ else
269
+ return (host == domain)
270
+ end
271
+ end
272
+ end
273
+ }
@@ -23,9 +23,7 @@ Test::Unit.run = true # don't run auto tests
23
23
  #
24
24
  class Reap::Test < Reap::Task
25
25
 
26
- def task_desc
27
- "Run unit-tests (each in a separate process)."
28
- end
26
+ task_desc "Run unit-tests (each in a separate process)."
29
27
 
30
28
  attr_accessor :libs, :files, :fixture, :against_installed
31
29
 
@@ -141,8 +139,17 @@ class Reap::Test < Reap::Task
141
139
  tests = Test::Unit::Collector::ObjectSpace.new.collect
142
140
  runner = Test::Unit::UI::TestRunnerMediator.new( tests )
143
141
  result = runner.run_suite
144
- output << Marshal.dump(result)
145
142
 
143
+ begin
144
+ marshalled = Marshal.dump(result)
145
+ rescue TypeError => e
146
+ $stderr << "MARSHAL ERROR\n"
147
+ $stderr << "TEST: #{testfile}\n"
148
+ $stderr << "DATA:" << result.inspect
149
+ exit 1
150
+ end
151
+ output << marshalled
152
+
146
153
  STDOUT.reopen(output)
147
154
  output.close
148
155
  }
@@ -152,7 +159,14 @@ class Reap::Test < Reap::Task
152
159
  ruby.read
153
160
  end
154
161
  p testfile if $VERBOSE
155
- return Marshal.load(result)
162
+ begin
163
+ marsh = Marshal.load(result)
164
+ rescue ArgumentError
165
+ $stderr << "\nCannot load marshalled test data."
166
+ $stderr << result << "\n"
167
+ exit 0
168
+ end
169
+ return marsh
156
170
  end
157
171
 
158
172
  #
@@ -11,9 +11,7 @@ require 'facet/string/margin'
11
11
  #
12
12
  class Reap::TestExt < Reap::Task
13
13
 
14
- def task_desc
15
- "Extract unit-tests from lib scripts."
16
- end
14
+ task_desc "Extract unit-tests from lib scripts."
17
15
 
18
16
  attr_accessor :dir, :files, :options
19
17
 
@@ -48,7 +46,9 @@ class Reap::TestExt < Reap::Task
48
46
  testing = extract( file )
49
47
  unless testing.strip.empty?
50
48
  complete_test = create( testing, file )
51
- fp = File.join(@dir,file)
49
+ libpath = File.dirname( file )
50
+ testfile = "test_" + File.basename( file )
51
+ fp = File.join(@dir,libpath,testfile)
52
52
  unless File.directory?( File.dirname( fp ) )
53
53
  FileUtils.mkdir_p( File.dirname(fp) )
54
54
  end
@@ -63,7 +63,7 @@ class Reap::TestExt < Reap::Task
63
63
  tests = ""; inside = false
64
64
  fstr = File.read( file )
65
65
  fstr.split(/\n/).each do |l|
66
- if l =~ /^=[ ]*begin[ ]*testing/
66
+ if l =~ /^=begin[ ]*test/i
67
67
  tests << "\n"
68
68
  inside = true
69
69
  next