summaryrefslogtreecommitdiff
path: root/lisp/service/git-update-service.lisp
blob: 31b1c3296beac2aa3d04be8845a6805108f5d730 (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
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))

(in-package :snow)

(defclass git-update-service (rest-service)
  ()
  (:documentation ""))

(defun git-update-json ()
  (with-noauth (instance git-update-service)
    t))

(defclass git-update/view-service (git-update-service)
  ((form :initarg :form
         :initform nil
         :accessor form)
   (location-p :initform nil))
  (:documentation ""))

(defun git-update-view-json ()
  (with-noauth (instance git-update/view-service)
    (setf (form instance)
          (make-form "git-update-form"
                     nil
                     t
                     `((:label "Update Git Checkouts" :field-type "button" :onclick "on_git_update_view_clicked()"))))))

(defclass git-update/results-service (git-update-service)
  ((stdout :initarg :stdout
           :initform nil
           :accessor stdout)
   (location-p :initform nil))
  (:documentation ""))

(defun git-update-results-json ()
  (with-noauth (instance git-update/results-service)
    (cl-fad:with-output-to-temporary-file (f :template "/tmp/snow/temp-%")
      (update-git (make-instance 'git-update :stdout (pathname f)))
      (setf (stdout instance) (uiop:native-namestring (pathname f))))))