From: Matt S Trout Date: Fri, 14 Feb 2014 21:52:17 +0000 (+0000) Subject: create file with initial content X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6da2126a70828a85167d4522184055ea8e545ec1;p=scpubgit%2FDKit.git create file with initial content --- diff --git a/lib/DX/Lib/FS.pm b/lib/DX/Lib/FS.pm index e8b9ea1..1cdc1c8 100644 --- a/lib/DX/Lib/FS.pm +++ b/lib/DX/Lib/FS.pm @@ -131,6 +131,18 @@ our @RULES = ( [ member_of => 'L' => 'Lines' ] ] ], [ exists => [ 'A' ], [ has_action => qw(FC A) ], + [ does => 'A' => \'DX::Lib::FS::Action::CreateFile' ] ], + [ react => [ qw(FC L) ], sub { + $_[0]->but(data => $_[0]->data.$_[1]."\n") + } ], + [ 'cut' ] ], + [ file_content_line => [ qw(FC L) ], + [ not => + [ exists => [ 'Lines' ], + [ prop => 'FC' => \'lines' => 'Lines' ], + [ member_of => 'L' => 'Lines' ] ] ], + [ exists => [ 'A' ], + [ has_action => qw(FC A) ], [ does => 'A' => \'DX::Lib::FS::Action::RewriteFile' ] ], [ react => [ qw(FC L) ], sub { $_[0]->but_add($_[1]) } ], [ 'cut' ] ],