1234567891011121314151617181920212223242526272829303132333435363738 |
- package SugarTrail::Repo;
- # provide access to STM objects
- #
- # * load_master()
-
- use strict;
- use warnings;
- use Carp;
- use helper;
- use SugarTrail::Template::Master;
-
- # initialize repo
- sub new {
- my $class = shift;
- my $args = { @_ };
- exists($args->{type}) or $args->{type} = 'SugarTrail::Repo::Filesystem';
- $class = $args->{type};
- #TODO: remove use fail
- use SugarTrail::Repo::Filesystem;
- return $class->new(%$args);
- }
-
- sub load_master {
- my $self = shift;
- my $args = { @_ };
-
- my $src = $args->{source};
-
- my $master = SugarTrail::Template::Master->new();
- $master->{source} = $src;
- $master->{revision} = $self->get_revision($src);
- $master->{text} = $self->load_text($src)
- or return;
-
- return $master;
- }
-
- 1;
|