From 0fa5f2a9a4535f1f12af95ba0375e67e87558344 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Mon, 25 Jul 2022 11:45:03 -0400 Subject: [PATCH] docs for ::GitGather --- lib/App/Changelord/Command/GitGather.pm | 17 +++++++---------- lib/App/Changelord/Command/Init.pm | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/App/Changelord/Command/GitGather.pm b/lib/App/Changelord/Command/GitGather.pm index 8d0f8e8..94385fa 100644 --- a/lib/App/Changelord/Command/GitGather.pm +++ b/lib/App/Changelord/Command/GitGather.pm @@ -31,7 +31,7 @@ Git messages are compared to the regular expression configured at `project.commit_regex`. If none is found, it defaults to - ^(?[^:]+):(?.*?)(\[(?[^\]]+)\])?$ + ^(?[^: ]+):(?.*?)(\[(?[^\]]+)\])?$ The regular expression must capture a C field, and may capture a C and C as well. @@ -41,10 +41,7 @@ END_POD use Path::Tiny; use Git::Repository; -has changelog => ( is => 'lazy' ); - -sub _build_changelog ($self) { $self->parent_command->changelog } - +with 'App::Changelord::Role::Changelog'; with 'App::Changelord::Role::Versions'; with 'App::Changelord::Role::ChangeTypes'; @@ -59,7 +56,7 @@ has commit_regex => ( sub _build_commit_regex($self) { my $regex = $self->changelog->{project}{commit_regex}; - my $default = '^(?[^:]+):(?.*?)(\[(?[^\]]+)\])?$'; + my $default = '^(?[^: ]+):(?.*?)(\[(?[^\]]+)\])?$'; if(!$regex) { warn "project.commit_regex not configured, using the default /$default/\n"; $regex = $default; @@ -69,7 +66,7 @@ sub _build_commit_regex($self) { sub lower_bound($self) { # 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; @@ -92,7 +89,7 @@ sub munge_message($self,$message) { } sub save_changelog($self) { - my $src = $self->parent_command->source; + my $src = $self->source; path($src)->spew( App::Changelord::Command::Init::serialize_changelog($self) ); } @@ -104,7 +101,7 @@ sub run ($self) { # figure out 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); @@ -121,7 +118,7 @@ sub run ($self) { $self->save_changelog; - say $self->parent_command->source, " updated"; + say $self->source, " updated"; } 1; diff --git a/lib/App/Changelord/Command/Init.pm b/lib/App/Changelord/Command/Init.pm index 4108ac8..b88acd2 100644 --- a/lib/App/Changelord/Command/Init.pm +++ b/lib/App/Changelord/Command/Init.pm @@ -51,7 +51,7 @@ sub run ($self) { homepage => undef, with_stats => 'true', ticket_url => undef, - commit_regex => /^(?[^:]+):(?.*?)(\[(?[^\]]+)\])?$/, + commit_regex => /^(?[^: ]+):(?.*?)(\[(?[^\]]+)\])?$/, }, change_types => $self->change_types, releases => [