From 3f533208c551a7273472e6157cb68beca9a0d03f Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Thu, 19 Jul 2012 21:41:51 +0300 Subject: [PATCH] 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. --- package-build.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/package-build.el b/package-build.el index 402e0a5e..935f072f 100644 --- a/package-build.el +++ b/package-build.el @@ -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: