Parent

Files

POM::Profile

Profile stores ancillary project metadata such as title, summary, list of authors, etc. Profile is the "mother load" of end-user information about a project. It is also arbitraily extensible so fields not strictly defined by this class can also be provided.

Constants

RE_EMAIL

Regular expression for matching valid email addresses.

Attributes

authors[RW]

List of authors.

contact[RW]

Official contact for this project. This is typically a name and email address.

created[RW]

The date the project was started.

description[RW]

Detailed description.

license[RW]

License.

name[R]

Project’s package name. The entry is required and must not contain spaces or puncuation.

resources[RW]

Table of project URIs encapsulated in a Resources object.

suite[RW]

Name of the user-account or master-project to which this project belongs. The suite name defaults to the project name if no entry is given. This is also aliased as collection.

summary[RW]

A one-line brief description.

title[RW]

Title of package (this defaults to project name capitalized).

Public Class Methods

default_filename() click to toggle source

The default file name to use for saving a new PROFILE file.

# File lib/pom/profile.rb, line 17
def self.default_filename
  'PROFILE.yml'
end
new(root, name, opts={}) click to toggle source

New Profile object. To create a new Profile the root directory of the project and the name of the project are required.

# File lib/pom/profile.rb, line 24
def initialize(root, name, opts={})
  @name = name
  super(root, opts)
end

Public Instance Methods

author() click to toggle source

Returns the first entry in the authors list.

# File lib/pom/profile.rb, line 110
def author
  authors.first
end
email() click to toggle source

Contact’s email address.

# File lib/pom/profile.rb, line 101
def email
  if md = RE_EMAIL.match(contact.to_s)
    md[0]
  else
    nil
  end
end
homepage() click to toggle source

Project’s homepage as listed in the resources.

# File lib/pom/profile.rb, line 88
def homepage
  resources.homepage
end
method_missing(sym, *args) click to toggle source

Profile is extensible. If a setting is assigned that is not already defined an attribute accessor will be created for it.

# File lib/pom/profile.rb, line 124
def method_missing(sym, *args)
  meth = sym.to_s
  name = meth.chomp('=')
  case meth
  when /=$/
    self[name] = args.first
  else
    super(sym, *args) if block_given? or args.size > 0
    nil
  end
end
repository() click to toggle source

Project’s public repository as listed in the resources.

# File lib/pom/profile.rb, line 93
def repository
  resources.repository
end
resources=(resources) click to toggle source

Set project resources table with a Hash or another Resources object.

# File lib/pom/profile.rb, line 83
def resources=(resources)
  self['resources'] = Resources.new(resources)
end
respond_to?(name) click to toggle source

Override standard respond_to? method to take method_missing lookup into account.

# File lib/pom/profile.rb, line 138
def respond_to?(name)
  return true if super(name)
  return true if self[name]
  return false
end
to_h() click to toggle source

Convert to hash.

# File lib/pom/profile.rb, line 115
def to_h
  data = @data.dup
  data['resources'] = data['resources'].to_h
  data
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.