From 37833f68cb30a2ade4358b7e9b2c7713acced760 Mon Sep 17 00:00:00 2001 From: "Ryan C. Thompson" Date: Wed, 8 Feb 2012 10:22:40 -0800 Subject: [PATCH] Add github-zip method --- el-get-methods.el | 1 + methods/el-get-github-zip.el | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 methods/el-get-github-zip.el diff --git a/el-get-methods.el b/el-get-methods.el index 9cf62207..c9b96f5a 100644 --- a/el-get-methods.el +++ b/el-get-methods.el @@ -39,6 +39,7 @@ (require 'el-get-http-tar) (require 'el-get-http-zip) (require 'el-get-github-tar) +(require 'el-get-github-zip) (require 'el-get-pacman) (require 'el-get-svn) diff --git a/methods/el-get-github-zip.el b/methods/el-get-github-zip.el new file mode 100644 index 00000000..c5e25474 --- /dev/null +++ b/methods/el-get-github-zip.el @@ -0,0 +1,44 @@ +;;; el-get --- Manage the external elisp bits and pieces you depend upon +;; +;; Copyright (C) 2010-2011 Dimitri Fontaine +;; +;; Author: Dimitri Fontaine +;; URL: http://www.emacswiki.org/emacs/el-get +;; GIT: https://github.com/dimitri/el-get +;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/ +;; +;; This file is NOT part of GNU Emacs. +;; +;; Install +;; Please see the README.asciidoc file from the same distribution + +(require 'el-get-http-zip) + +(defun el-get-github-zip-url (package) + (let* ((source (el-get-package-def package))) + (or + ;; Use :url if provided + (plist-get source :url) + ;; Else generate URL from username, and reponame + (let* ((username (el-get-as-string + (or (plist-get source :username) + (error "Recipe for Github zip package %s needs a username" package)))) + (reponame (el-get-as-string + (or (plist-get source :reponame) + package))) + (branch (or (plist-get source :branch) + "master"))) + (format "https://github.com/%s/%s/zipball/%s" + username reponame branch))))) + +(defun el-get-github-zip-install (package url post-install-fun) + "Clone the given package from Github following the URL." + (el-get-http-zip-install package + (or url (el-get-github-zip-url package)) + post-install-fun)) + +(el-get-register-derived-method :github-zip :http-zip + :install #'el-get-github-zip-install + :update #'el-get-github-zip-install) + +(provide 'el-get-github-zip)