NAME
Dist::Zilla::Role::RepoFileInjector - Create files outside the build directory
VERSION
version 0.005
SYNOPSIS
package Dist::Zilla::Plugin::MyPlugin;
use Moose;
with 'Dist::Zilla::Role::RepoFileInjector';
sub some_method {
...
$self->add_repo_file(Dist::Zilla::File::InMemory->new(...));
}
sub some_other_method {
...
$self->write_repo_files;
}
DESCRIPTION
This role is to be consumed by any plugin that plans to create files outside the distribution.
ATTRIBUTES
repo_root
A string indicating the base directory where the file(s) are written, when relative paths are provided. Defaults to the current working directory.
allow_overwrite
A boolean indicating whether it is permissible for the file to already exist (whereupon it is overwritten). When false, a fatal exception is thrown when the file already exists.
Defaults to true.
METHODS
add_repo_file
$plugin->add_repo_file($dzil_file);
Registers a file object to be written to disk. If the path is not absolute, it is treated as relative to repo_root
. The file should consume the Dist::Zilla::Role::File role.
write_repo_files
$plugin->write_repo_files;
Writes out all files registered previously with add_repo_file
. Your plugin should normally do this during either the AfterBuild
or AfterRelease
phase, e.g.:
sub after_build
{
my $self = shift;
$self->write_repo_files;
}
_repo_files
Returns the list of files added via add_repo_file
.
SEE ALSO
SUPPORT
Bugs may be submitted through the RT bug tracker (or bug-Dist-Zilla-Role-RepoFileInjector@rt.cpan.org).
There is also a mailing list available for users of this distribution, at http://dzil.org/#mailing-list.
There is also an irc channel available for users of this distribution, at irc://irc.perl.org/#distzilla.
I am also usually active on irc, as 'ether' at irc.perl.org
.
AUTHOR
Karen Etheridge <ether@cpan.org>
COPYRIGHT AND LICENCE
This software is copyright (c) 2015 by Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.