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.



92
93
94
95
96
97
98
# File 'lib/reap/metadata.rb', line 92

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

  @autodoc = true

  super(data)
end

Instance Attribute Details

#authorObject

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



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

def author
  @author
end

#autodocObject

Generate documentation on installation?



488
489
490
# File 'lib/reap/metadata.rb', line 488

def autodoc
  @autodoc
end

#bin_pathObject

Location(s) of executables.



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

def bin_path
  @bin_path
end

#bin_pathsObject

Location(s) of executables.



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

def bin_paths
  @bin_paths
end

#binpathObject

Location(s) of executables.



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

def binpath
  @binpath
end

#binpathsObject

Location(s) of executables.



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

def binpaths
  @binpaths
end

#briefObject

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



121
122
123
# File 'lib/reap/metadata.rb', line 121

def brief
  @brief
end

#build_dependenciesObject

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



421
422
423
# File 'lib/reap/metadata.rb', line 421

def build_dependencies
  @build_dependencies
end

#build_dependencyObject

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



421
422
423
# File 'lib/reap/metadata.rb', line 421

def build_dependency
  @build_dependency
end

#build_requirementObject

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



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

def build_requirement
  @build_requirement
end

#build_requirementsObject

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



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

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.



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

def buildno
  @buildno
end

#categoryObject

General one-word software category.



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

def category
  @category
end

#changelogObject

Changelog file.



364
365
366
# File 'lib/reap/metadata.rb', line 364

def changelog
  @changelog
end

#codenameObject

Current version code name.



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

def codename
  @codename
end

#compileObject

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



468
469
470
# File 'lib/reap/metadata.rb', line 468

def compile
  @compile
end

#conflictObject

What other packages does this package conflict.



397
398
399
# File 'lib/reap/metadata.rb', line 397

def conflict
  @conflict
end

#conflictsObject

What other packages does this package conflict.



397
398
399
# File 'lib/reap/metadata.rb', line 397

def conflicts
  @conflicts
end

#contactObject

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



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

def contact
  @contact
end

Copyright notice.



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

def copyright
  @copyright
end

#createdObject

The date the project was started.



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

def created
  @created
end

#dateObject

Date of release.



246
247
248
# File 'lib/reap/metadata.rb', line 246

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’.



307
308
309
# File 'lib/reap/metadata.rb', line 307

def default
  @default
end

#dependenciesObject

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



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

def dependencies
  @dependencies
end

#dependencyObject

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



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

def dependency
  @dependency
end

#descriptionObject

More detailed description of the package.



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

def description
  @description
end

#developmentObject

Project’s development site.



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

def development
  @development
end

#devlistObject

Developer’s mailing list.



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

def devlist
  @devlist
end

#devsiteObject

Project’s development site.



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

def devsite
  @devsite
end

#digestObject

Encryption digest type used.

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


315
316
317
# File 'lib/reap/metadata.rb', line 315

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.



526
527
528
# File 'lib/reap/metadata.rb', line 526

def distribute
  @distribute
end

#docsObject

Internet address(es) to online documentation.



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

def docs
  @docs
end

#documentObject

Files to be documented.



491
492
493
# File 'lib/reap/metadata.rb', line 491

def document
  @document
end

#documentationObject

Internet address(es) to online documentation.



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

def documentation
  @documentation
end

#domainObject

Official domain associated with this package.



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

def domain
  @domain
end

#downloadObject

Internet address(es) to downloadable packages.



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

def download
  @download
end

#emailObject

Gerneral email address.



178
179
180
# File 'lib/reap/metadata.rb', line 178

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.



535
536
537
# File 'lib/reap/metadata.rb', line 535

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.



258
259
260
# File 'lib/reap/metadata.rb', line 258

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.



258
259
260
# File 'lib/reap/metadata.rb', line 258

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.



472
473
474
# File 'lib/reap/metadata.rb', line 472

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

def gempaths
  @gempaths
end

#has_rdocObject

Generate documentation on installation?



488
489
490
# File 'lib/reap/metadata.rb', line 488

def has_rdoc
  @has_rdoc
end

#homepageObject

Project’s homepage.



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

def homepage
  @homepage
end

#hostsObject

URI of host providers.



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

def hosts
  @hosts
end

#ignoreObject

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



541
542
543
# File 'lib/reap/metadata.rb', line 541

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.



526
527
528
# File 'lib/reap/metadata.rb', line 526

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.



295
296
297
# File 'lib/reap/metadata.rb', line 295

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.



295
296
297
# File 'lib/reap/metadata.rb', line 295

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.



295
296
297
# File 'lib/reap/metadata.rb', line 295

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.



295
296
297
# File 'lib/reap/metadata.rb', line 295

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.



280
281
282
# File 'lib/reap/metadata.rb', line 280

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.



280
281
282
# File 'lib/reap/metadata.rb', line 280

def library
  @library
end

#licenseObject

Distribution License.



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

def license
  @license
end

#listObject

Project’s mailing list.



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

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

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.



301
302
303
# File 'lib/reap/metadata.rb', line 301

def loadpaths
  @loadpaths
end

#locationObject

Location is needed to calculate some conventional defaults.



102
103
104
# File 'lib/reap/metadata.rb', line 102

def location
  @location
end

#mailinglistObject

Project’s mailing list.



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

def mailinglist
  @mailinglist
end

#manifestObject

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



368
369
370
# File 'lib/reap/metadata.rb', line 368

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.



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

def master
  @master
end

#nameObject

“Unix” name of this project.



135
136
137
# File 'lib/reap/metadata.rb', line 135

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.



436
437
438
# File 'lib/reap/metadata.rb', line 436

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?



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

def platform
  @platform
end

#private_keyObject

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



327
328
329
# File 'lib/reap/metadata.rb', line 327

def private_key
  @private_key
end

#projectObject

“Unix” name of this project.



135
136
137
# File 'lib/reap/metadata.rb', line 135

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’.



409
410
411
# File 'lib/reap/metadata.rb', line 409

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’.



409
410
411
# File 'lib/reap/metadata.rb', line 409

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’.



409
410
411
# File 'lib/reap/metadata.rb', line 409

def provisions
  @provisions
end

#public_keyObject

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



321
322
323
# File 'lib/reap/metadata.rb', line 321

def public_key
  @public_key
end

#recommendObject

What other packages should be used with this package.



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

def recommend
  @recommend
end

#recommendationsObject

What other packages should be used with this package.



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

def recommendations
  @recommendations
end

#recommendsObject

What other packages should be used with this package.



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

def recommends
  @recommends
end

#releasedObject

Date of release.



246
247
248
# File 'lib/reap/metadata.rb', line 246

def released
  @released
end

#replaceObject

What other packages does this package replace.



402
403
404
# File 'lib/reap/metadata.rb', line 402

def replace
  @replace
end

#replacementsObject

What other packages does this package replace.



402
403
404
# File 'lib/reap/metadata.rb', line 402

def replacements
  @replacements
end

#replacesObject

What other packages does this package replace.



402
403
404
# File 'lib/reap/metadata.rb', line 402

def replaces
  @replaces
end

#repoObject

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



361
362
363
# File 'lib/reap/metadata.rb', line 361

def repo
  @repo
end

#repositoryObject

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



361
362
363
# File 'lib/reap/metadata.rb', line 361

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"


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

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"


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

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.



342
343
344
# File 'lib/reap/metadata.rb', line 342

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.



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

def scm_files
  @scm_files
end

#sloganObject

Slogan or “trademark” phrase.



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

def slogan
  @slogan
end

#statusObject

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



241
242
243
# File 'lib/reap/metadata.rb', line 241

def status
  @status
end

#subtitleObject

Subtitle is limited to 60 characters.



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

def subtitle
  @subtitle
end

#suggestObject

What other packages could be useful with this package.



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

def suggest
  @suggest
end

#suggestionsObject

What other packages could be useful with this package.



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

def suggestions
  @suggestions
end

#suggestsObject

What other packages could be useful with this package.



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

def suggests
  @suggests
end

#summaryObject

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



121
122
123
# File 'lib/reap/metadata.rb', line 121

def summary
  @summary
end

#synopsisObject

More detailed description of the package.



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

def synopsis
  @synopsis
end

#titleObject

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



109
110
111
# File 'lib/reap/metadata.rb', line 109

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.



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

def track
  @track
end

#unixnameObject

“Unix” name of this project.



135
136
137
# File 'lib/reap/metadata.rb', line 135

def unixname
  @unixname
end

#userlistObject

Project’s mailing list.



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

def userlist
  @userlist
end

#versionObject

Version number (eg. ‘1.0.0’).



228
229
230
# File 'lib/reap/metadata.rb', line 228

def version
  @version
end

#websiteObject

Project’s homepage.



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

def website
  @website
end

#wikiObject

Internet address for project wiki.



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

def wiki
  @wiki
end

Class Method Details

.read(location) ⇒ Object



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

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.



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

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.



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

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@.



559
560
561
# File 'lib/reap/metadata.rb', line 559

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

#get_bindingObject

Access to binding for use with ERB.



575
576
577
# File 'lib/reap/metadata.rb', line 575

def get_binding
  binding
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.



502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/reap/metadata.rb', line 502

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.



213
214
215
# File 'lib/reap/metadata.rb', line 213

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