diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index d77674334..c75dc04e3 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -1,21 +1,64 @@ # Installation -## Installing Leiningen -The simplest approach to setting up a Clojure environment is to install the build tool [Leiningen](https://github.com/technomancy/leiningen) which will provide access to a REPL (Read Eval Print Loop) for interactive development and allow you to run Clojure code. +## Installing the Clojure CLI +Clojure provides command line tools that can be used to start a Clojure repl, use Clojure and Java libraries, and start Clojure programs. -### Linux and Windows -For installation instructions on most platforms see: [Leiningen installation](https://github.com/technomancy/leiningen#installation). +### Linux +Ensure that the following dependencies are installed: `bash`, `curl`, `rlwrap`, and `Java`. + +```bash +curl -O https://download.clojure.org/install/linux-install-1.10.3.967.sh +chmod +x linux-install-1.10.3.967.sh +sudo ./linux-install-1.10.3.967.sh +``` ### Homebrew for Mac OS X -Update your Homebrew: -``` bash -$ brew update +Install the command line tools with brew from the [clojure/tools](https://github.com/clojure/homebrew-tools) tap: + +```bash +brew install clojure/tools/clojure ``` -Install Leiningen: -``` bash -$ brew install leiningen +### Windows +For running Clojure on Windows it is recommended to use WSL2. + +Another way to install Clojure on Windows is with the [Scoop](https://scoop.sh/) package manager. To install scoop, open PowerShell and run these 2 commands, one after the other: + + ```sh + iwr -useb get.scoop.sh | iex +Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force +`` + +To install Clojure with Scoop you have to add two important buckets first: + +```sh +# if you don't have git version control system installed +# it is required for adding new external buckets to your scoop installer +# you can skip this step otherwise +scoop install git + +# add scoop bucket for Java +scoop bucket add java + +# add scoop bucket for clojure build +scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure ``` -### Installing the standalone JAR -Alternatively you can download the latest stable release jar file from [clojure.org/downloads](http://clojure.org/community/downloads) which contains everything required to run Clojure code and provides a basic REPL. +Now we are ready to install Java and Clojure by issuing following commands: + +```sh +# install Java runtime and compiler +scoop install adoptopenjdk-lts-hotspot + +# install official clojure tools +scoop install clojure + +# update to the newest version +scoop update clojure +``` + +After successfully running steps above, you should be able to run Clojure with the following: + +```sh +clj +``` \ No newline at end of file diff --git a/docs/LEARNING.md b/docs/LEARNING.md index 4c5c9e820..6388a4e60 100644 --- a/docs/LEARNING.md +++ b/docs/LEARNING.md @@ -7,11 +7,11 @@ These resources can help you get started: ## References - [Clojure.org](http://clojure.org) The official language website. - [ClojureDocs](https://clojuredocs.org) A repository of language references and examples by function or keyword. -- [Grimoire](http://conj.io) Community combined cheatsheet and examples. ## Exercises and Tutorials - [4Clojure](https://4clojure.oxal.org/) A resource to help fledgling clojurians learn the language through interactive problems. -- [Clojure Katas](http://clojurekatas.org) A set of problems to help you get your hands dirty with Clojure. +- [4bb](https://github.com/porkostomus/4bb) Run 4clojure problems with babashka right from your shell. +- [Calva - Get Started with Clojure](https://calva.io/get-started-with-clojure/) A zero-install, interactive guide to get you started with Clojure using Calva and VS Code (via Gitpod) - [Wonderland Clojure Katas](https://github.com/gigasquid/wonderland-clojure-katas) Clojure Katas inspired by Alice in Wonderland. - [Parens of the Dead](http://www.parens-of-the-dead.com) A screencast series of zombie-themed games written with Clojure and ClojureScript. - [Clojure Koans](http://clojurekoans.com) ([online](http://clojurescriptkoans.com)) Exercises meant to initiate you to the mysteries of the Clojure language. @@ -19,8 +19,7 @@ These resources can help you get started: ## Community - [ClojureBridge](http://www.clojurebridge.org) Aims to increase diversity within the Clojure community by offering free, beginner-friendly Clojure programming workshops for women. - [Planet Clojure](http://planet.clojure.in) Clojure blog aggregator. -- [Clojure Gazette](http://www.clojuregazette.com) A free, weekly email to inspire Clojure programmers. -- [Clojure Weekly](http://reborg.tumblr.com) A weekly collection of Clojure topics. +- [Practicalli](https://practical.li/) Getting started with Clojure programming via YouTube broadcasts, screencasts and books. ## Books - [Living Clojure](http://shop.oreilly.com/product/0636920034292.do) by Carin Meier diff --git a/docs/TESTS.md b/docs/TESTS.md index 44ac804c3..c025dbc6f 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -1,33 +1,19 @@ # Tests -A Clojure REPL allows you to easily run code and get immediate feedback and can also be used to run tests. +## Clojure CLI -## Leiningen -To open a REPL using Leiningen change to the directory containing the exercise and run: -``` bash -$ lein repl -``` +The Clojure exercises on Exercism ship with a `deps.edn` file with a `:test` alias to invoke the [cognitect-labs test-runner](https://github.com/cognitect-labs/test-runner): -Once you are ready to work on an exercise and have created a file to hold your solution (such as `bob.clj`) you can run the tests using `clojure.test/run-tests` [as described here](http://clojure.github.io/clojure/clojure.test-api.html#clojure.test/run-tests). - -First, `require` the test namespace: -``` clojure -=> (require 'bob-test) -nil +``` bash +$ clj -X:test ``` -Then call `run-tests` on `bob-test`: -``` clojure -=> (clojure.test/run-tests 'bob-test) +This will scan your project's `test` directory for any tests defined using `clojure.test` and run them. -Testing bob-test - -Ran 14 tests containing 14 assertions. -0 failures, 0 errors. -{:test 14, :pass 14, :fail 0, :error 0, :type :summary} -``` +## Leiningen To run an exercise's tests with Leiningen, simply call: + ``` bash $ lein test @@ -36,14 +22,3 @@ lein test bob-test Ran 14 tests containing 14 assertions. 0 failures, 0 errors. ``` - -## Standalone JAR -To open a REPL using the standalone JAR file (assuming Clojure 1.8.0) run: -``` bash -$ java -cp clojure-1.8.0.jar clojure.main -``` - -To execute a file use: -``` bash -$ java -cp clojure-1.8.0.jar clojure.main bob_test.clj -``` diff --git a/exercises/shared/.docs/help.md b/exercises/shared/.docs/help.md index 938756654..df3da3af9 100644 --- a/exercises/shared/.docs/help.md +++ b/exercises/shared/.docs/help.md @@ -2,6 +2,8 @@ To get help if you're having trouble, you can use one of the following resources: +- [Ask Clojure](https://ask.clojure.org/) Official forum for Clojure Q & A. - [ClojureDocs](https://clojuredocs.org) A repository of language references and examples by function or keyword. -- [/r/clojure](https://www.reddit.com/r/clojure) is the C# subreddit. +- [/r/clojure](https://www.reddit.com/r/clojure) is the Clojure subreddit. - [StackOverflow](http://stackoverflow.com/questions/tagged/clojure) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. +- [Clojureverse](https://clojureverse.org/) Friendly and inclusive Clojure(Script) Community diff --git a/exercises/shared/.docs/tests.md b/exercises/shared/.docs/tests.md index 9083f7c4e..8e6eabc8b 100644 --- a/exercises/shared/.docs/tests.md +++ b/exercises/shared/.docs/tests.md @@ -1,6 +1,16 @@ # Tests -Leiningen can be used to run the exercise's test by running the following command from the exercise's directory: +## Clojure CLI + +The Clojure exercises on Exercism ship with a `deps.edn` file with a `:test` alias to invoke the [cognitect-labs test-runner](https://github.com/cognitect-labs/test-runner): + +``` bash +$ clj -X:test +``` + +## Leiningen + +Leiningen can also be used to run the exercise's test by running the following command from the exercise's directory: ```bash lein test @@ -10,6 +20,12 @@ lein test To use the REPL to run the exercise's test, run the following command from the exercise's directory: +```bash +$ clj +``` + +-or- + ```bash $ lein repl ```