Skip to content

Commit

Permalink
improved version command to be more responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 11, 2012
1 parent f02a5d9 commit da54954
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.49 2012-02-11 00:00:00
- Improved version command to be more responsive. (crab)
- Improved documentation.
- Fixed parent combinator bug in Mojo::DOM::CSS. (sharifulin, sri)

Expand Down
34 changes: 17 additions & 17 deletions lib/Mojolicious/Command/version.pm
Expand Up @@ -13,22 +13,6 @@ has usage => "usage: $0 version\n";
sub run {
my $self = shift;

# Latest version
my ($current) = $Mojolicious::VERSION =~ /^([^_]+)/;
my $latest = $current;
eval {
Mojo::UserAgent->new->max_redirects(3)
->get('search.cpan.org/dist/Mojolicious')->res->dom('.version')
->each(sub { $latest = $_->text if $_->text =~ /^[\d\.]+$/ });
};

# Message
my $message = 'This version is up to date, have fun!';
$message = 'Thanks for testing a development release, you are awesome!'
if $latest < $current;
$message = "You might want to update your Mojolicious to $latest."
if $latest > $current;

# EV
my $ev = eval 'use Mojo::IOWatcher::EV; 1' ? $EV::VERSION : 'not installed';

Expand Down Expand Up @@ -57,8 +41,24 @@ OPTIONAL
IO::Socket::SSL ($tls)
Net::Rendezvous::Publish ($bonjour)
$message
EOF

# Latest version
my ($current) = $Mojolicious::VERSION =~ /^([^_]+)/;
my $latest = $current;
eval {
Mojo::UserAgent->new->max_redirects(3)
->get('search.cpan.org/dist/Mojolicious')->res->dom('.version')
->each(sub { $latest = $_->text if $_->text =~ /^[\d\.]+$/ });
};

# Message
my $message = 'This version is up to date, have fun!';
$message = 'Thanks for testing a development release, you are awesome!'
if $latest < $current;
$message = "You might want to update your Mojolicious to $latest."
if $latest > $current;
say $message;
}

1;
Expand Down

0 comments on commit da54954

Please sign in to comment.