(= "Clojure Command Jogger" cljog)
Making Clojure automation scripts and CLI tools run... or at least Jog.
____ _ _ ___ ____
/ ___| | | |/ _ \ / ___|
| | | | _ | | | | | | _
| |___| |__| |_| | |_| | |_| |
\____|_____\___/ \___/ \____|
Developers tend to automate all the things. From cloud infrastructure setup (Terraform) and browser control (Selenium); to the day to day tasks of performing updates, and performing system backups. It helps us to:
- focus of other activities
- reduce human error and risk
- share efficiencies
- become DRY
I've always wanted to move away from Bash for automation into something that:
- is standalone
- allows specifying dependencies and required versions
- has an existing and established library of code available
- easy to write, run, extend, and share
- is performant
- interpreted (no compilation necessary)
- can be considered cross-platform
- supports simple sub-command discovery and invocation (similar to git)
- easy to setup
Python, Node.js, and Java are all languages that can be used for automation, if you can use the standard libraries.
Anything more complex requires additional steps to install dependencies and maintain. Inspired Alan Franzoni and his
article Standalone, single-file, editable Python scripts WITH DEPENDENCIES,
I decided to create cljog
for writing Clojure (with some inspiration from Eric Normand
Boilerplate for running Clojure as a shebang script Gist)
as a Bash replacement.
- Download
cljog
.wget https://raw.githubusercontent.com/axrs/cljog/0.2.0/cljog
- Make executable.
chmod +x cljog
- Move to a bin directory.
mv cljog /usr/bin/
- Install
cljog
into a bin directory and make it executable - Create a script with the
cljog
interpreter shebang.#!/usr/bin/env cljog
- Make the script executable and invoke it; or run it directly through
cljog
./script.clj
# or
cljog script.clj