| 1 | package ShipIt::Step; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | ShipIt::Step - a unit of work to be done prior to a release | ||
| 7 | |||
| 8 | =head1 OVERVIEW | ||
| 9 | |||
| 10 | Each step is implemented as a ShipIt::Step subclass, implementing an 'init' and 'run' method. | ||
| 11 | |||
| 12 | =cut | ||
| 13 | |||
| 14 | sub new { | ||
| 15 | my ($class, $conf) = @_; | ||
| 16 | my $self = bless {}, $class; | ||
| 17 | $self->init($conf); | ||
| 18 | return $self; | ||
| 19 | } | ||
| 20 | |||
| 21 | =head1 METHODS | ||
| 22 | |||
| 23 | =head2 init($conf) | ||
| 24 | |||
| 25 | Given the provided L<ShipIt::Conf> object, retrieve configuration keys | ||
| 26 | your step know about (using $conf->value($key)), and set fields in | ||
| 27 | $self (an empty hashref) for use later, in the 'run' method. You | ||
| 28 | can't access the configuration later in the 'run' method, as the | ||
| 29 | configuration is then locked down, already having been sanity checked | ||
| 30 | for unknown or missing keys. | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | # should override, if step needs configuration | ||
| 35 | sub init { | ||
| 36 | my ($self, $conf) = @_; | ||
| 37 | } | ||
| 38 | |||
| 39 | =head2 run($state) | ||
| 40 | |||
| 41 | Run your step. Return on success, die on failure. | ||
| 42 | |||
| 43 | Use the provided L<ShipIt::State> $state object to inquire about the | ||
| 44 | state of the release thus far, as populated by previous steps. | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | # return if okay, die if problems. | ||
| 49 | sub run { | ||
| 50 | my ($self, $state) = @_; | ||
| 51 | warn "Running NO-OP base class 'run' for step $self\n"; | ||
| 52 | } | ||
| 53 | |||
| 54 | =head1 SEE ALSO | ||
| 55 | |||
| 56 | L<ShipIt> - the ShipIt system itself | ||
| 57 | |||
| 58 | L<ShipIt::State> | ||
| 59 | |||
| 60 | L<ShipIt::Conf> | ||
| 61 | |||
| 62 | L<ShipIt::Step::FindVersion> | ||
| 63 | |||
| 64 | L<ShipIt::Step::ChangeVersion> | ||
| 65 | |||
| 66 | L<ShipIt::Step::DistTest> | ||
| 67 | |||
| 68 | L<ShipIt::Step::Commit> | ||
| 69 | |||
| 70 | L<ShipIt::Step::Tag> | ||
| 71 | |||
| 72 | L<ShipIt::Step::Release> | ||
| 73 | |||
| 74 | =cut | ||
| 75 | |||
| 76 | 1; |