1;;; env.el --- Cask: Ecukes environment file  -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2012-2014 Johan Andersson
4
5;; Author: Johan Andersson <johan.rejeep@gmail.com>
6;; Maintainer: Johan Andersson <johan.rejeep@gmail.com>
7;; URL: http://github.com/cask/cask
8
9;; This file is NOT part of GNU Emacs.
10
11;; This program is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; This program is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;;; Code:
27
28(require 's)
29(require 'f)
30(require 'dash)
31(require 'espuds)
32(require 'ansi)
33
34(defvar cask-test/features-path
35  (f-parent (f-parent load-file-name)))
36
37(defvar cask-test/vendor-path
38  (f-expand "vendor" cask-test/features-path))
39
40(defvar cask-test/root-path
41  (f-parent cask-test/features-path))
42
43(defvar cask-test/sandbox-path
44  (f-expand "sandbox" cask-test/features-path))
45
46(defvar cask-bin-path
47  (f-expand "bin" cask-test/root-path))
48
49(defvar cask-test/bin-command
50  (f-expand "cask" cask-bin-path))
51
52(defvar cask-test/stderr)
53(defvar cask-test/stdout)
54
55(defvar cask-initial-$PATH)
56(defvar cask-initial-$TRAVIS)
57
58(add-to-list 'load-path cask-test/root-path)
59
60(unless (require 'ert nil t)
61  (require 'ert (f-expand "ert" cask-test/vendor-path)))
62
63(Setup
64 (setq cask-initial-$PATH (getenv "PATH"))
65 (setq cask-initial-$TRAVIS (getenv "TRAVIS")))
66
67(Before
68 (setq cask-test/stderr "")
69 (setq cask-test/stdout "")
70
71 (when (f-dir? cask-test/sandbox-path)
72   (f-delete cask-test/sandbox-path 'force))
73 (f-mkdir cask-test/sandbox-path)
74
75 (setenv "PATH" cask-initial-$PATH)
76 (setenv "TRAVIS" cask-initial-$TRAVIS))
77
78(Fail
79 (-when-let (stdout (s-presence cask-test/stdout))
80   (princ "==================== CASK OUTPUT ====================\n")
81   (princ stdout))
82 (-when-let (stderr (s-presence cask-test/stderr))
83   (princ "==================== CASK OUTPUT ====================\n")
84   (princ (ansi-red "%s" stderr))))
85
86;;; env.el ends here
87