lxhome/build.el

90 rindas
2.7 KiB
EmacsLisp
Executable File

:;exec `echo $EMACS_PATH` --no-site-file --no-site-lisp --batch -L ./ -l "$0" -f main "$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)" "$@"
;;; Build.el --- The build script of my personal website -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2020-2022 Sameer Rahmani & Contributors
;;
;;; Version: 0.1.0
;;; Package-Version 0.1.0
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with thnis program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;; Code:
(setq debug-on-error t)
(setenv "FG42_HOME" (concat (getenv "HOME") "/.fg42/"))
(defconst fg42/CORE_DIR (concat (getenv "FG42_HOME") "core"))
(setq user-emacs-directory (concat (getenv "FG42_HOME") "emacs.d"))
(add-to-list 'load-path fg42/CORE_DIR)
(require 'fg42/build/utils)
(require 'fg42/build/core)
(defconst build/usage "
Usage:
build.el [PARAMS] COMMAND [...]
COMMANDS:
docs - Build the documents and convert them to HTML
PARAMS:
:d - Turns on the debug mode.
:e expr - Run the given `expr' before any operation.
")
(defproject lxsameer.com
project-root (nth 2 command-line-args-left)
docs-root "/orgs"
usage build/usage
prod-base-url "https://lxsameer.com"
docs-pages-dir "/essays"
docs-actions '(copy-necessary-files)
docs-ignore-category-check '("thoughts.org")
docs-title "lxsameer.com"
docs-desc "The little nest of mine")
(defun copy-necessary-files (build-dir base-url)
"Copy the top level pages to the BUILD-DIR with BASE-URL."
(copy-file (expand-file-name "orgs/coh.org" fg42/build-project-root)
(expand-file-name "site/coh.org" build-dir))
(copy-file (expand-file-name "orgs/faq.org" fg42/build-project-root)
(expand-file-name "site/faq.org" build-dir))
(copy-file (expand-file-name "orgs/gpg.org" fg42/build-project-root)
(expand-file-name "site/gpg.org" build-dir))
(copy-file (expand-file-name "thoughts.org" fg42/build-project-root)
(expand-file-name "thoughts.org" build-dir)))
(command-> command args
((string= command "docs")
(do-command
(require 'fg42/build/docs)
(fg42/build-docs build-dir))))
(provide 'build)
;; Local Variables:
;; mode: emacs-lisp
;; End:
;;; build.el ends here