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

#author ⇒ Object

Author(s) of this project. (Usually in "name " format.)



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

def author
  @author
end

#autodoc ⇒ Object

Generate documentation on installation?



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

def autodoc
  @autodoc
end

#bin_path ⇒ Object

Location(s) of executables.



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

def bin_path
  @bin_path
end

#bin_paths ⇒ Object

Location(s) of executables.



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

def bin_paths
  @bin_paths
end

#binpath ⇒ Object

Location(s) of executables.



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

def binpath
  @binpath
end

#binpaths ⇒ Object

Location(s) of executables.



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

def binpaths
  @binpaths
end

#brief ⇒ Object

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_dependencies ⇒ Object

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_dependency ⇒ Object

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_requirement ⇒ Object

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_requirements ⇒ Object

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

#buildno ⇒ Object

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

#category ⇒ Object

General one-word software category.



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

def category
  @category
end

#changelog ⇒ Object

Changelog file.



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

def changelog
  @changelog
end

#codename ⇒ Object

Current version code name.



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

def codename
  @codename
end

#compile ⇒ Object

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

#conflict ⇒ Object

What other packages does this package conflict.



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

def conflict
  @conflict
end

#conflicts ⇒ Object

What other packages does this package conflict.



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

def conflicts
  @conflicts
end

#contact ⇒ Object

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

#created ⇒ Object

The date the project was started.



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

def created
  @created
end

#date ⇒ Object

Date of release.



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

def date
  @date
end

#default ⇒ Object

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

#dependencies ⇒ Object

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

#dependency ⇒ Object

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

#description ⇒ Object

More detailed description of the package.



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

def description
  @description
end

#development ⇒ Object

Project's development site.



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

def development
  @development
end

#devlist ⇒ Object

Developer's mailing list.



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

def devlist
  @devlist
end

#devsite ⇒ Object

Project's development site.



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

def devsite
  @devsite
end

#digest ⇒ Object

Encryption digest type used. (md5, sha1, sha128, sha256, sha512).



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

def digest
  @digest
end

#distribute ⇒ Object

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

#docs ⇒ Object

Internet address(es) to online documentation.



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

def docs
  @docs
end

#document ⇒ Object

Files to be documented.



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

def document
  @document
end

#documentation ⇒ Object

Internet address(es) to online documentation.



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

def documentation
  @documentation
end

#domain ⇒ Object

Official domain associated with this package.



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

def domain
  @domain
end

#download ⇒ Object

Internet address(es) to downloadable packages.



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

def download
  @download
end

#email ⇒ Object

Gerneral email address.



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

def email
  @email
end

#exclude ⇒ Object

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

#executable ⇒ Object

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

#executables ⇒ Object

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

#extensions ⇒ Object

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_path ⇒ Object

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_paths ⇒ Object

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

#gempath ⇒ Object

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

#gempaths ⇒ Object

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_rdoc ⇒ Object

Generate documentation on installation?



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

def has_rdoc
  @has_rdoc
end

#homepage ⇒ Object

Project's homepage.



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

def homepage
  @homepage
end

#hosts ⇒ Object

URI of host providers.



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

def hosts
  @hosts
end

#ignore ⇒ Object

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

#include ⇒ Object

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_path ⇒ Object

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_paths ⇒ Object

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

#libpath ⇒ Object

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

#libpaths ⇒ Object

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

#libraries ⇒ Object

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

#library ⇒ Object

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

#license ⇒ Object

Distribution License.



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

def license
  @license
end

#list ⇒ Object

Project's mailing list.



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

def list
  @list
end

#load_path ⇒ Object

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_paths ⇒ Object

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

#loadpath ⇒ Object

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

#loadpaths ⇒ Object

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

#location ⇒ Object

Location is needed to calculate some conventional defaults.



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

def location
  @location
end

#mailinglist ⇒ Object

Project's mailing list.



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

def mailinglist
  @mailinglist
end

#manifest ⇒ Object

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

#master ⇒ Object

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

#name ⇒ Object

"Unix" name of this project.



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

def name
  @name
end

#package ⇒ Object

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

#platform ⇒ Object

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_key ⇒ Object

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

#project ⇒ Object

"Unix" name of this project.



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

def project
  @project
end

#provide ⇒ Object

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

#provides ⇒ Object

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

#provisions ⇒ Object

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_key ⇒ Object

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

#recommend ⇒ Object

What other packages should be used with this package.



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

def recommend
  @recommend
end

#recommendations ⇒ Object

What other packages should be used with this package.



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

def recommendations
  @recommendations
end

#recommends ⇒ Object

What other packages should be used with this package.



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

def recommends
  @recommends
end

#released ⇒ Object

Date of release.



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

def released
  @released
end

#replace ⇒ Object

What other packages does this package replace.



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

def replace
  @replace
end

#replacements ⇒ Object

What other packages does this package replace.



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

def replacements
  @replacements
end

#replaces ⇒ Object

What other packages does this package replace.



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

def replaces
  @replaces
end

#repo ⇒ Object

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



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

def repo
  @repo
end

#repository ⇒ Object

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



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

def repository
  @repository
end

#requirement ⇒ Object

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

#requirements ⇒ Object

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

#scm ⇒ Object

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_files ⇒ Object

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

#slogan ⇒ Object

Slogan or "trademark" phrase.



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

def slogan
  @slogan
end

#status ⇒ Object

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



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

def status
  @status
end

#subtitle ⇒ Object

Subtitle is limited to 60 characters.



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

def subtitle
  @subtitle
end

#suggest ⇒ Object

What other packages could be useful with this package.



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

def suggest
  @suggest
end

#suggestions ⇒ Object

What other packages could be useful with this package.



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

def suggestions
  @suggestions
end

#suggests ⇒ Object

What other packages could be useful with this package.



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

def suggests
  @suggests
end

#summary ⇒ Object

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



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

def summary
  @summary
end

#synopsis ⇒ Object

More detailed description of the package.



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

def synopsis
  @synopsis
end

#title ⇒ Object

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



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

def title
  @title
end

#track ⇒ Object

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

#unixname ⇒ Object

"Unix" name of this project.



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

def unixname
  @unixname
end

#userlist ⇒ Object

Project's mailing list.



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

def userlist
  @userlist
end

#version ⇒ Object

Version number (eg. '1.0.0').



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

def version
  @version
end

#website ⇒ Object

Project's homepage.



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

def website
  @website
end

#wiki ⇒ Object

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

#filelist ⇒ Object

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_binding ⇒ Object

Access to binding for use with ERB.



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

def get_binding
  binding
end

#package_name ⇒ Object 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_taguri ⇒ Object

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