use aliased 'DX::Lib::FS::Fact::PathStatus';
use aliased 'DX::Lib::FS::Fact::PathStatusInfo';
-use DX::Lib::FS::Guts;
use Moo;
with 'DX::Role::Action';
+with 'DX::Lib::FS::Role::RunOn';
has path => (is => 'ro', required => 1);
sub _do_run {
my ($self) = @_;
- DX::Lib::FS::Guts->create_directory($self->path, $self->mode);
+ $self->_call_guts(create_directory => $self->mode);
+(path_status => $self->path);
}
use aliased 'DX::Lib::FS::Fact::FileContent';
use aliased 'DX::Lib::FS::Fact::PathStatus';
use aliased 'DX::Lib::FS::Fact::PathStatusInfo';
-use DX::Lib::FS::Guts;
use Moo;
with 'DX::Role::Action';
+with 'DX::Lib::FS::Role::RunOn';
has path => (is => 'ro', required => 1);
sub _do_run {
my ($self) = @_;
- DX::Lib::FS::Guts->create_file($self->path, $self->mode, $self->data);
+ $self->_call_guts(create_file => $self->mode, $self->data);
+(path_status => $self->path);
}
package DX::Lib::FS::Action::RewriteFile;
use DX::Lib::FS::Fact::FileContent;
-use DX::Lib::FS::Guts;
use Moo;
with 'DX::Role::Action';
+with 'DX::Lib::FS::Role::RunOn';
has from => (is => 'ro', required => 1, handles => [ 'path' ]);
sub _do_run {
my ($self) = @_;
- DX::Lib::FS::Guts->rewrite_file($self->path, $self->final_content);
+ $self->_call_guts(rewrite_file => $self->final_content);
return +(file_content => $self->path);
}
package DX::Lib::FS::Action::SetPathMode;
-use DX::Lib::FS::Guts;
use Moo;
has path_status => (is => 'ro', required => 1);
has mode => (is => 'ro', required => 1);
with 'DX::Role::Action';
+with 'DX::Lib::FS::Role::RunOn';
sub expected_effect {
my ($self) = @_;
sub _do_run {
my ($self) = @_;
- DX::Lib::FS::Guts->set_path_mode($self->path, $self->mode);
+ $self->_call_guts(set_path_mode => $self->mode);
+(path_status => $self->path);
}
package DX::Lib::FS::Observation::FileContent;
use DX::Lib::FS::Fact::FileContent;
-use DX::Lib::FS::Guts;
use Moo;
has path => (is => 'ro', required => 1);
+with 'DX::Lib::FS::Role::RunOn';
+
sub run {
my ($self) = @_;
- my $data = DX::Lib::FS::Guts->file_content($self->path);
+ my $data = $self->_call_guts('file_content');
return () unless defined($data);
+(file_content => DX::Lib::FS::Fact::FileContent->new(
path => $self->path,
use aliased 'DX::Lib::FS::Fact::PathStatus';
use aliased 'DX::Lib::FS::Fact::PathStatusInfo';
-use DX::Lib::FS::Guts;
use Moo;
has path => (is => 'ro', required => 1);
+with 'DX::Lib::FS::Role::RunOn';
+
sub run {
my ($self) = @_;
- my $info = DX::Lib::FS::Guts->path_status_info($self->path);
+ my $info = $self->_call_guts('path_status_info');
(path_status => PathStatus->new(
path => $self->path,
($info