Class Buildr::Artifact
In: lib/buildr/packaging/artifact.rb  (CVS)
Parent: Rake::FileTask

A file task referencing an artifact in the local repository.

This task includes all the artifact attributes (group, id, version, etc). It points to the artifact‘s path in the local repository. When invoked, it will download the artifact into the local repository if the artifact does not already exist.

Note: You can enhance this task to create the artifact yourself, e.g. download it from a site that doesn‘t have a remote repository structure, copy it from a different disk, etc.

Methods

Included Modules

ActsAsArtifact Buildr

Constants

DEFAULT_TYPE = :jar   The default artifact type.

Public Class methods

Convert a hash spec to a file name.

Returns an array of specs for all the registered artifacts. (Anything created from artifact, or package).

Lookup a previously registered artifact task based on its specification (String or Hash).

Force overwriting target since we don‘t have source file to check for timestamp modification

Register an artifact task(s) for later lookup (see lookup).

Turn a spec into a hash. This method accepts a String, Hash or any object that responds to the method to_spec. There are several reasons to use this method:

  • You can pass anything that could possibly be a spec, and get a hash.
  • It will check that the spec includes the group identifier, artifact identifier and version number and set the file type, if missing.
  • It will always return a new specs hash.

Convert a hash back to a spec string. This method accepts a string, hash or any object that responds to to_spec.

Public Instance methods

Use this when you want to install or upload an artifact from a given content, for example:

  readme = artifact('com.example:readme:txt:1.0').content(<<-EOF
    Please visit our website at http://example.com/readme
  <<EOF
  install readme

If the argument is not a string, it will be converted to a string using to_s

Use this when you want to install or upload an artifact from a given file, for example:

  test = artifact('group:id:jar:1.0').from('test.jar')
  install test

See also Buildr#install and Buildr#upload.

Protected Instance methods

Downloads an artifact from one of the remote repositories, and stores it in the local repository. Raises an exception if the artifact is not found.

This method attempts to download the artifact from each repository in the order in which they are returned from remote, until successful.

Validates whether artifact is required to be downloaded from repository

[Validate]