The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JSAN::Index - JavaScript Archive Network Index SQLite/CDBI Interface

DESCRIPTION

JSAN is the JavaScript Archive Network, a CPAN implementation for Javascript.

You can find the JSAN at http://openjsan.org.

As well as a flat text file index like CPAN, the JSAN index is also distributed as a SQLite database.

JSAN::Index is a Class::DBI wrapper built around the JSAN SQLite index.

It allow you to easily do all sorts of nifty things with the index in a simple and straight forward way.

STATUS

This is currently only for the use of JSAN developers, as the index is still going through some amount of flux. It should not be used by outsiders until the index has stabilised a little and we assign a non-devel version

JSAN::Index

The JSAN::Index class itself currently contains a limited number of shortcut and utility methods.

install_dependency

The install_dependency method creates and returns a release-level dependency object that is used by JSAN::Client to schedule which releases to install.

Returns an Algorithm::Dependency object.

JSAN::Index::CDBI

The JSAN::Index::CDBI class acts as a base class for the index and provides the integration with Class::DBI and JSAN::Transport.

It has no user-servicable parts at this time.

JSAN::Index::Author

This class provides objects for authors in the JSAN index.

In addition to the general methods provided by Class::DBI, it has the following methods

login

The login accessor returns the JSAN author code/login for the author.

name

The name accessor returns the full name of the author.

doc

The doc accessor returns the root-relative documentation path for the author on any http://openjsan.org/ mirror.

email

The email accessor returns the public email address for the author.

url

The url acessor returns the uri for the authors homepage as a string.

releases

The releases method finds and retrieves all of the releases for an author.

Returns a list of \JSAN::Index::Release objects.

JSAN::Index::Extractable

JSAN::Index::Extractable provides a common base class for the various things that can be identified by a tarball and extracted to the local filesystem (or elsewhere).

For each of the methods, when called on a JSAN::Index::Release it extracts that release, when called on a JSAN::Index::Distribution extracts from the most recent release, and when call on a JSAN::Index::Library extracts the release that the library is contained in (according to the indexer).

extract_libs to => $path

The extract_libs method will extract the libraries for a release (i.e. the contents of the lib directory> to the local filesystem.

Returns the number of files extracted, or dies on error.

extract_tests to => $path

The extract_tests method will extract the test scripts for a release (i.e. the contents of the tests directory> to the local filesystem.

Returns the number of files extracted, or dies on error.

extract_resource to => 'path';

All JSAN tarballs contain a number of standard "resource" directories. The most common of these is the 'lib' resource.

It takes named parameters to control its behaviour.

to

The to parameter specifies the destination for the files to be extracted to. When passed as a single string, this is taken to be a directory on the local host.

No other destination options other than the local filesystem are available at this time, but more destination options are expected at a later date.

JSAN::Index::Library

This class provides objects for the various libraries in the JSAN.

In addition to the general methods provided by Class::DBI, it has the following methods

name

The name accessor returns the name (possibly including the use of pseudo-namespaces) of the library. e.g. "Test.Simple.Container.Browser"

release

The release method returns the \JSAN::Index::Release object for the release that the library is defined in.

version

The version accessor returns the version of the library.

doc

The doc accessor returns the root-relative location of the documentation for this library on the http://openjsan.org/ website.

distribution

The distribution method is a shortcut for $library->release->distribution and returns the \JSAN::Index::Distribution for the distribution that this library is of.

JSAN::Index::Distribution

This class provides objects for named distributions in the JSAN index.

In addition to the general methods provided by Class::DBI, it has the following methods

name

The name accessor returns the name of the distribution.

doc

The doc accessor returns the root-relative location of the documentation for this distribution on the http://openjsan.org/ website.

releases

The releases method finds and retrieves all of the releases of the distribution.

Returns a list of \JSAN::Index::Release objects.

JSAN::Index::Release

This class provides objects for a single release of a distribution by an author

In addition to the general methods provided by Class::DBI, it has the following methods

id

The id accessor returns the unique identifier for the release (an integer)

source

The source access returns the root-relative path within a JSAN mirror that the package can be found at.

distribution

The distribution method returns the \JSAN::Index::Distribution for the distribution that this release is of.

author

The author method returns the \JSAN::Index::Author for the JSAN author that uploaded the release.

version

The version accessor returns the version of the release.

created

The created accessor returns the time that the release was received and first indexed by the JSAN upload server.

Returns an integer in unix epoch time.

doc

The doc accessor returns the root-relative location of the documentation for this release on the http://openjsan.org/ website.

meta

The meta accessor returns the actual content of the META.yml file that came with the distribution.

checksum

The checksum accessor returns the MD5 checksum for the release tarball.

latest

The latest accessor returns a boolean flag indicating if the release is the most recent release of the distribution.

requires

The requires method finds the set of run-time library dependencies for this release, as identified in the META.yml data contained in the index.

Returns a reference to a HASH where the key is the name of a library as a string, and the value is the version for the dependency (or zero if the dependency is not for a specific version).

requires_libraries

The requires_libraries method returns a list of the JSAN::Index::Library dependencies as identified by the META.yml file for the release.

requires_releases

The requires_releases method returns a list of the JSAN::Index::Release dependencies based on the dependencies specified in the META.yml file for the release.

meta_data

The meta_data method loads and deserialises the META.yml content contained in the index (and returned by the meta method above).

mirror

The mirror method fetches the tarball from your JSAN currently configured JSAN mirror as determined by JSAN::Transport (if not already cached).

Returns a file path to the tarball on the local machine, or may emit an exception thrown by the underlying JSAN::Transport functions.

file_mirrored

The file_mirrored method checks to see if the release tarball has previously been downloaded to the local mirror.

Returns true if the file exists in the local mirror, or false if not.

file_path

The file_path method returns the location on the local disk where the release tarball should be, if mirrored.

archive

The archive method returns the release as an in-memory archive. Depending on the type, this should be either a Archive::Tar or an Archive::Zip object.

TO DO

- Add the testing dependency algorithm variant

- Add support for JSON META.yml files

- Add verbose support

SUPPORT

Bugs should be reported via the CPAN bug tracker at

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSAN-Client

For other issues, contact the author.

AUTHOR

Adam Kennedy <cpan@ali.as>, http://ali.as/

COPYRIGHT

Copyright 2005 Adam Kennedy. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.