reap 5.10.10 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. data/COPYING +400 -8
  2. data/README +136 -75
  3. data/bin/reap +2 -2
  4. data/bin/rubytest +5 -0
  5. data/data/reap/scaffold/standard/COPYING +403 -0
  6. data/data/reap/scaffold/{ChangeLog → standard/ChangeLog} +0 -0
  7. data/data/reap/scaffold/standard/INSTALL +14 -0
  8. data/data/reap/scaffold/{ProjectInfo → standard/ProjectInfo} +23 -24
  9. data/data/reap/scaffold/standard/README +3 -0
  10. data/data/reap/scaffold/standard/Rakefile +10 -0
  11. data/{Rakefile → data/reap/scaffold/standard/TODO} +0 -0
  12. data/data/reap/scaffold/{setup.rb → standard/setup.rb} +287 -270
  13. data/data/reap/scaffold/subversion/trunk/COPYING +403 -0
  14. data/data/reap/scaffold/{INSTALL → subversion/trunk/ChangeLog} +0 -0
  15. data/data/reap/scaffold/subversion/trunk/INSTALL +14 -0
  16. data/data/reap/scaffold/subversion/trunk/ProjectInfo +76 -0
  17. data/data/reap/scaffold/subversion/trunk/README +3 -0
  18. data/data/reap/scaffold/subversion/trunk/Rakefile +10 -0
  19. data/data/reap/scaffold/{README → subversion/trunk/TODO} +0 -0
  20. data/data/reap/scaffold/subversion/trunk/setup.rb +1568 -0
  21. data/data/reap/setup.rb +1568 -0
  22. data/lib/reap/bin/reap.rb +176 -80
  23. data/lib/reap/bin/rubytest.rb +53 -0
  24. data/lib/reap/class/announce.rb +220 -0
  25. data/lib/reap/class/doap.rb +80 -0
  26. data/lib/reap/class/extest.rb +151 -0
  27. data/lib/reap/class/filer.rb +62 -0
  28. data/lib/reap/class/installer.rb +178 -0
  29. data/lib/reap/class/manifest.rb +72 -0
  30. data/lib/reap/class/package.rb +468 -0
  31. data/lib/reap/class/publish.rb +152 -0
  32. data/lib/reap/class/rdoc.rb +131 -0
  33. data/lib/reap/class/test.rb +269 -0
  34. data/lib/reap/projectinfo.rb +187 -30
  35. data/lib/reap/rake.rb +42 -0
  36. data/lib/reap/reap.rb +89 -0
  37. data/lib/reap/tasks.rb +672 -11
  38. data/lib/reap/taskutils.rb +122 -0
  39. data/sample/ProjectInfo +96 -0
  40. data/sample/Rakefile +9 -0
  41. data/sample/Reapfile +11 -0
  42. data/sample/task/demo.rb +15 -0
  43. data/setup.rb +287 -272
  44. metadata +99 -257
  45. data/ANN +0 -3
  46. data/ChangeLog +0 -25
  47. data/ProjectInfo +0 -65
  48. data/data/reap/scaffold/COPYING +0 -11
  49. data/data/reap/scaffold/Rakefile +0 -146
  50. data/data/reap/scaffold/Todo +0 -0
  51. data/dev/Rakefile +0 -60
  52. data/dev/composite_task.rb +0 -27
  53. data/dev/compositepublisher.rb +0 -24
  54. data/dev/ftptools.rb +0 -139
  55. data/dev/license-each.rb +0 -85
  56. data/dev/publisher.rb +0 -75
  57. data/dev/rubyforgepublisher.rb +0 -18
  58. data/dev/sshpublisher.rb +0 -47
  59. data/dev/suby-cvs.rb +0 -46
  60. data/dev/template.rb +0 -72
  61. data/lib/reap/lint.rb +0 -0
  62. data/lib/reap/readymade.rb +0 -21
  63. data/lib/reap/task.rb +0 -187
  64. data/lib/reap/task/announce.rb +0 -156
  65. data/lib/reap/task/fileperm.rb +0 -82
  66. data/lib/reap/task/info.rb +0 -20
  67. data/lib/reap/task/install.rb +0 -33
  68. data/lib/reap/task/noop.rb +0 -26
  69. data/lib/reap/task/package.rb +0 -204
  70. data/lib/reap/task/publish.rb +0 -49
  71. data/lib/reap/task/rdoc.rb +0 -82
  72. data/lib/reap/task/scaffold.rb +0 -114
  73. data/lib/reap/task/test.rb +0 -186
  74. data/lib/reap/task/testext.rb +0 -110
  75. data/lib/reap/task/webpublish.rb +0 -43
  76. data/lib/reap/test.rb +0 -138
  77. data/test/tc_reap.rb +0 -11
  78. data/web/ProjectInfo +0 -57
  79. data/web/images/appleboy.jpg +0 -0
  80. data/web/images/grape.jpg +0 -0
  81. data/web/index.html +0 -124
  82. data/web/rdoc/classes/Object.html +0 -121
  83. data/web/rdoc/classes/ProjectInfo.html +0 -207
  84. data/web/rdoc/classes/ProjectInfo.src/M000094.html +0 -18
  85. data/web/rdoc/classes/ProjectInfo.src/M000095.html +0 -24
  86. data/web/rdoc/classes/ProjectInfo.src/M000096.html +0 -22
  87. data/web/rdoc/classes/ProjectInfo.src/M000097.html +0 -21
  88. data/web/rdoc/classes/ProjectInfo.src/M000098.html +0 -18
  89. data/web/rdoc/classes/Reap.html +0 -248
  90. data/web/rdoc/classes/Reap.src/M000023.html +0 -16
  91. data/web/rdoc/classes/Reap.src/M000024.html +0 -21
  92. data/web/rdoc/classes/Reap.src/M000025.html +0 -16
  93. data/web/rdoc/classes/Reap.src/M000026.html +0 -21
  94. data/web/rdoc/classes/Reap/Announce.html +0 -262
  95. data/web/rdoc/classes/Reap/Announce.src/M000030.html +0 -18
  96. data/web/rdoc/classes/Reap/Announce.src/M000031.html +0 -114
  97. data/web/rdoc/classes/Reap/Announce.src/M000032.html +0 -46
  98. data/web/rdoc/classes/Reap/Info.html +0 -176
  99. data/web/rdoc/classes/Reap/Info.src/M000033.html +0 -18
  100. data/web/rdoc/classes/Reap/Info.src/M000034.html +0 -17
  101. data/web/rdoc/classes/Reap/Info.src/M000035.html +0 -18
  102. data/web/rdoc/classes/Reap/Install.html +0 -193
  103. data/web/rdoc/classes/Reap/Install.src/M000036.html +0 -18
  104. data/web/rdoc/classes/Reap/Install.src/M000037.html +0 -20
  105. data/web/rdoc/classes/Reap/Install.src/M000038.html +0 -26
  106. data/web/rdoc/classes/Reap/Noop.html +0 -192
  107. data/web/rdoc/classes/Reap/Noop.src/M000027.html +0 -18
  108. data/web/rdoc/classes/Reap/Noop.src/M000028.html +0 -17
  109. data/web/rdoc/classes/Reap/Noop.src/M000029.html +0 -18
  110. data/web/rdoc/classes/Reap/Package.html +0 -310
  111. data/web/rdoc/classes/Reap/Package.src/M000055.html +0 -18
  112. data/web/rdoc/classes/Reap/Package.src/M000056.html +0 -68
  113. data/web/rdoc/classes/Reap/Package.src/M000057.html +0 -84
  114. data/web/rdoc/classes/Reap/Package.src/M000058.html +0 -61
  115. data/web/rdoc/classes/Reap/Perm.html +0 -236
  116. data/web/rdoc/classes/Reap/Perm.src/M000078.html +0 -18
  117. data/web/rdoc/classes/Reap/Perm.src/M000079.html +0 -21
  118. data/web/rdoc/classes/Reap/Perm.src/M000080.html +0 -42
  119. data/web/rdoc/classes/Reap/Perm.src/M000081.html +0 -26
  120. data/web/rdoc/classes/Reap/Perm.src/M000082.html +0 -18
  121. data/web/rdoc/classes/Reap/Publish.html +0 -213
  122. data/web/rdoc/classes/Reap/Publish.src/M000070.html +0 -18
  123. data/web/rdoc/classes/Reap/Publish.src/M000071.html +0 -22
  124. data/web/rdoc/classes/Reap/Publish.src/M000072.html +0 -37
  125. data/web/rdoc/classes/Reap/RDoc.html +0 -218
  126. data/web/rdoc/classes/Reap/RDoc.src/M000059.html +0 -18
  127. data/web/rdoc/classes/Reap/RDoc.src/M000060.html +0 -24
  128. data/web/rdoc/classes/Reap/RDoc.src/M000061.html +0 -70
  129. data/web/rdoc/classes/Reap/Task.html +0 -396
  130. data/web/rdoc/classes/Reap/Task.src/M000039.html +0 -18
  131. data/web/rdoc/classes/Reap/Task.src/M000040.html +0 -16
  132. data/web/rdoc/classes/Reap/Task.src/M000041.html +0 -16
  133. data/web/rdoc/classes/Reap/Task.src/M000042.html +0 -16
  134. data/web/rdoc/classes/Reap/Task.src/M000043.html +0 -16
  135. data/web/rdoc/classes/Reap/Task.src/M000044.html +0 -22
  136. data/web/rdoc/classes/Reap/Task.src/M000045.html +0 -16
  137. data/web/rdoc/classes/Reap/Task.src/M000046.html +0 -16
  138. data/web/rdoc/classes/Reap/Task.src/M000047.html +0 -16
  139. data/web/rdoc/classes/Reap/Task.src/M000048.html +0 -16
  140. data/web/rdoc/classes/Reap/Task.src/M000049.html +0 -16
  141. data/web/rdoc/classes/Reap/Task.src/M000050.html +0 -27
  142. data/web/rdoc/classes/Reap/Task.src/M000051.html +0 -19
  143. data/web/rdoc/classes/Reap/Task.src/M000052.html +0 -18
  144. data/web/rdoc/classes/Reap/Task.src/M000053.html +0 -18
  145. data/web/rdoc/classes/Reap/Task.src/M000054.html +0 -19
  146. data/web/rdoc/classes/Reap/Test.html +0 -253
  147. data/web/rdoc/classes/Reap/Test.src/M000062.html +0 -18
  148. data/web/rdoc/classes/Reap/Test.src/M000063.html +0 -26
  149. data/web/rdoc/classes/Reap/Test.src/M000064.html +0 -77
  150. data/web/rdoc/classes/Reap/Test.src/M000065.html +0 -27
  151. data/web/rdoc/classes/Reap/Test.src/M000066.html +0 -50
  152. data/web/rdoc/classes/Reap/Test/TestResults.html +0 -205
  153. data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +0 -21
  154. data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +0 -21
  155. data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +0 -23
  156. data/web/rdoc/classes/Reap/TestExt.html +0 -234
  157. data/web/rdoc/classes/Reap/TestExt.src/M000073.html +0 -18
  158. data/web/rdoc/classes/Reap/TestExt.src/M000074.html +0 -20
  159. data/web/rdoc/classes/Reap/TestExt.src/M000075.html +0 -49
  160. data/web/rdoc/classes/Reap/TestExt.src/M000076.html +0 -34
  161. data/web/rdoc/classes/Reap/TestExt.src/M000077.html +0 -27
  162. data/web/rdoc/classes/Reap/WebPublish.html +0 -213
  163. data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +0 -18
  164. data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +0 -21
  165. data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +0 -32
  166. data/web/rdoc/classes/ReapCommand.html +0 -425
  167. data/web/rdoc/classes/ReapCommand.src/M000001.html +0 -16
  168. data/web/rdoc/classes/ReapCommand.src/M000003.html +0 -16
  169. data/web/rdoc/classes/ReapCommand.src/M000005.html +0 -16
  170. data/web/rdoc/classes/ReapCommand.src/M000007.html +0 -16
  171. data/web/rdoc/classes/ReapCommand.src/M000009.html +0 -16
  172. data/web/rdoc/classes/ReapCommand.src/M000011.html +0 -16
  173. data/web/rdoc/classes/ReapCommand.src/M000013.html +0 -18
  174. data/web/rdoc/classes/ReapCommand.src/M000014.html +0 -19
  175. data/web/rdoc/classes/ReapCommand.src/M000015.html +0 -19
  176. data/web/rdoc/classes/ReapCommand.src/M000016.html +0 -24
  177. data/web/rdoc/classes/ReapCommand.src/M000018.html +0 -29
  178. data/web/rdoc/classes/Scaffold.html +0 -211
  179. data/web/rdoc/classes/Scaffold.src/M000086.html +0 -16
  180. data/web/rdoc/classes/Scaffold.src/M000087.html +0 -28
  181. data/web/rdoc/classes/Scaffold.src/M000088.html +0 -32
  182. data/web/rdoc/classes/Scaffold.src/M000089.html +0 -18
  183. data/web/rdoc/classes/UnitTestKernel.html +0 -176
  184. data/web/rdoc/classes/UnitTestKernel.src/M000019.html +0 -18
  185. data/web/rdoc/classes/UnitTestKernel.src/M000020.html +0 -18
  186. data/web/rdoc/classes/UnitTestKernel.src/M000021.html +0 -22
  187. data/web/rdoc/classes/UnitTestKernel.src/M000022.html +0 -22
  188. data/web/rdoc/classes/UnitTesting.html +0 -165
  189. data/web/rdoc/classes/UnitTesting.src/M000090.html +0 -34
  190. data/web/rdoc/classes/UnitTesting.src/M000091.html +0 -18
  191. data/web/rdoc/classes/UnitTesting/Failure.html +0 -156
  192. data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +0 -18
  193. data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +0 -21
  194. data/web/rdoc/created.rid +0 -1
  195. data/web/rdoc/files/ANN.html +0 -107
  196. data/web/rdoc/files/COPYING.html +0 -119
  197. data/web/rdoc/files/ChangeLog.html +0 -144
  198. data/web/rdoc/files/ProjectInfo.html +0 -190
  199. data/web/rdoc/files/README.html +0 -274
  200. data/web/rdoc/files/Rakefile.html +0 -101
  201. data/web/rdoc/files/lib/reap/bin/reap_rb.html +0 -129
  202. data/web/rdoc/files/lib/reap/lint_rb.html +0 -101
  203. data/web/rdoc/files/lib/reap/projectinfo_rb.html +0 -110
  204. data/web/rdoc/files/lib/reap/readymade_rb.html +0 -123
  205. data/web/rdoc/files/lib/reap/task/announce_rb.html +0 -114
  206. data/web/rdoc/files/lib/reap/task/fileperm_rb.html +0 -108
  207. data/web/rdoc/files/lib/reap/task/info_rb.html +0 -108
  208. data/web/rdoc/files/lib/reap/task/install_rb.html +0 -108
  209. data/web/rdoc/files/lib/reap/task/noop_rb.html +0 -108
  210. data/web/rdoc/files/lib/reap/task/package_rb.html +0 -109
  211. data/web/rdoc/files/lib/reap/task/publish_rb.html +0 -108
  212. data/web/rdoc/files/lib/reap/task/rdoc_rb.html +0 -108
  213. data/web/rdoc/files/lib/reap/task/scaffold_rb.html +0 -107
  214. data/web/rdoc/files/lib/reap/task/test_rb.html +0 -110
  215. data/web/rdoc/files/lib/reap/task/testext_rb.html +0 -109
  216. data/web/rdoc/files/lib/reap/task/webpublish_rb.html +0 -108
  217. data/web/rdoc/files/lib/reap/task_rb.html +0 -120
  218. data/web/rdoc/files/lib/reap/tasks_rb.html +0 -116
  219. data/web/rdoc/files/lib/reap/test_rb.html +0 -109
  220. data/web/rdoc/fr_class_index.html +0 -47
  221. data/web/rdoc/fr_file_index.html +0 -51
  222. data/web/rdoc/fr_method_index.html +0 -124
  223. data/web/rdoc/index.html +0 -24
  224. data/web/rdoc/rdoc-style.css +0 -208
@@ -0,0 +1,72 @@
1
+ #--
2
+ # __ __ _ __ _
3
+ # | \/ |__ _ _ _ (_)/ _|___ __| |_
4
+ # | |\/| / _` | ' \| | _/ -_|_-< _|
5
+ # |_| |_\__,_|_||_|_|_| \___/__/\__|
6
+ #
7
+ #++
8
+
9
+ require 'digest/md5'
10
+
11
+ module Reap
12
+
13
+ # = Manifest
14
+ #
15
+ # Create a manifest file for the package. Presently it is a very simple
16
+ # md5 + filename manifest. In the future this will be exanded to build
17
+ # a varity of manifest formats.
18
+ #
19
+ # Task specific settings:
20
+ #
21
+ # include Files to include
22
+ # exclude Files to exclude
23
+ #
24
+
25
+ class Manifest
26
+
27
+ include TaskUtils
28
+
29
+ MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~' ] #, 'dist', 'pkg' ]
30
+
31
+ # Note that ++dir++ is not offset by ++trunk++. But ++include++ and ++exclude++ are offset.
32
+
33
+ attr_accessor :trunk, :dir, :include, :exclude
34
+
35
+ def initialize( man )
36
+ @dir = '.'
37
+ @include = ['**/*']
38
+ @exclude = []
39
+
40
+ super
41
+
42
+ @trunk = '.' unless @trunk
43
+ @exclude |= MUST_EXCLUDE
44
+ end
45
+
46
+ # Generate manifest file.
47
+
48
+ def generate #( type=nil )
49
+ manifest_file = File.join( File.expand_path( @dir ), 'MANIFEST' )
50
+ package_files = FileList.new
51
+ Dir.chdir( @trunk ) do
52
+ package_files.include(*@include)
53
+ package_files.exclude(*@exclude) #if @exclude and not @exclude.empty?
54
+ File.open( manifest_file, 'w+') do |f|
55
+ package_files.each do |pf|
56
+ f << "#{salt(pf)} #{pf}\n" if File.file?(pf)
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ alias_method :call, :generate
63
+
64
+ private
65
+
66
+ def salt( file )
67
+ Digest::MD5.new( File.read( file ) ).hexdigest
68
+ end
69
+
70
+ end
71
+
72
+ end #module Reap
@@ -0,0 +1,468 @@
1
+ #--
2
+ # ___ _
3
+ # | _ \__ _ __| |____ _ __ _ ___
4
+ # | _/ _` / _| / / _` / _` / -_)
5
+ # |_| \__,_\__|_\_\__,_\__, \___|
6
+ # |___/
7
+ #++
8
+
9
+ require 'facet/fileutils/safe_ln.rb'
10
+ require 'facet/filelist.rb' unless defined?( FileList ) # prevent overlap with Rake's
11
+
12
+ module Reap
13
+
14
+ # = Package
15
+ #
16
+ # This class creates standard .zip, .tgz, or .tbz
17
+ # packages, plus .gem or .deb distributions.
18
+ #
19
+ # Builds distribution packages. The package task supports
20
+ # tar.gz, tar.bz2, zip source packages and gem, pacman and
21
+ # debian ditribution packages.
22
+ #
23
+ # Task specific settings:
24
+ #
25
+ # dir Directory in which to store distributions.
26
+ # include Files to include in distribution.
27
+ # exclude Files to exclude from those.
28
+ # distribute List of distribution types desired.
29
+ # (tgz, tar.gz, tbz, tar.bz2, zip, gem, deb, pac)
30
+ # project Project name.
31
+ # category Software category.
32
+ # architecture Can be any, i368, i686, ppc, etc.
33
+ # dependencies List of packages this program depends.
34
+ # recommends List of packages that can be used with this package.
35
+ # replaces List of packages this one replaces.
36
+ # executables Executable files in this distribution.
37
+ #
38
+ # RubyGems specific settings:
39
+ #
40
+ # autorequire
41
+ # platform
42
+ # require_paths
43
+ #
44
+ # The package task also has subsection for each type of distribution.
45
+ # These can be used to override settings in the package information
46
+ # if they in some way differ. Possible subsections are:
47
+ #
48
+ # gems
49
+ # pacman
50
+ # debian
51
+ #
52
+
53
+ class Package
54
+
55
+ include TaskUtils
56
+
57
+ MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~', 'dist', 'pkg', 'release' ]
58
+ LOCATIONS = [ 'dist', 'pkg', 'release', 'package', 'distribution' ]
59
+
60
+ attr :pkg
61
+
62
+ # Setup package task settings.
63
+
64
+ def initialize( pkg )
65
+ @pkg = pkg
66
+
67
+ #pkg.name ||= master.name
68
+ #pkg.title ||= master.title
69
+ #pkg.version ||= master.version
70
+ #pkg.project ||= master.project || master.rubyforge.project
71
+ #pkg.homepage ||= master.homepage || master.rubyforge.homepage
72
+
73
+ pkg.trunk ||= '.' # '.' probably will become the mater default.
74
+
75
+ pkg.status ||= 'development'
76
+ pkg.series ||= '1'
77
+ pkg.author ||= "Anonymous"
78
+ pkg.maintainer ||= pkg.author
79
+ pkg.email ||= ''
80
+ pkg.summary ||= ''
81
+ pkg.architecture ||= 'any'
82
+ pkg.license ||= 'Ruby/GPL'
83
+
84
+ pkg.dir ||= LOCATIONS.find { |f| File.directory?(f) } || 'dist'
85
+ pkg.date ||= Time.now.strftime("%Y-%m-%d")
86
+
87
+ d = pkg.date.split('-').collect{ |e| e.to_i }
88
+ #d[0] = d[0] - 2000 # No need to keep the 2000
89
+ pkg.version ||= d.join('.')
90
+
91
+ if $BUILD_VERSION
92
+ pkg.buildno = Time.now.strftime("%H*60+%M")
93
+ pkg.version += ".#{pkg.buildno}"
94
+ end
95
+
96
+ pkg.package_name ||= "#{pkg.name}-#{pkg.version}"
97
+
98
+ pkg.exclude ||= []
99
+ pkg.exclude |= MUST_EXCLUDE
100
+
101
+ pkg.include ||= ['**/*']
102
+
103
+ # distribute types include 'tgz', 'tbz', 'zip', 'tar.gz' 'tar.bz2', 'gem', 'pac' and 'deb'.
104
+
105
+ pkg.distribute ||= [ 'gem', 'tar.bz2', 'zip' ]
106
+ pkg.distribute = [pkg.distribute].flatten.collect { |t| t.to_s.strip.downcase }
107
+
108
+ pkg.dependencies ||= []
109
+ pkg.executables ||= []
110
+ pkg.requirements ||= []
111
+ pkg.recommends ||= []
112
+ pkg.conflicts ||= []
113
+ pkg.replaces ||= []
114
+
115
+ # Gem specific
116
+
117
+ # load rubygems if available
118
+ # (only do this if need be in future?)
119
+ begin
120
+ require 'rubygems'
121
+ rescue LoadError
122
+ # no rubygems
123
+ end
124
+
125
+ if defined?(::Gem) and pkg.gem
126
+ if pkg.gem.platform
127
+ begin
128
+ pkg.gem.platform = ::Gem::Platform.const_get(pkg.gem.platform.upcase)
129
+ rescue NameError
130
+ pkg.gem.platform = ::Gem::Platform::RUBY
131
+ end
132
+ else
133
+ pkg.gem.platform = ::Gem::Platform::RUBY
134
+ end
135
+ #@autorequire
136
+ end
137
+ end
138
+
139
+ # Generate packages.
140
+
141
+ def generate_packages
142
+
143
+ release_folder = File.join( pkg.dir, pkg.package_name )
144
+ mirror_folder = File.join( pkg.dir, pkg.package_name, pkg.package_name )
145
+
146
+ @release_path = File.expand_path( release_folder )
147
+ @mirror_path = File.expand_path( mirror_folder )
148
+
149
+ if FileTest.directory?(release_folder)
150
+ if $FORCE
151
+ puts "Removing old directory '#{File.expand_path(release_folder)}'..."
152
+ FileUtils.rm_r(release_folder)
153
+ else
154
+ puts "Package directory '#{pkg.package_name}' already exists. Use -f option to overwrite."
155
+ return nil
156
+ end
157
+ end
158
+
159
+ puts "Creating #{pkg.distribute.join(',')} packages..."
160
+
161
+ # First we make a copy of the files to be distributed.
162
+
163
+ FileUtils.mkdir_p( mirror_folder ) #pkg.dir #rescue nil
164
+ @package_files = nil
165
+ Dir.chdir( pkg.trunk ) do
166
+ @package_files = ::FileList.new(*pkg.include)
167
+ #package_files.include(*pkg.include)
168
+ @package_files.exclude(*pkg.exclude) if pkg.exclude #and not pkg.exclude.empty?
169
+ @package_files.resolve # reslove FileList here to be sure we get the right files!
170
+
171
+ @package_files.each do |f|
172
+ from = f #pkg.trunk ? File.join( pkg.trunk, f ) : f
173
+ to = File.join( @mirror_path, f )
174
+ to_dir = File.dirname( to )
175
+ FileUtils.mkdir_p( to_dir ) if not File.exist?(to_dir)
176
+ if File.directory?( from )
177
+ FileUtils.mkdir_p( to )
178
+ else
179
+ FileUtils.rm_f( to )
180
+ FileUtils.safe_ln( from, to )
181
+ end
182
+ end
183
+ end
184
+
185
+ # Now we create standard packages from the copy.
186
+
187
+ FileUtils.chdir( @release_path ) do
188
+ pkg.distribute.each do |t|
189
+ sh_cmd = nil
190
+ prefix = 'ERROR' # in case of unforseen bug
191
+ case t
192
+ when 'tbz', 'bz2', 'bzip2', 'tar.bz2'
193
+ prefix = ( t == 'tbz' ? 'tbz' : 'tar.bz2' )
194
+ sh_cmd = 'tar --bzip2 -cvf'
195
+ puts "\n[SHELL #{prefix.upcase}]"
196
+ when 'tgz', 'tar.gz'
197
+ prefix = ( t == 'tgz' ? 'tgz' : 'tar.gz' )
198
+ sh_cmd = 'tar --gzip -cvf'
199
+ puts "\n[SHELL #{prefix.upcase}]"
200
+ when 'zip'
201
+ prefix = 'zip'
202
+ sh_cmd = 'zip -r'
203
+ puts "\n[SHELL #{prefix.upcase}]"
204
+ when 'gem', 'deb', 'pac'
205
+ sh_cmd = nil
206
+ else
207
+ puts "WARNING: Unknown package type '#{t}' skipped"
208
+ sh_cmd = nil
209
+ end
210
+ sh %{#{sh_cmd} #{pkg.package_name}.#{prefix} #{pkg.package_name}} if sh_cmd
211
+ end
212
+ puts
213
+ end
214
+
215
+ # create gem package
216
+
217
+ if pkg.distribute.include?('gem')
218
+ if defined?(::Gem)
219
+ run_gem
220
+ else
221
+ tell "WARNING: Package .gem requested, but rubygems not found (skipped)."
222
+ end
223
+ end
224
+
225
+ # create debian package
226
+
227
+ if pkg.distribute.include?('deb')
228
+ if true # TODO ensure required debian tools here
229
+ run_deb
230
+ else
231
+ tell "WARNING: Package .deb requested, but debian tools not found (skipped)."
232
+ end
233
+ end
234
+
235
+ # create PKGBUILD (pacman, archlinux)
236
+
237
+ if pkg.distribute.include?('pac')
238
+ if true # TODO ensure required tools here
239
+ run_pacman
240
+ else
241
+ tell "WARNING: Pacman package requested, but required tools not found (skipped)."
242
+ end
243
+ end
244
+
245
+ # we can remove mirror folder now
246
+
247
+ #FileUtils.rm_r(mirror_folder)
248
+
249
+ return true
250
+ end
251
+
252
+ private
253
+
254
+ # This builds the gem package.
255
+
256
+ def run_gem
257
+
258
+ # use subsection if given
259
+ if pkg.gem
260
+ pkg = pkg().__merge__( pkg.gem )
261
+ else
262
+ pkg = pkg()
263
+ end
264
+
265
+ spec = Gem::Specification.new { |s|
266
+ s.name = pkg.name
267
+ s.version = pkg.version
268
+
269
+ pkg.dependencies.each { |d,v|
270
+ if v
271
+ s.add_dependency(d, v)
272
+ else
273
+ s.add_dependency(d)
274
+ end
275
+ }
276
+
277
+ s.summary = pkg.summary
278
+ s.requirements = pkg.requirements
279
+
280
+ # s.files = Dir.glob("lib/**/*").delete_if {|item| item.include?("CVS")}
281
+ # s.files.concat Dir.glob("bin/**/*").delete_if {|item| item.include?("CVS")}
282
+ #package_files = FileList.new
283
+ #package_files.include(*pkg.include)
284
+ #package_files.exclude(*pkg.exclude) if pkg.exclude and not pkg.exclude.empty?
285
+
286
+ s.files = @package_files.to_a
287
+
288
+ s.author = pkg.author
289
+ s.email = pkg.email
290
+ s.rubyforge_project = pkg.project
291
+ s.homepage = pkg.homepage
292
+
293
+ s.require_path = 'lib'
294
+ s.require_paths = pkg.require_paths if pkg.require_paths
295
+
296
+ s.autorequire = pkg.autorequire if pkg.autorequire
297
+ s.platform = pkg.platform
298
+
299
+ s.executables = pkg.executables
300
+ s.bindir = "bin"
301
+
302
+ s.has_rdoc = true
303
+ }
304
+
305
+ tell "[RUBYGEMS]"
306
+
307
+ Dir.chdir( @mirror_path ) {
308
+ Gem.manage_gems
309
+ Gem::Builder.new(spec).build
310
+ gems = Dir.glob( './*.gem' )
311
+ gems.each{ |f| FileUtils.mv( f, @release_path ) }
312
+ }
313
+
314
+ puts
315
+ end
316
+
317
+ # This build the Debiam package.
318
+
319
+ def run_deb
320
+
321
+ # use subsection if given
322
+ if pkg.debian
323
+ pkg = pkg().__merge__( pkg.debian )
324
+ else
325
+ pkg = pkg()
326
+ end
327
+
328
+ # build the debian control file
329
+
330
+ dep = pkg.dependencies.collect{ |d, v|
331
+ if v
332
+ "#{d} (#{v})"
333
+ else
334
+ d
335
+ end
336
+ }.join(', ')
337
+
338
+ # Some debian fields not yet used:
339
+ # Installed-Size: 1024
340
+ # Replaces: sam-sheepdog
341
+ # Pre-Depends: perl, ...
342
+ # Suggests: docbook
343
+
344
+ arch = pkg.architecture.downcase
345
+ arch = (arch == 'any' ? 'all' : arch)
346
+
347
+ ctrl = %{
348
+ Package: #{pkg.name}
349
+ Version: #{pkg.version}
350
+ Priority: optional
351
+ Architecture: #{arch}
352
+ Essential: no
353
+ }.tabto(0)
354
+ ctrl << "Section: #{pkg.category}\n" if pkg.category
355
+ ctrl << "Depends: #{dep}\n" unless dep.empty?
356
+ ctrl << "Recommends: #{pkg.recommends.join(' | ')}\n" unless pkg.recommends.empty?
357
+ ctrl << "Conflicts: #{pkg.conflicts.join(', ')}\n" unless pkg.conflicts.empty?
358
+ ctrl << "Maintainer: #{pkg.maintainer} <#{pkg.email}>\n"
359
+ ctrl << "Provides: #{pkg.name}\n"
360
+ ctrl << "Description: #{pkg.summary}\n"
361
+ ctrl << " #{pkg.description}\n"
362
+
363
+ if arch == 'all'
364
+ debname = "#{pkg.name}-ruby_#{pkg.version}.deb"
365
+ else
366
+ debname = "#{pkg.name}-ruby_#{pkg.version}_#{pkg.architecture}.deb"
367
+ end
368
+ pkgdir = @release_path #File.join( pkg.dir, pkg.package_name )
369
+ debdir = File.join( pkgdir, 'debian' )
370
+
371
+ #debdebdir = File.join( debdir, 'DEBIAN' )
372
+ debfile = File.join( pkgdir, debname )
373
+
374
+ puts "[SHELL DEB]"
375
+
376
+ FileUtils.mkdir_p(debdir)
377
+
378
+ Dir.chdir( @mirror_path ) do
379
+ unless provide_setup_rb
380
+ puts "Setup.rb is missing. Forced to skip debian package creation."
381
+ return nil
382
+ end
383
+
384
+ cmd = %{ruby setup.rb }
385
+ cmd << '-q ' unless $VERBOSE
386
+ cmd << %{all --installdirs=std --root=#{debdir}}
387
+
388
+ sh cmd
389
+
390
+ FileUtils.mkdir_p( File.join(debdir, 'DEBIAN') )
391
+ File.open( File.join(debdir, 'DEBIAN', 'control'), 'w') { |f| f << ctrl }
392
+
393
+ sh %{dpkg-deb -b #{debdir} #{debfile}}
394
+ end
395
+
396
+ puts
397
+ end
398
+
399
+ # This builds a pacman (archlinux) PKGBUILD script.
400
+
401
+ def run_pacman
402
+ # use subsection if it exists
403
+ if pkg.pacman
404
+ pkg = pkg().__merge__( pkg.pacman )
405
+ else
406
+ pkg = pkg()
407
+ end
408
+
409
+ unless pkg.source
410
+ tell "SOURCE, a URL to the source package, is a required field"
411
+ return nil
412
+ end
413
+
414
+ _dep = pkg.dependencies.collect{ |d| "'#{d}'" }.join(' ')
415
+ _rep = pkg.replaces.collect{ |d| "'#{d}'" }.join(' ')
416
+ _con = pkg.conflicts.collect{ |d| "'#{d}'" }.join(' ')
417
+
418
+ proto = %{
419
+ pkgname=#{pkg.name}
420
+ pkgver=#{pkg.version}
421
+ pkgrel=#{pkg.series}
422
+ pkgdesc="#{pkg.summary}"
423
+ url="#{pkg.homepage}"
424
+ license="#{pkg.license}"
425
+ depends=(#{_dep})
426
+ conflicts=(#{_con})
427
+ replaces=(#{_rep})
428
+ source=(#{pkg.source})
429
+ md5sums=(#{pkg.md5})
430
+ }.tabto(0)
431
+
432
+ # What are these for?
433
+ # install=
434
+ # backup=()
435
+
436
+ if pkg.usemake
437
+ proto << %{
438
+ makedepends=()"
439
+ build() {
440
+ cd $startdir/src/$pkgname-$pkgver
441
+ ./ruby setup.rb --prefix=/usr
442
+ make || return 1
443
+ make DESTDIR=$startdir/pkg install
444
+ }
445
+ }.tabto(0)
446
+ else
447
+ proto << %{
448
+ build() {
449
+ cd $startdir/src/$pkgname-$pkgver
450
+ ./ruby setup.rb --prefix=/usr
451
+ }
452
+ }.tabto(0)
453
+ end
454
+
455
+ pacdir = File.join( @release_path, 'pacman' )
456
+ #pacpacdir = File.join( pacdir, 'PACMAN' )
457
+ pacfile = File.join( pacdir, 'PKGBUILD' )
458
+
459
+ tell "[PACMAN PKGBUILD]"
460
+ FileUtils.mkdir_p( pacdir )
461
+ File.open( pacfile, 'w') { |f| f << proto }
462
+ tell "Created #{pacfile}"
463
+ puts
464
+ end
465
+
466
+ end #class Package
467
+
468
+ end #module Reap