[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/request c5a1068 7/7: Merge pull request #198 from dickmao/
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/request c5a1068 7/7: Merge pull request #198 from dickmao/conao3-fix-readme |
Date: |
Fri, 12 Feb 2021 14:57:10 -0500 (EST) |
branch: elpa/request
commit c5a10680f38cd9b60057a7d213eb9bc7dcec918b
Merge: 996a87d 705dd98
Author: dickmao <7578770+dickmao@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Merge pull request #198 from dickmao/conao3-fix-readme
Conao3 fix readme
---
.github/workflows/test.yml | 9 +-
Makefile | 26 ++++--
README.rst | 213 +++++++++++++++++++++------------------------
tools/install-evm.sh | 19 ----
4 files changed, 125 insertions(+), 142 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 51d38f9..a51caa6 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -96,8 +96,11 @@ jobs:
sh tools/install-cask.sh
cask link list
+ - name: test-install
+ if: startsWith(runner.os, 'Linux')
+ run: make test-install
+ continue-on-error: ${{ matrix.emacs_version == 'snapshot' }}
+
- name: test
- run: |
- make test-install
- make test
+ run: make test
continue-on-error: ${{ matrix.emacs_version == 'snapshot' }}
diff --git a/Makefile b/Makefile
index 0a29ad0..90557d2 100644
--- a/Makefile
+++ b/Makefile
@@ -67,12 +67,16 @@ install: compile dist
$(EMACS) -Q --batch --eval "(package-initialize)" \
--eval "(package-install-file \"dist/request-$(shell $(CASK)
version).tar\")"
-define SET_GITHUB_REPOSITORY =
-ifeq ($(GITHUB_REPOSITORY),)
- GITHUB_REPOSITORY := $(shell git config user.name)/$(shell basename
`git rev-parse --show-toplevel`)
+define SET_GITHUB_ACTOR =
+ifeq ($(GITHUB_ACTOR),)
+GITHUB_ACTOR := $(shell git config user.name)
endif
endef
+define SET_GITHUB_ACTOR_REPOSITORY =
+GITHUB_ACTOR_REPOSITORY := $(GITHUB_ACTOR)/$(shell basename `git rev-parse
--show-toplevel`)
+endef
+
define SET_GITHUB_HEAD_REF =
ifeq ($(GITHUB_HEAD_REF),)
GITHUB_HEAD_REF := $(shell git rev-parse --abbrev-ref HEAD)
@@ -81,15 +85,23 @@ endef
define SET_GITHUB_SHA =
ifeq ($(GITHUB_SHA),)
-GITHUB_SHA := $(shell if git show-ref --quiet --verify
origin/$(GITHUB_HEAD_REF) ; then git rev-parse origin/$(GITHUB_HEAD_REF) ; fi)
+GITHUB_SHA := $(shell git rev-parse origin/`git rev-parse --abbrev-ref HEAD`)
endif
endef
+define SET_GITHUB_COMMIT =
+GITHUB_COMMIT := $(shell if git show -s --format=%s "${GITHUB_SHA}" | egrep -q
"^Merge .* into" ; then git show -s --format=%s "${GITHUB_SHA}" | cut -d " "
-f2 ; else echo "${GITHUB_SHA}" ; fi)
+endef
+
.PHONY: test-install-vars
test-install-vars:
- $(eval $(call SET_GITHUB_REPOSITORY))
+ $(eval $(call SET_GITHUB_ACTOR))
+ $(eval $(call SET_GITHUB_ACTOR_REPOSITORY))
$(eval $(call SET_GITHUB_HEAD_REF))
$(eval $(call SET_GITHUB_SHA))
+ $(eval $(call SET_GITHUB_COMMIT))
+ git show -s --format=%s $(GITHUB_COMMIT)
+ git show -s --format=%s $(GITHUB_SHA)
@true
.PHONY: test-install
@@ -111,9 +123,9 @@ test-install: test-install-vars
--eval "(setq rcp (package-recipe-lookup \"request\"))" \
--eval "(unless (file-exists-p package-build-archive-dir) \
(make-directory package-build-archive-dir))" \
- --eval "(let* ((my-repo \"$(GITHUB_REPOSITORY)\") \
+ --eval "(let* ((my-repo \"$(GITHUB_ACTOR_REPOSITORY)\") \
(my-branch \"$(GITHUB_HEAD_REF)\") \
- (my-commit \"$(GITHUB_SHA)\")) \
+ (my-commit \"$(GITHUB_COMMIT)\")) \
(oset rcp :repo my-repo) \
(oset rcp :branch my-branch) \
(oset rcp :commit my-commit))" \
diff --git a/README.rst b/README.rst
index 28e2b7d..6f06906 100644
--- a/README.rst
+++ b/README.rst
@@ -29,45 +29,41 @@ GET:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/get"
- :params '(("key" . "value") ("key2" . "value2"))
- :parser 'json-read
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "I sent: %S" (assoc-default 'args data)))))
+ (request "http://httpbin.org/get"
+ :params '(("key" . "value") ("key2" . "value2"))
+ :parser 'json-read
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "I sent: %S" (assoc-default 'args data)))))
POST:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/post"
- :type "POST"
- :data '(("key" . "value") ("key2" . "value2"))
- ;; :data "key=value&key2=value2" ; this is equivalent
- :parser 'json-read
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "I sent: %S" (assoc-default 'form data)))))
+ (request "http://httpbin.org/post"
+ :type "POST"
+ :data '(("key" . "value") ("key2" . "value2"))
+ ;; :data "key=value&key2=value2" ;; this is equivalent
+ :parser 'json-read
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "I sent: %S" (assoc-default 'form data)))))
Block until completion:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/get"
- :sync t
- :complete (cl-function
- (lambda (&key response &allow-other-keys)
- (message "Done: %s" (request-response-status-code response)))))
+ (request "http://httpbin.org/get"
+ :sync t
+ :complete (cl-function
+ (lambda (&key response &allow-other-keys)
+ (message "Done: %s" (request-response-status-code response)))))
Curl authentication:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/get"
+ (request "http://httpbin.org/get"
:auth "digest" ;; or "basic", "anyauth", etc., which see curl(1)
:complete (cl-function
(lambda (&key response &allow-other-keys)
@@ -77,99 +73,93 @@ Request binary data:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/get"
- :encoding 'binary
- :complete (cl-function
- (lambda (&key response &allow-other-keys)
- (message "Done: %s" (request-response-status-code response)))))
+ (request "http://httpbin.org/get"
+ :encoding 'binary
+ :complete (cl-function
+ (lambda (&key response &allow-other-keys)
+ (message "Done: %s" (request-response-status-code
response)))))
POST file (**WARNING**: it will send the contents of the current buffer!):
.. code:: emacs-lisp
- (request
- "http://httpbin.org/post"
- :type "POST"
- :files `(("current buffer" . ,(current-buffer)))
- :parser 'json-read
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "I sent: %S" (assoc-default 'files data)))))
+ (request "http://httpbin.org/post"
+ :type "POST"
+ :files `(("current buffer" . ,(current-buffer)))
+ :parser 'json-read
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "I sent: %S" (assoc-default 'files data)))))
Rich callback dispatch (like `jQuery.ajax`):
.. code:: emacs-lisp
- (request
- "http://httpbin.org/status/418" ; try other codes, for example:
- ;; "http://httpbin.org/status/200" ; success callback will be called.
- ;; "http://httpbin.org/status/400" ; you will see "Got 400."
- :parser 'buffer-string
- :success
- (cl-function (lambda (&key data &allow-other-keys)
- (when data
- (with-current-buffer (get-buffer-create "*request demo*")
- (erase-buffer)
- (insert data)
- (pop-to-buffer (current-buffer))))))
- :error
- (cl-function (lambda (&rest args &key error-thrown &allow-other-keys)
- (message "Got error: %S" error-thrown)))
- :complete (lambda (&rest _) (message "Finished!"))
- :status-code '((400 . (lambda (&rest _) (message "Got 400.")))
- (418 . (lambda (&rest _) (message "Got 418.")))))
+ (request "http://httpbin.org/status/418"
+ ;; "http://httpbin.org/status/200" ;; success callback will be called.
+ ;; "http://httpbin.org/status/400" ;; you will see "Got 400."
+ :parser 'buffer-string
+ :success
+ (cl-function (lambda (&key data &allow-other-keys)
+ (when data
+ (with-current-buffer (get-buffer-create "*request demo*")
+ (erase-buffer)
+ (insert data)
+ (pop-to-buffer (current-buffer))))))
+ :error
+ (cl-function (lambda (&rest args &key error-thrown &allow-other-keys)
+ (message "Got error: %S" error-thrown)))
+ :complete (lambda (&rest _) (message "Finished!"))
+ :status-code '((400 . (lambda (&rest _) (message "Got 400.")))
+ (418 . (lambda (&rest _) (message "Got 418.")))))
Flexible PARSER option:
.. code:: emacs-lisp
- (request
- "https://github.com/tkf/emacs-request/commits/master.atom"
- ;; Parse XML in response body:
- :parser (lambda () (libxml-parse-xml-region (point) (point-max)))
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- ;; Just don't look at this function....
- (let ((get (lambda (node &rest names)
- (if names
- (apply get
- (first (xml-get-children
- node (car names)))
- (cdr names))
- (first (xml-node-children node))))))
- (message "Latest commit: %s (by %s)"
- (funcall get data 'entry 'title)
- (funcall get data 'entry 'author 'name))))))
+ (request "https://github.com/tkf/emacs-request/commits/master.atom"
+ ;; Parse XML in response body:
+ :parser (lambda () (libxml-parse-xml-region (point) (point-max)))
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ ;; Just don't look at this function....
+ (let ((get (lambda (node &rest names)
+ (if names
+ (apply get
+ (first (xml-get-children
+ node (car names)))
+ (cdr names))
+ (first (xml-node-children node))))))
+ (message "Latest commit: %s (by %s)"
+ (funcall get data 'entry 'title)
+ (funcall get data 'entry 'author 'name))))))
PUT JSON data:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/put"
- :type "PUT"
- :data (json-encode '(("key" . "value") ("key2" . "value2")))
- :headers '(("Content-Type" . "application/json"))
- :parser 'json-read
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "I sent: %S" (assoc-default 'json data)))))
+ (request "http://httpbin.org/put"
+ :type "PUT"
+ :data (json-encode '(("key" . "value") ("key2" . "value2")))
+ :headers '(("Content-Type" . "application/json"))
+ :parser 'json-read
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "I sent: %S" (assoc-default 'json data)))))
PUT JSON data including non-ascii strings:
.. code:: emacs-lisp
- (request
- "http://httpbin.org/put"
- :type "PUT"
- :data (json-encode '(("key" . "値1") ("key2" . "値2")))
- :headers '(("Content-Type" . "application/json"))
- :parser 'json-read
- :encoding 'utf-8
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "I sent: %S" (assoc-default 'json data)))))
+ (request "http://httpbin.org/put"
+ :type "PUT"
+ :data (json-encode '(("key" . "値1") ("key2" . "値2")))
+ :headers '(("Content-Type" . "application/json"))
+ :parser 'json-read
+ :encoding 'utf-8
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "I sent: %S" (assoc-default 'json data)))))
Another PUT JSON example (nested JSON using alist structure, how to represent
a boolean & how to selectively evaluate lisp):
@@ -179,29 +169,27 @@ Another PUT JSON example (nested JSON using alist
structure, how to represent a
;; to allow elisp evaluation of selected elements prefixed with a comma
(,)
;; (2) This value is expected as a boolean so use the nil / t elisp alist
denotation
;; (3) The function will be evaluated as it has been prefixed with a comma
(,)
- (request
- "http://httpbin.org/put"
- :type "PUT"
- :data (json-encode `(("jsonArray" . (("item1" . "value 1") ;; (1)
- ("item2" . t) ;; (2)
- ("item3" .
,(your-custom-elisp-function)))))) ;; (3)
- :headers '(("Content-Type" . "application/json"))
- :parser 'json-read
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "I sent: %S" (assoc-default 'json data)))))
+ (request "http://httpbin.org/put"
+ :type "PUT"
+ :data (json-encode `(("jsonArray" . (("item1" . "value 1") ;; (1)
+ ("item2" . t) ;; (2)
+ ("item3" .
,(your-custom-elisp-function)))))) ;; (3)
+ :headers '(("Content-Type" . "application/json"))
+ :parser 'json-read
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "I sent: %S" (assoc-default 'json data)))))
GET with Unix domain socket data:
.. code:: emacs-lisp
- (request
- "http:/hello.txt"
- :unix-socket "/tmp/app.sock"
- :parser (lambda () (buffer-string))
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (message "Got: %s" data))))
+ (request "http:/hello.txt"
+ :unix-socket "/tmp/app.sock"
+ :parser (lambda () (buffer-string))
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (message "Got: %s" data))))
Legacy documentation
@@ -209,9 +197,8 @@ Legacy documentation
* `Github Pages <http://tkf.github.com/emacs-request/>`
.. |build-status|
- image:: https://secure.travis-ci.org/tkf/emacs-request.svg
- ?branch=master
- :target: http://travis-ci.org/tkf/emacs-request
+ image:: https://github.com/tkf/emacs-request/workflows/CI/badge.svg
+ :target: https://github.com/tkf/emacs-request/actions
:alt: Build Status
.. |melpa-badge|
image:: http://melpa.org/packages/request-badge.svg
diff --git a/tools/install-evm.sh b/tools/install-evm.sh
deleted file mode 100644
index 3d6c737..0000000
--- a/tools/install-evm.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-# Install evm for Travis CI
-# or if already installed, then check for updates
-# Author: gonewest818 https://github.com/clojure-emacs/cider/pull/2139
-set -x
-
-WORKDIR=${HOME}/local
-EVMDIR=$WORKDIR/evm
-
-. tools/retry.sh
-
-if [ -d $EVMDIR ]
-then
- cd $EVMDIR
- git pull origin master
-else
- git clone https://github.com/rejeep/evm.git $EVMDIR
-fi
- [nongnu] elpa/request updated (996a87d -> c5a1068), ELPA Syncer, 2021/02/12
- [nongnu] elpa/request b1e5b8f 2/7: gha badge, ELPA Syncer, 2021/02/12
- [nongnu] elpa/request e77d005 1/7: fix S-exp format as (declare (indent 1)), ELPA Syncer, 2021/02/12
- [nongnu] elpa/request ee0c5a4 3/7: goose gha, ELPA Syncer, 2021/02/12
- [nongnu] elpa/request 8a5979f 5/7: If there's a better way to get the originating repo of PR, ELPA Syncer, 2021/02/12
- [nongnu] elpa/request 705dd98 6/7: get it to work locally too, ELPA Syncer, 2021/02/12
- [nongnu] elpa/request 131a3d4 4/7: getting sha1's correct in cross-repo PRs gets complicated, ELPA Syncer, 2021/02/12
- [nongnu] elpa/request c5a1068 7/7: Merge pull request #198 from dickmao/conao3-fix-readme,
ELPA Syncer <=