Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs #398

Merged
merged 10 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 55 additions & 12 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -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
```
7 changes: 3 additions & 4 deletions docs/LEARNING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ 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.

## 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
Expand Down
39 changes: 7 additions & 32 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
```
4 changes: 3 additions & 1 deletion exercises/shared/.docs/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 17 additions & 1 deletion exercises/shared/.docs/tests.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
```
Expand Down