Permalink
Browse files

Initial commit

  • Loading branch information...
1 parent 2917b38 commit d8eaecb8083cf5cdf9a7542a62fe1a62ba9d67e9 @rolandwalker committed Oct 25, 2012
Showing with 657 additions and 4 deletions.
  1. +149 −0 .travis.yml
  2. +173 −0 Makefile
  3. +79 −0 README.markdown
  4. +0 −4 README.md
  5. +58 −0 ert-tests/syntactic-sugar-test.el
  6. +198 −0 syntactic-sugar.el
View
@@ -0,0 +1,149 @@
+###
+### Notes
+###
+### The travis web interface may choke silently and fail to
+### update when there are issues with the .travis.yml file.
+###
+### The "travis-lint" command-line tool does not catch all
+### errors which may lead to silent failure.
+###
+### Shell-style comments must have "#" as the first character
+### of the line.
+###
+
+###
+### language
+###
+
+language: emacs-lisp
+
+###
+### defining the build matrix
+###
+### ===> <===
+### ===> each variation in env/matrix will be built and tested <===
+### ===> <===
+###
+### variables under env/global are available to the build process
+### but don't cause the creation of a separate variation
+###
+
+env:
+ matrix:
+ - EMACS=emacs22
+ - EMACS=emacs23
+ - EMACS=emacs24
+ - EMACS=emacs-snapshot
+ global:
+ - SOME_TOKEN=some_value
+
+###
+### allowing failures
+###
+### note that global variables must be included again
+### verbatim
+###
+
+matrix:
+ allow_failures:
+ - env:
+ - EMACS=emacs22
+ - SOME_TOKEN=some_value
+ - env:
+ - EMACS=emacs-snapshot
+ - SOME_TOKEN=some_value
+
+###
+### limit build attempts to defined branches
+###
+### - Seems to be the only way to keep feature branches from
+### breaking web badges. Wouldn't this functionality make
+### more sense in allow_failures, above?
+###
+
+branches:
+ only:
+ - master
+
+###
+### runtime initialization
+###
+### notes
+###
+### emacs22 is extracted manually from Ubuntu Maverick.
+###
+### emacs23 is the stock default, but is updated anyway to
+### a GUI-capable version, which will have certain additional
+### functions compiled in.
+###
+### emacs24 (current stable release) is obtained from the
+### cassou PPA: http://launchpad.net/~cassou/+archive/emacs
+###
+### emacs-snapshot (trunk) is obtained from the cassou PPA.
+### For the emacs-snapshot build, bleeding-edge versions
+### of all test dependencies are also used.
+###
+
+before_install:
+ - git submodule --quiet update --init --recursive
+
+install:
+ - if [ "$EMACS" = 'emacs22' ]; then
+ curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22_22.2-0ubuntu9_i386.deb &&
+ curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-bin-common_22.2-0ubuntu9_i386.deb &&
+ curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-common_22.2-0ubuntu9_all.deb &&
+ curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-el_22.2-0ubuntu9_all.deb &&
+ curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-gtk_22.2-0ubuntu9_i386.deb &&
+ sudo apt-get update -qq &&
+ sudo apt-get remove -qq emacs emacs23-bin-common emacs23-common emacs23-nox &&
+ sudo apt-get install -qq libjpeg62 xaw3dg &&
+ sudo dpkg -i emacs22_22.2-0ubuntu9_i386.deb emacs22-bin-common_22.2-0ubuntu9_i386.deb emacs22-common_22.2-0ubuntu9_all.deb emacs22-el_22.2-0ubuntu9_all.deb emacs22-gtk_22.2-0ubuntu9_i386.deb &&
+ sudo update-alternatives --set emacs22 /usr/bin/emacs22-gtk;
+ fi
+ - if [ "$EMACS" = 'emacs23' ]; then
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq emacs23-gtk emacs23-el;
+ fi
+ - if [ "$EMACS" = 'emacs24' ]; then
+ sudo add-apt-repository -y ppa:cassou/emacs &&
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq emacs24 emacs24-el;
+ fi
+ - if [ "$EMACS" = 'emacs-snapshot' ]; then
+ sudo add-apt-repository -y ppa:cassou/emacs &&
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq emacs-snapshot &&
+ sudo apt-get install -qq emacs-snapshot-el emacs-snapshot-gtk;
+ fi
+
+before_script:
+ - if [ "$EMACS" = 'emacs-snapshot' ]; then
+ make downloads-latest;
+ else
+ make downloads;
+ fi
+
+###
+### the actual build/test command
+###
+
+script:
+ $EMACS --version && make test EMACS=$EMACS
+
+###
+### settings
+###
+
+notifications:
+ email: false
+
+#
+# Emacs
+#
+# Local Variables:
+# indent-tabs-mode: nil
+# mangle-whitespace: t
+# require-final-newline: t
+# coding: utf-8
+# End:
+#
View
@@ -0,0 +1,173 @@
+EMACS=emacs
+# EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
+# EMACS=/Applications/Emacs23.app/Contents/MacOS/Emacs
+# EMACS=/Applications/Aquamacs.app/Contents/MacOS/Aquamacs
+# EMACS=/Applications/Macmacs.app/Contents/MacOS/Emacs
+# EMACS=/usr/local/bin/emacs
+# EMACS=/opt/local/bin/emacs
+# EMACS=/usr/bin/emacs
+
+INTERACTIVE_EMACS=/usr/local/bin/emacs
+# can't find an OS X variant that works correctly for interactive tests:
+# INTERACTIVE_EMACS=open -a Emacs.app --new --args
+# INTERACTIVE_EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
+# INTERACTIVE_EMACS=/Applications/Emacs.app/Contents/MacOS/bin/emacs
+
+RESOLVED_EMACS=$(shell readlink `which $(EMACS)` || echo "$(EMACS)")
+RESOLVED_INTERACTIVE_EMACS=$(shell readlink `which "$(INTERACTIVE_EMACS)"` || echo "$(INTERACTIVE_EMACS)")
+
+EMACS_CLEAN=-Q
+EMACS_BATCH=$(EMACS_CLEAN) --batch
+# TESTS can be overridden to specify a subset of tests
+TESTS=
+WIKI_USERNAME=roland.walker
+
+CURL=curl --silent
+EDITOR=runemacs -no_wait
+WORK_DIR=$(shell pwd)
+PACKAGE_NAME=$(shell basename $(WORK_DIR))
+PACKAGE_VERSION=$(shell perl -ne 'print "$$1\n" if m{^;+ *Version: *(\S+)}' $(PACKAGE_NAME).el)
+AUTOLOADS_FILE=$(PACKAGE_NAME)-autoloads.el
+TRAVIS_FILE=.travis.yml
+TEST_DIR=ert-tests
+TEST_DEP_1=ert
+TEST_DEP_1_STABLE_URL=http://bzr.savannah.gnu.org/lh/emacs/emacs-24/download/head:/ert.el-20110112160650-056hnl9qhpjvjicy-2/ert.el
+TEST_DEP_1_LATEST_URL=https://raw.github.com/emacsmirror/emacs/master/lisp/emacs-lisp/ert.el
+
+.PHONY : build dist not-dirty pkg-version downloads downloads-latest autoloads \
+ test-autoloads test-travis test test-prep test-batch test-interactive \
+ test-tests clean edit run-pristine run-pristine-local upload-github \
+ upload-wiki upload-marmalade test-dep-1 test-dep-2 test-dep-3 test-dep-4 \
+ test-dep-5 test-dep-6 test-dep-7 test-dep-8 test-dep-9
+
+build :
+ $(RESOLVED_EMACS) $(EMACS_BATCH) --eval \
+ "(progn \
+ (setq byte-compile-error-on-warn t) \
+ (batch-byte-compile))" *.el
+
+not-dirty :
+ @git diff --quiet '$(PACKAGE_NAME).el' || \
+ ( git --no-pager diff '$(PACKAGE_NAME).el'; \
+ echo "Uncommitted edits - do a git stash"; \
+ false )
+
+pkg-version :
+ @test -n '$(PACKAGE_VERSION)' || \
+ ( echo "No package version"; false )
+
+test-dep-1 :
+ @cd '$(TEST_DIR)' && \
+ $(RESOLVED_EMACS) $(EMACS_BATCH) -L . -L .. -l '$(TEST_DEP_1)' || \
+ (echo "Can't load test dependency $(TEST_DEP_1).el, run 'make downloads' to fetch it" ; exit 1)
+
+downloads :
+ $(CURL) '$(TEST_DEP_1_STABLE_URL)' > '$(TEST_DIR)/$(TEST_DEP_1).el'
+
+downloads-latest :
+ $(CURL) '$(TEST_DEP_1_LATEST_URL)' > '$(TEST_DIR)/$(TEST_DEP_1).el'
+
+autoloads :
+ $(RESOLVED_EMACS) $(EMACS_BATCH) --eval \
+ "(progn \
+ (setq generated-autoload-file \"$(WORK_DIR)/$(AUTOLOADS_FILE)\") \
+ (update-directory-autoloads \"$(WORK_DIR)\"))"
+
+test-autoloads : autoloads
+ @$(RESOLVED_EMACS) $(EMACS_BATCH) -L . -l './$(AUTOLOADS_FILE)' || \
+ ( echo "failed to load autoloads: $(AUTOLOADS_FILE)" && false )
+
+test-travis :
+ @if test -z "$$TRAVIS" && test -e '$(TRAVIS_FILE)'; then travis-lint '$(TRAVIS_FILE)'; fi
+
+test-tests :
+ @perl -ne 'if (m/^\s*\(\s*ert-deftest\s*(\S+)/) {die "$$1 test name duplicated in $$ARGV\n" if $$dupes{$$1}++}' '$(TEST_DIR)/'*-test.el
+
+test-prep : build test-dep-1 test-autoloads test-travis test-tests
+
+test-batch :
+ @cd '$(TEST_DIR)' && \
+ (for test_lib in *-test.el; do \
+ $(RESOLVED_EMACS) $(EMACS_BATCH) -L . -L .. -l cl \
+ -l '$(TEST_DEP_1)' -l "$$test_lib" --eval \
+ "(flet ((ert--print-backtrace (&rest args) \
+ (insert \"no backtrace in batch mode\"))) \
+ (ert-run-tests-batch-and-exit '(and \"$(TESTS)\" (not (tag :interactive)))))" || exit 1; \
+ done)
+
+test-interactive : test-prep
+ @cd '$(TEST_DIR)' && \
+ (for test_lib in *-test.el; do \
+ $(RESOLVED_INTERACTIVE_EMACS) $(EMACS_CLEAN) --eval \
+ "(progn \
+ (cd \"$(WORK_DIR)/$(TEST_DIR)\") \
+ (setq dired-use-ls-dired nil) \
+ (setq frame-title-format \"TEST SESSION $$test_lib\") \
+ (setq enable-local-variables :safe))" \
+ -L . -L .. -l cl -l '$(TEST_DEP_1)' -l "$$test_lib" \
+ --visit "$$test_lib" --eval \
+ "(progn \
+ (when (> (length \"$(TESTS)\") 0) \
+ (push \"\\\"$(TESTS)\\\"\" ert--selector-history)) \
+ (setq buffer-read-only t) \
+ (setq cursor-in-echo-area t) \
+ (call-interactively 'ert-run-tests-interactively) \
+ (ding) \
+ (when (y-or-n-p \"PRESS Y TO QUIT THIS TEST SESSION\") \
+ (with-current-buffer \"*ert*\" \
+ (kill-emacs \
+ (if (re-search-forward \"^Failed:[^\\n]+unexpected\" 500 t) 1 0)))))" || exit 1; \
+ done)
+
+test : test-prep test-batch
+
+run-pristine :
+ @cd '$(TEST_DIR)' && \
+ $(RESOLVED_EMACS) $(EMACS_CLEAN) --eval \
+ "(progn \
+ (setq package-enable-at-startup nil) \
+ (setq package-load-list nil) \
+ (when (fboundp 'package-initialize) \
+ (package-initialize)) \
+ (cd \"$(WORK_DIR)/$(TEST_DIR)\") \
+ (setq dired-use-ls-dired nil) \
+ (setq frame-title-format \"PRISTINE SESSION $(PACKAGE_NAME)\") \
+ (setq enable-local-variables :safe))" \
+ -L .. -l '$(PACKAGE_NAME)' .
+
+run-pristine-local :
+ @cd '$(TEST_DIR)' && \
+ $(RESOLVED_EMACS) $(EMACS_CLEAN) --eval \
+ "(progn \
+ (cd \"$(WORK_DIR)/$(TEST_DIR)\") \
+ (setq dired-use-ls-dired nil) \
+ (setq frame-title-format \"PRISTINE-LOCAL SESSION $(PACKAGE_NAME)\") \
+ (setq enable-local-variables :safe))" \
+ -L . -L .. -l '$(PACKAGE_NAME)' .
+
+clean :
+ @rm -f '$(AUTOLOADS_FILE)' *.elc *~ */*.elc */*~ .DS_Store */.DS_Store *.bak */*.bak && \
+ cd '$(TEST_DIR)' && \
+ rm -f './$(TEST_DEP_1).el' './$(TEST_DEP_2).el' './$(TEST_DEP_3).el' './$(TEST_DEP_4).el' './$(TEST_DEP_5a).el' \
+ './$(TEST_DEP_5).el' './$(TEST_DEP_6).el' './$(TEST_DEP_7).el' './$(TEST_DEP_8).el' './$(TEST_DEP_9).el'
+
+edit :
+ @$(EDITOR) `git ls-files`
+
+upload-github :
+ @git push origin master
+
+upload-wiki : not-dirty
+ @$(RESOLVED_EMACS) $(EMACS_BATCH) --eval \
+ "(progn \
+ (setq package-load-list '((yaoddmuse t))) \
+ (when (fboundp 'package-initialize) \
+ (package-initialize)) \
+ (require 'yaoddmuse) \
+ (setq yaoddmuse-username \"$(WIKI_USERNAME)\") \
+ (yaoddmuse-post-file \
+ \"$(PACKAGE_NAME).el\" \
+ yaoddmuse-default-wiki \
+ \"$(PACKAGE_NAME).el\" \
+ \"updated version\") \
+ (sleep-for 5))"
Oops, something went wrong.

0 comments on commit d8eaecb

Please sign in to comment.