diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-05 14:26:10 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-05 14:26:44 -0700 |
commit | 97c6103625c4a45ae27d0c4ecfcdb70032be3bb9 (patch) | |
tree | 770bc229b21aa93446a59f5a939723d691517509 | |
parent | 8bd3e70d923fc2001d7f8aa5027e7abbcef58ee8 (diff) | |
download | consfigurator-97c6103625c4a45ae27d0c4ecfcdb70032be3bb9.tar.gz |
in fact, combine HAS-CONTENT and HAS-CONTENT-LINES
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | src/package.lisp | 1 | ||||
-rw-r--r-- | src/property/file.lisp | 9 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/package.lisp b/src/package.lisp index 7091f51..7e2e632 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -182,7 +182,6 @@ (:use #:cl #:consfigurator #:alexandria) (:local-nicknames (#:re #:cl-ppcre)) (:export #:has-content - #:has-content-lines #:contains-lines #:data-uploaded #:host-data-uploaded diff --git a/src/property/file.lisp b/src/property/file.lisp index 79b57da..45eb176 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -29,12 +29,9 @@ point in doing that here because WRITEFILE is synchronous." (writefile file (unlines new-lines) :try-preserve t)))) (defprop has-content :posix (path content) - "Ensure there is a file at PATH whose content is the string CONTENT." - (:apply (writefile path content))) - -(defprop has-content-lines :posix (path lines) - "Ensure there is a file at PATH whose lines are the elements of LINES." - (:apply (writefile path (unlines lines)))) + "Ensure there is a file at PATH whose content is CONTENT. +CONTENT can be a list of lines or a single string." + (:apply (writefile path (if (listp content) (unlines content) content)))) (defprop contains-lines :posix (path lines) "Ensure there is a file at PATH containing each of LINES once." |