Skip to content

Commit

Permalink
Prep work before merging fork
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenhombre committed Jul 7, 2022
1 parent 689760a commit da8784e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
*.class
*.jar
.eastwood
.idea
/.lein-*
/.nrepl-port
/checkouts
/classes
/target
README.html
README.pdf
oatmeal.iml
pom.xml
pom.xml.asc
profiles.clj
system-index.txt
.idea
oatmeal.iml
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM adoptopenjdk:11-jre-hotspot

RUN apt-get -qq -y update
RUN apt-get -qq -y upgrade

RUN apt-get install -qq -y leiningen sbcl make
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y make sbcl leiningen

WORKDIR /home/janice

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ docker:

test:
# Switch to `lein test` if test fails in CI and you need more info:
#lein test
lein do test, bikeshed, kibit, eastwood
# lein test
# Otherwise I prefer Kaocha because of the descriptive test output:
lein do kaocha, bikeshed, kibit, eastwood
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject oatmeal "0.2.0-SNAPSHOT"
(defproject oatmeal "0.0.28-SNAPSHOT"
:description "A tool for working with Common Lisp projects"
:url "http://github.com/eigenhombre/oatmeal"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
Expand Down
23 changes: 13 additions & 10 deletions src/oatmeal/build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@
{:projname projname})))

(def ^:dynamic *report-success*
(fn [projtype projname] (println (format "%s %s" projtype projname))))
(fn [projtype projname]
(println (format "%s %s" projtype projname))))

(defn- show-dir [projtype projname]
(defn ^:private show-action [projtype projname]
(*report-success* projtype projname))

(defmacro make-project [projname & body]
(defmacro make-project
{:style/indent 1}
[projname & body]
`(let [tldir# (fs/*lisp-toplevel-dir*)
target# (str tldir# "/" ~projname)
render-file# (partial render-and-write ~projname target#)
~'target target#
~'render-file render-file#]
(when (.exists (io/file target#))
(throw (FileAlreadyExistsException.
(format "Directory '%s' already exists; not overwriting."
target#))))
(format "Directory '%s' already exists; not overwriting."
target#))))
(fs/mkdirp target#)
(fs/mkdirp (str target# "/src"))
(fs/mkdirp (str target# "/test"))
Expand All @@ -35,9 +38,9 @@
(render-file# "test/package.lisp" "common/test/package.lisp")
~@body))

;; These statements break linting. However, they are mandatory
;; to make Cursive work. So, you can uncomment them when changing
;; this code.
;; These statements break linting. However, they are mandatory to make
;; the Cursive plugin for the IntelliJ editor work. So, you can
;; uncomment them when changing this code:
#_(declare render-file)
#_(declare target)

Expand All @@ -47,7 +50,7 @@
(render-file (str projname ".asd") "lib/lib.asd")
(render-file "src/main.lisp" "lib/src/main.lisp")
(render-file "src/package.lisp" "lib/src/package.lisp")
(show-dir "LIB" target)))
(show-action "LIB" target)))

(defn make-app [projname]
(make-project projname
Expand All @@ -57,4 +60,4 @@
(render-file "src/package.lisp" "app/package.lisp")
(render-file "build.sh" "app/build.sh")
(chmod "+x" (str target "/build.sh"))
(show-dir "APP" target)))
(show-action "APP" target)))
12 changes: 6 additions & 6 deletions test/oatmeal/e2e_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
[clojure.test :refer [deftest testing is]]
[me.raynes.fs :as rfs]
[oatmeal.core :refer [execute-cmd]]
[oatmeal.fs :refer [mkdirp]]
[oatmeal.fs :as fs])
[oatmeal.fs :refer [mkdirp] :as fs])
(:import [java.nio.file FileAlreadyExistsException]
(java.io File)))

Expand Down Expand Up @@ -40,7 +39,7 @@
(testing (str "Making a new " (name kind) " project")
(let [success-reports (atom [])]
(fs/with-tmp-dir d
(binding [oatmeal.fs/*lisp-toplevel-dir*
(binding [fs/*lisp-toplevel-dir*
(fn [] (dir-path d))

oatmeal.build/*report-success*
Expand Down Expand Up @@ -148,6 +147,7 @@
(is (zero? exit))
(is (empty? err))
(is (not (exists "/foo/foo"))))))))))
(is (= [{:t (-> kind name .toUpperCase)
:n (str d "/foo")}]
@success-reports))))))))
(testing "Success was reported correctly"
(is (= [{:t (-> kind name .toUpperCase)
:n (str d "/foo")}]
@success-reports)))))))))

0 comments on commit da8784e

Please sign in to comment.