use Moo;
with 'DX::Role::Action';
+with 'DX::Lib::FS::Role::RunOn';
has path => (is => 'ro', required => 1);
+has mode => (is => 'ro', predicate => 1);
+
sub expected_effect {
my ($self) = @_;
return +(path_status => PathStatus->new(
path => $self->path,
- info => PathStatusInfo->new(is_directory => 1, mode => '')
+ info => PathStatusInfo->new(
+ is_directory => 1,
+ mode => ($self->has_mode ? $self->mode : '')
+ )
));
}
sub _do_run {
my ($self) = @_;
- mkdir($self->path) or die "Couldn't mkdir ${\$self->path}: $!";
- +(path_status => PathStatus->new(path => $self->path));
+ $self->_call_guts(create_directory => $self->mode);
+ +(path_status => $self->path);
}
1;