reap 6.0.2 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/COPYING +666 -395
- data/MANIFEST +139 -0
- data/NOTES +12 -0
- data/README +19 -163
- data/bin/reap-announce +7 -0
- data/bin/reap-check-load +8 -0
- data/bin/reap-check-syntax +7 -0
- data/bin/reap-clean +7 -0
- data/bin/reap-clobber +7 -0
- data/bin/reap-doc +7 -0
- data/bin/reap-doc-rdoc +7 -0
- data/bin/reap-doc-ri +7 -0
- data/bin/reap-init +69 -0
- data/bin/reap-inspect +7 -0
- data/bin/reap-install +8 -0
- data/bin/reap-install-gem +8 -0
- data/bin/reap-log +7 -0
- data/bin/reap-log-changes +8 -0
- data/bin/reap-log-notes +8 -0
- data/bin/reap-make +7 -0
- data/bin/reap-make-clean +7 -0
- data/bin/reap-make-distclean +7 -0
- data/bin/reap-make-extconf +7 -0
- data/bin/reap-make-static +8 -0
- data/bin/reap-package +8 -0
- data/bin/reap-package-gem +7 -0
- data/bin/reap-package-tgz +7 -0
- data/bin/reap-package-zip +7 -0
- data/bin/reap-prepare +7 -0
- data/bin/reap-publish +7 -0
- data/bin/reap-release +7 -0
- data/bin/reap-scaffold +8 -0
- data/bin/reap-scm-branch +7 -0
- data/bin/reap-scm-tag +7 -0
- data/bin/reap-spec +7 -0
- data/bin/reap-spec-doc +8 -0
- data/bin/reap-stamp +7 -0
- data/bin/reap-stats +7 -0
- data/bin/reap-test +7 -0
- data/bin/reap-test-cross +7 -0
- data/bin/reap-test-load +9 -0
- data/bin/reap-test-solo +7 -0
- data/bin/reap-uninstall +7 -0
- data/bin/reap-uninstall-gem +7 -0
- data/data/reap/base/CHANGES +19 -0
- data/data/reap/base/COPYING +674 -0
- data/data/reap/base/NOTES +12 -0
- data/data/reap/base/README +8 -0
- data/data/reap/build/rake/Rakefile +130 -0
- data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
- data/data/reap/build/rake-lite/install.rb +79 -0
- data/data/reap/build/tasks/task/rdoc +211 -0
- data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
- data/data/reap/build/tasks/task/test +38 -0
- data/data/reap/init/meta/project.yaml +21 -0
- data/demo/README +15 -0
- data/demo/lib/foo/foo.rb +7 -0
- data/demo/meta/VERSION +1 -0
- data/demo/meta/project.yaml +21 -0
- data/lib/reap/application.rb +80 -0
- data/lib/reap/default.yaml +77 -0
- data/lib/reap/extensions/array.rb +50 -0
- data/lib/reap/extensions/hash.rb +63 -0
- data/lib/reap/extensions/string.rb +31 -0
- data/lib/reap/extensions.rb +6 -0
- data/lib/reap/iobject.rb +264 -0
- data/lib/reap/manager/announce.rb +193 -0
- data/lib/reap/manager/check.rb +109 -0
- data/lib/reap/manager/clean.rb +58 -0
- data/lib/reap/manager/gem.rb +200 -0
- data/lib/reap/manager/html.rb +69 -0
- data/lib/reap/manager/log.rb +214 -0
- data/lib/reap/manager/make.rb +109 -0
- data/lib/reap/manager/pack.rb +232 -0
- data/lib/reap/manager/publish.rb +72 -0
- data/lib/reap/manager/rdoc.rb +194 -0
- data/lib/reap/manager/release.rb +78 -0
- data/lib/reap/manager/rubyforge.rb +44 -0
- data/lib/reap/manager/scaffold.rb +138 -0
- data/lib/reap/manager/scm.rb +66 -0
- data/lib/reap/manager/site.rb +27 -0
- data/lib/reap/manager/spec.rb +94 -0
- data/lib/reap/manager/stats.rb +145 -0
- data/lib/reap/manager/svn.rb +76 -0
- data/lib/reap/manager/test.rb +389 -0
- data/lib/reap/manager.rb +74 -0
- data/lib/reap/metadata.rb +603 -0
- data/lib/reap/project.rb +165 -0
- data/lib/reap/settings.rb +67 -0
- data/lib/reap/systems/rubyforge.rb +737 -0
- data/lib/reap/systems/subversion.rb +333 -0
- data/lib/reap/utilities/fileutils.rb +304 -0
- data/lib/reap/utilities/netutils.rb +221 -0
- data/lib/reap/utilities/setuputils.rb +124 -0
- data/lib/reap/utilities/shellutils.rb +175 -0
- data/log/Changelog.txt +107 -0
- data/log/FIXME.txt +25 -0
- data/log/TODO.txt +72 -0
- data/meta/VERSION +1 -0
- data/meta/description +4 -0
- data/meta/project.yaml +20 -0
- data/task/man +14 -0
- data/task/rdoc +20 -0
- data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
- metadata +225 -153
- data/ProjectInfo +0 -105
- data/bin/reap +0 -5
- data/bin/rubytest +0 -5
- data/data/reap/install.rb +0 -62
- data/data/reap/scaffold/standard/COPYING +0 -403
- data/data/reap/scaffold/standard/ChangeLog +0 -0
- data/data/reap/scaffold/standard/INSTALL +0 -14
- data/data/reap/scaffold/standard/ProjectInfo +0 -77
- data/data/reap/scaffold/standard/README +0 -3
- data/data/reap/scaffold/standard/Rakefile +0 -10
- data/data/reap/scaffold/standard/TODO +0 -0
- data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
- data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
- data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
- data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
- data/data/reap/scaffold/subversion/trunk/README +0 -3
- data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
- data/data/reap/scaffold/subversion/trunk/TODO +0 -0
- data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
- data/forge/ProjectInfo +0 -38
- data/forge/ProjectInfo.rb +0 -76
- data/forge/TODO +0 -10
- data/forge/installer.rb +0 -250
- data/forge/reference/Rakefile +0 -124
- data/forge/reference/Rakefile.htm +0 -69
- data/forge/reference/aRakefile +0 -60
- data/forge/reference/compositepublisher.rb +0 -24
- data/forge/reference/ftptools.rb +0 -139
- data/forge/reference/installers/package.rb +0 -629
- data/forge/reference/license-each.rb +0 -85
- data/forge/reference/publisher.rb +0 -75
- data/forge/reference/rubyforge.rb +0 -247
- data/forge/reference/rubyforgepublisher.rb +0 -18
- data/forge/reference/sshpublisher.rb +0 -47
- data/forge/reference/suby-cvs.rb +0 -46
- data/forge/scaffold.rb +0 -126
- data/forge/unit_runner/README +0 -6
- data/forge/unit_runner/commentrunner.rb +0 -62
- data/forge/unit_runner/cunit.rb +0 -17
- data/forge/unit_runner/forkedrunner.rb +0 -91
- data/forge/unit_runner/sample.rb +0 -16
- data/lib/reap/bin/reap.rb +0 -230
- data/lib/reap/bin/rubytest.rb +0 -53
- data/lib/reap/class/announce.rb +0 -220
- data/lib/reap/class/doap.rb +0 -80
- data/lib/reap/class/extest.rb +0 -146
- data/lib/reap/class/filer.rb +0 -62
- data/lib/reap/class/manifest.rb +0 -68
- data/lib/reap/class/package.rb +0 -576
- data/lib/reap/class/publish.rb +0 -152
- data/lib/reap/class/rdoc.rb +0 -123
- data/lib/reap/class/test.rb +0 -264
- data/lib/reap/projectinfo.rb +0 -208
- data/lib/reap/rake.rb +0 -42
- data/lib/reap/reap.rb +0 -89
- data/lib/reap/tasks.rb +0 -756
- data/lib/reap/taskutils.rb +0 -122
- data/note/LATEST +0 -44
- data/note/doap.xml +0 -28
- data/note/history/Rakefile-0.1 +0 -308
- data/sample/ProjectInfo +0 -96
- data/sample/Rakefile +0 -9
- data/sample/Reapfile +0 -11
- data/sample/task/demo.rb +0 -15
- data/setup.rb +0 -1568
- data/web/ProjectInfo.html +0 -75
- data/web/images/grape.jpg +0 -0
- data/web/index.html +0 -312
data/lib/reap/class/package.rb
DELETED
@@ -1,576 +0,0 @@
|
|
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
|
-
# rules (see below)
|
38
|
-
#
|
39
|
-
# RubyGems specific settings:
|
40
|
-
#
|
41
|
-
# autorequire
|
42
|
-
# platform
|
43
|
-
# require_paths
|
44
|
-
#
|
45
|
-
# The package task also has subsection for each type of distribution.
|
46
|
-
# These can be used to override settings in the package information
|
47
|
-
# if they in some way differ. Possible subsections are:
|
48
|
-
#
|
49
|
-
# gems
|
50
|
-
# pacman
|
51
|
-
# debian
|
52
|
-
#
|
53
|
-
# Finally there is one last parameter that you can use for creating packages
|
54
|
-
# called 'rules'. The rules setting allows you to define how files are
|
55
|
-
# copied into the distribution package, so instead of a one to one copy
|
56
|
-
# of the included files, you can actually have a file placed in a different
|
57
|
-
# location within the distribution. This can be very handy if you wish to
|
58
|
-
# develop you project with one layout, but need to distribute it with another.
|
59
|
-
#
|
60
|
-
# The rules parameter is a literal string that consists of one rule per line.
|
61
|
-
# A line consists three space separated entries.
|
62
|
-
#
|
63
|
-
# from_path, file_glob, to_path
|
64
|
-
#
|
65
|
-
# If no 'to_path' is given then it is considered the same as the 'from_path'.
|
66
|
-
# It also supports two variables $name and $version which will be substitued
|
67
|
-
# any of these entries. Here is a possible example:
|
68
|
-
#
|
69
|
-
# rules: |
|
70
|
-
# lib **/* lib/$name/$version
|
71
|
-
#
|
72
|
-
# This will move any file under lib/ to the equivalent location under lib/$name/$version/.
|
73
|
-
# The default set of rules is a mirror image transfer, spelled out it would be:
|
74
|
-
#
|
75
|
-
# rules: |
|
76
|
-
# bin *
|
77
|
-
# ext **/*
|
78
|
-
# lib **/*
|
79
|
-
# data **/*
|
80
|
-
# conf **/*
|
81
|
-
#
|
82
|
-
# If your using Rolls against a normal project folder the alterntive is to create
|
83
|
-
# versioned paths, probably as follows:
|
84
|
-
#
|
85
|
-
# rules: |
|
86
|
-
# ext/$name **/* $name/$version
|
87
|
-
# lib/$name **/* $name/$version
|
88
|
-
# data/$name **/* $name/$version
|
89
|
-
# conf/$name **/* $name/$version ?
|
90
|
-
#
|
91
|
-
# Please note that the rules parameter is a new feature and is still considered beta.
|
92
|
-
|
93
|
-
class Package
|
94
|
-
|
95
|
-
include TaskUtils
|
96
|
-
|
97
|
-
KINDS = [ 'bin', 'lib', 'ext', 'data', 'conf', 'doc' ]
|
98
|
-
LOCATIONS = [ 'dist', 'pkg', 'release', 'package', 'distribution' ]
|
99
|
-
MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~', 'dist', 'pkg', 'release' ]
|
100
|
-
|
101
|
-
attr :pkg
|
102
|
-
|
103
|
-
# Setup package task settings.
|
104
|
-
|
105
|
-
def initialize( pkg )
|
106
|
-
@pkg = pkg
|
107
|
-
|
108
|
-
pkg.status ||= 'development'
|
109
|
-
pkg.series ||= '1'
|
110
|
-
pkg.author ||= "Anonymous"
|
111
|
-
pkg.maintainer ||= pkg.author
|
112
|
-
pkg.email ||= ''
|
113
|
-
pkg.summary ||= ''
|
114
|
-
pkg.architecture ||= 'any'
|
115
|
-
pkg.license ||= 'Ruby/GPL'
|
116
|
-
|
117
|
-
pkg.dir ||= LOCATIONS.find { |f| File.directory?(f) } || 'dist'
|
118
|
-
pkg.date ||= Time.now.strftime("%Y-%m-%d")
|
119
|
-
|
120
|
-
d = pkg.date.split('-').collect{ |e| e.to_i }
|
121
|
-
#d[0] = d[0] - 2000 # No need to keep the 2000
|
122
|
-
pkg.version ||= d.join('.')
|
123
|
-
|
124
|
-
if $BUILD_VERSION
|
125
|
-
pkg.buildno = Time.now.strftime("%H*60+%M")
|
126
|
-
pkg.version += ".#{pkg.buildno}"
|
127
|
-
end
|
128
|
-
|
129
|
-
pkg.package_name ||= "#{pkg.name}-#{pkg.version}"
|
130
|
-
|
131
|
-
pkg.exclude ||= []
|
132
|
-
pkg.exclude |= MUST_EXCLUDE
|
133
|
-
|
134
|
-
pkg.include ||= ['**/*']
|
135
|
-
|
136
|
-
# distribute types include 'tgz', 'tbz', 'zip', 'tar.gz' 'tar.bz2', 'gem', 'pac' and 'deb'.
|
137
|
-
|
138
|
-
pkg.distribute ||= [ 'gem', 'tar.bz2', 'zip' ]
|
139
|
-
pkg.distribute = [pkg.distribute].flatten.collect { |t| t.to_s.strip.downcase }
|
140
|
-
|
141
|
-
pkg.dependencies ||= []
|
142
|
-
pkg.executables ||= []
|
143
|
-
pkg.requirements ||= []
|
144
|
-
pkg.recommends ||= []
|
145
|
-
pkg.conflicts ||= []
|
146
|
-
pkg.replaces ||= []
|
147
|
-
|
148
|
-
@rules = parse_rules( pkg.rules )
|
149
|
-
end
|
150
|
-
|
151
|
-
private
|
152
|
-
|
153
|
-
#--
|
154
|
-
# TODO use shellwords
|
155
|
-
#++
|
156
|
-
def parse_rules( spec )
|
157
|
-
return [] unless spec
|
158
|
-
rules = [] #Hash.new { |h,k| h[k] = [] }
|
159
|
-
lines = spec.strip.split("\n")
|
160
|
-
lines.each { |line|
|
161
|
-
words = line.strip.split(/\s+/)
|
162
|
-
from, glob, to = *words
|
163
|
-
rules << [ vsub(from), vsub(glob), vsub(to) ]
|
164
|
-
}
|
165
|
-
rules
|
166
|
-
end
|
167
|
-
|
168
|
-
def vsub( str )
|
169
|
-
return nil if str.nil?
|
170
|
-
str = str.gsub( '$version', pkg.version.to_s ) #@version.to_s )
|
171
|
-
str = str.gsub( '$name', pkg.name.to_s )
|
172
|
-
str
|
173
|
-
end
|
174
|
-
|
175
|
-
public
|
176
|
-
|
177
|
-
# Generate packages.
|
178
|
-
|
179
|
-
def generate_packages
|
180
|
-
|
181
|
-
release_folder = File.join( pkg.dir, pkg.package_name )
|
182
|
-
mirror_folder = File.join( pkg.dir, pkg.package_name, pkg.package_name )
|
183
|
-
|
184
|
-
@release_path = File.expand_path( release_folder )
|
185
|
-
@mirror_path = File.expand_path( mirror_folder )
|
186
|
-
|
187
|
-
if FileTest.directory?(release_folder)
|
188
|
-
if $FORCE
|
189
|
-
puts "Removing old directory '#{File.expand_path(release_folder)}'..."
|
190
|
-
FileUtils.rm_r(release_folder) unless $PRETEND
|
191
|
-
else
|
192
|
-
puts "Package directory '#{pkg.package_name}' already exists. Use -f option to overwrite."
|
193
|
-
return nil
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
#puts "Creating #{pkg.distribute.join(',')} packages..."
|
198
|
-
|
199
|
-
# First we make a copy of the files to be distributed.
|
200
|
-
|
201
|
-
if $PRETEND
|
202
|
-
puts "mkdir_p #{mirror_folder}"
|
203
|
-
else
|
204
|
-
FileUtils.mkdir_p( mirror_folder )
|
205
|
-
end
|
206
|
-
|
207
|
-
trans = transfer_rules()
|
208
|
-
|
209
|
-
list = ::FileList.new
|
210
|
-
list.include(*pkg.include)
|
211
|
-
list.exclude(*pkg.exclude) if pkg.exclude
|
212
|
-
list.resolve
|
213
|
-
|
214
|
-
# build transfer table
|
215
|
-
folders, files = [], {}
|
216
|
-
list.each do |from|
|
217
|
-
to = trans.key?(from) ? trans[from] : from
|
218
|
-
#to = File.join( mirror_folder, to )
|
219
|
-
if File.directory?( from )
|
220
|
-
folders << to
|
221
|
-
else
|
222
|
-
files[ from ] = to
|
223
|
-
folders << File.dirname( to ) # ensure creation of files' folder
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
folders.delete('')
|
228
|
-
folders.uniq!
|
229
|
-
|
230
|
-
# create folders
|
231
|
-
folders.each do |to|
|
232
|
-
to = File.join( mirror_folder, to )
|
233
|
-
if $PRETEND
|
234
|
-
puts "mkdir_p #{to}"
|
235
|
-
else
|
236
|
-
FileUtils.mkdir_p( to )
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
# safe link files
|
241
|
-
files.each do |from, to|
|
242
|
-
to = File.join( mirror_folder, to )
|
243
|
-
if $PRETEND
|
244
|
-
puts "safe_ln #{from}, #{to}"
|
245
|
-
else
|
246
|
-
FileUtils.safe_ln( from, to )
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
# store package folders and files relative to mirror_folder (gems build uses this)
|
251
|
-
@package_files = folders + files.values
|
252
|
-
#@package_files = package_files.collect{ |f| f.sub("#{mirror_folder}/", '') }
|
253
|
-
|
254
|
-
# Now we create standard packages from the copy.
|
255
|
-
|
256
|
-
FileUtils.chdir( @release_path ) do
|
257
|
-
pkg.distribute.each do |t|
|
258
|
-
sh_cmd = nil
|
259
|
-
prefix = 'ERROR' # in case of unforseen bug
|
260
|
-
case t
|
261
|
-
when 'tbz', 'bz2', 'bzip2', 'tar.bz2'
|
262
|
-
prefix = ( t == 'tbz' ? 'tbz' : 'tar.bz2' )
|
263
|
-
sh_cmd = 'tar --bzip2 -cvf'
|
264
|
-
puts "\n[SHELL #{prefix.upcase}]"
|
265
|
-
when 'tgz', 'tar.gz'
|
266
|
-
prefix = ( t == 'tgz' ? 'tgz' : 'tar.gz' )
|
267
|
-
sh_cmd = 'tar --gzip -cvf'
|
268
|
-
puts "\n[SHELL #{prefix.upcase}]"
|
269
|
-
when 'zip'
|
270
|
-
prefix = 'zip'
|
271
|
-
sh_cmd = 'zip -r'
|
272
|
-
puts "\n[SHELL #{prefix.upcase}]"
|
273
|
-
when 'gem', 'deb', 'pac'
|
274
|
-
sh_cmd = nil
|
275
|
-
else
|
276
|
-
puts "WARNING: Unknown package type '#{t}' skipped"
|
277
|
-
sh_cmd = nil
|
278
|
-
end
|
279
|
-
sh %{#{sh_cmd} #{pkg.package_name}.#{prefix} #{pkg.package_name}} if sh_cmd
|
280
|
-
end
|
281
|
-
puts
|
282
|
-
end
|
283
|
-
|
284
|
-
# TODO Finish pretend mode for the distribution types.
|
285
|
-
return if $PRETEND
|
286
|
-
|
287
|
-
# create gem package
|
288
|
-
|
289
|
-
if pkg.distribute.include?('gem')
|
290
|
-
|
291
|
-
# load rubygems if available
|
292
|
-
begin
|
293
|
-
require 'rubygems'
|
294
|
-
run_gem
|
295
|
-
rescue LoadError
|
296
|
-
# no rubygems
|
297
|
-
tell "WARNING: Package .gem requested, but rubygems not found (skipped)."
|
298
|
-
end
|
299
|
-
|
300
|
-
# if defined?(::Gem)
|
301
|
-
# run_gem
|
302
|
-
# else
|
303
|
-
# tell "WARNING: Package .gem requested, but rubygems not found (skipped)."
|
304
|
-
# end
|
305
|
-
end
|
306
|
-
|
307
|
-
# create debian package
|
308
|
-
|
309
|
-
if pkg.distribute.include?('deb')
|
310
|
-
if true # TODO ensure required debian tools here
|
311
|
-
run_deb
|
312
|
-
else
|
313
|
-
tell "WARNING: Package .deb requested, but debian tools not found (skipped)."
|
314
|
-
end
|
315
|
-
end
|
316
|
-
|
317
|
-
# create PKGBUILD (pacman, archlinux)
|
318
|
-
|
319
|
-
if pkg.distribute.include?('pac')
|
320
|
-
if true # TODO ensure required tools here
|
321
|
-
run_pacman
|
322
|
-
else
|
323
|
-
tell "WARNING: Pacman package requested, but required tools not found (skipped)."
|
324
|
-
end
|
325
|
-
end
|
326
|
-
|
327
|
-
# we can remove mirror folder now
|
328
|
-
|
329
|
-
FileUtils.rm_r(mirror_folder) unless $PRETEND #or $OPTIONS[:retain]
|
330
|
-
|
331
|
-
return true
|
332
|
-
end
|
333
|
-
|
334
|
-
private
|
335
|
-
|
336
|
-
# Determine transfer rules.
|
337
|
-
#
|
338
|
-
# Rules should proceed from the most general to the most specific.
|
339
|
-
|
340
|
-
def transfer_rules
|
341
|
-
trans = {}
|
342
|
-
@rules.each do |rule|
|
343
|
-
from, glob, to = *rule
|
344
|
-
to = from unless to #?
|
345
|
-
files = Dir.glob( File.join( from, glob ) )
|
346
|
-
files.each do |file|
|
347
|
-
trans[file] = File.join( to, file.sub(from,'') )
|
348
|
-
end
|
349
|
-
end
|
350
|
-
trans
|
351
|
-
end
|
352
|
-
|
353
|
-
# Build a gem package.
|
354
|
-
|
355
|
-
def run_gem
|
356
|
-
|
357
|
-
# use subsection if given
|
358
|
-
if pkg.gem
|
359
|
-
pkg = pkg().__merge__( pkg.gem )
|
360
|
-
else
|
361
|
-
pkg = pkg()
|
362
|
-
end
|
363
|
-
|
364
|
-
spec = Gem::Specification.new { |s|
|
365
|
-
s.name = pkg.name
|
366
|
-
s.version = pkg.version
|
367
|
-
|
368
|
-
pkg.dependencies.each { |d,v|
|
369
|
-
if v
|
370
|
-
s.add_dependency(d, v)
|
371
|
-
else
|
372
|
-
s.add_dependency(d)
|
373
|
-
end
|
374
|
-
}
|
375
|
-
|
376
|
-
if pkg.platform
|
377
|
-
begin
|
378
|
-
s.platform = ::Gem::Platform.const_get(pkg.platform.upcase)
|
379
|
-
rescue NameError
|
380
|
-
s.platform = ::Gem::Platform::RUBY
|
381
|
-
end
|
382
|
-
else
|
383
|
-
s.platform = ::Gem::Platform::RUBY
|
384
|
-
end
|
385
|
-
|
386
|
-
s.summary = pkg.summary
|
387
|
-
s.requirements = pkg.requirements
|
388
|
-
|
389
|
-
# s.files = Dir.glob("lib/**/*").delete_if {|item| item.include?("CVS")}
|
390
|
-
# s.files.concat Dir.glob("bin/**/*").delete_if {|item| item.include?("CVS")}
|
391
|
-
#package_files = FileList.new
|
392
|
-
#package_files.include(*pkg.include)
|
393
|
-
#package_files.exclude(*pkg.exclude) if pkg.exclude and not pkg.exclude.empty?
|
394
|
-
|
395
|
-
s.files = @package_files.to_a
|
396
|
-
|
397
|
-
s.author = pkg.author
|
398
|
-
s.email = pkg.email
|
399
|
-
s.rubyforge_project = pkg.project
|
400
|
-
s.homepage = pkg.homepage
|
401
|
-
|
402
|
-
s.require_path = 'lib'
|
403
|
-
s.require_paths = pkg.require_paths if pkg.require_paths
|
404
|
-
|
405
|
-
s.autorequire = pkg.autorequire if pkg.autorequire
|
406
|
-
|
407
|
-
s.executables = pkg.executables
|
408
|
-
s.bindir = "bin"
|
409
|
-
|
410
|
-
s.has_rdoc = true
|
411
|
-
}
|
412
|
-
|
413
|
-
tell "[RUBYGEMS]"
|
414
|
-
|
415
|
-
Dir.chdir( @mirror_path ) {
|
416
|
-
Gem.manage_gems
|
417
|
-
Gem::Builder.new(spec).build
|
418
|
-
gems = Dir.glob( './*.gem' )
|
419
|
-
gems.each{ |f| FileUtils.mv( f, @release_path ) }
|
420
|
-
}
|
421
|
-
|
422
|
-
puts
|
423
|
-
end
|
424
|
-
|
425
|
-
# This build the Debiam package.
|
426
|
-
|
427
|
-
def run_deb
|
428
|
-
|
429
|
-
# use subsection if given
|
430
|
-
if pkg.debian
|
431
|
-
pkg = pkg().__merge__( pkg.debian )
|
432
|
-
else
|
433
|
-
pkg = pkg()
|
434
|
-
end
|
435
|
-
|
436
|
-
# build the debian control file
|
437
|
-
|
438
|
-
dep = pkg.dependencies.collect{ |d, v|
|
439
|
-
if v
|
440
|
-
"#{d} (#{v})"
|
441
|
-
else
|
442
|
-
d
|
443
|
-
end
|
444
|
-
}.join(', ')
|
445
|
-
|
446
|
-
# Some debian fields not yet used:
|
447
|
-
# Installed-Size: 1024
|
448
|
-
# Replaces: sam-sheepdog
|
449
|
-
# Pre-Depends: perl, ...
|
450
|
-
# Suggests: docbook
|
451
|
-
|
452
|
-
arch = pkg.architecture.downcase
|
453
|
-
arch = (arch == 'any' ? 'all' : arch)
|
454
|
-
|
455
|
-
ctrl = %{
|
456
|
-
Package: #{pkg.name}
|
457
|
-
Version: #{pkg.version}
|
458
|
-
Priority: optional
|
459
|
-
Architecture: #{arch}
|
460
|
-
Essential: no
|
461
|
-
}.tabto(0)
|
462
|
-
ctrl << "Section: #{pkg.category}\n" if pkg.category
|
463
|
-
ctrl << "Depends: #{dep}\n" unless dep.empty?
|
464
|
-
ctrl << "Recommends: #{pkg.recommends.join(' | ')}\n" unless pkg.recommends.empty?
|
465
|
-
ctrl << "Conflicts: #{pkg.conflicts.join(', ')}\n" unless pkg.conflicts.empty?
|
466
|
-
ctrl << "Maintainer: #{pkg.maintainer} <#{pkg.email}>\n"
|
467
|
-
ctrl << "Provides: #{pkg.name}\n"
|
468
|
-
ctrl << "Description: #{pkg.summary}\n"
|
469
|
-
ctrl << " #{pkg.description}\n"
|
470
|
-
|
471
|
-
if arch == 'all'
|
472
|
-
debname = "#{pkg.name}-ruby_#{pkg.version}.deb"
|
473
|
-
else
|
474
|
-
debname = "#{pkg.name}-ruby_#{pkg.version}_#{pkg.architecture}.deb"
|
475
|
-
end
|
476
|
-
pkgdir = @release_path #File.join( pkg.dir, pkg.package_name )
|
477
|
-
debdir = File.join( pkgdir, 'debian' )
|
478
|
-
|
479
|
-
#debdebdir = File.join( debdir, 'DEBIAN' )
|
480
|
-
debfile = File.join( pkgdir, debname )
|
481
|
-
|
482
|
-
puts "[SHELL DEB]"
|
483
|
-
|
484
|
-
FileUtils.mkdir_p(debdir)
|
485
|
-
|
486
|
-
Dir.chdir( @mirror_path ) do
|
487
|
-
unless provide_setup_rb
|
488
|
-
puts "Setup.rb is missing. Forced to skip debian package creation."
|
489
|
-
return nil
|
490
|
-
end
|
491
|
-
|
492
|
-
cmd = %{ruby setup.rb }
|
493
|
-
cmd << '-q ' unless $VERBOSE
|
494
|
-
cmd << %{all --installdirs=std --root=#{debdir}}
|
495
|
-
|
496
|
-
sh cmd
|
497
|
-
|
498
|
-
FileUtils.mkdir_p( File.join(debdir, 'DEBIAN') )
|
499
|
-
File.open( File.join(debdir, 'DEBIAN', 'control'), 'w') { |f| f << ctrl }
|
500
|
-
|
501
|
-
sh %{dpkg-deb -b #{debdir} #{debfile}}
|
502
|
-
end
|
503
|
-
|
504
|
-
puts
|
505
|
-
end
|
506
|
-
|
507
|
-
# This builds a pacman (archlinux) PKGBUILD script.
|
508
|
-
|
509
|
-
def run_pacman
|
510
|
-
# use subsection if it exists
|
511
|
-
if pkg.pacman
|
512
|
-
pkg = pkg().__merge__( pkg.pacman )
|
513
|
-
else
|
514
|
-
pkg = pkg()
|
515
|
-
end
|
516
|
-
|
517
|
-
unless pkg.source
|
518
|
-
tell "SOURCE, a URL to the source package, is a required field"
|
519
|
-
return nil
|
520
|
-
end
|
521
|
-
|
522
|
-
_dep = pkg.dependencies.collect{ |d| "'#{d}'" }.join(' ')
|
523
|
-
_rep = pkg.replaces.collect{ |d| "'#{d}'" }.join(' ')
|
524
|
-
_con = pkg.conflicts.collect{ |d| "'#{d}'" }.join(' ')
|
525
|
-
|
526
|
-
proto = %{
|
527
|
-
pkgname=#{pkg.name}
|
528
|
-
pkgver=#{pkg.version}
|
529
|
-
pkgrel=#{pkg.series}
|
530
|
-
pkgdesc="#{pkg.summary}"
|
531
|
-
url="#{pkg.homepage}"
|
532
|
-
license="#{pkg.license}"
|
533
|
-
depends=(#{_dep})
|
534
|
-
conflicts=(#{_con})
|
535
|
-
replaces=(#{_rep})
|
536
|
-
source=(#{pkg.source})
|
537
|
-
md5sums=(#{pkg.md5})
|
538
|
-
}.tabto(0)
|
539
|
-
|
540
|
-
# What are these for?
|
541
|
-
# install=
|
542
|
-
# backup=()
|
543
|
-
|
544
|
-
if pkg.usemake
|
545
|
-
proto << %{
|
546
|
-
makedepends=()"
|
547
|
-
build() {
|
548
|
-
cd $startdir/src/$pkgname-$pkgver
|
549
|
-
./ruby setup.rb --prefix=/usr
|
550
|
-
make || return 1
|
551
|
-
make DESTDIR=$startdir/pkg install
|
552
|
-
}
|
553
|
-
}.tabto(0)
|
554
|
-
else
|
555
|
-
proto << %{
|
556
|
-
build() {
|
557
|
-
cd $startdir/src/$pkgname-$pkgver
|
558
|
-
./ruby setup.rb --prefix=/usr
|
559
|
-
}
|
560
|
-
}.tabto(0)
|
561
|
-
end
|
562
|
-
|
563
|
-
pacdir = File.join( @release_path, 'pacman' )
|
564
|
-
#pacpacdir = File.join( pacdir, 'PACMAN' )
|
565
|
-
pacfile = File.join( pacdir, 'PKGBUILD' )
|
566
|
-
|
567
|
-
tell "[PACMAN PKGBUILD]"
|
568
|
-
FileUtils.mkdir_p( pacdir )
|
569
|
-
File.open( pacfile, 'w') { |f| f << proto }
|
570
|
-
tell "Created #{pacfile}"
|
571
|
-
puts
|
572
|
-
end
|
573
|
-
|
574
|
-
end #class Package
|
575
|
-
|
576
|
-
end #module Reap
|