Commit | Line | Data |
4d2ad771 |
1 | package DX::Lib::FS::Action::CreateFile; |
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 | |
9 | has path => (is => 'ro', required => 1); |
10 | |
11 | sub expected_effect { |
12 | my ($self) = @_; |
13 | return +(path_status => PathStatus->new( |
14 | path => $self->path, |
15 | info => PathStatusInfo->new(is_file => 1, mode => '') |
16 | )); |
17 | } |
18 | |
19 | sub _do_run { |
20 | my ($self) = @_; |
21 | open my $fh, '>>', $self->path or die "Couldn't create ${\$self->path}: $!"; |
22 | +(path_status => PathStatus->new(path => $self->path)); |
23 | } |
24 | |
25 | 1; |