Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pokle/clojr
Run single file clojure scripts
https://github.com/pokle/clojr
Last synced: 10 days ago
JSON representation
Run single file clojure scripts
- Host: GitHub
- URL: https://github.com/pokle/clojr
- Owner: pokle
- License: epl-1.0
- Created: 2014-07-27T14:12:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-20T04:20:33.000Z (almost 8 years ago)
- Last Synced: 2024-09-15T08:25:56.762Z (2 months ago)
- Language: Clojure
- Size: 31.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clojr
Clojr is short for Clojure runner.
I've always wanted to write single file utility Clojure scripts like you can with shell scripts, ruby, python, perl, etc. Now you can with Clojr.
### Installation - Unixes
Install [Java](http://java.sun.com), and if you use the repl a lot - install rlwrap (to get history and fancy editing).
```sh
git clone https://github.com/pokle/clojr
cd clojr
./scripts/build
./scripts/install
```And then you should have clojr installed in /usr/local/bin/ - which should be on your path.
### Running
The first time your run clojr, it will download its Clojure dependencies.
#### Run your single file clojure scripts
clojr yourscript.clj
#### Run a REPL
clojr
#### Hash bangs!
Create a Clojure file starting with a has bang like this:
#!/usr/bin/env bash clojr
(println "Hellfjord - watch it!")And if you called it hello.clj, you can make it executable and run it:
$ chmod +x hello.clj
$ ./hello.clj
Hellfjord - watch it!#### Load adjacent files
Just use the Clojure load function to load other files in directories relative to the inital one. Have a look at the load_hello.clj sample.
#### Load maven / clojars dependencies
You can download maven or clojars libraries with the clojr/dep macro:
(clojr/dep cheshire) ; Loads the latest version of cheshire
(use 'cheshire.core) ; Bring it into our namespace
(parse-string "{}") ; => {}You can specify a version like this:
(clojr/dep cheshire "5.3.1")
And roll in the '(use 'cheshire.core)' like this:
(clojr/dep cheshire "5.3.1" cheshire.core)
### Development
Read doc/building.md