create file with initial content
[scpubgit/DKit.git] / lib / DX / Lib / FS.pm
index e8b9ea1..1cdc1c8 100644 (file)
@@ -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' ] ],