Class: Reap::Project::Metadata

Inherits:
InfoObject show all
Defined in:
lib/reap/metadata.rb

Overview

Project Metadata

The Project Metadata class stores project information. This information includes the general information about a project, such as title, description, homepage, etc. which is essentially static. Once set, it will probably will never change. The class also contains default settings for packaging; information that is usually static, but may vary for a partciular package platform or format.

When utilizing this class it is important not confuse oneself thinking that a project is not a project just becuase it is a sub-project. A sub-project is a project, it just happens to belong to a master project.

Constant Summary collapse

PROJECT_FILE =
'{,meta/}{project}{info,}{.yaml,.yml,}'
VERSION_FILE =
'{,meta/}{version}{.text,.txt,}'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from InfoObject

#[], alias_accessor, alias_method, attr_accessor, #attributes, #gather, instance_attributes, #instance_data, #select, #taguri, #to_hash, #to_xml, #to_yaml, #to_yaml_properties, #update, #valid?, #validate, validate, validation

Constructor Details

#initialize(location, data = {}) ⇒ Metadata

New Project.



91
92
93
94
# File 'lib/reap/metadata.rb', line 91

def initialize(location, data={})
  @location = location
  super(data)
end

Instance Attribute Details

#authorObject

Author(s) of this project. (Usually in “name <email>” format.)



165
166
167
# File 'lib/reap/metadata.rb', line 165

def author
  @author
end

#bin_pathObject

Location(s) of executables.



275
276
277
# File 'lib/reap/metadata.rb', line 275

def bin_path
  @bin_path
end

#bin_pathsObject

Location(s) of executables.



275
276
277
# File 'lib/reap/metadata.rb', line 275

def bin_paths
  @bin_paths
end

#binpathObject

Location(s) of executables.



275
276
277
# File 'lib/reap/metadata.rb', line 275

def binpath
  @binpath
end

#binpathsObject

Location(s) of executables.



275
276
277
# File 'lib/reap/metadata.rb', line 275

def binpaths
  @binpaths
end

#briefObject

Brief one-line description of the package (Max 80 chars.)



117
118
119
# File 'lib/reap/metadata.rb', line 117

def brief
  @brief
end

#build_dependenciesObject

What packages does this package need to build? (eg. ‘rake’, ‘reap’, etc.)



411
412
413
# File 'lib/reap/metadata.rb', line 411

def build_dependencies
  @build_dependencies
end

#build_dependencyObject

What packages does this package need to build? (eg. ‘rake’, ‘reap’, etc.)



411
412
413
# File 'lib/reap/metadata.rb', line 411

def build_dependency
  @build_dependency
end

#build_requirementObject

Abirtary information about what might be needed to build this package.



416
417
418
# File 'lib/reap/metadata.rb', line 416

def build_requirement
  @build_requirement
end

#build_requirementsObject

Abirtary information about what might be needed to build this package.



416
417
418
# File 'lib/reap/metadata.rb', line 416

def build_requirements
  @build_requirements
end

#buildnoObject

Build number can br set to an arbitrar number, or if set to true, it will defaults to a number based on current date-time.



225
226
227
# File 'lib/reap/metadata.rb', line 225

def buildno
  @buildno
end

#categoryObject

General one-word software category.



161
162
163
# File 'lib/reap/metadata.rb', line 161

def category
  @category
end

#changelogObject

Changelog file.



354
355
356
# File 'lib/reap/metadata.rb', line 354

def changelog
  @changelog
end

#codenameObject

Current version code name.



221
222
223
# File 'lib/reap/metadata.rb', line 221

def codename
  @codename
end

#compileObject

Script to run prior to build. No entry indicates no compilation.



449
450
451
# File 'lib/reap/metadata.rb', line 449

def compile
  @compile
end

#conflictObject

What other packages does this package conflict.



387
388
389
# File 'lib/reap/metadata.rb', line 387

def conflict
  @conflict
end

#conflictsObject

What other packages does this package conflict.



387
388
389
# File 'lib/reap/metadata.rb', line 387

def conflicts
  @conflicts
end

#contactObject

Contact(s) (defaults to authors). TODO Move to Variants?



169
170
171
# File 'lib/reap/metadata.rb', line 169

def contact
  @contact
end

Copyright notice.



148
149
150
# File 'lib/reap/metadata.rb', line 148

def copyright
  @copyright
end

#createdObject

The date the project was started.



145
146
147
# File 'lib/reap/metadata.rb', line 145

def created
  @created
end

#dateObject

Date of release.



236
237
238
# File 'lib/reap/metadata.rb', line 236

def date
  @date
end

#defaultObject

This only applys to Rolls. It is the default file to load. TODO: Think of a more descirptive name than ‘default’.



297
298
299
# File 'lib/reap/metadata.rb', line 297

def default
  @default
end

#dependenciesObject

What other packages must this package have in order to function.



372
373
374
# File 'lib/reap/metadata.rb', line 372

def dependencies
  @dependencies
end

#dependencyObject

What other packages must this package have in order to function.



372
373
374
# File 'lib/reap/metadata.rb', line 372

def dependency
  @dependency
end

#descriptionObject

More detailed description of the package.



128
129
130
# File 'lib/reap/metadata.rb', line 128

def description
  @description
end

#developmentObject

Project’s development site.



189
190
191
# File 'lib/reap/metadata.rb', line 189

def development
  @development
end

#devlistObject

Developer’s mailing list.



204
205
206
# File 'lib/reap/metadata.rb', line 204

def devlist
  @devlist
end

#devsiteObject

Project’s development site.



189
190
191
# File 'lib/reap/metadata.rb', line 189

def devsite
  @devsite
end

#digestObject

Encryption digest type used.

(md5, sha1, sha128, sha256, sha512).


305
306
307
# File 'lib/reap/metadata.rb', line 305

def digest
  @digest
end

#distributeObject

Files to be distributed in a package. Defaults to all files. If an entry is a directory then all it’s contents are also included. This along with @exclude@ and @ignore@ is used to generate a manifest.



499
500
501
# File 'lib/reap/metadata.rb', line 499

def distribute
  @distribute
end

#docsObject

Internet address(es) to online documentation.



192
193
194
# File 'lib/reap/metadata.rb', line 192

def docs
  @docs
end

#documentObject

Generate documentation on installation?



463
464
465
# File 'lib/reap/metadata.rb', line 463

def document
  @document
end

#documentationObject

Internet address(es) to online documentation.



192
193
194
# File 'lib/reap/metadata.rb', line 192

def documentation
  @documentation
end

#domainObject

Official domain associated with this package.



183
184
185
# File 'lib/reap/metadata.rb', line 183

def domain
  @domain
end

#downloadObject

Internet address(es) to downloadable packages.



195
196
197
# File 'lib/reap/metadata.rb', line 195

def download
  @download
end

#emailObject

Gerneral email address.



174
175
176
# File 'lib/reap/metadata.rb', line 174

def email
  @email
end

#excludeObject

File to exclude from package. This is usually more useful than @distribute@, as it allows you to remove from all files, rather then explicitly designate everything to be included. Exlcusions have priority over dsitribute’s inclusions. If an entry is a directory then all it’s contents are also excluded.



508
509
510
# File 'lib/reap/metadata.rb', line 508

def exclude
  @exclude
end

#executableObject

Files in this package that are executables. These files must in the packages bin/ directory. If left blank all bin/ files are included.



248
249
250
# File 'lib/reap/metadata.rb', line 248

def executable
  @executable
end

#executablesObject

Files in this package that are executables. These files must in the packages bin/ directory. If left blank all bin/ files are included.



248
249
250
# File 'lib/reap/metadata.rb', line 248

def executables
  @executables
end

#extensionsObject

Packages that are intended to compile on install may need this. It is a list of “extension scripts” which generate Makefiles for use in compilation.



453
454
455
# File 'lib/reap/metadata.rb', line 453

def extensions
  @extensions
end

#gem_pathObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def gem_path
  @gem_path
end

#gem_pathsObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def gem_paths
  @gem_paths
end

#gempathObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def gempath
  @gempath
end

#gempathsObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def gempaths
  @gempaths
end

#has_rdocObject

Generate documentation on installation?



463
464
465
# File 'lib/reap/metadata.rb', line 463

def has_rdoc
  @has_rdoc
end

#homepageObject

Project’s homepage.



186
187
188
# File 'lib/reap/metadata.rb', line 186

def homepage
  @homepage
end

#ignoreObject

Files to generally ignore, mainly used for manifest collection. Ignore has priority over @exclude@ and @distribute@.



514
515
516
# File 'lib/reap/metadata.rb', line 514

def ignore
  @ignore
end

#includeObject

Files to be distributed in a package. Defaults to all files. If an entry is a directory then all it’s contents are also included. This along with @exclude@ and @ignore@ is used to generate a manifest.



499
500
501
# File 'lib/reap/metadata.rb', line 499

def include
  @include
end

#lib_pathObject

Location(s) of libraries (used by Rolls). In most cases this is something like:

'lib/myapp'

It would be nice if this could just be lib/ as it would mean one less layer in a project heirarchy. But RubyGems and traditional installers could not handle this, so this isn’t a reasonable course at this point.



285
286
287
# File 'lib/reap/metadata.rb', line 285

def lib_path
  @lib_path
end

#lib_pathsObject

Location(s) of libraries (used by Rolls). In most cases this is something like:

'lib/myapp'

It would be nice if this could just be lib/ as it would mean one less layer in a project heirarchy. But RubyGems and traditional installers could not handle this, so this isn’t a reasonable course at this point.



285
286
287
# File 'lib/reap/metadata.rb', line 285

def lib_paths
  @lib_paths
end

#libpathObject

Location(s) of libraries (used by Rolls). In most cases this is something like:

'lib/myapp'

It would be nice if this could just be lib/ as it would mean one less layer in a project heirarchy. But RubyGems and traditional installers could not handle this, so this isn’t a reasonable course at this point.



285
286
287
# File 'lib/reap/metadata.rb', line 285

def libpath
  @libpath
end

#libpathsObject

Location(s) of libraries (used by Rolls). In most cases this is something like:

'lib/myapp'

It would be nice if this could just be lib/ as it would mean one less layer in a project heirarchy. But RubyGems and traditional installers could not handle this, so this isn’t a reasonable course at this point.



285
286
287
# File 'lib/reap/metadata.rb', line 285

def libpaths
  @libpaths
end

#librariesObject

Library files in this package that are public. This is akin to load_path but specifies specific files that can be loaded from the outside –where as those not listed are considerd private.

NOTE: This is not enforced –and may never be. It complicates library loading. Ie. how to distinguish public loading from external loading. But it something that can be consider more carfully in the future. For now it can serve as an optional reference.



270
271
272
# File 'lib/reap/metadata.rb', line 270

def libraries
  @libraries
end

#libraryObject

Library files in this package that are public. This is akin to load_path but specifies specific files that can be loaded from the outside –where as those not listed are considerd private.

NOTE: This is not enforced –and may never be. It complicates library loading. Ie. how to distinguish public loading from external loading. But it something that can be consider more carfully in the future. For now it can serve as an optional reference.



270
271
272
# File 'lib/reap/metadata.rb', line 270

def library
  @library
end

#licenseObject

Distribution License.



153
154
155
# File 'lib/reap/metadata.rb', line 153

def license
  @license
end

#listObject

Project’s mailing list.



201
202
203
# File 'lib/reap/metadata.rb', line 201

def list
  @list
end

#load_pathObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def load_path
  @load_path
end

#load_pathsObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def load_paths
  @load_paths
end

#loadpathObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def loadpath
  @loadpath
end

#loadpathsObject

The traditional load path(s) (used by Ruby’s own site loading and RubyGems). The default is lib/, which is usually correct.



291
292
293
# File 'lib/reap/metadata.rb', line 291

def loadpaths
  @loadpaths
end

#locationObject

Location is needed to calculate some conventional defaults.



98
99
100
# File 'lib/reap/metadata.rb', line 98

def location
  @location
end

#mailinglistObject

Project’s mailing list.



201
202
203
# File 'lib/reap/metadata.rb', line 201

def mailinglist
  @mailinglist
end

#manifestObject

Manifest file. Defaults to ‘MANIFEST’. (I like to put it in meta/MANIFEST, personally.)



358
359
360
# File 'lib/reap/metadata.rb', line 358

def manifest
  @manifest
end

#masterObject

If this is a sub-project, then master is the “Unix” name of the master project to which this sub-project belongs.



142
143
144
# File 'lib/reap/metadata.rb', line 142

def master
  @master
end

#nameObject

“Unix” name of this project.



131
132
133
# File 'lib/reap/metadata.rb', line 131

def name
  @name
end

#packageObject

Package name. This defaults to project name, but it may vary under different package formats –deb vs. gem, for instance.



426
427
428
# File 'lib/reap/metadata.rb', line 426

def package
  @package
end

#platformObject

Platform. The default is nil, which is considered cross-platform. This tends to only change for special builds.

TODO: if current?



438
439
440
# File 'lib/reap/metadata.rb', line 438

def platform
  @platform
end

#private_keyObject

Private key file associated with this library. This is useful for security purposes especially remote loading. [_privkey.pem]



317
318
319
# File 'lib/reap/metadata.rb', line 317

def private_key
  @private_key
end

#projectObject

“Unix” name of this project.



131
132
133
# File 'lib/reap/metadata.rb', line 131

def project
  @project
end

#provideObject

What other package(s) does this package provide the same dependency fulfilment. For example, a package ‘bar-plus’ might fulfill the same dependency criteria as package ‘bar’, so ‘bar-plus’ is said to provide ‘bar’.



399
400
401
# File 'lib/reap/metadata.rb', line 399

def provide
  @provide
end

#providesObject

What other package(s) does this package provide the same dependency fulfilment. For example, a package ‘bar-plus’ might fulfill the same dependency criteria as package ‘bar’, so ‘bar-plus’ is said to provide ‘bar’.



399
400
401
# File 'lib/reap/metadata.rb', line 399

def provides
  @provides
end

#provisionsObject

What other package(s) does this package provide the same dependency fulfilment. For example, a package ‘bar-plus’ might fulfill the same dependency criteria as package ‘bar’, so ‘bar-plus’ is said to provide ‘bar’.



399
400
401
# File 'lib/reap/metadata.rb', line 399

def provisions
  @provisions
end

#public_keyObject

Public key file associated with this library. This is useful for security purposes especially remote loading. [pubkey.pem]



311
312
313
# File 'lib/reap/metadata.rb', line 311

def public_key
  @public_key
end

#recommendObject

What other packages should be used with this package.



377
378
379
# File 'lib/reap/metadata.rb', line 377

def recommend
  @recommend
end

#recommendationsObject

What other packages should be used with this package.



377
378
379
# File 'lib/reap/metadata.rb', line 377

def recommendations
  @recommendations
end

#recommendsObject

What other packages should be used with this package.



377
378
379
# File 'lib/reap/metadata.rb', line 377

def recommends
  @recommends
end

#releasedObject

Date of release.



236
237
238
# File 'lib/reap/metadata.rb', line 236

def released
  @released
end

#replaceObject

What other packages does this package replace.



392
393
394
# File 'lib/reap/metadata.rb', line 392

def replace
  @replace
end

#replacementsObject

What other packages does this package replace.



392
393
394
# File 'lib/reap/metadata.rb', line 392

def replacements
  @replacements
end

#replacesObject

What other packages does this package replace.



392
393
394
# File 'lib/reap/metadata.rb', line 392

def replaces
  @replaces
end

#repoObject

Internet address to source code repository. (http://, ftp://, etc.)



351
352
353
# File 'lib/reap/metadata.rb', line 351

def repo
  @repo
end

#repositoryObject

Internet address to source code repository. (http://, ftp://, etc.)



351
352
353
# File 'lib/reap/metadata.rb', line 351

def repository
  @repository
end

#requirementObject

Abirtary information about what might be needed to use this package. This is strictly information for the end-user to consider.

Eg. "Fast graphics card"


406
407
408
# File 'lib/reap/metadata.rb', line 406

def requirement
  @requirement
end

#requirementsObject

Abirtary information about what might be needed to use this package. This is strictly information for the end-user to consider.

Eg. "Fast graphics card"


406
407
408
# File 'lib/reap/metadata.rb', line 406

def requirements
  @requirements
end

#scmObject

Specifices the type of revision control system used.

darcs, svn, cvs, etc.

Will try to determine which version control system is being used.



332
333
334
# File 'lib/reap/metadata.rb', line 332

def scm
  @scm
end

#scm_filesObject

Files that are tracked under revision control. Default is all less standard exceptions. ‘+’ and ‘-’ prefixes can be used to augment the list rather than fully override it.



347
348
349
# File 'lib/reap/metadata.rb', line 347

def scm_files
  @scm_files
end

#sloganObject

Slogan or “trademark” phrase.



158
159
160
# File 'lib/reap/metadata.rb', line 158

def slogan
  @slogan
end

#statusObject

Status of this release: alpha, beta, RC1, etc.



231
232
233
# File 'lib/reap/metadata.rb', line 231

def status
  @status
end

#subtitleObject

Subtitle is limited to 60 characters.



112
113
114
# File 'lib/reap/metadata.rb', line 112

def subtitle
  @subtitle
end

#suggestObject

What other packages could be useful with this package.



382
383
384
# File 'lib/reap/metadata.rb', line 382

def suggest
  @suggest
end

#suggestionsObject

What other packages could be useful with this package.



382
383
384
# File 'lib/reap/metadata.rb', line 382

def suggestions
  @suggestions
end

#suggestsObject

What other packages could be useful with this package.



382
383
384
# File 'lib/reap/metadata.rb', line 382

def suggests
  @suggests
end

#summaryObject

Brief one-line description of the package (Max 80 chars.)



117
118
119
# File 'lib/reap/metadata.rb', line 117

def summary
  @summary
end

#synopsisObject

More detailed description of the package.



128
129
130
# File 'lib/reap/metadata.rb', line 128

def synopsis
  @synopsis
end

#titleObject

The title of the project (free-form, defaults to name).



105
106
107
# File 'lib/reap/metadata.rb', line 105

def title
  @title
end

#trackObject

Files that are tracked under revision control. Default is all less standard exceptions. ‘+’ and ‘-’ prefixes can be used to augment the list rather than fully override it.



347
348
349
# File 'lib/reap/metadata.rb', line 347

def track
  @track
end

#userlistObject

Project’s mailing list.



201
202
203
# File 'lib/reap/metadata.rb', line 201

def userlist
  @userlist
end

#versionObject

Version number (eg. ‘1.0.0’).



218
219
220
# File 'lib/reap/metadata.rb', line 218

def version
  @version
end

#websiteObject

Project’s homepage.



186
187
188
# File 'lib/reap/metadata.rb', line 186

def website
  @website
end

#wikiObject

Internet address for project wiki.



198
199
200
# File 'lib/reap/metadata.rb', line 198

def wiki
  @wiki
end

Class Method Details

.read(location) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/reap/metadata.rb', line 50

def self.read(location)
   = read_project(location)
  versdata = read_version(location)

  data = {}
  data.update()
  data.update(versdata)

  new(location, data)
end

.read_project(location) ⇒ Object

Parse release file for release information.



63
64
65
66
67
68
69
70
71
# File 'lib/reap/metadata.rb', line 63

def self.read_project(location)
  glob = File.join(location, PROJECT_FILE)
  file = Dir.glob(glob, File::FNM_CASEFOLD).first
  if file
    YAML::load(File.open(file))
  else
    raise LoadError, "project file not found"
  end
end

.read_version(location) ⇒ Object

Parse version file for current release information.



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/reap/metadata.rb', line 75

def self.read_version(location)
  glob = File.join(location, VERSION_FILE)
  file = Dir.glob(glob, File::FNM_CASEFOLD).first
  if file
    str = File.read(file)
    version, status, date, *null = *str.strip.split(/\s+/)
    date = Date.parse(date).strftime("%Y-%m-%d")
    data = {'version' => version, 'status' => status, 'date' => date}
  else
    data = {}
  end
  return data
end

Instance Method Details

#filelistObject

List of file included in a package. This is generated using @distribute@, @exlude@ and @ignore@.



532
533
534
# File 'lib/reap/metadata.rb', line 532

def filelist
  @filelist ||= collect_files(true)
end

#package_nameObject Also known as: stage_name

Package name is generally in the form of name-version, or name-version-platform if platform is specified.

TODO: Improve buildno support.



475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/reap/metadata.rb', line 475

def package_name
  if buildno
    buildno = Time.now.strftime("%H*60+%M")
    versnum = "#{version}.#{buildno}"
  else
    versnum = version
  end

  if platform 
    "#{package}-#{versnum}-#{platform}"
  else
    "#{package}-#{versnum}"
  end
end

#project_taguriObject

Returns a standard taguri id for the library and release.



209
210
211
# File 'lib/reap/metadata.rb', line 209

def project_taguri
  "tag:#{name}.#{domain},#{created}"  # or released?
end