Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

-main can take multiple files/dirs #28

Merged
merged 3 commits into from over 1 year ago

2 participants

AlexBaranosky Phil Hagelberg
AlexBaranosky

No description provided.

AlexBaranosky

This also includes a fix so that clojure.test is always :require/:refer/:all'ed

Phil Hagelberg technomancy merged commit 12e3b50 into from
Phil Hagelberg
Owner

Sorry for the delay. Looks good; thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  project.clj
@@ -7,6 +7,7 @@
7 7 :dependencies [[org.clojure/clojure "1.4.0"]]
8 8 :profiles {:dev {:dependencies [[org.clojure/tools.trace "0.7.3"]
9 9 [org.clojars.runa/clj-schema "0.7.0"]
  10 + [gui-diff "0.3.9"]
10 11 [korma "0.3.0-beta11"]]}}
11 12 :test-selectors {:default (constantly true)
12 13 :integration :integration
@@ -14,6 +15,7 @@
14 15 ;; retain compatibility with lein1 for now
15 16 :dev-dependencies [[org.clojure/tools.trace "0.7.3"]
16 17 [org.clojars.runa/clj-schema "0.7.0"]
  18 + [gui-diff "0.3.9"]
17 19 [korma "0.3.0-beta11"]]
18 20 :dev-resource-paths "dev-resources")
19 21
5 src/slam/hound.clj
@@ -28,8 +28,9 @@
28 28
29 29 (defn -main
30 30 "Takes a file or dir and rewrites the .clj files with reconstructed ns forms."
31   - [file-or-dir]
32   - (doseq [file (file-seq (io/file file-or-dir))
  31 + [& file-or-dirs]
  32 + (doseq [file-or-dir file-or-dirs
  33 + file (file-seq (io/file file-or-dir))
33 34 :when (re-find #"/[^\./]+\.clj" (str file))]
34 35 (try
35 36 (swap-in-reconstructed-ns-form file)
4 src/slam/hound/regrow.clj
@@ -75,7 +75,9 @@
75 75 :require-refer (for [n (all-ns)
76 76 [sym var] (ns-publics n)
77 77 :when (= missing (name sym))]
78   - [(ns-name n) :refer [sym]])))
  78 + (if (= (ns-name n) 'clojure.test)
  79 + ['clojure.test :refer :all]
  80 + [(ns-name n) :refer [sym]]))))
79 81
80 82 (defn- butlast-regex [candidate]
81 83 (if (symbol? candidate)
9 src/slam/hound/stitch.clj
@@ -15,9 +15,12 @@
15 15 (-> c resolve .getName (.split "\\.") last symbol))))))
16 16
17 17 (defn- group-by-namespace [uses]
18   - (for [[namespace subclause] (group-by first uses)]
19   - [namespace :refer (vec (sort (for [[_ _ [var]] subclause]
20   - var)))]))
  18 + (for [[namespace subclause] (group-by first uses)
  19 + :let [[[_require_ _refer_ referred]] subclause]]
  20 + (if (= :all referred)
  21 + [namespace :refer :all]
  22 + [namespace :refer (vec (sort (for [[_ _ [var]] subclause]
  23 + var)))])))
21 24
22 25 (defn collapse-clause [ns-map clause]
23 26 (case clause
3  test/slam/hound/regrow_test.clj
@@ -19,8 +19,7 @@
19 19 :gen-class nil
20 20 :require-as '[[clojure.java.io :as io] [clojure.set :as set]]
21 21 :require-refer '[[slam.hound.stitch :refer [ns-from-map]]
22   - [clojure.test :refer [is]]
23   - [clojure.test :refer [deftest]]]
  22 + [clojure.test :refer :all]]
24 23 :import '(java.io.File java.io.ByteArrayInputStream
25 24 clojure.lang.Compiler$BodyExpr
26 25 java.util.UUID)
2  test/slam/hound_test.clj
@@ -31,7 +31,7 @@
31 31 \"Testing some things going on here.\"
32 32 (:require [clojure.java.io :as io]
33 33 [clojure.set :as set]
34   - [clojure.test :refer [deftest is]]
  34 + [clojure.test :refer :all]
35 35 [slam.hound.stitch :refer [ns-from-map]])
36 36 (:import (clojure.lang Compiler$BodyExpr)
37 37 (java.io ByteArrayInputStream File)

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.