ensure all author deps are installed before doing release testing
Jesse Luehrs [Mon, 3 Jan 2011 20:07:08 +0000 (14:07 -0600)]
dist.ini
inc/RequireAuthorDeps.pm [new file with mode: 0644]

index c952a7e..4fdcd06 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -6,6 +6,8 @@ copyright_holder = Infinity Interactive, Inc.
 
 version = 1.9901
 
+[=inc::RequireAuthorDeps]
+
 [=inc::GatherDir]
 [PruneCruft]
 [ManifestSkip]
diff --git a/inc/RequireAuthorDeps.pm b/inc/RequireAuthorDeps.pm
new file mode 100644 (file)
index 0000000..d19966f
--- /dev/null
@@ -0,0 +1,25 @@
+package inc::RequireAuthorDeps;
+
+use Moose;
+
+use Try::Tiny;
+
+with 'Dist::Zilla::Role::BeforeRelease';
+
+sub before_release {
+    my $self = shift;
+
+    $self->log("Ensuring all author dependencies are installed");
+    my $req = Version::Requirements->new;
+    my $prereqs = $self->zilla->prereqs;
+
+    for my $phase (qw(build test configure runtime develop)) {
+        $req->add_requirements($prereqs->requirements_for($phase, 'requires'));
+    }
+
+    for my $mod (grep { $_ ne 'perl' } $req->required_modules) {
+        Class::MOP::load_class($mod);
+    }
+}
+
+1;