Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding ability to upgrade dependencies with TASK_UPGRADE

  • Loading branch information...
commit 563898785d5a39af66c6d5ad3a296dfb7568bb3e 1 parent 23684cf
@yanick authored
Showing with 21 additions and 2 deletions.
  1. +15 −2 Build.PL
  2. +6 −0 lib/Task/BeLike/YANICK.pm
View
17 Build.PL
@@ -1,10 +1,17 @@
-use 5.006; #warnings.pm;
+use 5.10.0;
use strict;
use warnings;
+use Getopt::Long;
use Module::Build;
+GetOptions(
+ upgrade => \my $opt_upgrade,
+);
+
+$opt_upgrade ||= $ENV{TASK_UPGRADE};
+
my $builder = Module::Build->new(
module_name => 'Task::BeLike::YANICK',
license => 'perl',
@@ -38,9 +45,15 @@ sub get_requirements {
next unless /^=item \s+/x;
my ( $module, $version ) = split ' ' => $';
-
$module =~ s/^ L< (.*?) > $/$1/x;
+ if ( $opt_upgrade and not $version ) {
+ require CPANPLUS::Backend;
+ state $cb = CPANPLUS::Backend->new;
+
+ $version = $cb->module_tree( $module )->package_version;
+ }
+
$requirements{$module} = $version || 0;
}
View
6 lib/Task/BeLike/YANICK.pm
@@ -16,6 +16,12 @@ Task::BeLike::YANICK - like Yanick? Be like Yanick!
This L<Task> module installs the modules that I use on
a regular basis.
+Wait, there is more!
+It can also B<update> the modules that I use on a regular basis!
+To do that, do
+
+ TASK_UPGRADE=1 cpan -f Task::BeLike::YANICK
+
=head1 MODULES INSTALLED BY THIS TASK
=head2 Object-Oriented Frameworks
Please sign in to comment.
Something went wrong with that request. Please try again.