Commit 98c5aa8b authored by Ryan C. Thompson's avatar Ryan C. Thompson

Add github method

parent 3bebbeb5
......@@ -32,6 +32,7 @@
(require 'el-get-emacswiki)
(require 'el-get-fink)
(require 'el-get-git)
(require 'el-get-github)
(require 'el-get-git-svn)
(require 'el-get-hg)
(require 'el-get-http)
;;; el-get --- Manage the external elisp bits and pieces you depend upon
;; Copyright (C) 2010-2011 Dimitri Fontaine
;; Author: Dimitri Fontaine <>
;; URL:
;; GIT:
;; Licence: WTFPL, grab your copy here:
;; This file is NOT part of GNU Emacs.
;; Install
;; Please see the README.asciidoc file from the same distribution
(require 'el-get-core)
(defconst el-get-github-url-type-plist
(list 'http ""
'https ""
'git "git://"
'ssh "")
"Plist mapping Github types to their URL format strings.")
(defun el-get-github-url-format (url-type)
(or (plist-get el-get-github-url-type-plist
(error "Unknown Github repo URL type: %s" url-type)))
(defcustom el-get-github-default-url-type 'http
"The kind of URL to use for Github repositories.
Choices are `http', `https', `git'. This is effectively the
default `:url-type' for Github recipes that do not specify one.
Individual Github recipes can override this setting by providing
their own `:url-type' property. Note that `ssh' is also an
acceptable value for `:url-type', but you should not set it here
because it will prevent access to any repositories not owned by
:group 'el-get
:type '(choice (const :tag "HTTP" http)
(const :tag "HTTPS" https)
(const :tag "git" git)))
(defun el-get-replace-string (from to str)
"Replace all instances of FROM with TO in str.
FROM is a literal string, not a regexp."
(replace-regexp-in-string (regexp-quote from) to str 'fixedcase 'literal))
(defun el-get-github-url (package)
(let* ((source (el-get-package-def package)))
;; Use :url if provided
(plist-get source :url)
;; Else generate URL from username, reponame, and url-type
(let* ((username (el-get-as-string
(or (plist-get source :username)
(error "Recipe for Github package %s needs a username" package))))
(reponame (el-get-as-string
(or (plist-get source :reponame)
(url-type (el-get-as-symbol
(or (plist-get source :url-type)
(url-format-string (or (plist-get el-get-github-url-type-plist
(error "Unknown Github URL type: %s" url-type))))
"%USER%" username
"%REPO%" reponame
(defun el-get-github-clone (package url post-install-fun)
"Clone the given package from Github following the URL."
(el-get-git-clone package
(or url (el-get-github-url package))
(defun el-get-github-pull (package url post-update-fun)
"git pull the package."
(el-get-git-pull package
(or url (el-get-github-url package))
:github #'el-get-github-clone #'el-get-github-pull #'el-get-rmdir)
(provide 'el-get-github)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment