Parent

Files

POM::Metadata

The Metadata class encsulates a project’s Package and Profile data in a single interface.

Attributes

sources[R]

Metadata sources.

Public Class Methods

new(root, opts={}) click to toggle source
# File lib/pom/metadata.rb, line 16
def initialize(root, opts={})
  root = Pathname.new(root)

  @profile = nil
  @metadir = nil

  @package = Package.new(root, opts) #if Package.find(root)
  @profile = Profile.new(root, name) #if Profile.find(root)

  # DEPRECATE
  @metadir = Metadir.new(root) if Metadir.find(root)

  # TODO: Add @profile.resources to lookup ?
  @sources = [@package, @profile, @metadir].compact
end

Public Instance Methods

backup!() click to toggle source

Backup all metadata resources to `.cache/pom` location.

# File lib/pom/metadata.rb, line 71
def backup!
  sources.each do |source|
    source.backup!
  end
end
loadpath() click to toggle source

Load path(s) of the project, which are provided by the package.

# File lib/pom/metadata.rb, line 59
def loadpath
  @package.loadpath
end
metadir() click to toggle source

Access to meta directory entries. For backward compatability, maybe deprecated in future.

# File lib/pom/metadata.rb, line 44
def metadir
  @metadir
end
method_missing(sym, *args, &blk) click to toggle source

Delegate access to metdata sources.

# File lib/pom/metadata.rb, line 78
def method_missing(sym, *args, &blk)
  vals = []
  sources.each do |source|
    if source.respond_to?(sym)
      val = source.__send__(sym, *args, &blk)
      if val
        return val unless $DEBUG
        vals << val
      end
    end
  end
  # warn "multiple values that are not equal" ?
  vals.first
end
name() click to toggle source

Name of the project, which is provided by the package.

# File lib/pom/metadata.rb, line 49
def name
  @package.name
end
package() click to toggle source

The PACKAGE provides access to current package information.

# File lib/pom/metadata.rb, line 33
def package
  @package
end
profile() click to toggle source

The PROFILE provides general information about the project.

# File lib/pom/metadata.rb, line 38
def profile
  @profile
end
save!() click to toggle source

Save all metadata resources, i.e. package and profile.

# File lib/pom/metadata.rb, line 64
def save!
  sources.each do |source|
    source.save!
  end
end
to_s() click to toggle source

Provide a summary text of project’s metadata.

# File lib/pom/metadata.rb, line 94
def to_s
  s = []
  s << "#{title} v#{version}"
  s << ""
  s << "#{summary}"
  s << ""
  s << "contact    : #{contact}"
  s << "homepage   : #{homepage}"
  s << "repository : #{repository}"
  s << "authors    : #{authors.join(',')}"
  s << "package    : #{name}-#{version}"
  s << "requires   : #{requires.join(',')}"
  s.join("\n")
end
version() click to toggle source

Version of the project, which is provided by the package.

# File lib/pom/metadata.rb, line 54
def version
  @package.version
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.