Skip to content

Instantly share code, notes, and snippets.

@unclebob
Created March 10, 2024 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unclebob/8883540e8b5afb17e4c105203a83b92d to your computer and use it in GitHub Desktop.
Save unclebob/8883540e8b5afb17e4c105203a83b92d to your computer and use it in GitHub Desktop.
newclj -- a simple tool to prepare a clojure project using speclj
#!/bin/zsh
echo "making speclj project $1."
mkdir $1
cd $1
mkdir src
mkdir spec
cat >deps.edn << EOF
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
speclj/speclj {:mvn/version "3.4.5"}}
:aliases
{:spec {:main-opts ["-m" "speclj.main" "-c"]
:extra-deps {speclj/speclj {:mvn/version "3.4.5"}}
:extra-paths ["spec"]}}
}
EOF
cat >src/$1.clj << EOF
(ns $1)
EOF
cat >spec/$1_spec.clj << EOF
(ns $1-spec
(:require [speclj.core :refer :all]
[$1 :refer :all]))
(describe "$1"
(it "needs writing"
(should false)))
EOF
echo "Done. Start tests with clj -M:spec <opts>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment