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
@@ -0,0 +1,603 @@
|
|
1
|
+
# = TITLE:
|
2
|
+
#
|
3
|
+
# Project
|
4
|
+
#
|
5
|
+
# = COPYING:
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007 Tiger Ops
|
8
|
+
#
|
9
|
+
# This file is part of the ProUtils' Ratch program.
|
10
|
+
#
|
11
|
+
# Ratch is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 3 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
#
|
16
|
+
# Ratch is distributed in the hope that it will be useful,
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
# GNU General Public License for more details.
|
20
|
+
#
|
21
|
+
# You should have received a copy of the GNU General Public License
|
22
|
+
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
|
24
|
+
require 'facets/dir/multiglob'
|
25
|
+
require 'reap/iobject'
|
26
|
+
|
27
|
+
module Reap
|
28
|
+
|
29
|
+
class Project
|
30
|
+
|
31
|
+
# = Project Metadata
|
32
|
+
#
|
33
|
+
# The Project Metadata class stores project information. This information includes
|
34
|
+
# the general information about a project, such as title, description, homepage, etc.
|
35
|
+
# which is essentially static. Once set, it will probably will never change.
|
36
|
+
# The class also contains default settings for packaging; information that is
|
37
|
+
# usually static, but may vary for a partciular package platform or format.
|
38
|
+
#
|
39
|
+
# When utilizing this class it is important not confuse oneself thinking that a
|
40
|
+
# project is not a project just becuase it is a sub-project. A sub-project is a
|
41
|
+
# project, it just happens to belong to a master project.
|
42
|
+
|
43
|
+
class Metadata < InfoObject
|
44
|
+
|
45
|
+
PROJECT_FILE = '{,meta/}{project}{info,}{.yaml,.yml,}'
|
46
|
+
VERSION_FILE = '{,meta/}{version}{.text,.txt,}'
|
47
|
+
|
48
|
+
#
|
49
|
+
|
50
|
+
def self.read(location)
|
51
|
+
metadata = read_project(location)
|
52
|
+
versdata = read_version(location)
|
53
|
+
|
54
|
+
data = {}
|
55
|
+
data.update(metadata)
|
56
|
+
data.update(versdata)
|
57
|
+
|
58
|
+
new(location, data)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Parse release file for release information.
|
62
|
+
|
63
|
+
def self.read_project(location)
|
64
|
+
glob = File.join(location, PROJECT_FILE)
|
65
|
+
file = Dir.glob(glob, File::FNM_CASEFOLD).first
|
66
|
+
if file
|
67
|
+
YAML::load(File.open(file))
|
68
|
+
else
|
69
|
+
raise LoadError, "project file not found"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Parse version file for current release information.
|
74
|
+
|
75
|
+
def self.read_version(location)
|
76
|
+
glob = File.join(location, VERSION_FILE)
|
77
|
+
file = Dir.glob(glob, File::FNM_CASEFOLD).first
|
78
|
+
if file
|
79
|
+
str = File.read(file)
|
80
|
+
version, status, date, *null = *str.strip.split(/\s+/)
|
81
|
+
date = Date.parse(date).strftime("%Y-%m-%d")
|
82
|
+
data = {'version' => version, 'status' => status, 'date' => date}
|
83
|
+
else
|
84
|
+
data = {}
|
85
|
+
end
|
86
|
+
return data
|
87
|
+
end
|
88
|
+
|
89
|
+
# New Project.
|
90
|
+
|
91
|
+
def initialize(location, data={})
|
92
|
+
@location = location
|
93
|
+
super(data)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Location is needed to calculate some conventional defaults.
|
97
|
+
|
98
|
+
attr_accessor :location
|
99
|
+
|
100
|
+
|
101
|
+
# General
|
102
|
+
#------------------------------------------------------------------------
|
103
|
+
|
104
|
+
# The title of the project (free-form, defaults to name).
|
105
|
+
attr_accessor :title do
|
106
|
+
@title || (
|
107
|
+
name if respond_to?(:name)
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Subtitle is limited to 60 characters.
|
112
|
+
attr_accessor :subtitle do
|
113
|
+
@subtitle.to_s[0..59]
|
114
|
+
end
|
115
|
+
|
116
|
+
# Brief one-line description of the package (Max 80 chars.)
|
117
|
+
attr_accessor :summary, :brief do
|
118
|
+
if @summary
|
119
|
+
@summary.to_s[0..79]
|
120
|
+
else
|
121
|
+
i = @description.index('.') || 79
|
122
|
+
i = 79 if i > 79
|
123
|
+
@description[0..i]
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# More detailed description of the package.
|
128
|
+
attr_accessor :description, :synopsis
|
129
|
+
|
130
|
+
# "Unix" name of this project.
|
131
|
+
attr_accessor :project, :name
|
132
|
+
|
133
|
+
# Overrides Project#name.
|
134
|
+
# TODO: Fit release name into name or package_name (?)
|
135
|
+
#def name
|
136
|
+
# @name ||= release.name
|
137
|
+
#end
|
138
|
+
|
139
|
+
# If this is a sub-project, then +master+ is the
|
140
|
+
# "Unix" name of the master project to which this
|
141
|
+
# sub-project belongs.
|
142
|
+
attr_accessor :master
|
143
|
+
|
144
|
+
# The date the project was started.
|
145
|
+
attr_accessor :created
|
146
|
+
|
147
|
+
# Copyright notice.
|
148
|
+
attr_accessor :copyright do
|
149
|
+
@copyright || "Copyright (c) #{Time.now.strftime('%Y')} #{author}"
|
150
|
+
end
|
151
|
+
|
152
|
+
# Distribution License.
|
153
|
+
attr_accessor :license do
|
154
|
+
@license || 'GPLv3'
|
155
|
+
end
|
156
|
+
|
157
|
+
# Slogan or "trademark" phrase.
|
158
|
+
attr_accessor :slogan
|
159
|
+
|
160
|
+
# General one-word software category.
|
161
|
+
attr_accessor :category
|
162
|
+
|
163
|
+
# Author(s) of this project.
|
164
|
+
# (Usually in "name <email>" format.)
|
165
|
+
attr_accessor :author
|
166
|
+
|
167
|
+
# Contact(s) (defaults to authors).
|
168
|
+
# TODO Move to Variants?
|
169
|
+
attr_accessor :contact do
|
170
|
+
@contact || author
|
171
|
+
end
|
172
|
+
|
173
|
+
# Gerneral email address.
|
174
|
+
attr_accessor :email do
|
175
|
+
if md = /<(.*?)>/.match(contact)
|
176
|
+
md[1]
|
177
|
+
else
|
178
|
+
"ruby-talk@ruby-lang.org"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Official domain associated with this package.
|
183
|
+
attr_accessor :domain
|
184
|
+
|
185
|
+
# Project's homepage.
|
186
|
+
attr_accessor :homepage, :website
|
187
|
+
|
188
|
+
# Project's development site.
|
189
|
+
attr_accessor :development, :devsite
|
190
|
+
|
191
|
+
# Internet address(es) to online documentation.
|
192
|
+
attr_accessor :documentation, :docs
|
193
|
+
|
194
|
+
# Internet address(es) to downloadable packages.
|
195
|
+
attr_accessor :download
|
196
|
+
|
197
|
+
# Internet address for project wiki.
|
198
|
+
attr_accessor :wiki
|
199
|
+
|
200
|
+
# Project's mailing list.
|
201
|
+
attr_accessor :userlist, :mailinglist, :list
|
202
|
+
|
203
|
+
# Developer's mailing list.
|
204
|
+
attr_accessor :devlist do
|
205
|
+
@devlist || @userlist
|
206
|
+
end
|
207
|
+
|
208
|
+
# Returns a standard taguri id for the library and release.
|
209
|
+
def project_taguri
|
210
|
+
"tag:#{name}.#{domain},#{created}" # or released?
|
211
|
+
end
|
212
|
+
|
213
|
+
|
214
|
+
# Version
|
215
|
+
#------------------------------------------------------------------------
|
216
|
+
|
217
|
+
# Version number (eg. '1.0.0').
|
218
|
+
attr_accessor :version
|
219
|
+
|
220
|
+
# Current version code name.
|
221
|
+
attr_accessor :codename
|
222
|
+
|
223
|
+
# Build number can br set to an arbitrar number, or if set to true,
|
224
|
+
# it will defaults to a number based on current date-time.
|
225
|
+
attr_accessor :buildno do
|
226
|
+
@buildno = Time.now.strftime("%y%m%d%H%M") if TrueClass === @buildno
|
227
|
+
@buildno
|
228
|
+
end
|
229
|
+
|
230
|
+
# Status of this release: alpha, beta, RC1, etc.
|
231
|
+
attr_accessor :status do
|
232
|
+
@stats || 'alpha'
|
233
|
+
end
|
234
|
+
|
235
|
+
# Date of release.
|
236
|
+
attr_accessor :date, :released do
|
237
|
+
@date
|
238
|
+
end
|
239
|
+
|
240
|
+
|
241
|
+
# Content Classification
|
242
|
+
#------------------------------------------------------------------------
|
243
|
+
|
244
|
+
# Files in this package that are executables.
|
245
|
+
# These files must in the packages bin/ directory.
|
246
|
+
# If left blank all bin/ files are included.
|
247
|
+
|
248
|
+
attr_accessor :executable, :executables do
|
249
|
+
return [@executable].flatten.compact if @executable
|
250
|
+
exes = []
|
251
|
+
dir = File.join(location, 'bin')
|
252
|
+
if File.directory?(dir)
|
253
|
+
Dir.chdir(dir) do
|
254
|
+
exes = Dir.glob('*')
|
255
|
+
end
|
256
|
+
end
|
257
|
+
@executable = exes
|
258
|
+
end
|
259
|
+
|
260
|
+
# Library files in this package that are *public*.
|
261
|
+
# This is akin to load_path but specifies specific files
|
262
|
+
# that can be loaded from the outside --where as those
|
263
|
+
# not listed are considerd *private*.
|
264
|
+
#
|
265
|
+
# NOTE: This is not enforced --and may never be. It
|
266
|
+
# complicates library loading. Ie. how to distinguish public
|
267
|
+
# loading from external loading. But it something that can be
|
268
|
+
# consider more carfully in the future. For now it can serve
|
269
|
+
# as an optional reference.
|
270
|
+
attr_accessor :library, :libraries do
|
271
|
+
[@library || 'lib/**/*'].flatten
|
272
|
+
end
|
273
|
+
|
274
|
+
# Location(s) of executables.
|
275
|
+
attr_accessor :bin_path, :bin_paths, :binpath, :binpaths
|
276
|
+
|
277
|
+
# Location(s) of libraries (used by Rolls).
|
278
|
+
# In most cases this is something like:
|
279
|
+
#
|
280
|
+
# 'lib/myapp'
|
281
|
+
#
|
282
|
+
# It would be nice if this could just be lib/ as it would mean one less
|
283
|
+
# layer in a project heirarchy. But RubyGems and traditional installers
|
284
|
+
# could not handle this, so this isn't a reasonable course at this point.
|
285
|
+
attr_accessor :lib_path, :lib_paths, :libpath, :libpaths do
|
286
|
+
[@lib_path || "lib/#{name}"].flatten
|
287
|
+
end
|
288
|
+
|
289
|
+
# The traditional load path(s) (used by Ruby's own site loading and RubyGems).
|
290
|
+
# The default is lib/, which is usually correct.
|
291
|
+
attr_accessor :load_path, :load_paths, :loadpath, :loadpaths, :gem_path, :gem_paths, :gempath, :gempaths do
|
292
|
+
[@load_path || "lib"].flatten
|
293
|
+
end
|
294
|
+
|
295
|
+
# This only applys to Rolls. It is the default file to load.
|
296
|
+
# TODO: Think of a more descirptive name than 'default'.
|
297
|
+
attr_accessor :default
|
298
|
+
|
299
|
+
|
300
|
+
# Security
|
301
|
+
#------------------------------------------------------------------------
|
302
|
+
|
303
|
+
# Encryption digest type used.
|
304
|
+
# (md5, sha1, sha128, sha256, sha512).
|
305
|
+
attr_accessor :digest do
|
306
|
+
@digest || 'md5'
|
307
|
+
end
|
308
|
+
|
309
|
+
# Public key file associated with this library. This is useful
|
310
|
+
# for security purposes especially remote loading. [pubkey.pem]
|
311
|
+
attr_accessor :public_key do
|
312
|
+
@public_key || 'pubkey.pem'
|
313
|
+
end
|
314
|
+
|
315
|
+
# Private key file associated with this library. This is useful
|
316
|
+
# for security purposes especially remote loading. [_privkey.pem]
|
317
|
+
attr_accessor :private_key
|
318
|
+
# @private_key || '_privkey.pem'
|
319
|
+
# end
|
320
|
+
|
321
|
+
|
322
|
+
# Source Management
|
323
|
+
#------------------------------------------------------------------------
|
324
|
+
|
325
|
+
# Specify which verison control system is being used.
|
326
|
+
# Sometimes this is autmatically detectable, but it
|
327
|
+
# is better to specify it.
|
328
|
+
|
329
|
+
# Specifices the type of revision control system used.
|
330
|
+
# darcs, svn, cvs, etc.
|
331
|
+
# Will try to determine which version control system is being used.
|
332
|
+
attr_accessor :scm do
|
333
|
+
return @scm unless @scm.nil?
|
334
|
+
@scm = if File.directory?('.svn')
|
335
|
+
'svn'
|
336
|
+
elsif File.directory?('_darcs')
|
337
|
+
'darcs'
|
338
|
+
else
|
339
|
+
false
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
# Files that are tracked under revision control.
|
344
|
+
# Default is all less standard exceptions.
|
345
|
+
# '+' and '-' prefixes can be used to augment the list
|
346
|
+
# rather than fully override it.
|
347
|
+
attr_accessor :track, :scm_files
|
348
|
+
|
349
|
+
# Internet address to source code repository.
|
350
|
+
# (http://, ftp://, etc.)
|
351
|
+
attr_accessor :repository, :repo
|
352
|
+
|
353
|
+
# Changelog file.
|
354
|
+
attr_accessor :changelog
|
355
|
+
|
356
|
+
# Manifest file. Defaults to 'MANIFEST'.
|
357
|
+
# (I like to put it in meta/MANIFEST, personally.)
|
358
|
+
attr_accessor :manifest do
|
359
|
+
@manifest ||= 'MANIFEST'
|
360
|
+
end
|
361
|
+
|
362
|
+
|
363
|
+
# Dependencies
|
364
|
+
#------------------------------------------------------------------------
|
365
|
+
# Package inter-relationship data. Generally refered to as package
|
366
|
+
# "dependencies", but also includes +recommendations+, +suggestions+,
|
367
|
+
# +replacements+, +provisions+, and +build-dependencies+, as well
|
368
|
+
# as a few other fields that set a package apart.
|
369
|
+
#------------------------------------------------------------------------
|
370
|
+
|
371
|
+
# What other packages *must* this package have in order to function.
|
372
|
+
attr_accessor :dependency, :dependencies do
|
373
|
+
@dependency || []
|
374
|
+
end
|
375
|
+
|
376
|
+
# What other packages *should* be used with this package.
|
377
|
+
attr_accessor :recommend, :recommends, :recommendations do
|
378
|
+
@recommend || []
|
379
|
+
end
|
380
|
+
|
381
|
+
# What other packages *could* be useful with this package.
|
382
|
+
attr_accessor :suggest, :suggests, :suggestions do
|
383
|
+
@suggest || []
|
384
|
+
end
|
385
|
+
|
386
|
+
# What other packages does this package conflict.
|
387
|
+
attr_accessor :conflict, :conflicts do
|
388
|
+
@conflict || []
|
389
|
+
end
|
390
|
+
|
391
|
+
# What other packages does this package replace.
|
392
|
+
attr_accessor :replace, :replaces, :replacements do
|
393
|
+
@replace || []
|
394
|
+
end
|
395
|
+
|
396
|
+
# What other package(s) does this package provide the same dependency fulfilment.
|
397
|
+
# For example, a package 'bar-plus' might fulfill the same dependency criteria
|
398
|
+
# as package 'bar', so 'bar-plus' is said to provide 'bar'.
|
399
|
+
attr_accessor :provide, :provides, :provisions do
|
400
|
+
@provide || []
|
401
|
+
end
|
402
|
+
|
403
|
+
# Abirtary information about what might be needed to use this package.
|
404
|
+
# This is strictly information for the end-user to consider.
|
405
|
+
# Eg. "Fast graphics card"
|
406
|
+
attr_accessor :requirement, :requirements do
|
407
|
+
@requirement || []
|
408
|
+
end
|
409
|
+
|
410
|
+
# What packages does this package need to build? (eg. 'rake', 'reap', etc.)
|
411
|
+
attr_accessor :build_dependency, :build_dependencies do
|
412
|
+
@build_dependency || []
|
413
|
+
end
|
414
|
+
|
415
|
+
# Abirtary information about what might be needed to build this package.
|
416
|
+
attr_accessor :build_requirement, :build_requirements do
|
417
|
+
@build_requirement || []
|
418
|
+
end
|
419
|
+
|
420
|
+
|
421
|
+
# Packaging
|
422
|
+
#------------------------------------------------------------------------
|
423
|
+
|
424
|
+
# Package name. This defaults to project name, but it may vary under
|
425
|
+
# different package formats --deb vs. gem, for instance.
|
426
|
+
attr_accessor :package do
|
427
|
+
@package || name
|
428
|
+
#@package || (
|
429
|
+
# name if respond_to?(:name)
|
430
|
+
#)
|
431
|
+
end
|
432
|
+
|
433
|
+
# Platform. The default is nil, which is considered cross-platform.
|
434
|
+
# This tends to only change for special builds.
|
435
|
+
#
|
436
|
+
# TODO: if current?
|
437
|
+
|
438
|
+
attr_accessor :platform
|
439
|
+
|
440
|
+
# Architecture(s) this package can be run on: any, i386, i686, ppc, etc.
|
441
|
+
# This is strictly informational and is inteded to indicate the possiblities,
|
442
|
+
# not the particular platform this package runs on.
|
443
|
+
|
444
|
+
#attr_accessor :arch, :architecture do
|
445
|
+
# @arch || "any"
|
446
|
+
#end
|
447
|
+
|
448
|
+
# Script to run prior to build. No entry indicates no compilation.
|
449
|
+
attr_accessor :compile
|
450
|
+
|
451
|
+
# Packages that are intended to compile on install may need this. It is a list
|
452
|
+
# of "extension scripts" which generate Makefiles for use in compilation.
|
453
|
+
attr_accessor :extensions do
|
454
|
+
[@extensions || Dir.glob(File.join(location, 'ext/**/extconf.rb'))].flatten.compact
|
455
|
+
end
|
456
|
+
|
457
|
+
#
|
458
|
+
#validate "compile script not found" do
|
459
|
+
# compile ? File.file?(compile) : true
|
460
|
+
#end
|
461
|
+
|
462
|
+
# Generate documentation on installation?
|
463
|
+
attr_accessor :document, :has_rdoc
|
464
|
+
|
465
|
+
#
|
466
|
+
#attr_accessor :package_directory, :package_store do
|
467
|
+
# @package_directory || 'pkg'
|
468
|
+
#end
|
469
|
+
|
470
|
+
# Package name is generally in the form of +name-version+, or
|
471
|
+
# +name-version-platform+ if +platform+ is specified.
|
472
|
+
#
|
473
|
+
# TODO: Improve buildno support.
|
474
|
+
|
475
|
+
def package_name
|
476
|
+
if buildno
|
477
|
+
buildno = Time.now.strftime("%H*60+%M")
|
478
|
+
versnum = "#{version}.#{buildno}"
|
479
|
+
else
|
480
|
+
versnum = version
|
481
|
+
end
|
482
|
+
|
483
|
+
if platform
|
484
|
+
"#{package}-#{versnum}-#{platform}"
|
485
|
+
else
|
486
|
+
"#{package}-#{versnum}"
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
alias_method :stage_name, :package_name
|
491
|
+
|
492
|
+
|
493
|
+
# Distribution
|
494
|
+
#------------------------------------------------------------------------
|
495
|
+
|
496
|
+
# Files to be distributed in a package. Defaults to all files.
|
497
|
+
# If an entry is a directory then all it's contents are also included.
|
498
|
+
# This along with @exclude@ and @ignore@ is used to generate a manifest.
|
499
|
+
attr_accessor :distribute, :include do
|
500
|
+
[@distribute || '**/*'].flatten.compact
|
501
|
+
end
|
502
|
+
|
503
|
+
# File to exclude from package. This is usually more useful than
|
504
|
+
# @distribute@, as it allows you to remove from all files, rather then
|
505
|
+
# explicitly designate everything to be included. Exlcusions have priority
|
506
|
+
# over dsitribute's inclusions. If an entry is a directory then all
|
507
|
+
# it's contents are also excluded.
|
508
|
+
attr_accessor :exclude do
|
509
|
+
[@exclude].flatten.compact
|
510
|
+
end
|
511
|
+
|
512
|
+
# Files to generally ignore, mainly used for manifest collection. Ignore
|
513
|
+
# has priority over @exclude@ and @distribute@.
|
514
|
+
attr_accessor :ignore do
|
515
|
+
@ignore || %w{ **/.svn _darcs .config .installed }
|
516
|
+
end
|
517
|
+
|
518
|
+
# Manifest file.
|
519
|
+
#def manifest
|
520
|
+
# @manifest #||= Manifest.open
|
521
|
+
#end
|
522
|
+
|
523
|
+
# Set manifest file, which will load it.
|
524
|
+
#def manifest=(file)
|
525
|
+
# @manifest = file
|
526
|
+
# @filelist = File.read_list(file) #Manifest.open(file)
|
527
|
+
# return file
|
528
|
+
#end
|
529
|
+
|
530
|
+
# List of file included in a package. This is generated using
|
531
|
+
# @distribute@, @exlude@ and @ignore@.
|
532
|
+
def filelist
|
533
|
+
@filelist ||= collect_files(true)
|
534
|
+
end
|
535
|
+
|
536
|
+
# Validate that the files in the manifest actually exist.
|
537
|
+
#def validate_manifest
|
538
|
+
# missing = []
|
539
|
+
# filelist.each do |f|
|
540
|
+
# missing << f unless File.exist?(f)
|
541
|
+
# end
|
542
|
+
# unless missing.empty?
|
543
|
+
# raise ValidationError, "manifest lists non-existent files -- " + missing.join(" ")
|
544
|
+
# end
|
545
|
+
#end
|
546
|
+
|
547
|
+
private
|
548
|
+
|
549
|
+
# Collect distribution files.
|
550
|
+
|
551
|
+
def collect_files(with_dirs=false)
|
552
|
+
files = []
|
553
|
+
|
554
|
+
Dir.chdir(location) do
|
555
|
+
files += Dir.multiglob_r(*distribute)
|
556
|
+
files -= Dir.multiglob_r(*exclude)
|
557
|
+
files -= Dir.multiglob_r(*ignore)
|
558
|
+
files -= Dir.multiglob_r('pkg') #package_directory
|
559
|
+
end
|
560
|
+
|
561
|
+
files = files.to_a
|
562
|
+
|
563
|
+
unless with_dirs
|
564
|
+
files = files.select{ |f| !File.directory?(f) }
|
565
|
+
end
|
566
|
+
|
567
|
+
return files
|
568
|
+
end
|
569
|
+
|
570
|
+
|
571
|
+
# Validation
|
572
|
+
#------------------------------------------------------------------------
|
573
|
+
|
574
|
+
public
|
575
|
+
|
576
|
+
#
|
577
|
+
validate "version is required" do
|
578
|
+
version
|
579
|
+
end
|
580
|
+
|
581
|
+
#
|
582
|
+
validate "location is required" do
|
583
|
+
location
|
584
|
+
end
|
585
|
+
|
586
|
+
#
|
587
|
+
validate "executables do not exist" do
|
588
|
+
exes = []
|
589
|
+
dir = File.join(location, 'bin')
|
590
|
+
if File.directory?(dir)
|
591
|
+
Dir.chdir(dir) do
|
592
|
+
exes = Dir.glob('*')
|
593
|
+
end
|
594
|
+
end
|
595
|
+
(executables - exes).empty?
|
596
|
+
end
|
597
|
+
|
598
|
+
end
|
599
|
+
|
600
|
+
end
|
601
|
+
|
602
|
+
end
|
603
|
+
|