File Coverage

blib/lib/Minion/Command/minion/version.pm
Criterion Covered Total %
statement 3 13 23.0
branch 0 8 0.0
condition n/a
subroutine 1 3 33.3
pod 1 1 100.0
total 5 25 20.0


line stmt bran cond sub pod time code
1             package Minion::Command::minion::version;
2              
3 1     1   23829 use Mojo::Base 'Mojolicious::Command';
  1         11278  
  1         11  
4              
5             our $VERSION = '0.02';
6              
7             has description => 'Show version of Minion';
8             has usage => sub { shift->extract_usage };
9              
10             sub run {
11 0     0 1   my $self = shift;
12              
13 0 0         my $minion_version = eval 'use Minion; 1' ? $Minion::VERSION : 'n/a';
14              
15 0           print <
16             Perl ($^V, $^O)
17             Minion ($minion_version)
18             EOF
19              
20             # Check latest version on CPAN
21 0 0         my $latest = eval {
22 0     0     $self->app->ua->max_redirects(10)->tap(sub { $_->proxy->detect })
23             ->get('fastapi.metacpan.org/v1/release/Minion')
24 0           ->result->json->{version};
25             } or return;
26            
27 0           my $msg = 'This version is up to date, have fun!';
28 0 0         $msg = 'Thanks for testing a development release, you are awesome!'
29             if $latest < $Minion::VERSION;
30 0 0         $msg = "You might want to update your Minion to $latest!"
31             if $latest > $Minion::VERSION;
32 0           say $msg;
33             }
34              
35             =head1 NAME
36              
37             Minion::Command::minion::version - Minion version command
38              
39             =head1 VERSION
40              
41             Version 0.01
42              
43             =cut
44              
45             =head1 SYNOPSIS
46              
47             Usage: APPLICATIION minion version
48              
49             Options:
50             -h, --help Show this summary of available options
51              
52             =head1 ATTRIBUTES
53              
54             =head2 description
55              
56             my $description = $v->description;
57             $v = $v->description('Foo');
58            
59             Short description of this command, used for the command list.
60              
61             =head2 usage
62              
63             my $usage = $v->usage;
64             $v = $v->usage('Foo');
65              
66             Usage information for this command, used for the help screen.
67              
68             =head1 METHODS
69              
70             =head2 run
71              
72             $v->run(@ARGV);
73            
74             Run this command.
75              
76             =cut
77              
78             =head1 AUTHOR
79              
80             Bob Faist, C<< >>
81              
82             =head1 ACKNOWLEDGEMENTS
83              
84             Most of this code borrows heavily from L written by sri.
85              
86             =head1 LICENSE AND COPYRIGHT
87              
88             Copyright 2017 Bob Faist.
89              
90             This program is free software; you can redistribute it and/or modify it
91             under the terms of the the Artistic License (2.0). You may obtain a
92             copy of the full license at:
93              
94             L
95              
96             Any use, modification, and distribution of the Standard or Modified
97             Versions is governed by this Artistic License. By using, modifying or
98             distributing the Package, you accept this license. Do not use, modify,
99             or distribute the Package, if you do not accept this license.
100              
101             If your Modified Version has been derived from a Modified Version made
102             by someone other than you, you are nevertheless required to ensure that
103             your Modified Version complies with the requirements of this license.
104              
105             This license does not grant you the right to use any trademark, service
106             mark, tradename, or logo of the Copyright Holder.
107              
108             This license includes the non-exclusive, worldwide, free-of-charge
109             patent license to make, have made, use, offer to sell, sell, import and
110             otherwise transfer the Package with respect to any patent claims
111             licensable by the Copyright Holder that are necessarily infringed by the
112             Package. If you institute patent litigation (including a cross-claim or
113             counterclaim) against any party alleging that the Package constitutes
114             direct or contributory patent infringement, then this Artistic License
115             to you shall terminate on the date that such litigation is filed.
116              
117             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
118             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
119             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
120             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
121             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
122             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
123             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
124             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
125              
126              
127             =cut
128              
129             1; # End of Minion::Command::minion::version