NAME

Skilletor::Role::Source - The interface of a source backend (local, git, url)

VERSION

version 0.001

SYNOPSIS

package My::Source;
use Moo;
with 'Skilletor::Role::Source';

sub resolve { return { dir => $dir, version => 'local' } }
sub check   { my ( $self, $cached_version ) = @_; return 1 }

DESCRIPTION

The reference's sources/types.ts. A backend knows how to bring its source to a local directory and how to tell cheaply whether it moved; it knows nothing about templating or the target file system.

resolve

my $loc = $source->resolve;
# { dir => '/abs/tree', version => 'git:ab12cd3', warning => '...' }

Fetch or prepare the source. version is opaque: local, git:<sha>, etag:<etag>, sha256:<hex> or unknown. warning is set when the backend fell back to a stale cache (offline). What a backend compares with is its own cache's, never the caller's lock. Throws Skilletor::Error::Source when there is nothing to serve.

check

my $changed = $source->check($cached_version);

Has the source changed since $cached_version? True when it cannot tell.

SUPPORT

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

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