From: Matt S Trout Date: Sat, 22 Feb 2014 12:48:08 +0000 (+0000) Subject: surprise! Object::Remote! X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9854aea02301c4a610b98f4ec3ee3bc749e91d45;p=scpubgit%2FDKit.git surprise! Object::Remote! --- diff --git a/lib/DX/Lib/FS/Action/CreateDirectory.pm b/lib/DX/Lib/FS/Action/CreateDirectory.pm index 5c8346b..cd90de1 100644 --- a/lib/DX/Lib/FS/Action/CreateDirectory.pm +++ b/lib/DX/Lib/FS/Action/CreateDirectory.pm @@ -2,10 +2,10 @@ package DX::Lib::FS::Action::CreateDirectory; 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); @@ -24,7 +24,7 @@ sub expected_effect { 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); } diff --git a/lib/DX/Lib/FS/Action/CreateFile.pm b/lib/DX/Lib/FS/Action/CreateFile.pm index e2b874b..314a516 100644 --- a/lib/DX/Lib/FS/Action/CreateFile.pm +++ b/lib/DX/Lib/FS/Action/CreateFile.pm @@ -3,10 +3,10 @@ package DX::Lib::FS::Action::CreateFile; 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); @@ -30,7 +30,7 @@ sub expected_effect { 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); } diff --git a/lib/DX/Lib/FS/Action/RewriteFile.pm b/lib/DX/Lib/FS/Action/RewriteFile.pm index c636e35..9b1b4fb 100644 --- a/lib/DX/Lib/FS/Action/RewriteFile.pm +++ b/lib/DX/Lib/FS/Action/RewriteFile.pm @@ -1,10 +1,10 @@ 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' ]); @@ -40,7 +40,7 @@ sub expected_effect { 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); } diff --git a/lib/DX/Lib/FS/Action/SetPathMode.pm b/lib/DX/Lib/FS/Action/SetPathMode.pm index 8613448..6366d49 100644 --- a/lib/DX/Lib/FS/Action/SetPathMode.pm +++ b/lib/DX/Lib/FS/Action/SetPathMode.pm @@ -1,12 +1,12 @@ 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) = @_; @@ -16,7 +16,7 @@ sub expected_effect { 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); } diff --git a/lib/DX/Lib/FS/Observation/FileContent.pm b/lib/DX/Lib/FS/Observation/FileContent.pm index ee5a441..e8ed309 100644 --- a/lib/DX/Lib/FS/Observation/FileContent.pm +++ b/lib/DX/Lib/FS/Observation/FileContent.pm @@ -1,14 +1,15 @@ 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, diff --git a/lib/DX/Lib/FS/Observation/PathStatus.pm b/lib/DX/Lib/FS/Observation/PathStatus.pm index a7b05cf..16466e7 100644 --- a/lib/DX/Lib/FS/Observation/PathStatus.pm +++ b/lib/DX/Lib/FS/Observation/PathStatus.pm @@ -2,14 +2,15 @@ package DX::Lib::FS::Observation::PathStatus; 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