Can be any type of data (but should be serializable)
Dependency resolution matches attribute names
Step Classes
Can declare productions, dependencies, or both
A class can have multiple productions
Steps must consume the Stepford::Role::Step role
or Stepford::Role::Step::FileGenerator
Step Classes Continued
Classes must define run() and last_run_time()
FileGenerator role provides last_run_time()
The run() should do all heavy lifting, not builders!
Simple Step Class
package Thing::Step::WriteDataFile;
use File::Slurp::Tiny qw( write_file );
use Moose;
with 'Stepford::Role::Step::FileGenerator';
has output_dir => (
traits => ['StepDependency'],
is => 'ro',
isa => 'Dir',
required => 1,
);
has data_file => (
traits => ['StepProduction'],
is => 'ro',
isa => 'File',
lazy => 1,
default => sub { $_[0]->output_dir()->file('data') },
);
sub run {
my $self = shift;
write_file( $self->data_file, 'foo' );
}
Creating a Stepford::Runner
Loads all your step classes
Doesn't do anything else until you call run()
Stepford::Runner->run
Calculates the dependency tree, throwing errors if ...
Two steps have productions of the same name
It finds a cycle in the dependencies
A step has a dependency that cannot be satisfied by an other step's productions
Calculates a concrete plan for the given final steps
Runs the plan by ...
Getting the next step class to run
Creating an object for the class
Parameters for the class can come from arguments passed
to run() as well as relevant productions from
previous steps
Checking if a step is up to date and running it if needed