| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Dist::Zilla::Plugin::TravisYML; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:BBYRD'; # AUTHORITY | 
| 4 |  |  |  |  |  |  | our $VERSION = '1.13'; # VERSION | 
| 5 |  |  |  |  |  |  | # ABSTRACT: creates a .travis.yml file for Travis CI | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 1 |  |  | 1 |  | 579110 | use Moose; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 8 | 1 |  |  | 1 |  | 5398 | use sanity; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 8 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 306421 | use Dist::Zilla::File::InMemory; | 
|  | 1 |  |  |  |  | 73133 |  | 
|  | 1 |  |  |  |  | 51 |  | 
| 11 | 1 |  |  | 1 |  | 9 | use List::AllUtils 'first'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 610 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | # DZIL role ordering gets really weird here... | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | # FilePruner   - Since the .travis.yml file doesn't belong in the build | 
| 16 |  |  |  |  |  |  | # InstallTool  - Both cases need to be here after prereqs are built | 
| 17 |  |  |  |  |  |  | # AfterRelease - So that we have the build version in the build directory for Git::CommitBuild | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | with 'Dist::Zilla::Role::FilePruner'; | 
| 20 |  |  |  |  |  |  | with 'Dist::Zilla::Role::InstallTool'; | 
| 21 |  |  |  |  |  |  | with 'Dist::Zilla::Role::AfterRelease'; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | with 'Dist::Zilla::Role::FileInjector'; | 
| 24 |  |  |  |  |  |  | with 'Dist::Zilla::Role::TravisYML'; | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | around mvp_multivalue_args => sub { | 
| 27 |  |  |  |  |  |  | my ($orig, $self) = @_; | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | my @start = $self->$orig; | 
| 30 |  |  |  |  |  |  | return ( | 
| 31 |  |  |  |  |  |  | @start, qw(notify_email notify_irc irc_template extra_env), | 
| 32 |  |  |  |  |  |  | ### XXX: Yes, this ends up being 7*3*3=63 attributes, but such is the price of progress... | 
| 33 |  |  |  |  |  |  | ( | 
| 34 |  |  |  |  |  |  | map { $_, $_.'_dzil', $_.'_build' } | 
| 35 |  |  |  |  |  |  | map { $_, 'pre_'.$_, 'post_'.$_ } | 
| 36 |  |  |  |  |  |  | @Dist::Zilla::Role::TravisYML::phases | 
| 37 |  |  |  |  |  |  | ), | 
| 38 |  |  |  |  |  |  | ); | 
| 39 |  |  |  |  |  |  | }; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | sub prune_files { | 
| 42 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 43 | 0 |  |  | 0 |  |  | my $file = first { $_->name eq '.travis.yml' } @{$self->zilla->files}; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | ### !!! NINJA !!! ### | 
| 46 | 0 | 0 |  |  |  |  | $self->zilla->prune_file($file) if $file; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | # Yes, this plugin has nothing to do with installers, but this is the only way to: | 
| 50 |  |  |  |  |  |  | # | 
| 51 |  |  |  |  |  |  | # 1. Make sure things like PruneCruft don't interfere with YAML building. | 
| 52 |  |  |  |  |  |  | # 2. Create the YAML file -after- prereqs have been finalized | 
| 53 |  |  |  |  |  |  | # 3. Do it in a way that doesn't actually add any files into the build dir or tar.gz. | 
| 54 |  |  |  |  |  |  | # | 
| 55 |  |  |  |  |  |  | # See also: https://github.com/SineSwiper/Dist-Zilla-TravisCI/issues/11 | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | sub setup_installer { | 
| 58 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 59 | 0 |  |  |  |  |  | $self->build_travis_yml;  # Not much here... most of the magic is in the role | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | sub after_release { | 
| 63 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 64 | 0 | 0 |  |  |  |  | return unless $self->build_branch; | 
| 65 | 0 |  | 0 |  |  |  | my $file = $self->build_travis_yml(1) || return; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | # Now we have to add the file back in | 
| 68 | 0 |  |  |  |  |  | $self->add_file( | 
| 69 |  |  |  |  |  |  | # Since we put the file in the build directory, we have to use InMemory to | 
| 70 |  |  |  |  |  |  | # prevent the file paths from getting mismatched with what is in zilla->files | 
| 71 |  |  |  |  |  |  | Dist::Zilla::File::InMemory->new({ | 
| 72 |  |  |  |  |  |  | name    => '.travis.yml', | 
| 73 |  |  |  |  |  |  | content => scalar $file->slurp, | 
| 74 |  |  |  |  |  |  | mode    => $file->stat->mode & 0755, # kill world-writeability | 
| 75 |  |  |  |  |  |  | }) | 
| 76 |  |  |  |  |  |  | ); | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 80 |  |  |  |  |  |  | 42; | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | __END__ | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =pod | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =encoding UTF-8 | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =head1 NAME | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | Dist::Zilla::Plugin::TravisYML - creates a .travis.yml file for Travis CI | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | [TravisYML] | 
| 95 |  |  |  |  |  |  | ; defaults | 
| 96 |  |  |  |  |  |  | build_branch = /^build\/.*/ | 
| 97 |  |  |  |  |  |  | notify_email = 1 | 
| 98 |  |  |  |  |  |  | notify_irc   = 0 | 
| 99 |  |  |  |  |  |  | mvdt         = 0 | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | ; These options are probably a good idea | 
| 102 |  |  |  |  |  |  | ; if you are going to use a build_branch | 
| 103 |  |  |  |  |  |  | [Git::CommitBuild] | 
| 104 |  |  |  |  |  |  | release_branch  = build/%b | 
| 105 |  |  |  |  |  |  | release_message = Release build of v%v (on %b) | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | [@Git] | 
| 108 |  |  |  |  |  |  | allow_dirty = dist.ini | 
| 109 |  |  |  |  |  |  | allow_dirty = README | 
| 110 |  |  |  |  |  |  | allow_dirty = .travis.yml | 
| 111 |  |  |  |  |  |  | push_to = origin master:master | 
| 112 |  |  |  |  |  |  | push_to = origin build/master:build/master | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | This plugin creates a C<<< .travis.yml >>> file in your distro for CI smoke testing (or what we like | 
| 117 |  |  |  |  |  |  | to call L<"chain smoking"|Dist::Zilla::App::Command::chainsmoke/CHAIN SMOKING?>).  It will also | 
| 118 |  |  |  |  |  |  | (optionally) create a separate C<<< .travis.yml >>> file for your build directory after a release. | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | Why two files?  Because chain smoking via DZIL will work a lot differently than a traditional | 
| 121 |  |  |  |  |  |  | C<<< Makefile.PL; make >>>.  This tests both your distribution repo environment as well as what a | 
| 122 |  |  |  |  |  |  | CPAN user would see. | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | Of course, you still need to L<turn on Travis CI|http://docs.travis-ci.com/user/getting-started/> | 
| 125 |  |  |  |  |  |  | and the remote still needs to be a GitHub repo for any of this to work. | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =head1 OPTIONS | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =head2 build_branch | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | This is a regular expression indicating which (build) branches are okay for running through | 
| 132 |  |  |  |  |  |  | Travis CI, per the L<configuration|http://about.travis-ci.org/docs/user/build-configuration/>'s | 
| 133 |  |  |  |  |  |  | branch whitelist option.  The value will be inserted directly as an C<<< only >>> clause.  The default | 
| 134 |  |  |  |  |  |  | is C<<< /^build\/.*/ >>>. | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | This more or less requires L<Git::CommitBuild|Dist::Zilla::Plugin::Git::CommitBuild> to work. | 
| 137 |  |  |  |  |  |  | (Ordering is important, too.  TravisYML comes before Git::CommitBuild.)  You should change | 
| 138 |  |  |  |  |  |  | this to match up with the C<<< release_branch >>> option, if your build branch is not going to reside | 
| 139 |  |  |  |  |  |  | in a C<<< build/* >>> structure. | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | Also, if you want to disable build branch testing, you can set this to C<<< 0 >>>. | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =head2 dzil_branch | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | Like C<<< build_branch >>>, this is a regular expression indicating which branches are okay for | 
| 146 |  |  |  |  |  |  | running through Travis CI for DZIL chainsmoking.  The value will be inserted directly as | 
| 147 |  |  |  |  |  |  | an C<<< only >>> clause on your main DZIL C<<< .travis.yml >>> file.  The default is not set, so that it is | 
| 148 |  |  |  |  |  |  | ran for all of your branches. | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | If you want to disable "after release" testing, because, say, you're using L<Travis::TestRelease|Dist::Zilla::Plugin::Travis::TestRelease> | 
| 151 |  |  |  |  |  |  | to test things beforehand, you can restrict Travis to only test the release_testing branches: | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | dzil_branch = /^release_testing\/.*/ | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =head2 notify_email | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | This affects the notification options of the resulting YML file.  It can either be set to: | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | =over | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | =item * | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | C<<< 0 >>> = Disable email notification | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | =item * | 
| 166 |  |  |  |  |  |  |  | 
| 167 |  |  |  |  |  |  | C<<< 1 >>> = Enable email notification, using Travis CI's default email scheme | 
| 168 |  |  |  |  |  |  |  | 
| 169 |  |  |  |  |  |  | =item * | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | C<<< foo@bar.com >>> (can be multiple; one per line) = Enable email notification to these email | 
| 172 |  |  |  |  |  |  | addresses | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | =back | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | The default is C<<< 1 >>>. | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | =head2 notify_irc | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | This affects the notification options of the resulting YML file.  It can either be set to: | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | =over | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =item * | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | C<<< 0 >>> = Disable IRC notification | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | =item * | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | C<<< 1 >>> = Enable IRC notification, using the C<<< IRC >>> or C<<< x_irc >>> meta resource value | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | =item * | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | C<<< irc://irc.perl.org/#roomname >>> (can be multiple; one per line) = Enable IRC notification | 
| 195 |  |  |  |  |  |  | to these IRC serverE<sol>rooms | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | =back | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | The default is C<<< 0 >>>.  Please ask permission from the room channel operators before enabling | 
| 200 |  |  |  |  |  |  | bot notification. | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | =head2 irc_template | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | Only applies when IRC notification is on.  The default is: | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | %{branch}#%{build_number} by %{author}: %{message} (%{build_url}) | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | This option can be specified more than once for multiple lines.  See L<Travis-CI's IRC notification docs|http://about.travis-ci.org/docs/user/notifications/#IRC-notification> | 
| 209 |  |  |  |  |  |  | for a list of variables that can be used. | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | =head2 perl_version | 
| 212 |  |  |  |  |  |  |  | 
| 213 |  |  |  |  |  |  | This is a space-delimited option with a list of the perl versions to test against.  Versions can | 
| 214 |  |  |  |  |  |  | be prepended with a dash to indicate that the version is allowed to fail. | 
| 215 |  |  |  |  |  |  |  | 
| 216 |  |  |  |  |  |  | The default is all of the major stable releases of Perl from 5.8 on up, including the | 
| 217 |  |  |  |  |  |  | bleeding edge of Perl (called 'blead').  This works even if Travis doesn't actually carry | 
| 218 |  |  |  |  |  |  | that version, thanks to Haarg's L<Perl Travis Helper tools|http://github.com/haarg/perl-travis-helper>, | 
| 219 |  |  |  |  |  |  | used by this module to auto-install the right version of Perl via L<Perlbrew|http://perlbrew.pl/>. | 
| 220 |  |  |  |  |  |  |  | 
| 221 |  |  |  |  |  |  | Versions 5.8 and 'blead' are marked as "allowed to fail" versions.  The former is because | 
| 222 |  |  |  |  |  |  | there are various DZIL plugins that require 5.10.  The latter because, well, it's bleeding | 
| 223 |  |  |  |  |  |  | edge, and the tests may be failing because it's Perl's fault. | 
| 224 |  |  |  |  |  |  |  | 
| 225 |  |  |  |  |  |  | You can restrict it down to only a few like this: | 
| 226 |  |  |  |  |  |  |  | 
| 227 |  |  |  |  |  |  | perl_version = 5.10 5.12 5.14.3 -5.8 | 
| 228 |  |  |  |  |  |  |  | 
| 229 |  |  |  |  |  |  | Note that any custom settings here will prevent any newer versions from being auto-added (as this | 
| 230 |  |  |  |  |  |  | distro is updated). | 
| 231 |  |  |  |  |  |  |  | 
| 232 |  |  |  |  |  |  | =head2 perl_version_build | 
| 233 |  |  |  |  |  |  |  | 
| 234 |  |  |  |  |  |  | This is just like C<<< perl_version >>>, except for build branches.  Both of these options are used in | 
| 235 |  |  |  |  |  |  | dual DZIL+build YAML files as well.  (See the C<<< support_builddir >>> option for more details.) | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  | The default is whatever C<<< perl_version >>> is set to.  You may want to force 5.8 to disallow failure: | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | perl_version_build = 5.20 5.18 5.16 5.14 5.12 5.10 5.8 | 
| 240 |  |  |  |  |  |  |  | 
| 241 |  |  |  |  |  |  | This, of course, requires that your module is compatible with 5.8. | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | =head2 mvdt | 
| 244 |  |  |  |  |  |  |  | 
| 245 |  |  |  |  |  |  | Turning this on enables L<Minimum Version Dependency Testing|Dist::Zilla::TravisCI::MVDT>.  This | 
| 246 |  |  |  |  |  |  | will make your YML file less of a static file, as it will now include commands to forcefully | 
| 247 |  |  |  |  |  |  | B<downgrade> your dependencies to the lowest version that your prereqs said they would be able | 
| 248 |  |  |  |  |  |  | to use. | 
| 249 |  |  |  |  |  |  |  | 
| 250 |  |  |  |  |  |  | While going through the MVDT process is recommended, it can be a royal PITA sometimes, so this | 
| 251 |  |  |  |  |  |  | option isn't on by default.  It's HIGHLY recommended that you read the above doc first to get an | 
| 252 |  |  |  |  |  |  | idea of what you're diving into. | 
| 253 |  |  |  |  |  |  |  | 
| 254 |  |  |  |  |  |  | This applies to both YML files. | 
| 255 |  |  |  |  |  |  |  | 
| 256 |  |  |  |  |  |  | =head2 test_authordeps | 
| 257 |  |  |  |  |  |  |  | 
| 258 |  |  |  |  |  |  | Controls whether author dependencies will be tested while DZIL chainsmoking.  This option | 
| 259 |  |  |  |  |  |  | is also directly linked to verbosity and parallelization of the author deps: | 
| 260 |  |  |  |  |  |  |  | 
| 261 |  |  |  |  |  |  | =over | 
| 262 |  |  |  |  |  |  |  | 
| 263 |  |  |  |  |  |  | =item * | 
| 264 |  |  |  |  |  |  |  | 
| 265 |  |  |  |  |  |  | C<<< 0 >>> = No tests or verbosity, all files are downloadedE<sol>installed in parallel (10 processes at a time) | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | =item * | 
| 268 |  |  |  |  |  |  |  | 
| 269 |  |  |  |  |  |  | C<<< 1 >>> = Each module is downloaded one at a time, tested, and with verbosity turned on | 
| 270 |  |  |  |  |  |  |  | 
| 271 |  |  |  |  |  |  | =back | 
| 272 |  |  |  |  |  |  |  | 
| 273 |  |  |  |  |  |  | The default is C<<< 0 >>>. | 
| 274 |  |  |  |  |  |  |  | 
| 275 |  |  |  |  |  |  | =head2 test_deps | 
| 276 |  |  |  |  |  |  |  | 
| 277 |  |  |  |  |  |  | Just like C<<< test_authordeps >>>, but for the real deps that the module needs.  This also affects | 
| 278 |  |  |  |  |  |  | testing for build chainsmoking as well. | 
| 279 |  |  |  |  |  |  |  | 
| 280 |  |  |  |  |  |  | The default is C<<< 1 >>>. | 
| 281 |  |  |  |  |  |  |  | 
| 282 |  |  |  |  |  |  | =head2 support_builddir | 
| 283 |  |  |  |  |  |  |  | 
| 284 |  |  |  |  |  |  | Controls whether to build a dual DZIL+build YAML or a standard DZIL YAML.  This is different than a | 
| 285 |  |  |  |  |  |  | build branch YAML, as that is solely used for build tests. | 
| 286 |  |  |  |  |  |  |  | 
| 287 |  |  |  |  |  |  | This new config would add a new env variable and double the number of Travis tests.  It is expected | 
| 288 |  |  |  |  |  |  | that a build directory would be found in C<<< .build/testing >>>.  If it doesn't exist, the build tests | 
| 289 |  |  |  |  |  |  | would essentially be a no-op. | 
| 290 |  |  |  |  |  |  |  | 
| 291 |  |  |  |  |  |  | This is used by L<Travis::TestRelease|Dist::Zilla::Plugin::Travis::TestRelease>'s release testing | 
| 292 |  |  |  |  |  |  | branches, if its C<<< create_builddir >>> option is also turned on.  However, if you have some other | 
| 293 |  |  |  |  |  |  | mechanism to dump the build release into that directory (and don't mind a combined DZIL+build master | 
| 294 |  |  |  |  |  |  | branch), this option could be used to test that sort of branch. | 
| 295 |  |  |  |  |  |  |  | 
| 296 |  |  |  |  |  |  | Because it can make the config (and Travis tests) kind of messy if you're not using them, the default | 
| 297 |  |  |  |  |  |  | is C<<< 0 >>>. | 
| 298 |  |  |  |  |  |  |  | 
| 299 |  |  |  |  |  |  | =head2 Custom Commands | 
| 300 |  |  |  |  |  |  |  | 
| 301 |  |  |  |  |  |  | For the most part, the default command sets for TravisYML serves its purpose.  However, you may | 
| 302 |  |  |  |  |  |  | have some unusual situation from within your distro that demands a custom command or two.  For | 
| 303 |  |  |  |  |  |  | that purpose, there is a set of "dynamic" options available to add or replace any part of the | 
| 304 |  |  |  |  |  |  | command list for Travis. | 
| 305 |  |  |  |  |  |  |  | 
| 306 |  |  |  |  |  |  | They are in the form of: | 
| 307 |  |  |  |  |  |  |  | 
| 308 |  |  |  |  |  |  | $pos$phase$filetype | 
| 309 |  |  |  |  |  |  |  | 
| 310 |  |  |  |  |  |  | $pos      = Either 'pre_' or 'post_' (optional) | 
| 311 |  |  |  |  |  |  | $phase    = One of the Travis-CI testing phases (required) | 
| 312 |  |  |  |  |  |  | $filetype = Either '_dzil' or '_build' (optional) | 
| 313 |  |  |  |  |  |  |  | 
| 314 |  |  |  |  |  |  | See L<Travis-CI's Build Lifecycle|http://docs.travis-ci.com/user/build-lifecycle/> | 
| 315 |  |  |  |  |  |  | for a list of phases. | 
| 316 |  |  |  |  |  |  |  | 
| 317 |  |  |  |  |  |  | The positions determine if the commands are to be added at the beginning (C<<< pre_ >>>), the end (C<<< post_ >>>), or | 
| 318 |  |  |  |  |  |  | replacing (no prefix) the existing code.  Replace entire blocks at your own risk; TravisYML may change | 
| 319 |  |  |  |  |  |  | the original blocks for bug fixes or new features, and you wouldn't see them if they were replaced. | 
| 320 |  |  |  |  |  |  |  | 
| 321 |  |  |  |  |  |  | The file type determines if these command changes are for the DZIL YML file (C<<< _dzil >>>), the build YML file | 
| 322 |  |  |  |  |  |  | (C<<< _build >>>), or both (no suffix). | 
| 323 |  |  |  |  |  |  |  | 
| 324 |  |  |  |  |  |  | For example, this would give you the following combinations for the 'before_install' phase: | 
| 325 |  |  |  |  |  |  |  | 
| 326 |  |  |  |  |  |  | before_install            = Replace all before_install blocks | 
| 327 |  |  |  |  |  |  | pre_before_install        = Unshift lines to all before_install blocks | 
| 328 |  |  |  |  |  |  | post_before_install       = Push lines to all before_install blocks | 
| 329 |  |  |  |  |  |  | before_install_dzil       = Replace DZIL before_install block | 
| 330 |  |  |  |  |  |  | pre_before_install_dzil   = Unshift lines to DZIL before_install block | 
| 331 |  |  |  |  |  |  | post_before_install_dzil  = Push lines to DZIL before_install block | 
| 332 |  |  |  |  |  |  | before_install_build      = Replace build before_install block | 
| 333 |  |  |  |  |  |  | pre_before_install_build  = Unshift lines to build before_install block | 
| 334 |  |  |  |  |  |  | post_before_install_build = Push lines to build before_install block | 
| 335 |  |  |  |  |  |  |  | 
| 336 |  |  |  |  |  |  | These options are all multi-lined, so you can add as many commands as you need: | 
| 337 |  |  |  |  |  |  |  | 
| 338 |  |  |  |  |  |  | pre_install_dzil = export AUTHOR_TESTING=1 | 
| 339 |  |  |  |  |  |  | pre_install_dzil = echo "Author testing is now "$AUTHOR_TESTING | 
| 340 |  |  |  |  |  |  |  | 
| 341 |  |  |  |  |  |  | =head1 WHY USE THIS? | 
| 342 |  |  |  |  |  |  |  | 
| 343 |  |  |  |  |  |  | A common question I get with this plugin is: I<"If .travis.yml is a static file, why bother with a plugin?"> | 
| 344 |  |  |  |  |  |  |  | 
| 345 |  |  |  |  |  |  | Three reasons: | 
| 346 |  |  |  |  |  |  |  | 
| 347 |  |  |  |  |  |  | 1. B<DZIL and Travis-CI interactions> - If you look at the YML file itself, you'll notice that it's not a 5-line | 
| 348 |  |  |  |  |  |  | file.  It's not as simple as telling Travis that this is a Perl distro and GO.  Both Travis-CI and DZIL are | 
| 349 |  |  |  |  |  |  | ever changing platforms, and this plugin will keep things in sync with those two platforms.  (For example, | 
| 350 |  |  |  |  |  |  | Travis VMs recently stopped using a valid nameE<sol>email for git's user.* config items, which impacted DZIL smoking | 
| 351 |  |  |  |  |  |  | with certain Git plugins.  So, TravisYML had to compensate.)  I personally use this plugin myself, so if there | 
| 352 |  |  |  |  |  |  | are new issues that come up, I should be one of the first to notice. | 
| 353 |  |  |  |  |  |  |  | 
| 354 |  |  |  |  |  |  | 2. B<Build branches> - Build branches are great for having a perfect copy of your current release, giving non-DZIL | 
| 355 |  |  |  |  |  |  | folks a chance to submit patches, and for running a Travis-CI test on something that is close to the CPAN | 
| 356 |  |  |  |  |  |  | release as possible.  However, setting that up can be tricky, and it requires a second YML file just for the build | 
| 357 |  |  |  |  |  |  | branch.  TravisYML manages that by hiding the DZIL C<<< .travis.yml >>> file prior to building, and then creating a new | 
| 358 |  |  |  |  |  |  | one after release (but before the build branch is commited). | 
| 359 |  |  |  |  |  |  |  | 
| 360 |  |  |  |  |  |  | 3. B<MVDT> - If you want to brave through the L<Minimum Version Dependency Testing|Dist::Zilla::TravisCI::MVDT> | 
| 361 |  |  |  |  |  |  | process, this will automate the YML generation for you. | 
| 362 |  |  |  |  |  |  |  | 
| 363 |  |  |  |  |  |  | =head1 AVAILABILITY | 
| 364 |  |  |  |  |  |  |  | 
| 365 |  |  |  |  |  |  | The project homepage is L<https://github.com/SineSwiper/Dist-Zilla-TravisCI>. | 
| 366 |  |  |  |  |  |  |  | 
| 367 |  |  |  |  |  |  | The latest version of this module is available from the Comprehensive Perl | 
| 368 |  |  |  |  |  |  | Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN | 
| 369 |  |  |  |  |  |  | site near you, or see L<https://metacpan.org/module/Dist::Zilla::TravisCI/>. | 
| 370 |  |  |  |  |  |  |  | 
| 371 |  |  |  |  |  |  | =head1 AUTHOR | 
| 372 |  |  |  |  |  |  |  | 
| 373 |  |  |  |  |  |  | Brendan Byrd <bbyrd@cpan.org> | 
| 374 |  |  |  |  |  |  |  | 
| 375 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 376 |  |  |  |  |  |  |  | 
| 377 |  |  |  |  |  |  | This software is Copyright (c) 2015 by Brendan Byrd. | 
| 378 |  |  |  |  |  |  |  | 
| 379 |  |  |  |  |  |  | This is free software, licensed under: | 
| 380 |  |  |  |  |  |  |  | 
| 381 |  |  |  |  |  |  | The Artistic License 2.0 (GPL Compatible) | 
| 382 |  |  |  |  |  |  |  | 
| 383 |  |  |  |  |  |  | =cut |