Skip to content

Commit

Permalink
provide a callback for when we're done
Browse files Browse the repository at this point in the history
  • Loading branch information
nicferrier committed Apr 15, 2013
1 parent 2fd3ce9 commit 3352e86
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions marmalade-mongo.el
Expand Up @@ -32,7 +32,16 @@
target-root package-name version
(concat package-name "-" version "." type)))

(defun marmalade-mongo-done ()
"Called at the end of the conversion."
(message "marmalade-mongo all done"))

(defun marmalade-mongo/make-files (files target-root)
"Recursive package to package-file maker.
Use mongofiles to grab a file from the database and put it on the
file system. Recurs around the FILES and calls
`marmalade-mongo-done' when it's finished."
(when files
(destructuring-bind (file-entry &rest files) files
(destructuring-bind (filename package-name type version) file-entry
Expand All @@ -56,12 +65,14 @@
(lambda (proc status)
(when (equal status "finished\n")
(condition-case err
(progn
(rename-file temp-file target-file)
(marmalade-mongo/make-files files target-root))
(rename-file temp-file target-file)
(file-error
(message "marmalade-mongo %s to %s got %S"
temp-file target-file err))))))))))))
temp-file target-file err)))
(if files
(marmalade-mongo/make-files files target-root)
;; Call the end function if we're done
(marmalade-mongo-done)))))))))))

(defun marmalade-mongo/buf->list (buffer)
"Converts the buffer listing of the files in mongo to a proper list."
Expand Down

0 comments on commit 3352e86

Please sign in to comment.