doc for ::Bump
This commit is contained in:
parent
615cc0f581
commit
364ad6d587
@ -3,7 +3,11 @@ package App::Changelord::Command::Bump;
|
|||||||
use 5.36.0;
|
use 5.36.0;
|
||||||
|
|
||||||
use Moo;
|
use Moo;
|
||||||
use CLI::Osprey desc => 'bump next version';
|
use CLI::Osprey desc => 'bump next version',
|
||||||
|
description_pod => <<'END';
|
||||||
|
Set a version for the NEXT release based on the types of its changes.
|
||||||
|
Also set the release date of that release to today.
|
||||||
|
END
|
||||||
|
|
||||||
use Path::Tiny;
|
use Path::Tiny;
|
||||||
use JSON;
|
use JSON;
|
||||||
@ -11,15 +15,11 @@ use YAML qw/ Bless /;
|
|||||||
use List::AllUtils qw/ first min uniq /;
|
use List::AllUtils qw/ first min uniq /;
|
||||||
use Version::Dotted::Semantic;
|
use Version::Dotted::Semantic;
|
||||||
|
|
||||||
|
with 'App::Changelord::Role::Changelog';
|
||||||
with 'App::Changelord::Role::ChangeTypes';
|
with 'App::Changelord::Role::ChangeTypes';
|
||||||
|
|
||||||
has changelog => ( is => 'lazy' );
|
|
||||||
|
|
||||||
with 'App::Changelord::Role::Versions';
|
with 'App::Changelord::Role::Versions';
|
||||||
with 'App::Changelord::Role::Stats';
|
with 'App::Changelord::Role::Stats';
|
||||||
|
|
||||||
sub _build_changelog ($self) { $self->parent_command->changelog }
|
|
||||||
|
|
||||||
sub run ($self) {
|
sub run ($self) {
|
||||||
my $bump = shift @ARGV;
|
my $bump = shift @ARGV;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ sub run ($self) {
|
|||||||
Bless($_)->keys( [ uniq qw/ version date changes /, sort keys %$_ ] );
|
Bless($_)->keys( [ uniq qw/ version date changes /, sort keys %$_ ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
path( $self->parent_command->source )->spew( YAML::Dump($change) );
|
path( $self->source )->spew( YAML::Dump($change) );
|
||||||
|
|
||||||
say "new version minted: $version";
|
say "new version minted: $version";
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use feature 'try';
|
|||||||
requires 'changelog';
|
requires 'changelog';
|
||||||
|
|
||||||
sub latest_version($self){
|
sub latest_version($self){
|
||||||
first { $_ } grep { $_ ne 'NEXT' } map { eval { $_->{version} } } $self->changelog->{releases}->@*;
|
first { $_ } grep { $_ ne 'NEXT' } map { eval { $_->{version} || '' } } $self->changelog->{releases}->@*, 'v0.0.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
sub next_version($self) {
|
sub next_version($self) {
|
||||||
@ -29,7 +29,10 @@ sub next_version($self) {
|
|||||||
map { $_ => $level } $_->{keywords}->@*
|
map { $_ => $level } $_->{keywords}->@*
|
||||||
} $self->change_types->@*;
|
} $self->change_types->@*;
|
||||||
|
|
||||||
my $bump =min 2, map { $_ eq 'major' ? 0 : $_ eq 'minor' ? 1 : 2 } map { $mapping{$_->{type}} || 'patch' } $upcoming->{changes}->@*;
|
no warnings;
|
||||||
|
my $bump =min 2, map { $_ eq 'major' ? 0 : $_ eq 'minor' ? 1 : 2 } map { $mapping{$_->{type}} || 'patch' }
|
||||||
|
map { ref ? $_ : { desc => $_ } }
|
||||||
|
$upcoming->{changes}->@*;
|
||||||
|
|
||||||
$version->bump($bump);
|
$version->bump($bump);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user