about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-07-30T18·12-0700
committerclbot <clbot@tvl.fyi>2022-08-01T17·29+0000
commit081742a07e7bf438655b390f46e0ce103a0b0e55 (patch)
treeb4ae950e479e20b4aff84f39f21fbeee98d26504
parentf957a57ad8cd6a1dc3243a4373f15888b680d87f (diff)
feat(wpcarro/emacs): Package fs.el r/4362
According to SourceGraph, this is unused, but I'm checking it in for historical
purposes.

Change-Id: I24bcb1c71a9f6de527bb54057cf13d01493c45bf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6016
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
-rw-r--r--users/wpcarro/emacs/pkgs/fs/default.nix29
-rw-r--r--users/wpcarro/emacs/pkgs/fs/fs.el (renamed from users/wpcarro/emacs/.emacs.d/wpc/fs.el)22
-rw-r--r--users/wpcarro/emacs/pkgs/fs/tests.el26
3 files changed, 55 insertions, 22 deletions
diff --git a/users/wpcarro/emacs/pkgs/fs/default.nix b/users/wpcarro/emacs/pkgs/fs/default.nix
new file mode 100644
index 0000000000..e6afd107e9
--- /dev/null
+++ b/users/wpcarro/emacs/pkgs/fs/default.nix
@@ -0,0 +1,29 @@
+{ pkgs, depot, ... }:
+
+let
+  fs = pkgs.callPackage
+    ({ emacsPackages }:
+      emacsPackages.trivialBuild {
+        pname = "fs";
+        version = "1.0.0";
+        src = ./fs.el;
+        packageRequires =
+          (with emacsPackages; [
+            dash
+            f
+            s
+          ]);
+      })
+    { };
+
+  emacs = (pkgs.emacsPackagesFor pkgs.emacs28).emacsWithPackages (epkgs: [
+    fs
+  ]);
+in
+fs.overrideAttrs (_old: {
+  doCheck = true;
+  checkPhase = ''
+    ${emacs}/bin/emacs -batch \
+      -l ert -l ${./tests.el} -f ert-run-tests-batch-and-exit
+  '';
+})
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/fs.el b/users/wpcarro/emacs/pkgs/fs/fs.el
index c303b23539..125c1f1007 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/fs.el
+++ b/users/wpcarro/emacs/pkgs/fs/fs.el
@@ -31,8 +31,6 @@ Will error for inputs with a trailing slash."
        fs-ensure-dir)
   (f-touch path))
 
-(f-dirname "/tmp/a/b/file.txt")
-
 (defun fs-ensure-dir (path)
   "Ensure that a directory and its ancestor directories in `PATH' exist."
   (->> path
@@ -45,25 +43,5 @@ Should behave similarly in spirit to the Unix command, ls.
 If `FULL-PATH?' is set, return the full-path of the files."
   (-drop 2 (directory-files dir full-path?)))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Tests
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(ert-deftest fs-test-ensure-file ()
-  (let ((file "/tmp/file/a/b/c/file.txt"))
-    ;; Ensure this file doesn't exist first to prevent false-positives.
-    (f-delete file t)
-    (fs-ensure-file file)
-    (should (and (f-exists? file)
-                 (f-file? file)))))
-
-(ert-deftest fs-test-ensure-dir ()
-  (let ((dir "/tmp/dir/a/b/c"))
-    ;; Ensure the directory doesn't exist.
-    (f-delete dir t)
-    (fs-ensure-dir dir)
-    (should (and (f-exists? dir)
-                 (f-dir? dir)))))
-
 (provide 'fs)
 ;;; fs.el ends here
diff --git a/users/wpcarro/emacs/pkgs/fs/tests.el b/users/wpcarro/emacs/pkgs/fs/tests.el
new file mode 100644
index 0000000000..adef11a607
--- /dev/null
+++ b/users/wpcarro/emacs/pkgs/fs/tests.el
@@ -0,0 +1,26 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Dependencies
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(require 'ert)
+(require 'fs)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Tests
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(ert-deftest fs-test-ensure-file ()
+  (let ((file "/tmp/file/a/b/c/file.txt"))
+    ;; Ensure this file doesn't exist first to prevent false-positives.
+    (f-delete file t)
+    (fs-ensure-file file)
+    (should (and (f-exists? file)
+                 (f-file? file)))))
+
+(ert-deftest fs-test-ensure-dir ()
+  (let ((dir "/tmp/dir/a/b/c"))
+    ;; Ensure the directory doesn't exist.
+    (f-delete dir t)
+    (fs-ensure-dir dir)
+    (should (and (f-exists? dir)
+                 (f-dir? dir)))))