Merge pull request #140 from dtulig/master

Addresses an issue where marginalia fails to parse a project.clj where the first form in the file isn't "defproject".
This commit is contained in:
Ben Bader 2015-01-08 12:23:22 -08:00
commit 715e4f14f0
3 changed files with 23 additions and 3 deletions

View file

@ -124,7 +124,11 @@
(let [rdr (clojure.lang.LineNumberingPushbackReader.
(java.io.FileReader.
(java.io.File. path)))]
(parse-project-form (read rdr)))
(loop [line (read rdr)]
(let [found-project? (= 'defproject (first line))]
(if found-project?
(parse-project-form line)
(recur (read rdr))))))
(catch Exception e
(throw (Exception.
(str

View file

@ -0,0 +1,6 @@
(ns marginalia.test.core
(:require marginalia.core)
(:use clojure.test))
(deftest parse-project-file-simple
(is (= "project-name" (:name (marginalia.core/parse-project-file "test/marginalia/test/multi-def-project.clj.txt")))))

View file

@ -0,0 +1,10 @@
(defn some-other-form
[]
(= 1 1))
(defproject project-name "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]])