Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made eastwood lein1 compatible

  • Loading branch information...
commit 7832ac8bcb86110ba2a904fe11757a44f3ac1c78 1 parent dc3f098
@jonase authored
View
4 README.md
@@ -21,11 +21,11 @@ Eastwood warns when it finds
## Installation
-Eastwood is a leiningen plugin. Add `[jonase/eastwood "0.0.1"]` to
+Eastwood is a leiningen plugin. Add `[jonase/eastwood "0.0.2"]` to
your `:plugins` vector in your `:user` profile (Leiningen 2) or if you
are using Leiningen 1:
- $ lein plugin install jonase/eastwood 0.0.1
+ $ lein plugin install jonase/eastwood 0.0.2
## Usage
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject jonase/eastwood "0.0.1"
+(defproject jonase/eastwood "0.0.2"
:description "A Clojure lint tool"
:dependencies [[analyze "0.1.6"]
[org.clojure/tools.namespace "0.1.2"]
View
5 src/eastwood/core.clj
@@ -57,5 +57,8 @@
excluded-linters (set (:exclude-linters opts))
linters (set/difference linters excluded-linters)]
(doseq [namespace namespaces]
- (lint-ns namespace linters))))
+ (try
+ (lint-ns namespace linters)
+ (catch RuntimeException e
+ (println "Linting failed:" (.getMessage e)))))))
View
23 src/leiningen/eastwood.clj
@@ -1,11 +1,26 @@
-(ns leiningen.eastwood
- (:use [leiningen.core.eval :only [eval-in-project]]))
+(ns leiningen.eastwood)
+
+;; Stolen from lein-swank:
+;; https://github.com/technomancy/swank-clojure/blob/master/lein-swank/src/leiningen/swank.clj#L45
+(defn eval-in-project
+ "Support eval-in-project in both Leiningen 1.x and 2.x."
+ [project form init]
+ (let [[eip two?] (or (try (require 'leiningen.core.eval)
+ [(resolve 'leiningen.core.eval/eval-in-project)
+ true]
+ (catch java.io.FileNotFoundException _))
+ (try (require 'leiningen.compile)
+ [(resolve 'leiningen.compile/eval-in-project)]
+ (catch java.io.FileNotFoundException _)))]
+ (if two?
+ (eip project form init)
+ (eip project form nil nil init))))
(defn prepare-project [project]
(let [project (update-in project
[:dependencies]
conj
- '[jonase/eastwood "0.0.1"])
+ '[jonase/eastwood "0.0.2"])
project (if (contains? project :source-path)
(assoc project :source-paths [(:source-path project)])
@@ -26,5 +41,3 @@
`(eastwood.core/run-eastwood '~opts)
'(require 'eastwood.core)))))
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.