diff options
author | gregor herrmann <gregoa@debian.org> | 2020-07-10 19:12:27 +0200 |
---|---|---|
committer | gregor herrmann <gregoa@debian.org> | 2020-07-10 19:12:27 +0200 |
commit | c7afa6313e6af97955febec96300c072803c6a9d (patch) | |
tree | 13dad049e8917295d6b08af0f28980bd2fe66a94 | |
parent | ea527615735a1ca64c0a9930056a6dc569ffabea (diff) | |
parent | da3d27725fd4960ac28316715087418216e9b2de (diff) |
Update upstream source from tag 'upstream/0.216'
Update to upstream version '0.216'
with Debian dir 03fa56986507f716dcdc40f0b289565ca2a7ffaa
-rw-r--r-- | Changes | 7 | ||||
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | META.json | 77 | ||||
-rw-r--r-- | META.yml | 75 | ||||
-rw-r--r-- | Makefile.PL | 4 | ||||
-rw-r--r-- | README | 23 | ||||
-rw-r--r-- | dist.ini | 2 | ||||
-rw-r--r-- | lib/Progress/Any.pm | 39 | ||||
-rw-r--r-- | lib/Progress/Any/Output.pm | 6 | ||||
-rw-r--r-- | lib/Progress/Any/Output/Null.pm | 4 | ||||
-rw-r--r-- | t/01-basics.t | 4 |
11 files changed, 150 insertions, 93 deletions
@@ -1,3 +1,10 @@ +0.216 2020-07-09 Released-By: PERLANCAR; Urgency: medium + + - Add reset(). + + - Add optional argument 'force_update' to update(). + + 0.215 2020-06-21 Released-By: PERLANCAR; Urgency: medium - Output: Accept -optname => optval, ... as an alternative to @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.014. +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Changes LICENSE MANIFEST @@ -4,7 +4,7 @@ "perlancar <perlancar@cpan.org>" ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010", + "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -58,10 +58,10 @@ "web" : "https://github.com/perlancar/perl-Progress-Any" } }, - "version" : "0.215", + "version" : "0.216", "x_Dist_Zilla" : { "perl" : { - "version" : "5.030002" + "version" : "5.030000" }, "plugins" : [ { @@ -78,52 +78,52 @@ } }, "name" : "@Author::PERLANCAR/@Filter/GatherDir", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Author::PERLANCAR/@Filter/PruneCruft", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Author::PERLANCAR/@Filter/ManifestSkip", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Author::PERLANCAR/@Filter/MetaYAML", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Author::PERLANCAR/@Filter/License", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Author::PERLANCAR/@Filter/PodCoverageTests", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Author::PERLANCAR/@Filter/PodSyntaxTests", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@Author::PERLANCAR/@Filter/ExtraTests", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::PERLANCAR/@Filter/ExecDir", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Author::PERLANCAR/@Filter/ShareDir", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", @@ -133,22 +133,22 @@ } }, "name" : "@Author::PERLANCAR/@Filter/MakeMaker", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Author::PERLANCAR/@Filter/Manifest", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Author::PERLANCAR/@Filter/ConfirmRelease", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::PERLANCAR/ExecDir script", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::BeforeBuild", @@ -168,7 +168,7 @@ { "class" : "Dist::Zilla::Plugin::PERLANCAR::EnsurePrereqToSpec", "name" : "@Author::PERLANCAR/PERLANCAR::EnsurePrereqToSpec", - "version" : "0.062" + "version" : "0.060" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::MetaResources", @@ -214,12 +214,12 @@ { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Author::PERLANCAR/MetaJSON", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Author::PERLANCAR/MetaConfig", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Authority", @@ -389,7 +389,7 @@ { "class" : "Dist::Zilla::Plugin::PruneFiles", "name" : "@Author::PERLANCAR/PruneFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Pod2Readme", @@ -399,7 +399,7 @@ { "class" : "Dist::Zilla::Plugin::Rinci::AddPrereqs", "name" : "@Author::PERLANCAR/Rinci::AddPrereqs", - "version" : "0.145" + "version" : "0.144" }, { "class" : "Dist::Zilla::Plugin::Rinci::AddToDb", @@ -409,7 +409,7 @@ { "class" : "Dist::Zilla::Plugin::Rinci::EmbedValidator", "name" : "@Author::PERLANCAR/Rinci::EmbedValidator", - "version" : "0.250" + "version" : "0.251" }, { "class" : "Dist::Zilla::Plugin::SetScriptShebang", @@ -503,7 +503,7 @@ } }, "name" : "TestRequires", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Prereqs", @@ -514,57 +514,57 @@ } }, "name" : "Prereqs", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", - "version" : "6.014" + "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", - "version" : "6.014" + "version" : "6.012" } ], "zilla" : { @@ -572,13 +572,12 @@ "config" : { "is_trial" : 0 }, - "version" : "6.014" + "version" : "6.012" } }, "x_authority" : "cpan:PERLANCAR", - "x_generated_by_perl" : "v5.30.2", - "x_serialization_backend" : "Cpanel::JSON::XS version 4.19", - "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later", + "x_generated_by_perl" : "v5.30.0", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.12", "x_static_install" : 1 } @@ -11,7 +11,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010' +generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,10 +27,10 @@ resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Progress-Any homepage: https://metacpan.org/release/Progress-Any repository: git://github.com/perlancar/perl-Progress-Any.git -version: '0.215' +version: '0.216' x_Dist_Zilla: perl: - version: '5.030002' + version: '5.030000' plugins: - class: Dist::Zilla::Plugin::GatherDir @@ -44,62 +44,62 @@ x_Dist_Zilla: prune_directory: [] root: . name: '@Author::PERLANCAR/@Filter/GatherDir' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::PruneCruft name: '@Author::PERLANCAR/@Filter/PruneCruft' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Author::PERLANCAR/@Filter/ManifestSkip' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::MetaYAML name: '@Author::PERLANCAR/@Filter/MetaYAML' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::License name: '@Author::PERLANCAR/@Filter/License' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Author::PERLANCAR/@Filter/PodCoverageTests' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Author::PERLANCAR/@Filter/PodSyntaxTests' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::ExtraTests name: '@Author::PERLANCAR/@Filter/ExtraTests' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::PERLANCAR/@Filter/ExecDir' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::ShareDir name: '@Author::PERLANCAR/@Filter/ShareDir' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Author::PERLANCAR/@Filter/MakeMaker' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::Manifest name: '@Author::PERLANCAR/@Filter/Manifest' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Author::PERLANCAR/@Filter/ConfirmRelease' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::PERLANCAR/ExecDir script' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::PERLANCAR::BeforeBuild name: '@Author::PERLANCAR/PERLANCAR::BeforeBuild' @@ -115,7 +115,7 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::PERLANCAR::EnsurePrereqToSpec name: '@Author::PERLANCAR/PERLANCAR::EnsurePrereqToSpec' - version: '0.062' + version: '0.060' - class: Dist::Zilla::Plugin::PERLANCAR::MetaResources name: '@Author::PERLANCAR/PERLANCAR::MetaResources' @@ -150,11 +150,11 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::MetaJSON name: '@Author::PERLANCAR/MetaJSON' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::MetaConfig name: '@Author::PERLANCAR/MetaConfig' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::Authority name: '@Author::PERLANCAR/Authority' @@ -288,7 +288,7 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::PruneFiles name: '@Author::PERLANCAR/PruneFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::Pod2Readme name: '@Author::PERLANCAR/Pod2Readme' @@ -296,7 +296,7 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::Rinci::AddPrereqs name: '@Author::PERLANCAR/Rinci::AddPrereqs' - version: '0.145' + version: '0.144' - class: Dist::Zilla::Plugin::Rinci::AddToDb name: '@Author::PERLANCAR/Rinci::AddToDb' @@ -304,7 +304,7 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::Rinci::EmbedValidator name: '@Author::PERLANCAR/Rinci::EmbedValidator' - version: '0.250' + version: '0.251' - class: Dist::Zilla::Plugin::SetScriptShebang name: '@Author::PERLANCAR/SetScriptShebang' @@ -376,7 +376,7 @@ x_Dist_Zilla: phase: test type: requires name: TestRequires - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::Prereqs config: @@ -384,54 +384,53 @@ x_Dist_Zilla: phase: runtime type: requires name: Prereqs - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' - version: '6.014' + version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' - version: '6.014' + version: '6.012' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' - version: '6.014' + version: '6.012' x_authority: cpan:PERLANCAR -x_generated_by_perl: v5.30.2 +x_generated_by_perl: v5.30.0 x_serialization_backend: 'YAML::Tiny version 1.73' -x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' x_static_install: 1 diff --git a/Makefile.PL b/Makefile.PL index 492051a..da3590e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.014. +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. use strict; use warnings; @@ -29,7 +29,7 @@ my %WriteMakefileArgs = ( "Test::Exception" => 0, "Test::More" => "0.98" }, - "VERSION" => "0.215", + "VERSION" => "0.216", "test" => { "TESTS" => "t/*.t" } @@ -2,8 +2,8 @@ NAME Progress::Any - Record progress to any output VERSION - This document describes version 0.215 of Progress::Any (from Perl - distribution Progress-Any), released on 2020-06-21. + This document describes version 0.216 of Progress::Any (from Perl + distribution Progress-Any), released on 2020-07-09. SYNOPSIS Example of using in a script with terminal progress bar as output @@ -299,6 +299,12 @@ METHODS Can be set to "finished" to finish a task. + * force_update => BOOL + + Default false. Some outputs choose only to update themselves after a + certain amount of time or number of updates have passed; this forces + their update. + finish Usage: @@ -312,6 +318,19 @@ METHODS %args, ); + reset + Usage: + + $progress->reset(%args) + + Equivalent to: + + $progress->update( + pos => 0, + state => 'started', + %args, + ); + start Usage: @@ -1,4 +1,4 @@ -version=0.215 +version=0.216 name=Progress-Any diff --git a/lib/Progress/Any.pm b/lib/Progress/Any.pm index b092ea5..f4b5de6 100644 --- a/lib/Progress/Any.pm +++ b/lib/Progress/Any.pm @@ -1,7 +1,7 @@ package Progress::Any; -our $DATE = '2020-06-21'; # DATE -our $VERSION = '0.215'; # VERSION +our $DATE = '2020-07-09'; # DATE +our $VERSION = '0.216'; # VERSION use 5.010001; use strict; @@ -359,7 +359,10 @@ sub _should_update_output { # finishing, update the output to show finished state return 1; } elsif ($output->{force_update}) { - # force update + # this is an undocumented force update for now, the output itself or + # something else can set this to force an update. but this will only be + # done once because we delete the key; if another update wants to be + # forced, they need to set this again. delete $output->{force_update}; return 1; } elsif ($priority eq 'high') { @@ -393,6 +396,7 @@ sub update { my $message = delete($args{message}); my $priority = delete($args{priority}) // 'normal'; + my $force_update = delete($args{force_update}); die "Unknown argument(s) to update(): ".join(", ", keys(%args)) if keys(%args); @@ -405,7 +409,8 @@ sub update { while (1) { if ($outputs{$task}) { for my $output (@{ $outputs{$task} }) { - next unless $self->_should_update_output($output, $now, $priority); + next unless $force_update || + $self->_should_update_output($output, $now, $priority); if (ref($message) eq 'CODE') { $message = $message->(); } @@ -439,6 +444,11 @@ sub finish { $self->update(pos=>$self->{target}, state=>'finished', %args); } +sub reset { + my ($self, %args) = @_; + $self->update(pos=>0, state=>'started', %args); +} + our $template_regex = qr{( # all=1 % ( #width=2 @@ -585,7 +595,7 @@ Progress::Any - Record progress to any output =head1 VERSION -This document describes version 0.215 of Progress::Any (from Perl distribution Progress-Any), released on 2020-06-21. +This document describes version 0.216 of Progress::Any (from Perl distribution Progress-Any), released on 2020-07-09. =head1 SYNOPSIS @@ -904,6 +914,11 @@ ignore updates lower than a certain level. Can be set to C<finished> to finish a task. +=item * force_update => BOOL + +Default false. Some outputs choose only to update themselves after a certain +amount of time or number of updates have passed; this forces their update. + =back =head2 finish @@ -920,6 +935,20 @@ Equivalent to: %args, ); +=head2 reset + +Usage: + + $progress->reset(%args) + +Equivalent to: + + $progress->update( + pos => 0, + state => 'started', + %args, + ); + =head2 start Usage: diff --git a/lib/Progress/Any/Output.pm b/lib/Progress/Any/Output.pm index dd99af8..2984f23 100644 --- a/lib/Progress/Any/Output.pm +++ b/lib/Progress/Any/Output.pm @@ -1,9 +1,9 @@ package Progress::Any::Output; our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY -our $DATE = '2020-06-21'; # DATE +our $DATE = '2020-07-09'; # DATE our $DIST = 'Progress-Any'; # DIST -our $VERSION = '0.215'; # VERSION +our $VERSION = '0.216'; # VERSION use 5.010001; use strict; @@ -83,7 +83,7 @@ Progress::Any::Output - Assign output to progress indicators =head1 VERSION -This document describes version 0.215 of Progress::Any::Output (from Perl distribution Progress-Any), released on 2020-06-21. +This document describes version 0.216 of Progress::Any::Output (from Perl distribution Progress-Any), released on 2020-07-09. =head1 SYNOPSIS diff --git a/lib/Progress/Any/Output/Null.pm b/lib/Progress/Any/Output/Null.pm index 41ecdc8..f2fe96a 100644 --- a/lib/Progress/Any/Output/Null.pm +++ b/lib/Progress/Any/Output/Null.pm @@ -4,7 +4,7 @@ use 5.010; use strict; use warnings; -our $VERSION = '0.215'; # VERSION +our $VERSION = '0.216'; # VERSION sub new { my ($class, %args) = @_; @@ -30,7 +30,7 @@ Progress::Any::Output::Null - Null output =head1 VERSION -This document describes version 0.215 of Progress::Any::Output::Null (from Perl distribution Progress-Any), released on 2020-06-21. +This document describes version 0.216 of Progress::Any::Output::Null (from Perl distribution Progress-Any), released on 2020-07-09. =for Pod::Coverage ^(new|update)$ diff --git a/t/01-basics.t b/t/01-basics.t index 33d6a9d..83b054e 100644 --- a/t/01-basics.t +++ b/t/01-basics.t @@ -9,6 +9,10 @@ use Test::More 0.98; use Test::Exception; use Time::HiRes qw(sleep); +# XXX test finish() +# XXX test reset() +# XXX test update() argument: force_update + subtest "get_indicator, {total_,pos}, {total_,}target, percent_complete" => sub { %Progress::Any::indicators = (); |