Add functions that export to json

The list of recipies and the packages in the archive can be serialized
to json with:
 - package-build-alist-as-json
 - package-build-archive-alist-as-json

The json files can be used to simplify the generation of the html index
or serve as some form of API for non-lisp clients.
This commit is contained in:
Georgi Valkov 2012-07-19 21:41:51 +03:00 committed by Donald Curtis
parent 3fe20de5b2
commit 3f533208c5

View file

@ -645,9 +645,22 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs."
(expand-file-name "archive-contents"
package-build-archive-dir)))))
(package-build-initialize)
;; Utility functions
(autoload 'json-encode "json")
(defun package-build-alist-as-json (fn)
(interactive)
(with-temp-file fn
(insert (json-encode package-build-alist))))
(defun package-build-archive-alist-as-json (fn)
(interactive)
(with-temp-file fn
(insert (json-encode package-build-archive-alist))))
(provide 'package-build)
;; Local Variables: