Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 7 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jul 05, 2012
@joelmccracken joelmccracken Added bash script to help manage the way emacs is run
The ecukes command is now a bash script.
ecukes was renamed to ecukes.el, which is now loaded by the script.
You may run ecukes in a graphical way by running it with the argument --graphical
That should clearly be renamed, but I am currently unimaginative.
You may also specify the argument that ecukes uses to run emacs via
the shell variable ECUKES_EMACS; set it to the path of the emacs you
would like it to run.
4791ca2
@joelmccracken joelmccracken Fixed but with mktemp in ecukes shell script.
Basically, mktemp was used with somewhat nonstandard shell syntax. It
worked fine on my machine (OSX Lion), but hopefully changing it to a
somewhat more standard syntax will work better across platforms.
d82ebb7
@joelmccracken joelmccracken Fixed a bug where really long cuke output would be truncated when
running --graphical

Before, script just output the contents of *Messages* when it
ended. This was a problem because *Messages* seems to only keep so
much information.
Now, it uses after-advice on the message function to save any message
output to a different buffer and outputs the contents at the end.
e6da76d
@joelmccracken joelmccracken Quick renaming fix (sauron to ecukes)
Used the name of another project I am working
with (sauron) in this code (ecukes). Changed it to ecukes.
b5762da
@joelmccracken joelmccracken Attempting to fix issues with bash script and ecukes.el
File ecukes now works with scripts mentioned in the comments for pull
request 61. Mentioned versions of ~/bin/emacs executables now
work.
Also reworked the message hack to hopefully behave a bit better,
especially with nils.
d0f8f3a
@joelmccracken joelmccracken --graphical file arguments command line bug fix
when file was rewritten, forgot to include the remaning command arguments to the
--graphical ecukes' emacs invocation
67b124f
Commits on Jul 06, 2012
@rejeep rejeep Update to version 0.2.0
Includes support for --graphical option which runs a real Emacs instance (Thanks @joelmccracken)
Bugfixes
2e8898d
Showing with 203 additions and 136 deletions.
  1. +32 −136 ecukes
  2. +171 −0 ecukes.el
View
168 ecukes
@@ -1,149 +1,45 @@
-#!/usr/bin/env emacs --script
+#!/usr/bin/env bash
-;;; ecukes --- Cucumber for Emacs
+# ecukes --- Cucumber for Emacs
+# Copyright (C) 2012 Joel McCracken
-;; Copyright (C) 2010 Johan Andersson
+# License:
-;; Author: Johan Andersson <johan.rejeep@gmail.com>
-;; Maintainer: Johan Andersson <johan.rejeep@gmail.com>
-;; Version: 0.1.0
-;; Keywords: testing, cucumber
-;; URL: http://github.com/rejeep/ecukes
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
-;; This file is NOT part of GNU Emacs.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
-;;; License:
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
+# see README for information
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+ECUKES_EL=$(dirname $BASH_SOURCE)/ecukes.el
-;;; Commentary:
-;; See README
+if [ -z "$ECUKES_EMACS" ] ; then
+ ECUKES_EMACS="emacs"
+fi
-;;; Code:
+if [ "$1" == "--graphical" ] ; then
+ # create spec output file
+ export ECUKES_OUTFILE=`mktemp /tmp/emacsoutput.XXXXX`
+ $ECUKES_EMACS --load "$ECUKES_EL" -q "${@:2}"
-(setq debug-on-error t)
-(setq debug-on-entry t)
+ # send that file to the console
+ cat $ECUKES_OUTFILE
-(defvar ecukes-path
- (file-name-directory load-file-name)
- "Path to ecukes.")
-
-(defvar ecukes-vendor-path
- (expand-file-name "vendor" ecukes-path)
- "Path to ecukes vendor.")
-
-(add-to-list 'load-path ecukes-path)
-(add-to-list 'load-path ecukes-vendor-path)
-
-(eval-when-compile
- (require 'cl))
-
-(require 'ansi)
-(require 'ecukes-template)
-(require 'ecukes-new)
-(require 'ecukes-def)
-(require 'ecukes-startup)
-(require 'ecukes-parse)
-(require 'ecukes-steps)
-(require 'ecukes-run)
-(require 'ecukes-print)
-(require 'ecukes-hooks)
-(require 'ecukes-stats)
-
-(add-to-list 'command-switch-alist '("--new" . ecukes-new-handler))
-
-(when (ecukes-startup-run-p)
-
- (defun run-step (step &optional print background)
- "Run STEP, including increasing counters."
- (if previous-step-success
- (cond
- ((ecukes-run-step step)
- (unless background (ecukes-stats-step-pass))
- (if print
- (ecukes-print-step-success step)))
- (t
- (unless background (ecukes-stats-step-fail))
- (setq step-has-failed t)
- (if print
- (ecukes-print-step-failure step))
- (setq previous-step-success nil)))
- (ecukes-stats-step-skip)
- (if print
- (ecukes-print-step-pending step))))
-
- (let ((feature-files (ecukes-startup-features argv)))
- (cond (feature-files
-
- (ecukes-startup-load)
-
- (ecukes-hooks-run-setup)
-
- (dolist (feature-file feature-files)
- (let* ((feature (ecukes-parse-feature feature-file))
- (background (ecukes-feature-background feature))
- (scenarios (ecukes-feature-scenarios feature))
- (steps
- (apply
- 'append
- (if background (ecukes-background-steps background))
- (mapcar 'ecukes-scenario-steps scenarios)))
- (undefined (ecukes-steps-undefined steps)))
-
- (setq step-has-failed nil)
- (setq previous-step-success t)
- (setq background-runned nil)
-
- (cond (undefined
- (ecukes-print-undefined-steps undefined))
- ((let ((intro (ecukes-feature-intro feature)))
- (ecukes-print-intro intro)
-
- (when background
- (ecukes-print-background-header)
- (dolist (step (ecukes-background-steps background))
- (run-step step t))
- (setq background-runned t))
-
- (dolist (scenario scenarios)
- (ecukes-hooks-run-before)
-
- (when background
- (dolist (step (ecukes-background-steps background))
- (run-step step nil t)))
-
- (ecukes-print-newline)
- (ecukes-print-scenario-header scenario)
- (dolist (step (ecukes-scenario-steps scenario))
- (run-step step t))
-
- (if step-has-failed
- (ecukes-stats-scenario-fail)
- (ecukes-stats-scenario-pass))
-
- (setq previous-step-success t)
- (setq step-has-failed nil)
-
- (ecukes-hooks-run-after)))))))
- (ecukes-hooks-run-teardown)
-
- (ecukes-stats-print-summary))
- (t
- (ecukes-print-message
- (ansi-red "You did not provide any features to run"))))))
-
-;;; ecukes.el ends here
+ # clean up
+ rm $ECUKES_OUTFILE
+else
+ $ECUKES_EMACS --script $ECUKES_EL "$@"
+fi
View
171 ecukes.el
@@ -0,0 +1,171 @@
+#!/usr/bin/env emacs --script
+;;; ecukes --- Cucumber for Emacs
+
+;; Copyright (C) 2010 Johan Andersson
+
+;; Author: Johan Andersson <johan.rejeep@gmail.com>
+;; Maintainer: Johan Andersson <johan.rejeep@gmail.com>
+;; Version: 0.2.0
+;; Keywords: testing, cucumber
+;; URL: http://github.com/rejeep/ecukes
+
+;; This file is NOT part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; See README
+
+;;; Code:
+
+(setq debug-on-error t)
+(setq debug-on-entry t)
+
+(defvar *ecukes-message-log* (list ""))
+
+(defadvice message (after ecukes-log-messages-to-buffer
+ activate)
+ (when ad-return-value
+ (setf (cdr (last *ecukes-message-log*))
+ (cons ad-return-value nil))))
+
+
+(defvar ecukes-path
+ (file-name-directory load-file-name)
+ "Path to ecukes.")
+
+(defvar ecukes-vendor-path
+ (expand-file-name "vendor" ecukes-path)
+ "Path to ecukes vendor.")
+
+(add-to-list 'load-path ecukes-path)
+(add-to-list 'load-path ecukes-vendor-path)
+
+(eval-when-compile
+ (require 'cl))
+
+(require 'ansi)
+(require 'ecukes-template)
+(require 'ecukes-new)
+(require 'ecukes-def)
+(require 'ecukes-startup)
+(require 'ecukes-parse)
+(require 'ecukes-steps)
+(require 'ecukes-run)
+(require 'ecukes-print)
+(require 'ecukes-hooks)
+(require 'ecukes-stats)
+
+(add-to-list 'command-switch-alist '("--new" . ecukes-new-handler))
+
+(when (ecukes-startup-run-p)
+
+ (defun run-step (step &optional print background)
+ "Run STEP, including increasing counters."
+ (if previous-step-success
+ (cond
+ ((ecukes-run-step step)
+ (unless background (ecukes-stats-step-pass))
+ (if print
+ (ecukes-print-step-success step)))
+ (t
+ (unless background (ecukes-stats-step-fail))
+ (setq step-has-failed t)
+ (if print
+ (ecukes-print-step-failure step))
+ (setq previous-step-success nil)))
+ (ecukes-stats-step-skip)
+ (if print
+ (ecukes-print-step-pending step))))
+
+ (let ((feature-files (ecukes-startup-features argv)))
+ (cond (feature-files
+
+ (ecukes-startup-load)
+
+ (ecukes-hooks-run-setup)
+
+ (dolist (feature-file feature-files)
+ (let* ((feature (ecukes-parse-feature feature-file))
+ (background (ecukes-feature-background feature))
+ (scenarios (ecukes-feature-scenarios feature))
+ (steps
+ (apply
+ 'append
+ (if background (ecukes-background-steps background))
+ (mapcar 'ecukes-scenario-steps scenarios)))
+ (undefined (ecukes-steps-undefined steps)))
+
+ (setq step-has-failed nil)
+ (setq previous-step-success t)
+ (setq background-runned nil)
+
+ (cond (undefined
+ (ecukes-print-undefined-steps undefined))
+ ((let ((intro (ecukes-feature-intro feature)))
+ (ecukes-print-intro intro)
+
+ (when background
+ (ecukes-print-background-header)
+ (dolist (step (ecukes-background-steps background))
+ (run-step step t))
+ (setq background-runned t))
+
+ (dolist (scenario scenarios)
+ (ecukes-hooks-run-before)
+
+ (when background
+ (dolist (step (ecukes-background-steps background))
+ (run-step step nil t)))
+
+ (ecukes-print-newline)
+ (ecukes-print-scenario-header scenario)
+ (dolist (step (ecukes-scenario-steps scenario))
+ (run-step step t))
+
+ (if step-has-failed
+ (ecukes-stats-scenario-fail)
+ (ecukes-stats-scenario-pass))
+
+ (setq previous-step-success t)
+ (setq step-has-failed nil)
+
+ (ecukes-hooks-run-after)))))))
+
+ (ecukes-hooks-run-teardown)
+
+ (ecukes-stats-print-summary))
+ (t
+ (ecukes-print-message
+ (ansi-red "You did not provide any features to run"))))))
+
+(when (getenv "ECUKES_OUTFILE")
+ (with-temp-buffer
+ (mapcar (lambda (line)
+ (insert line) (insert "\n"))
+ *ecukes-message-log*)
+ ;; ecukes-tmp-file-target needs to get set from somewhere else
+ (write-file (getenv "ECUKES_OUTFILE")))
+ ;; kill emacs needs to happen because when ecukes-tmp-file-target
+ ;; is set, emacs is running as graphical and -q
+ (kill-emacs))
+
+
+
+;;; ecukes.el ends here

No commit comments for this range

Something went wrong with that request. Please try again.