Commit a16a6ac8 authored by Rüdiger Sonderfeld's avatar Rüdiger Sonderfeld

Check if file name matches recipe name.

This should prevent mistakes such as 5002d1a9.
Signed-off-by: 's avatarRüdiger Sonderfeld <ruediger@c-plusplus.de>
parent 5002d1a9
......@@ -271,13 +271,13 @@ object or a file path."
(interactive (list (current-buffer)))
(if (bufferp file-or-buffer)
(with-current-buffer file-or-buffer
(el-get-check-recipe-in-current-buffer))
(el-get-check-recipe-in-current-buffer (buffer-file-name)))
(with-temp-buffer
(erase-buffer)
(insert-file-contents file-or-buffer)
(el-get-check-recipe-in-current-buffer))))
(el-get-check-recipe-in-current-buffer file-or-buffer))))
(defun el-get-check-recipe-in-current-buffer ()
(defun el-get-check-recipe-in-current-buffer (recipe-file-name)
(let ((recipe (save-excursion
(goto-char (point-min))
(read (current-buffer))))
......@@ -286,6 +286,11 @@ object or a file path."
(display-buffer buffer)
(with-current-buffer buffer
(erase-buffer)
(when (and recipe-file-name
(not (string= (file-name-base recipe-file-name)
(plist-get recipe :name))))
(incf numerror)
(insert "* File name should match recipe name.\n"))
;; Check if userspace property is used.
(loop for key in '(:before :after)
for alt in '(:prepare :post-init)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment