docs for ::GitGather

This commit is contained in:
Yanick Champoux 2022-07-25 11:45:03 -04:00
parent 364ad6d587
commit 0fa5f2a9a4
2 changed files with 8 additions and 11 deletions

View File

@ -31,7 +31,7 @@ Git messages are compared to the regular expression
configured at `project.commit_regex`. If none is found, it configured at `project.commit_regex`. If none is found, it
defaults to defaults to
^(?<type>[^:]+):(?<desc>.*?)(\[(?<ticket>[^\]]+)\])?$ ^(?<type>[^: ]+):(?<desc>.*?)(\[(?<ticket>[^\]]+)\])?$
The regular expression must capture a C<desc> field, and may The regular expression must capture a C<desc> field, and may
capture a C<type> and C<ticket> as well. capture a C<type> and C<ticket> as well.
@ -41,10 +41,7 @@ END_POD
use Path::Tiny; use Path::Tiny;
use Git::Repository; use Git::Repository;
has changelog => ( is => 'lazy' ); with 'App::Changelord::Role::Changelog';
sub _build_changelog ($self) { $self->parent_command->changelog }
with 'App::Changelord::Role::Versions'; with 'App::Changelord::Role::Versions';
with 'App::Changelord::Role::ChangeTypes'; with 'App::Changelord::Role::ChangeTypes';
@ -59,7 +56,7 @@ has commit_regex => (
sub _build_commit_regex($self) { sub _build_commit_regex($self) {
my $regex = $self->changelog->{project}{commit_regex}; my $regex = $self->changelog->{project}{commit_regex};
my $default = '^(?<type>[^:]+):(?<desc>.*?)(\[(?<ticket>[^\]]+)\])?$'; my $default = '^(?<type>[^: ]+):(?<desc>.*?)(\[(?<ticket>[^\]]+)\])?$';
if(!$regex) { if(!$regex) {
warn "project.commit_regex not configured, using the default /$default/\n"; warn "project.commit_regex not configured, using the default /$default/\n";
$regex = $default; $regex = $default;
@ -69,7 +66,7 @@ sub _build_commit_regex($self) {
sub lower_bound($self) { sub lower_bound($self) {
# either the most recent commit in the current release # either the most recent commit in the current release
my @sha1s = grep { $_ } map { $_->{commit} } $self->next_release->{changes}->@*; my @sha1s = grep { $_ } map { $_->{commit} } grep { ref } $self->next_release->{changes}->@*;
return pop @sha1s if @sha1s; return pop @sha1s if @sha1s;
@ -92,7 +89,7 @@ sub munge_message($self,$message) {
} }
sub save_changelog($self) { sub save_changelog($self) {
my $src = $self->parent_command->source; my $src = $self->source;
path($src)->spew( App::Changelord::Command::Init::serialize_changelog($self) ); path($src)->spew( App::Changelord::Command::Init::serialize_changelog($self) );
} }
@ -104,7 +101,7 @@ sub run ($self) {
# figure out lower bound # figure out lower bound
my $from = $self->lower_bound; my $from = $self->lower_bound;
say "checking from ", ( $from || 'the dawn of time' ), " on"; say "checking since ", ( $from || 'the dawn of time' );
my @messages = map { $self->munge_message($_) } $self->get_commits($from); my @messages = map { $self->munge_message($_) } $self->get_commits($from);
@ -121,7 +118,7 @@ sub run ($self) {
$self->save_changelog; $self->save_changelog;
say $self->parent_command->source, " updated"; say $self->source, " updated";
} }
1; 1;

View File

@ -51,7 +51,7 @@ sub run ($self) {
homepage => undef, homepage => undef,
with_stats => 'true', with_stats => 'true',
ticket_url => undef, ticket_url => undef,
commit_regex => /^(?<type>[^:]+):(?<desc>.*?)(\[(?<ticket>[^\]]+)\])?$/, commit_regex => /^(?<type>[^: ]+):(?<desc>.*?)(\[(?<ticket>[^\]]+)\])?$/,
}, },
change_types => $self->change_types, change_types => $self->change_types,
releases => [ releases => [