summaryrefslogtreecommitdiff
path: root/DEPLOY.org
blob: 8d77b7710fcc67d1138fa0d9e16c683b27955f80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
* Build New Lisp Application Image

#+name: build-image
#+begin_src emacs-lisp :results none :var image-name=vampire-image-name()
  (with-current-buffer (get-buffer-create "*vampire-build*")
    (erase-buffer)
    (insert (format "Building image %s.\n\n" image-name))
    (shell-command "sbcl --load build.lisp" (current-buffer))
    (rename-file "bin/vampire" image-name))
  (switch-to-buffer-other-window "*vampire-build*")
#+end_src

** New tagged image filename

#+name: vampire-image-name
#+begin_src emacs-lisp
  (let ((commit (string-trim (shell-command-to-string "git rev-parse --short HEAD")))
	(date (string-trim (shell-command-to-string "date '+%Y%m%d'"))))
    (format "bin/vampire-%s-%s" commit date))
#+end_src

* Deploy Image and Assets to Server Host

#+begin_src emacs-lisp :var name=vampire-image-name() dest="/scp:vampire@:" :noweb yes
    (with-current-buffer (get-buffer-create "*vampire-deploy*")
      (erase-buffer)
      (insert (format "Deploying image %s. \n\n" name))
      <<deploy-image>>
      <<deploy-assets>>)
    (switch-to-buffer-other-window "*vampire-deploy*")
#+end_src

** Copy Image To Host Destination

#+name: deploy-image
#+begin_src emacs-lisp :results none
  (let ((destination (concat dest name)))
    (insert (format "Copying image %s to %s" name destination)) (newline)
    (copy-file name destination t)
    (insert (format "Making symbolic link to point bin/vampire at %s" name destination)) (newline)
    (make-symbolic-link destination (concat dest "bin/vampire") t))
#+end_src

** Copy CSS files

#+name: deploy-assets
#+begin_src emacs-lisp :results none
(let ((destination (concat dest "static/css/")))
  (insert (format "Copying static CSS assets %s..." destination)) (newline)
  (copy-directory "static/css/" destination nil nil t)
  (insert "Done.") (newline))
#+end_src

** copy directory notes

If NEWNAME is a directory name, copy DIRECTORY as a subdirectory
there.  However, if called from Lisp with a non-nil optional
argument COPY-CONTENTS, copy the contents of DIRECTORY directly
into NEWNAME instead.