]> git.eshelyaron.com Git - esy-publish.git/commitdiff
Add a command for testing the website locally
authorEshel Yaron <me@eshelyaron.com>
Sun, 16 Apr 2023 18:34:19 +0000 (21:34 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 16 Apr 2023 18:34:19 +0000 (21:34 +0300)
esy-publish.el

index 742f1abfcfff42da34fd8fd5e9a2d001c2487a99..300f314f8437210690579639649274d9c3664529 100644 (file)
 
 (defvar esy-publish-did-setup-p nil)
 
+(defvar esy-publish--buffers nil)
+
+(defvar esy-publish--publishing nil)
+
+(defvar esy-publish--local-server-process nil)
+
 (defvar esy-publish-elisp-directory
   (file-name-as-directory
    (file-truename
   (esy-publish--finalize-feed plist)
   (esy-publish--finalize-sitemap plist))
 
-(defvar esy-publish--buffers nil)
-
-(defvar esy-publish--publishing nil)
-
 ;;;###autoload
 (defun esy-publish (&optional force)
   (interactive "P")
         (kill-buffer buffer))))
   (setq esy-publish--buffers nil))
 
-(defun esy-publish-all ()
-  (esy-publish t))
-
 ;;;###autoload
 (defun esy-publish-to-remote ()
   (interactive)
                    esy-publish-local-directory
                    esy-publish-remote-directory)))
 
+;;;###autoload
+(defun esy-publish-local-server ()
+  (interactive)
+  (unless (process-live-p esy-publish--local-server-process)
+    (let ((default-directory esy-publish-local-directory))
+      (start-process "esy-publish-local-server" nil
+                     "python3" "-m" "http.server"))))
+
 (provide 'esy-publish)
 ;;; esy-publish.el ends here