3 (defun import-package (pkg)
4 (asdf:load-system pkg))
7 (format t "~%~c[1;33mRunning ~:(~A~)~c[0m~%" #\Esc (getf task :name) #\Esc)
9 (eval (getf task :directions))
10 (progn (format t "~c[1;32m- ~:(~A~) Passed!~c[0m~%" #\Esc (getf task :name) #\Esc) t)
11 (format t "~c[1;31m- ~:(~A~) Failed!~c[0m~%" #\Esc (getf task :name) #\Esc)))
20 TASK: a keyword, representing a task that can be run
24 Get a list of tasks available in the current .candle file."
26 (not (probe-file ".candle"))
28 (with-open-file (str ".candle")
29 (asdf:initialize-source-registry `(:source-registry (:tree ,(car (directory "."))) :INHERIT-CONFIGURATION))
30 (mapcar #'import-package (cdr (read str)))
31 (mapcar (lambda (task) (getf task :name)) (getf (read str) :tasks)))))
33 (defun run (&optional specified-task)
34 "RUN &optional SPECIFIED-TASK => RESULT
38 SPECIFIED-TASK: a keyword, the task to run
39 RESULT: a boolean, whether the process was successful
43 Runs the script specified by the .candle file in the current directory.
44 When completed, the boolean will be returned if it was successful or not.
46 If SPECIFIED-TASK exists, only that task is run."
48 (not (probe-file ".candle"))
50 (with-open-file (str ".candle")
51 (asdf:initialize-source-registry `(:source-registry (:tree ,(car (directory "."))) :INHERIT-CONFIGURATION))
52 (mapcar #'import-package (cdr (read str)))
54 ((candle-definition (read str)))
55 (format t "Running tasks for ~(~A~)~%" (getf candle-definition :name))
59 (lambda (task) (and specified-task (not (eql (getf task :name) specified-task))))
60 (getf candle-definition :tasks))))))))