Catalyst::Model::SVN - Catalyst Model to browse Subversion repositories
# Model __PACKAGE__->config( repository => '/path/to/svn/root/or/path' ); # Controller sub default : Private { my ($self, $c) = @_; my $path = join('/', $c->req->args); my $revision = $c->req->param('revision') || 'HEAD'; $c->stash->{'repository_revision'} = MyApp::M::SVN->revision; $c->stash->{'items'} = MyApp::M::SVN->ls($path, $revision); $c->stash->{'template'} = 'blog.tt'; };
This model class uses the perl-subversion bindings to access a Subversion repository and list items and view their contents. It is currently only a read-only client but may expand to be a fill fledged client at a later time.
The following configuration options are available:
This is the full path to the root of, or any directory in your Subversion repository. This can be one of http://, svn://, or file:/// schemes.
This is the default revision to use when no revision is specified. By default, this will be HEAD.
HEAD
Returns the contents of the path specified. If path is a copy, the logs are transversed to find original. The request is then reissued for the original path for the revision specified.
path
revision
Returns a array of Catalyst::Model::SVN::Item objects in list context, each representing an entry in the specified repository path. In scalar context, it returns an array reference. If path is a copy, the logs are transversed to find the original. The request is then reissued for the original path for the revision specified.
Catalyst::Model::SVN::Item
Each Catalyst::Model::SVN::Item object has the following methods:
The author of the latest revision of the current item.
The contents of the of the current item. This is the same as calling Catalyst::Model::SVN-cat($item->uri, $item->revision)
Catalyst::Model::SVN-
Returns 1 if the current item is a directory; 0 otherwise.
Returns 1 if the current item is a file; 0 otherwise.
Returns the kind of the current item. See SVN::Core for the possible types, usually $SVN::Node::path or $SVN::Node::file.
Returns the last log entry for the current item. Be forewarned, this makes an extra call to the repository, which is slow. Only use this if you are listing a single item, and not when looping through large collections of items. If the current item is a copy, the logs are transversed to find the original. The request is then reissued for the original path for the revision specified.
Returns the name of the current item.
Returns the path of the current item relative to the repository root.
Returns the revision of the current item.
Returns the raw file size in bytes for the current item.
Returns the last modified time of the current item as a DateTime object.
Returns the full repository path of the current item.
Returns the repository specified in the configuration repository option.
repository
Returns the latest revisions of the repository you are connected to.
Catalyst::Manual, Catalyst::Helper, SVN::Client, SVN::Ra
Christopher H. Laco CPAN ID: CLACO claco@chrislaco.com http://today.icantfocus.com/blog/
To install Catalyst::Model::SVN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Model::SVN
CPAN shell
perl -MCPAN -e shell install Catalyst::Model::SVN
For more information on module installation, please visit the detailed CPAN module installation guide.