Git::Wrapper::Plus::Tester - Utility for testing things with a git repository
version 0.004011
use Git::Wrapper::Plus::Tester; my $t = Git::Wrapper::Plus::Tester->new(); $t->run_env( sub { my $wrapper = $t->git; $wrapper->init_db(); # ETC. } );
This module solves the problem of the tedious amount of leg work you need to do to simply execute a test with Git.
Namely:
Creating a scratch directory
Creating a fake home directory in that scratch directory
Setting HOME to that fake home
HOME
Setting valid, but bogus values for GIT_(COMMITTER|AUTHOR)_(NAME|EMAIL)
GIT_(COMMITTER|AUTHOR)_(NAME|EMAIL)
Creating a directory for the repository to work with in the scratch directory
Creating a Git::Wrapper instance with that repository path
This module does all of the above for you, and makes some of them flexible via attributes.
run_env
Sets up basic environment, and runs code, reverting environment when done.
$o->run_env(sub { my $wrapper = $o->git; });
temp_dir
OPTIONAL
home_dir
repo_dir
git
committer_name
OPTIONAL. Defaults to A. U. Thor
A. U. Thor
committer_email
OPTIONAL. Defaults to author@example.org
author@example.org
author_name
OPTIONAL. Defaults to ->committer_name
->committer_name
author_email
OPTIONAL. Defaults to ->committer_email
->committer_email
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Git::Wrapper::Plus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Wrapper::Plus
CPAN shell
perl -MCPAN -e shell install Git::Wrapper::Plus
For more information on module installation, please visit the detailed CPAN module installation guide.