surprise! Object::Remote!
[scpubgit/DKit.git] / lib / DX / Lib / FS / Action / CreateDirectory.pm
1 package DX::Lib::FS::Action::CreateDirectory;
2
3 use aliased 'DX::Lib::FS::Fact::PathStatus';
4 use aliased 'DX::Lib::FS::Fact::PathStatusInfo';
5 use Moo;
6
7 with 'DX::Role::Action';
8 with 'DX::Lib::FS::Role::RunOn';
9
10 has path => (is => 'ro', required => 1);
11
12 has mode => (is => 'ro', predicate => 1);
13
14 sub expected_effect {
15   my ($self) = @_;
16   return +(path_status => PathStatus->new(
17     path => $self->path,
18     info => PathStatusInfo->new(
19       is_directory => 1,
20       mode => ($self->has_mode ? $self->mode : '')
21     )
22   ));
23 }
24
25 sub _do_run {
26   my ($self) = @_;
27   $self->_call_guts(create_directory => $self->mode);
28   +(path_status => $self->path);
29 }
30
31 1;