-
Notifications
You must be signed in to change notification settings - Fork 45
/
rails-spec.el
73 lines (57 loc) · 2.57 KB
/
rails-spec.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
;;; rails-rake.el --- emacs-rails integraions with rake tasks.
;; Copyright (C) 2006 Dmitry Galinsky <dima dot exe at gmail dot com>
;; Authors: Dmitry Galinsky <dima dot exe at gmail dot com>,
;; Peter Rezikov <crazypit13 at gmail dot com>
;; Keywords: ruby rails languages oop
;; $URL: svn+ssh://rubyforge/var/svn/emacs-rails/trunk/rails-spec.el $
;; $Id: rails-spec.el 117 2007-03-25 23:37:37Z dimaexe $
;;; 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 2
;; of the License, 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 this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(defvar rails-spec:all-files "./spec"
"All spec files/directories in project")
(defvar rails-spec:last-files rails-spec:all-files
"Last files that run with spec. In this variable memorized each spec coommand.")
(defvar rails-spec:runner "./script/spec"
"Command, that run specs.")
(defvar rails-spec:runner-options ""
"Options to spec command.")
(defun rails-spec:run-files (files)
"Run spec for files"
(interactive "Mspec files: ")
(setf rails-spec:last-files files)
(let ((default-process-coding-system '(utf-8 . utf-8)))
(rails-project:compile-in-root
(concat rails-spec:runner " "
rails-spec:runner-options " "
files))))
(defun rails-spec:run-this-file ()
"Run spec for current file"
(interactive)
(rails-spec:run-files (buffer-file-name (current-buffer))))
(defun rails-spec:run-all ()
"Run spec for all files in project (rails-spec:all-files variable)"
(interactive)
(rails-spec:run-files rails-spec:all-files))
(defun rails-spec:run-last ()
"Run last runned spec command"
(interactive)
(rails-spec:run-files rails-spec:last-files))
(defun rails-spec:run-this-spec ()
"Run spec where the point is"
(interactive)
(let ((default-process-coding-system '(utf-8 . utf-8)))
(rails-project:compile-in-root
(concat rails-spec:runner " "
rails-spec:runner-options (concat " --line " (substring (what-line) 5) " ")
(buffer-file-name (current-buffer))))))
(provide 'rails-spec)