Skip to content

Commit 83ed65d

Browse files
committed
refactor for cask
1 parent 2e303e3 commit 83ed65d

17 files changed

+275
-279
lines changed

.ert-runner

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-L .

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/docs/build/doctrees/
22
/docs/build/texinfo/
3-
TAGS
3+
TAGS
4+
/.cask
5+
/elpa

.travis.yml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
language: python
2-
python:
3-
- "2.7"
1+
language: emacs-lisp
42
env:
53
matrix:
6-
- EMACS=emacs
7-
- EMACS=emacs24
8-
- EMACS=emacs-snapshot
9-
before_install:
10-
- if [ "$EMACS" = "emacs24" ]; then
11-
sudo add-apt-repository -y ppa:cassou/emacs &&
12-
sudo apt-get update -qq &&
13-
sudo apt-get install -qq emacs24 emacs24-el;
14-
fi
15-
- if [ "$EMACS" = 'emacs-snapshot' ]; then
16-
sudo add-apt-repository -y ppa:cassou/emacs &&
17-
sudo apt-get update -qq &&
18-
sudo apt-get install -qq
19-
emacs-snapshot-el emacs-snapshot;
20-
fi
21-
- pip install --use-mirrors virtualenv-emacs
22-
- virtualenv_install_emacs --with-emacs=`which "$EMACS"` --marmalade
23-
- elpa-get eieio pcache logito mocker
24-
- emacs --version
4+
- EVM_EMACS=emacs-24.1-bin
5+
- EVM_EMACS=emacs-24.2-bin
6+
- EVM_EMACS=emacs-24.3-bin
7+
- EVM_EMACS=emacs-24.4-bin
8+
- EVM_EMACS=emacs-24.5-bin
9+
install:
10+
- sudo mkdir /usr/local/evm
11+
- sudo chown $(id -u):$(id -g) /usr/local/evm
12+
- curl -fsSkL --max-time 10 --retry 10 --retry-delay 10 https://raw.github.com/rejeep/evm/master/go | bash
13+
- export PATH="$HOME/.evm/bin:$PATH"
14+
- evm install $EVM_EMACS --use
15+
- curl -fsSkL --max-time 10 --retry 10 --retry-delay 10 https://raw.github.com/cask/cask/master/go | python
16+
- export PATH="$HOME/.cask/bin:$PATH"
17+
- cask
2518
script:
26-
make test
19+
make travis-ci

Cask

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(source gnu)
2+
(source marmalade)
3+
(source melpa-stable)
4+
5+
(package "gh" "1.0.0"
6+
"Github API client libraries.")
7+
8+
(depends-on "emacs" "24.1")
9+
(depends-on "s" "1.9.0")
10+
(depends-on "dash" "2.9.0")
11+
(depends-on "pcache" "0.3.1")
12+
(depends-on "logito" "0.1")
13+
(depends-on "marshal" "0.5.0")
14+
15+
(development
16+
(depends-on "ert-runner")
17+
(depends-on "shut-up")
18+
(depends-on "mocker"))

Makefile

Lines changed: 16 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,23 @@
1-
PKGNAME = gh
2-
VERSION = 1.0.0
3-
SNAPDIR = $(PKGNAME)-$(VERSION)
1+
EMACS ?= emacs
2+
CASK ?= cask
43

5-
PKGDEF = $(PKGNAME)-pkg.el
6-
AUTODEF = $(PKGNAME)-auto.el
7-
SPECIAL = $(PKGDEF) $(AUTODEF)
8-
ALLSOURCE = $(wildcard *.el)
4+
test: unit-tests
95

10-
SOURCE = $(filter-out $(SPECIAL), $(ALLSOURCE))
11-
TARGET = $(patsubst %.el,%.elc, $(SOURCE))
12-
README = README.md
6+
unit-tests: elpa
7+
${CASK} exec ert-runner
138

14-
EMACS = emacs
15-
SITEFLAG = --no-site-file
16-
EFLAGS =
17-
BATCH = $(EMACS) $(EFLAGS) $(SITEFLAG) -batch -q -L .
9+
elpa: Cask *.el
10+
mkdir -p elpa
11+
${CASK} install 2> elpa/install.log
1812

19-
PREFIX = /usr/local
20-
ELISPDIR = $(PREFIX)/share/emacs/site-lisp/$(PKGNAME)
13+
clean-elpa:
14+
rm -rf elpa
2115

22-
TEXI2HTML = makeinfo --html --number-sections
16+
clean-elc:
17+
rm -f *.elc test/*.elc
2318

24-
# Location of Emacs Lisp Package Archive entries
25-
ELPA=../../elpa
19+
clean: clean-elpa clean-elc
2620

27-
all: lisp docs
28-
29-
lisp: $(TARGET)
30-
31-
autoloads: $(AUTODEF)
32-
33-
$(AUTODEF): $(PKGNAME)-auto.in $(SOURCE)
34-
cp $(PKGNAME)-auto.in $(AUTODEF)
35-
rm -f $(AUTODEF)c
36-
@$(BATCH) -l $(PKGNAME)-auto \
37-
-f gh-generate-autoloads \
38-
$(shell pwd | sed -e 's|^/cygdrive/\([a-z]\)|\1:|')/$(AUTODEF) .
39-
40-
%.elc: %.el
41-
@$(BATCH) -f batch-byte-compile $<
42-
43-
clean:
44-
rm -f *~ $(TARGET) $(PKGNAME).info $(PKGNAME).html
45-
46-
realclean: clean docsclean
47-
rm -f $(AUTODEF)
48-
49-
install-bin: lisp
50-
install -d $(ELISPDIR)
51-
install -m 0644 $(ALLSOURCE) $(TARGET) $(ELISPDIR)
52-
53-
install: install-bin
54-
55-
distclean: clean
56-
rm -Rf ../$(SNAPDIR)
57-
58-
release: autoloads distclean
59-
mkdir ../$(SNAPDIR) && chmod 0755 ../$(SNAPDIR)
60-
cp $(SPECIAL) $(SOURCE) ../$(SNAPDIR)
61-
(cd .. && tar cjf $(PKGNAME)-$(VERSION).tar.bz2 $(SNAPDIR)/*)
62-
63-
elpa: info
64-
rm -fR $(ELPA)/$(SNAPDIR)
65-
rm -f $(ELPA)/$(PKGNAME)-$(VERSION).tar
66-
mkdir -p $(ELPA)/$(SNAPDIR) && chmod 0755 $(ELPA)/$(SNAPDIR)
67-
cp $(SOURCE) $(ELPA)/$(SNAPDIR)
68-
pandoc -f markdown_github -t plain $(README) | tail -n +3 > $(ELPA)/$(SNAPDIR)/README
69-
cp docs/build/texinfo/$(PKGNAME).info $(ELPA)/$(SNAPDIR)
70-
sed -e "s/%VERSION%/$(VERSION)/g" < $(PKGDEF) \
71-
> $(ELPA)/$(SNAPDIR)/$(PKGDEF)
72-
(cd $(ELPA) && tar cf $(PKGNAME)-$(VERSION).tar $(SNAPDIR))
73-
74-
info:
75-
$(MAKE) -C docs info
76-
77-
html:
78-
$(MAKE) -C docs html
79-
80-
docs: info html
81-
82-
docsclean:
83-
rm -f doc/$(PKGNAME).info doc/$(PKGNAME).html
84-
85-
test: lisp
86-
@$(BATCH) -l tests/gh-tests.el -l tests/gh-gist-tests.el \
87-
-l tests/gh-issues-tests.el -l tests/gh-orgs-tests.el \
88-
-f ert-run-tests-batch-and-exit
21+
print-deps:
22+
${EMACS} --version
23+
@echo CASK=${CASK}

gh-auto.in

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; gh-gist-tests.el --- tests for gh-gist.el
1+
;;; gh-gist-test.el --- test for gh-gist.el
22

33
;; Copyright (C) 2012 Yann Hodique
44

@@ -26,38 +26,38 @@
2626

2727
;;; Code:
2828

29-
(require 'gh-tests)
29+
(require 'gh-test)
3030
(require 'gh-gist)
3131

32-
(defun gh-gist-tests:test-regular-gist (gist)
33-
(should (equal (oref gist :id) "1"))
32+
(defun gh-gist-test:test-regular-gist (gist)
33+
(should (equal (oref gist :id) "aa5a315d61ae9438b18d"))
3434
(should (oref gist :public))
3535
(should (equal (length (oref gist :files)) 1)))
3636

37-
(ert-deftest gh-gist-tests:regular-list ()
38-
(let* ((api (gh-tests-mock-api 'gh-gist-api))
37+
(ert-deftest gh-gist-test:regular-list ()
38+
(let* ((api (gh-test-mock-api 'gh-gist-api))
3939
(gists
40-
(gh-tests-with-traces-buffers ((gists-buf "list_gists_sample.txt"))
41-
(gh-tests-mock-url ((:record-cls mocker-stub-record
40+
(gh-test-with-traces-buffers ((gists-buf "list_gists_sample.txt"))
41+
(gh-test-mock-url ((:record-cls mocker-stub-record
4242
:output gists-buf))
4343
(oref (gh-gist-list api "octocat") :data)))))
4444
(should (equal (length gists) 1))
4545
(let ((gist (car gists)))
4646
(should (object-of-class-p gist 'gh-gist-gist-stub))
47-
(gh-gist-tests:test-regular-gist gist))))
47+
(gh-gist-test:test-regular-gist gist))))
4848

49-
(ert-deftest gh-gist-tests:regular-get ()
50-
(let* ((api (gh-tests-mock-api 'gh-gist-api))
49+
(ert-deftest gh-gist-test:regular-get ()
50+
(let* ((api (gh-test-mock-api 'gh-gist-api))
5151
(gist
52-
(gh-tests-with-traces-buffers ((gist-buf "get_gist_sample.txt"))
53-
(gh-tests-mock-url ((:record-cls mocker-stub-record
52+
(gh-test-with-traces-buffers ((gist-buf "get_gist_sample.txt"))
53+
(gh-test-mock-url ((:record-cls mocker-stub-record
5454
:output gist-buf))
5555
(oref (gh-gist-get api "1") :data)))))
5656
(should (object-of-class-p gist 'gh-gist-gist))
57-
(gh-gist-tests:test-regular-gist gist)))
57+
(gh-gist-test:test-regular-gist gist)))
5858

59-
(ert-deftest gh-gist-tests:regular-new ()
60-
(let* ((api (gh-tests-mock-api 'gh-gist-api))
59+
(ert-deftest gh-gist-test:regular-new ()
60+
(let* ((api (gh-test-mock-api 'gh-gist-api))
6161
(gist-stub
6262
(make-instance 'gh-gist-gist-stub
6363
:description "description of gist"
@@ -67,12 +67,12 @@
6767
:filename "ring.erl"
6868
:content "contents of gist"))))
6969
(gist
70-
(gh-tests-with-traces-buffers ((gist-buf "get_gist_sample.txt"))
71-
(gh-tests-mock-url ((:record-cls mocker-stub-record
70+
(gh-test-with-traces-buffers ((gist-buf "get_gist_sample.txt"))
71+
(gh-test-mock-url ((:record-cls mocker-stub-record
7272
:output gist-buf))
7373
(oref (gh-gist-new api gist-stub) :data)))))
7474
(should (object-of-class-p gist 'gh-gist-gist))
75-
(gh-gist-tests:test-regular-gist gist)))
75+
(gh-gist-test:test-regular-gist gist)))
7676

77-
(provide 'gh-gist-tests)
78-
;;; gh-gist-tests.el ends here
77+
(provide 'gh-gist-test)
78+
;;; gh-gist-test.el ends here
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; gh-issues-tests.el --- tests fir gh-issues.el
1+
;;; gh-issues-test.el --- test fir gh-issues.el
22

33
;; Copyright (C) 2012 Yann Hodique
44

@@ -26,18 +26,18 @@
2626

2727
;;; Code:
2828

29-
(require 'gh-tests)
29+
(require 'gh-test)
3030
(require 'gh-issues)
3131

32-
(defun gh-issues-tests:test-regular-issue (issue)
32+
(defun gh-issues-test:test-regular-issue (issue)
3333
(should (equal (oref issue :number) 1347))
3434
(should (equal (oref issue :state) "open")))
3535

36-
(ert-deftest gh-issues-tests:regular-list ()
37-
(let* ((api (gh-tests-mock-api 'gh-issues-api))
36+
(ert-deftest gh-issues-test:regular-list ()
37+
(let* ((api (gh-test-mock-api 'gh-issues-api))
3838
(issues
39-
(gh-tests-with-traces-buffers ((gists-buf "list_issues_sample.txt"))
40-
(gh-tests-mock-url ((:record-cls mocker-stub-record
39+
(gh-test-with-traces-buffers ((gists-buf "list_issues_sample.txt"))
40+
(gh-test-mock-url ((:record-cls mocker-stub-record
4141
:output gists-buf))
4242
(oref
4343
(gh-issues-issue-list api "octocat"
@@ -46,7 +46,7 @@
4646
(should (equal (length issues) 1))
4747
(let ((issue (car issues)))
4848
(should (object-of-class-p issue 'gh-issues-issue))
49-
(gh-issues-tests:test-regular-issue issue))))
49+
(gh-issues-test:test-regular-issue issue))))
5050

51-
(provide 'gh-issues-tests)
52-
;;; gh-issues-tests.el ends here
51+
(provide 'gh-issues-test)
52+
;;; gh-issues-test.el ends here
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; gh-orgs-tests.el --- tests for gh-orgs.el
1+
;;; gh-orgs-test.el --- test for gh-orgs.el
22

33
;; Copyright (C) 2012 Yann Hodique
44

@@ -26,56 +26,56 @@
2626

2727
;;; Code:
2828

29-
(require 'gh-tests)
29+
(require 'gh-test)
3030
(require 'gh-orgs)
3131

32-
(defun gh-orgs-tests:test-regular-org-stub (org)
32+
(defun gh-orgs-test:test-regular-org-stub (org)
3333
(should (equal (oref org :id) 1))
3434
(should (equal (oref org :login) "github"))
3535
(should (equal "https://github.com/images/error/octocat_happy.gif" (oref org :avatar-url))))
3636

37-
(defun gh-orgs-tests:test-regular-org (org)
38-
(gh-orgs-tests:test-regular-org-stub org)
37+
(defun gh-orgs-test:test-regular-org (org)
38+
(gh-orgs-test:test-regular-org-stub org)
3939
(should (equal (oref org :public-gists) 1))
4040
(should (equal (oref org :public-repos) 2)))
4141

42-
(ert-deftest gh-orgs-tests:regular-list ()
43-
(let* ((api (gh-tests-mock-api 'gh-orgs-api))
42+
(ert-deftest gh-orgs-test:regular-list ()
43+
(let* ((api (gh-test-mock-api 'gh-orgs-api))
4444
(orgs
45-
(gh-tests-with-traces-buffers ((orgs-buf "list_orgs_sample.txt"))
46-
(gh-tests-mock-url ((:record-cls mocker-stub-record
45+
(gh-test-with-traces-buffers ((orgs-buf "list_orgs_sample.txt"))
46+
(gh-test-mock-url ((:record-cls mocker-stub-record
4747
:output orgs-buf))
4848
(oref (gh-orgs-list api "dummy") :data)))))
4949
(should (equal (length orgs) 1))
5050
(let ((org (car orgs)))
5151
(should (object-of-class-p org 'gh-orgs-org-stub))
52-
(gh-orgs-tests:test-regular-org-stub org))))
52+
(gh-orgs-test:test-regular-org-stub org))))
5353

54-
(ert-deftest gh-orgs-tests:regular-get ()
55-
(let* ((api (gh-tests-mock-api 'gh-orgs-api))
54+
(ert-deftest gh-orgs-test:regular-get ()
55+
(let* ((api (gh-test-mock-api 'gh-orgs-api))
5656
(org
57-
(gh-tests-with-traces-buffers ((orgs-buf "get_org_sample.txt"))
58-
(gh-tests-mock-url ((:record-cls mocker-stub-record
57+
(gh-test-with-traces-buffers ((orgs-buf "get_org_sample.txt"))
58+
(gh-test-mock-url ((:record-cls mocker-stub-record
5959
:output orgs-buf))
6060
(oref (gh-orgs-get api "github") :data)))))
6161
(should (object-of-class-p org 'gh-orgs-org))
62-
(gh-orgs-tests:test-regular-org org)))
62+
(gh-orgs-test:test-regular-org org)))
6363

64-
(ert-deftest gh-orgs-tests:regular-update ()
65-
(let* ((api (gh-tests-mock-api 'gh-orgs-api))
64+
(ert-deftest gh-orgs-test:regular-update ()
65+
(let* ((api (gh-test-mock-api 'gh-orgs-api))
6666
(org-stub
6767
(make-instance 'gh-orgs-org
6868
:login "github"
6969
:id 1
7070
:url "https://api.github.com/orgs/1"
7171
:avatar-url "https://github.com/images/error/octocat_happy.gif"))
7272
(org
73-
(gh-tests-with-traces-buffers ((orgs-buf "get_org_sample.txt"))
74-
(gh-tests-mock-url ((:record-cls mocker-stub-record
73+
(gh-test-with-traces-buffers ((orgs-buf "get_org_sample.txt"))
74+
(gh-test-mock-url ((:record-cls mocker-stub-record
7575
:output orgs-buf))
7676
(oref (gh-orgs-update api org-stub) :data)))))
7777
(should (object-of-class-p org 'gh-orgs-org))
78-
(gh-orgs-tests:test-regular-org org)))
78+
(gh-orgs-test:test-regular-org org)))
7979

80-
(provide 'gh-orgs-tests)
81-
;;; gh-orgs-tests.el ends here
80+
(provide 'gh-orgs-test)
81+
;;; gh-orgs-test.el ends here

0 commit comments

Comments
 (0)