-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create method 'gitlab'. #2605
Open
gavk
wants to merge
1
commit into
dimitri:master
Choose a base branch
from
gavk:feature2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create method 'gitlab'. #2605
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
;;; el-get --- Manage the external elisp bits and pieces you depend upon | ||
;; | ||
;; Copyright (C) 2010-2011 Dimitri Fontaine | ||
;; | ||
;; Author: Dimitri Fontaine <[email protected]> | ||
;; URL: http://www.emacswiki.org/emacs/el-get | ||
;; GIT: https://githab.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.md file from the same distribution | ||
|
||
(require 'el-get-http-tar) | ||
(require 'el-get-gitlab) | ||
|
||
(defun el-get-gitlab-tar-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* ((user-and-repo (el-get-gitlab-parse-user-and-repo package)) | ||
(username (car user-and-repo)) | ||
(reponame (cdr user-and-repo)) | ||
(branch (or (plist-get source :branch) | ||
"master"))) | ||
(format "https://gitlab.com/%s/%s/tarball/%s" | ||
username reponame branch))))) | ||
|
||
(defun el-get-gitlab-tar-install (package url post-install-fun) | ||
"Clone the given package from Github following the URL." | ||
;; The recipe must have a `:url' property for | ||
;; `el-get-http-tar-install' to work. Also, since gitlab tarballs | ||
;; are ".tar.gz", we know what the default tar options should be. | ||
(let* ((old-pdef (el-get-package-def package)) | ||
(url (or url (el-get-gitlab-tar-url package))) | ||
(options (or (plist-get old-pdef :options) '("xzf"))) | ||
(new-pdef (append `(:url ,url :options ,options) | ||
(el-get-package-def package))) | ||
(el-get-sources (cons new-pdef el-get-sources))) | ||
(el-get-http-tar-install package url post-install-fun))) | ||
|
||
(el-get-register-derived-method :gitlab-tar :http-tar | ||
:install #'el-get-gitlab-tar-install | ||
:update #'el-get-gitlab-tar-install | ||
:guess-website #'el-get-gitlab-guess-website) | ||
|
||
(provide 'el-get-gitlab-tar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
;;; el-get --- Manage the external elisp bits and pieces you depend upon | ||
;; | ||
;; Copyright (C) 2010-2011 Dimitri Fontaine | ||
;; | ||
;; Author: Dimitri Fontaine <[email protected]> | ||
;; 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.md file from the same distribution | ||
|
||
(require 'el-get-http-zip) | ||
(require 'el-get-gitlab) | ||
|
||
(defun el-get-gitlab-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* ((user-and-repo (el-get-gitlab-parse-user-and-repo package)) | ||
(username (car user-and-repo)) | ||
(reponame (cdr user-and-repo)) | ||
(branch (or (plist-get source :branch) | ||
"master"))) | ||
(format "https://gitlab.com/%s/%s/zipball/%s" | ||
username reponame branch))))) | ||
|
||
(defun el-get-gitlab-zip-install (package url post-install-fun) | ||
"Clone the given package from Github following the URL." | ||
;; The recipe must have a `:url' property for | ||
;; `el-get-http-zip-install' to work. | ||
(let* ((old-pdef (el-get-package-def package)) | ||
(url (or url (el-get-gitlab-zip-url package))) | ||
(new-pdef (append `(:url ,url) | ||
(el-get-package-def package))) | ||
(el-get-sources (cons new-pdef el-get-sources))) | ||
(el-get-http-zip-install package url post-install-fun))) | ||
|
||
(el-get-register-derived-method :gitlab-zip :http-zip | ||
:install #'el-get-gitlab-zip-install | ||
:update #'el-get-gitlab-zip-install | ||
:guess-website #'el-get-gitlab-guess-website) | ||
|
||
(provide 'el-get-gitlab-zip) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
;;; el-get --- Manage the external elisp bits and pieces you depend upon | ||
;; | ||
;; Copyright (C) 2010-2011 Dimitri Fontaine | ||
;; | ||
;; Author: Dimitri Fontaine <[email protected]> | ||
;; 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.md file from the same distribution | ||
|
||
(require 'el-get-core) | ||
(require 'el-get-git) | ||
|
||
(defconst el-get-gitlab-url-type-plist | ||
(list 'http "http://gitlab.com/%USER%/%REPO%.git" | ||
'https "https://gitlab.com/%USER%/%REPO%.git" | ||
'git "git://gitlab.com/%USER%/%REPO%.git" | ||
'ssh "[email protected]:%USER%/%REPO%.git") | ||
"Plist mapping Github types to their URL format strings.") | ||
|
||
(defcustom el-get-gitlab-default-url-type 'https | ||
"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 | ||
you." | ||
: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-gitlab-parse-user-and-repo (package) | ||
"Returns a cons cell of `(USER . REPO)'." | ||
(let* ((source (el-get-package-def package)) | ||
(user-slash-repo | ||
(or (plist-get source :pkgname) | ||
(error ":pkgname \"username/reponame\" is mandatory for gitlab recipe '%s" | ||
package))) | ||
(user-and-repo (split-string user-slash-repo "/" 'omit-nulls))) | ||
(assert (= (length user-and-repo) 2) nil | ||
"Github pkgname %s must be of the form username/reponame" | ||
user-slash-repo) | ||
(cons (first user-and-repo) (second user-and-repo)))) | ||
|
||
(defun el-get-gitlab-url-private (url-type username reponame) | ||
"Return the url of a particular gitlab project. | ||
URL-TYPE must be a valid property (a symbol) of | ||
`el-get-gitlab-url-type-plist'. | ||
USERNAME and REPONAME are strings." | ||
(let ((url-format-string | ||
(or (plist-get el-get-gitlab-url-type-plist url-type) | ||
(error "Unknown Github repo URL type: %s" url-type)))) | ||
(el-get-replace-string | ||
"%USER%" username | ||
(el-get-replace-string "%REPO%" reponame url-format-string)))) | ||
|
||
(defun el-get-gitlab-url (package) | ||
(let* ((source (el-get-package-def package)) | ||
(user-and-repo (el-get-gitlab-parse-user-and-repo package)) | ||
(username (car user-and-repo)) | ||
(reponame (cdr user-and-repo)) | ||
(url-type (el-get-as-symbol | ||
(or (plist-get source :url-type) | ||
el-get-gitlab-default-url-type)))) | ||
(el-get-gitlab-url-private url-type username reponame))) | ||
|
||
(defun el-get-gitlab-clone (package _url post-install-fun) | ||
"Clone the given package from Github following the URL." | ||
(el-get-git-clone package (el-get-gitlab-url package) post-install-fun)) | ||
|
||
(defun el-get-gitlab-pull (package _url post-install-fun) | ||
"Update the given package from Github following the URL." | ||
(el-get-git-pull package (el-get-gitlab-url package) post-install-fun)) | ||
|
||
(defun el-get-gitlab-guess-website (package) | ||
(let* ((user-and-repo (el-get-gitlab-parse-user-and-repo package)) | ||
(username (car user-and-repo)) | ||
(reponame (cdr user-and-repo))) | ||
(el-get-gitlab-url-private 'https username reponame))) | ||
|
||
(el-get-register-derived-method :gitlab :git | ||
:install #'el-get-gitlab-clone | ||
:update #'el-get-gitlab-pull | ||
:guess-website #'el-get-gitlab-guess-website) | ||
|
||
(provide 'el-get-gitlab) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there's just six recipes using gitlab urls right now, maybe we should just change them all to
:type gitlab
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. In addition to the existing 6 recipes, there is also "mo-git-blame", which moved to gitlab.
type git => type gitlab
url "https://gitlab.com/warsaw/winring.git" => pkgname "warsaw/winring"