Mojolicious-Plugin-Fondation
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Fondation/Command/fondation.pm view on Meta::CPAN
}
say "-- Clean complete --";
}
# ---------------------------------------------------------------------------
# fondation refresh
# ---------------------------------------------------------------------------
sub _run_refresh ($self, $app) {
$self->_run_clean($app);
$self->_run_init($app);
say "-- Refresh complete --";
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Mojolicious::Plugin::Fondation::Command::fondation - Fondation orchestration commands -- init, upgrade, clean, refresh
=head1 VERSION
version 0.08
=head1 SYNOPSIS
$ myapp.pl fondation init
$ myapp.pl fondation upgrade
$ myapp.pl fondation clean
$ myapp.pl fondation refresh
=head1 DESCRIPTION
Provides C<init>, C<upgrade>, C<clean>, C<refresh>, and C<plan> commands that iterate
over all loaded Fondation plugins and execute the steps each plugin declares in its
C<fondation_meta>.
=head2 Plugin contract
Plugins declare their participation via C<fondation_meta -> defaults>:
sub fondation_meta {
return {
defaults => {
fondation_init => [ ['db', 'prepare', '-y'], ['db', 'install'] ],
fondation_upgrade => [ ['db', 'prepare', '-y', '-a'], ['db', 'upgrade'] ],
fondation_clean => ['data/app.db'],
},
};
}
All three keys are optional -- a plugin only declares what it needs.
Because they live in C<defaults>, they participate in the config merge
cascade (direct > app config > defaults). Users can override or extend
them just like any other Fondation config value.
=over
=item * C<fondation_init> -- array of command steps, each C<[command, args...]>
=item * C<fondation_upgrade> -- array of command steps for incremental upgrade
=item * C<fondation_clean> -- array of paths (relative to app home) to remove
=back
=head2 Commands
=head3 fondation plan
Dry-run preview that shows what C<init>, C<upgrade>, C<clean>, or C<refresh> would
execute without actually running any steps.
$ myapp.pl fondation plan init
$ myapp.pl fondation plan upgrade
$ myapp.pl fondation plan clean
$ myapp.pl fondation plan refresh
Output shows each plugin (by short name) and its steps or clean targets,
in load order. A summary line at the end gives plugin and step counts.
=head3 fondation init
Iterates over plugins in load order. For each plugin that declares
C<fondation_init>, runs each step via C<< $app->commands->run(@step) >>.
=head3 fondation upgrade
Same as C<init>, but uses C<fondation_upgrade> from each plugin.
=head3 fondation clean
Iterates over plugins in load order and removes each path declared in the
plugin's C<fondation_clean> list. Paths are relative to the application home.
=head3 fondation refresh
Calls C<fondation clean> followed by C<fondation init>.
=head1 NAME
Mojolicious::Plugin::Fondation::Command::fondation - Orchestrate Fondation plugins
=head1 AUTHOR
Daniel Brosseau <dab@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Daniel Brosseau.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
( run in 1.591 second using v1.01-cache-2.11-cpan-e7c6538aa59 )