mirror of
https://github.com/dimitri/el-get.git
synced 2024-09-29 13:08:51 +08:00
Merge pull request #2461 from manandbytes/github-update
Delegate install and update actions for github to git
This commit is contained in:
commit
c09cb391df
|
@ -39,6 +39,7 @@ following is true and retun nil:
|
|||
SCP-like syntax
|
||||
|
||||
- PACKAGE definition has a non-empty :checksum"
|
||||
(assert (stringp URL) nil "URL is nil, can't decide if it's safe to install package '%s'" PACKAGE)
|
||||
(let* ((checksum (plist-get (el-get-package-def PACKAGE) :checksum))
|
||||
(checksum-empty (or (not (stringp checksum))
|
||||
(if (fboundp 'string-blank-p)
|
||||
|
|
|
@ -78,11 +78,13 @@ USERNAME and REPONAME are strings."
|
|||
el-get-github-default-url-type))))
|
||||
(el-get-github-url-private url-type username reponame)))
|
||||
|
||||
(defun el-get-github-clone (package url post-install-fun)
|
||||
(defun el-get-github-clone (package _url post-install-fun)
|
||||
"Clone the given package from Github following the URL."
|
||||
(let ((url (or url (el-get-github-url package))))
|
||||
(el-get-insecure-check package url)
|
||||
(el-get-git-clone package url post-install-fun)))
|
||||
(el-get-git-clone package (el-get-github-url package) post-install-fun))
|
||||
|
||||
(defun el-get-github-pull (package _url post-install-fun)
|
||||
"Update the given package from Github following the URL."
|
||||
(el-get-git-pull package (el-get-github-url package) post-install-fun))
|
||||
|
||||
(defun el-get-github-guess-website (package)
|
||||
(let* ((user-and-repo (el-get-github-parse-user-and-repo package))
|
||||
|
@ -92,6 +94,7 @@ USERNAME and REPONAME are strings."
|
|||
|
||||
(el-get-register-derived-method :github :git
|
||||
:install #'el-get-github-clone
|
||||
:update #'el-get-github-pull
|
||||
:guess-website #'el-get-github-guess-website)
|
||||
|
||||
(provide 'el-get-github)
|
||||
|
|
|
@ -181,3 +181,20 @@ John.Doe-123_@example.com"))
|
|||
(el-get-sources '((:name "dummy" :type github :checksum checksum))))
|
||||
;; TODO check for error message?
|
||||
(should-error (el-get-insecure-check "dummy" url) :type 'error)))))
|
||||
|
||||
(ert-deftest el-get-github-update ()
|
||||
"Update :type github"
|
||||
(let* ((github-pkgname "user/dummy.el")
|
||||
(el-get-sources `((:name "dummy" :type github :pkgname ,github-pkgname)))
|
||||
(el-get-allow-insecure nil))
|
||||
(letf (((symbol-function 'el-get-package-is-installed)
|
||||
(lambda (package)
|
||||
(string= package "dummy")))
|
||||
((symbol-function 'el-get-git-pull)
|
||||
(lambda (package url post-install)
|
||||
(should (string= package "dummy"))
|
||||
(should (string= url (concat "https://github.com/" github-pkgname ".git")))))
|
||||
((symbol-function 'el-get-insecure-check)
|
||||
(lambda (package url)
|
||||
(error "Leave 'el-get-insecure-check to git"))))
|
||||
(should (el-get-do-update "dummy")))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user