Mojolicious-Plugin-Fondation
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Fondation/Command/fondation.pm view on Meta::CPAN
remove_tree($path->to_string, { safe => 0 });
}
elsif (-f $path) {
say " [$short] Removing $target";
unlink $path->to_string;
}
}
}
}
# Phase 2: init
$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, refresh
=head1 VERSION
version 0.03
=head1 SYNOPSIS
$ myapp.pl fondation init
$ myapp.pl fondation upgrade
$ myapp.pl fondation refresh
=head1 DESCRIPTION
Provides C<init>, C<upgrade>, 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>, or C<refresh> would
execute without actually running any steps.
$ myapp.pl fondation plan init
$ myapp.pl fondation plan upgrade
$ 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 refresh
=over
=item 1. Removes all paths declared in each plugin's C<fondation_clean>
=item 2. Runs C<fondation init>
=back
=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 0.776 second using v1.01-cache-2.11-cpan-9581c071862 )