Skip to content

Added pretty library and added colorful output #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
:description "Koan Engine for Clojure projects."
:dependencies [[org.clojure/clojure "1.4.0"]
[fresh "1.0.2"]
[jline "0.9.94" :exclusions [junit]]])
[jline "0.9.94" :exclusions [junit]]
[io.aviso/pretty "0.1.18"]])
11 changes: 6 additions & 5 deletions src/koan_engine/koans.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns koan-engine.koans
(:use [clojure.java.io :only [file resource]])
(:require [koan-engine.util :as u]
[clojure.string :as str]))
[clojure.string :as str]
[io.aviso.ansi :as pretty]))

;; TODO: Proper koan validation. Accept the path as an argument.
(defn ordered-koans [answer-path]
Expand All @@ -24,11 +25,11 @@

(defn report-error [file-path line error]
(let [message (or (.getMessage error) (.toString error))]
(println "\nNow meditate upon"
(str (last (str/split file-path #"/"))
(when line (str ":" line))))
(println (str "\nNow meditate upon "
(pretty/blue (str (last (str/split file-path #"/"))
(when line (str ":" line))))))
(println "---------------------")
(println "Assertion failed!")
(println (pretty/bold-red "Assertion failed!"))
(println (.replaceFirst message "^Assert failed: " ""))))

(defn tests-pass? [dojo-path file-path]
Expand Down