You should be able to call an arbitrary command before or after a hook using the install subcommand for testing. This way you can check the state right before or right after any of the hooks, in the correct directory for that stage.
You should be able to set any number of hooks from the command line
You should be able to specify an interactive shell, like bash for interactive testing
Invocation should look something like this:
% af install --before build bash --after download 'ls -l'
This will run ls -l right after the download, and bash right before the build begins.
The methods $build->meta->after_hook and $build->meta->before_hook are undocumented as of this writing, but I intend on making them documented, supported methods in the near future. This could also be implemented using $build->meta->around_hook but my preference is to use after/before_hook.
On second thought this should be implemented with $build->meta->around_hook because we will need to be able to catch and rethrow exceptions that happen in the enclosing hook. Something like:
$meta->around_hook(
$hook_name => sub {
my($orig, @args) = @_;
my $ret = eval { $orig->(@args) };
my $error = $@;
# execute command here
die $error if $error;
$ret;
}
);
Actually I think for the before we can do the $build->meta->before_hook for simplicity.
You should be able to call an arbitrary command before or after a hook using the install subcommand for testing. This way you can check the state right before or right after any of the hooks, in the correct directory for that stage.
Invocation should look something like this:
This will run
ls -l
right after the download, and bash right before the build begins.The methods$build->meta->after_hook
and$build->meta->before_hook
are undocumented as of this writing, but I intend on making them documented, supported methods in the near future. This could also be implemented using$build->meta->around_hook
but my preference is to useafter/before_hook
.On second thought this should be implemented with
$build->meta->around_hook
because we will need to be able to catch and rethrow exceptions that happen in the enclosing hook. Something like:Actually I think for the before we can do the
$build->meta->before_hook
for simplicity.