| 1 | 1 | ▶ | use 5.008; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Dist::Zilla::Plugin::SVK::Check; | ||
| 6 | # ABSTRACT: check your svk repository before releasing | ||
| 7 | |||
| 8 | 0 | ▶ | use SVK; use SVK::XD; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | use Moose; | ||
| 10 | |||
| 11 | with 'Dist::Zilla::Role::BeforeRelease'; | ||
| 12 | with 'Dist::Zilla::Role::SVK::DirtyFiles'; | ||
| 13 | |||
| 14 | use Cwd; | ||
| 15 | |||
| 16 | # -- public methods | ||
| 17 | |||
| 18 | sub before_release { | ||
| 19 | my $self = shift; | ||
| 20 | my $output; | ||
| 21 | |||
| 22 | my $dir = getcwd; | ||
| 23 | my @file = qx "svk status"; | ||
| 24 | |||
| 25 | # everything but files listed in allow_dirty should be in a | ||
| 26 | # clean state | ||
| 27 | my @dirty = $self->list_dirty_files; | ||
| 28 | if ( @dirty ) { | ||
| 29 | my $errmsg = | ||
| 30 | "branch at $dir has modified files not on waiver list:\n" . | ||
| 31 | join "\n", map { "\t$_" } @dirty; | ||
| 32 | $self->log_fatal($errmsg); | ||
| 33 | } | ||
| 34 | |||
| 35 | # no files should be untracked | ||
| 36 | my @virgin = grep m/^\?/, @file; | ||
| 37 | if ( @virgin ) { | ||
| 38 | my $errmsg = | ||
| 39 | "branch at $dir has unversioned files:\n" . | ||
| 40 | join "\n", map { "\t$_" } @virgin; | ||
| 41 | $self->log_fatal($errmsg); | ||
| 42 | } | ||
| 43 | |||
| 44 | $self->log( "branch \$branch is in a clean state and no unversioned files" ); | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | 1; | ||
| 49 | |||
| 50 | |||
| 51 | =pod | ||
| 52 | |||
| 53 | =head1 NAME | ||
| 54 | |||
| 55 | Dist::Zilla::Plugin::SVK::Check - check your svk repository before releasing | ||
| 56 | |||
| 57 | =head1 VERSION | ||
| 58 | |||
| 59 | version 0.10 | ||
| 60 | |||
| 61 | =head1 SYNOPSIS | ||
| 62 | |||
| 63 | In your F<dist.ini>: | ||
| 64 | |||
| 65 | [SVK::Check] | ||
| 66 | allow_dirty = dist.ini | ||
| 67 | allow_dirty = README | ||
| 68 | changelog = Changes ; this is the default | ||
| 69 | |||
| 70 | =head1 DESCRIPTION | ||
| 71 | |||
| 72 | This plugin checks that svk is in a clean state before releasing. The following checks are performed before releasing: | ||
| 73 | |||
| 74 | =over 4 | ||
| 75 | |||
| 76 | =item * there should be no unversioned files in the working copy | ||
| 77 | |||
| 78 | =item * the working copy should be without local modifications. The files listed in C<allow_dirty> can be modified locally, though. | ||
| 79 | |||
| 80 | =back | ||
| 81 | |||
| 82 | If those conditions are not met, the plugin will die, and the release will thus be aborted. This lets you fix the problems before continuing. | ||
| 83 | |||
| 84 | The plugin accepts the following options: | ||
| 85 | |||
| 86 | =over 4 | ||
| 87 | |||
| 88 | =item * changelog - the name of your changelog file. defaults to F<Changes>. | ||
| 89 | |||
| 90 | =item * allow_dirty - a file that is allowed to have local modifications. This option may appear multiple times. The default list is F<dist.ini> and the changelog file given by C<changelog>. You can use C<allow_dirty => to prohibit all local modifications. | ||
| 91 | |||
| 92 | =back | ||
| 93 | |||
| 94 | =for Pod::Coverage before_release | ||
| 95 | |||
| 96 | =head1 AUTHOR | ||
| 97 | |||
| 98 | Dr Bean <drbean at (a) cpan dot (.) org> | ||
| 99 | |||
| 100 | =head1 COPYRIGHT AND LICENSE | ||
| 101 | |||
| 102 | This software is copyright (c) 2010 by Dr Bean. | ||
| 103 | |||
| 104 | This is free software; you can redistribute it and/or modify it under | ||
| 105 | the same terms as the Perl 5 programming language system itself. | ||
| 106 | |||
| 107 | =cut | ||
| 108 | |||
| 109 | |||
| 110 | __END__ | ||