Remove Eldev dependency
Intead of using Eldev I'll use Guix to manage the dependencies of this project.
This commit is contained in:
parent
fe7933869e
commit
13a9b718b8
4 changed files with 22 additions and 59 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
/.cask
|
||||
/.org-timestamps
|
||||
/.sass-cache
|
||||
/.emacs-local
|
||||
|
||||
# Built files
|
||||
/public
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
build.mk: literate-build.org
|
||||
emacs -quick -batch \
|
||||
HOME=".emacs-local" emacs -quick -batch \
|
||||
-eval "(package-initialize)" \
|
||||
-load ob-tangle \
|
||||
-eval "(org-babel-tangle-file \"$<\"))"
|
||||
|
|
|
@ -11,14 +11,12 @@ I specify that =build.mk= file should depend on /this/ file ({{{input-file}}}) a
|
|||
|
||||
#+begin_src makefile-gmake :tangle GNUmakefile
|
||||
build.mk: literate-build.org
|
||||
emacs -quick -batch \
|
||||
HOME=".emacs-local" emacs -quick -batch \
|
||||
-eval "(package-initialize)" \
|
||||
-load ob-tangle \
|
||||
-eval "(org-babel-tangle-file \"$<\"))"
|
||||
#+end_src
|
||||
|
||||
I can't use Eldev in this particular recipe because it needs a file with proper package headers and all, and that doesn't get generated until we run this. I'm cheating a little bit because I'm expecting this command to also generate the other files the build needs without explicitly saying so.
|
||||
|
||||
After that it's just a matter of including the file I want.
|
||||
|
||||
#+begin_src makefile-gmake :tangle GNUmakefile
|
||||
|
@ -49,12 +47,12 @@ The =build= target converts everything from whatever source files they are to ht
|
|||
build: html css ## Build the site and copy it to the staging directory
|
||||
#+end_src
|
||||
|
||||
The =html= target calls Emacs. It depends on the =Eldev= file having been generated to specify any additional dependencies and which package archives should be used and this file will be generated by the =Eldev= target.
|
||||
The =html= target calls Emacs.
|
||||
|
||||
#+begin_src makefile-gmake
|
||||
html: Eldev
|
||||
html:
|
||||
@echo "Publishing..."
|
||||
eldev emacs --quick --batch --load publish.el --funcall org-publish-all
|
||||
HOME=".emacs-local" emacs --quick --batch --load publish.el --funcall org-publish-all
|
||||
#+end_src
|
||||
|
||||
The =css= target does specify its dependencies. This is both an exercise in writing make files (which I generally quite enjoy), and also to make sure that my builds don't take too long unless they actually have to. Ultimately any =.css= file gets created from a =.scss= file by calling the =scss= program. I'm intentionally not using recursive make in this project because it slows make down a lot, and I don't have to manage several make files this way.
|
||||
|
@ -79,7 +77,7 @@ The =deploy= target first makes sure that =build= has been executed at least onc
|
|||
deploy: ## Deploy the site to live
|
||||
@[[ -e public/index.html ]] || (echo "Run 'make build' before deploy" && exit 1)
|
||||
rsync --verbose --checksum --recursive --delete \
|
||||
--exclude '*~' --exclude '.eldev' --delete-excluded \
|
||||
--exclude '*~' --exclude '.emacs-local' --delete-excluded \
|
||||
public/ ryuslash.org:ryuslash-next/
|
||||
#+end_src
|
||||
|
||||
|
@ -91,7 +89,7 @@ clean: ## Remove all of the build files
|
|||
@rm -rvf *.elc
|
||||
@rm -rvf public
|
||||
@rm -rvf .org-timestamps
|
||||
@rm -rvf posts/index.org build.mk Eldev publish.el
|
||||
@rm -rvf posts/index.org build.mk .emacs-local publish.el
|
||||
#+end_src
|
||||
|
||||
The =serve= target is a convenience target for when I'm writing or making modifications to the build and publish processes. It just starts a simple =php= web server in the =public/= directory so that I can easily load it in my browser.
|
||||
|
@ -101,15 +99,15 @@ serve: ## Run a simple web server to look at the results
|
|||
@cd public && php -S "localhost:8000"
|
||||
#+end_src
|
||||
|
||||
The =theme= target is another convenience target. I generate the colors for the source code blocks on my site from my Emacs theme. This target exports the colors from my theme so that the code blocks can use them. This file is then included by the scss files. There is no good dependency here, because there is no file for the export of my theme to depend on right now, just occasionally I have to run it. It does depend on the =Eldev= file having been generated.
|
||||
The =theme= target is another convenience target. I generate the colors for the source code blocks on my site from my Emacs theme. This target exports the colors from my theme so that the code blocks can use them. This file is then included by the scss files. There is no good dependency here, because there is no file for the export of my theme to depend on right now, just occasionally I have to run it.
|
||||
|
||||
#+begin_note
|
||||
I keep this particular target around for playing with, but right now it doesn't actually work. Just because even though I load and enable =yoshi-theme= it doesn't appear to apply the theme in a batch session. Seems understandable because no UI actually gets loaded, but that does mean that it can't figure out which faces it sets and it just outputs the colors for the default theme.
|
||||
#+end_note
|
||||
|
||||
#+begin_src makefile-gmake
|
||||
theme: Eldev ## Generate the theme CSS
|
||||
eldev emacs --quick --batch --load htmlize --load ox-html \
|
||||
theme: ## Generate the theme CSS
|
||||
HOME=".emacs-local" emacs --quick --batch --load htmlize --load ox-html \
|
||||
-eval "(setq org-html-htmlize-output-type 'css)" \
|
||||
-funcall org-html-htmlize-generate-css \
|
||||
-load yoshi-theme \
|
||||
|
@ -132,52 +130,18 @@ Finally, as a precaution, I specify that all of the main targets are phony targe
|
|||
.PHONY: publish deploy html css help theme
|
||||
#+end_src
|
||||
|
||||
* Eldev
|
||||
:PROPERTIES:
|
||||
:header-args:emacs-lisp: :tangle Eldev
|
||||
:END:
|
||||
|
||||
With Eldev I can install dependencies of my [[Publishing project]] locally. Really the only reason I chose to use Eldev is because it is available in the [[file:guix.org][Guix]] repository.
|
||||
|
||||
Since this is an actually full-fledged Emacs Lisp file and I don't know what I'm going to be doing in the future, I should be sure to enable lexical binding. Otherwise Emacs defaults to using dynamic binding, and that might cause some surprises in the future, since I'm quite used to using lexical binding everywhere.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
; -*- lexical-binding: t; -*-
|
||||
#+end_src
|
||||
|
||||
All I'm doing here, really, is enable the various Emacs Lisp Package Archives.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(eldev-use-package-archive 'gnu)
|
||||
(eldev-use-package-archive 'nongnu)
|
||||
(eldev-use-package-archive 'melpa)
|
||||
#+end_src
|
||||
|
||||
* Publishing project
|
||||
:PROPERTIES:
|
||||
:header-args:emacs-lisp: :tangle publish.el
|
||||
:END:
|
||||
|
||||
Before anything else, here too I need to add a file header and enable lexical binding. If I don't add the file header Eldev won't work right.
|
||||
Before anything else I need to enable lexical binding.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;;; publish.el --- Publish project for ryuslash.org -*- lexical-binding: t; -*-
|
||||
;;; -*- lexical-binding: t -*-
|
||||
#+end_src
|
||||
|
||||
And then I have to keep a list of required packages so that Eldev can figure out which to download. I also need the Version header to keep Eldev happy.
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes
|
||||
;; Version: 1
|
||||
;; Package-Requires: (<<required-packages>>)
|
||||
#+end_src
|
||||
|
||||
I install =dockerfile-mode= because some of my posts include examples of docker files. And I use the latest =org= mode package.
|
||||
|
||||
#+begin_src emacs-lisp :exports none :tangle no :noweb-ref required-packages :noweb-sep " "
|
||||
dockerfile-mode org htmlize
|
||||
#+end_src
|
||||
|
||||
Some packages must be loaded to make sure their features can be used by the export process.
|
||||
I require =dockerfile-mode= because some of my posts include examples of docker files. And I use the latest =org= mode package. Some other packages must be loaded to make sure their features can be used by the export process as well.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'dockerfile-mode)
|
||||
|
@ -456,15 +420,6 @@ This is a convenience project so that I can publish everything all at once. It a
|
|||
("all" :components ("pages" "rss" "posts" "assets"))
|
||||
#+end_src
|
||||
|
||||
** File footer
|
||||
|
||||
Finally I need to add a file footer, again to keep Eldev happy.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(provide 'publish)
|
||||
;;; publish.el ends here
|
||||
#+end_src
|
||||
|
||||
* Footnotes
|
||||
|
||||
[fn:1] You have to evaluate it in a special way. Either with {{{kbd(C-M-x)}}} or {{{kbd(C-u C-x C-e)}}}.
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
(packages->manifest
|
||||
(list
|
||||
(specification->package "emacs-eldev")
|
||||
(specification->package "coreutils")
|
||||
(specification->package "make")
|
||||
(specification->package "emacs")
|
||||
(specification->package "emacs-org")
|
||||
(specification->package "emacs-dash")
|
||||
(specification->package "emacs-htmlize")
|
||||
(specification->package "emacs-dockerfile-mode")
|
||||
(specification->package "emacs-rainbow-delimiters")
|
||||
(specification->package "emacs-ox-rss")
|
||||
(specification->package "rsync")))
|
||||
|
|
Loading…
Reference in a new issue