9b6086f42aa1aaf76a9a7c49e68f0dbeb0cd2194
[scpubgit/DX.git] / lib / DX / Role / SimpleAction.pm
1 package DX::Role::SimpleAction;
2
3 use DX::Role;
4
5 with 'DX::Role::Action';
6
7 has target_path => (is => 'ro', required => 1);
8
9 has _updates => (is => 'lazy');
10
11 requires '_build__updates';
12
13 sub dry_run {
14   my ($self, $hyp) = @_;
15   my ($scope, @events) = $hyp->scope->apply_updates($self->_updates);
16   return (
17     $hyp->but(
18       scope => $scope,
19       actions => [ @{$hyp->actions}, $self ],
20       action_applications => [ @{$hyp->action_applications}, $self ],
21     ),
22     @events
23   );
24 }
25
26 sub run { shift->updates }
27
28 1;