(sb-thread:join-thread save-thread))
sb-ext:*exit-hooks*)))
+(defun find-project-by-name-or-die (name)
+ (when name
+ (or
+ (find name *all-project* :test #'string= :key #'project-name)
+ (raise-candle-error :project-does-not-exist))))
+
(defun add-project (name src)
(when
(not (cl-ppcre:scan "^[0-9A-Za-z-]*$" name))
(defun refresh-project (name)
(let*
- ((project (find name *all-project* :test #'string= :key #'project-name))
+ ((project (find-project-by-name-or-die name))
(branches (find-branch-by-project project)))
(git project "fetch" "origin" "--prune")
(multiple-value-bind (success code out err) (git project "branch" "-r" "--format" "%(refname) %(objectname)" "--list" "origin/*")
(defun delete-project (name)
(let
- ((project (find name *all-project* :test #'string= :key #'project-name)))
- (when (not project) (raise-candle-error :project-does-not-exist))
+ ((project (find-project-by-name-or-die name)))
(sb-ext:delete-directory (project-dir project) :recursive t)
(mapcar #'nremove-job (find-job-by-project project))
(mapcar #'nremove-branch (find-branch-by-project project))
(defun project-branch-information (name)
(let
- ((project (find name *all-project* :test #'string= :key #'project-name)))
- (when (not project) (raise-candle-error :project-does-not-exist))
+ ((project (find-project-by-name-or-die name)))
(mapcar
(lambda (branch)
(list
(defun project-job-information (name)
(let
- ((project (when name (find name *all-project* :test #'string= :key #'project-name))))
- (when (and name (not project)) (raise-candle-error :project-does-not-exist))
+ ((project (find-project-by-name-or-die name)))
(mapcar #'job->job-information
(if project
(find-job-by-project project)
(and (<= (length sha) (length job-sha)) (string= sha (subseq job-sha 0 (length sha)))))
(find-job-by-project project)
:key #'job-sha))))
- (when (not project) (raise-candle-error :project-does-not-exist))
(when (not job) (raise-candle-error :job-does-not-exist))
job))
(lambda (project)
(list
(project-name project)
- (project-src project)))
+ (project-src project)
+ (failures (project-name project))))
*all-project*))
(defun failures (project-name)
(let
- ((project (when project-name (find project-name *all-project* :test #'string= :key #'project-name))))
- (when (and project-name (not project)) (raise-candle-error :project-does-not-exist))
+ ((project (find-project-by-name-or-die project-name)))
(length
(remove-if-not
(lambda (branch) (eql :failed (job-status (branch-job branch))))