• Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    Java
  • License
    Eclipse Public Li...
  • Created almost 9 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run clojure scripts with dependencies.

Inlein

Run Clojure scripts with dependencies, but without classpath pains.

Installation

For a full introduction and tutorial to Inlein, please see the Getting Started-page on the wiki. If you know how to use and install Leiningen, you can follow the installation steps and quickstarts in this README.

Inlein installs itself on the first run of the inlein script; there is no separate install script. Follow these instructions to install Inlein manually:

  1. Make sure you have a Java JDK version 7 or later.
  2. Download the latest inlein program released
  3. Place it on your $PATH. (~/bin is a good choice if it is on your path.)
  4. Set it to be executable. (chmod 755 ~/bin/inlein)
  5. Run it.

Note that the first invokation with a script may be a bit slow, as inlein has to retrieve and start the inlein daemon. You can force download and daemon startup by calling inlein --start-daemon, to ensure faster startup times on subsequent runs.

Quickstart

Inlein is usually called with the file to run, along with the parameters passed to the script itself.

inlein myscript.clj my args here

On *nix-like systems, you can omit calling inlein directly by making the script executable and prepending the shebang-line

#!/usr/bin/env inlein

at the very start of the script.

Sample Script

As an example, let's make a script which calculates the nth prime number for the user (0-indexed). We will use my prime library to find the prime, to show how to add dependencies.

Type this into a file, and call it primes.clj:

#!/usr/bin/env inlein

'{:dependencies [[org.clojure/clojure "1.8.0"]
                 [com.hypirion/primes "0.2.1"]]}

(require '[com.hypirion.primes :as p])

(when-not (first *command-line-args*)
  (println "Usage:" (System/getProperty "$0") "prime-number")
  (System/exit 1))

(-> (first *command-line-args*)
    (Long/parseLong)
    (p/get)
    println)

Now make it executable (chmod +x primes.clj), and try it out by e.g. calling ./primes.clj 10.

An inlein script begins with a quoted map, which contains the script's dependencies. They are specified exactly like in Leiningen, as a vector of dependencies associated with the :dependency key. The quoted map may also contain JVM options you want to set (generally to speed up program startup).

Inlein also tags the name of the file to the System property $0, to ease creation of "shell"-like scripts.

Building from Source

If you have ~/bin on your path and want to run a snapshot version of inlein, you can just call test/install.sh. This should place the client in ~/bin/inlein and the proper deamon where it needs to be placed. Remember that you have to override the installed inlein version manually if you want to upgrade or downgrade again.

To play around with the source, or install manually, see the Bootstrapping section in CONTRIBUTING.md.

License

Copyright © 2016-2017 Jean Niklas L'orange

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. See the file LICENSE.

More Repositories

1

c-rrb

RRB-tree implemented as a library in C.
C
164
star
2

clj-xchart

XChart wrapper for Clojure
Clojure
110
star
3

lein-shell

Call shell from within Leiningen.
Clojure
56
star
4

clj-conduit

Clojure transducers with a more readable interface
Clojure
33
star
5

haskell-transducers

Clojure's Transducers in Haskell
Haskell
33
star
6

roulette-tree

Data structure for efficient fitness-proportionate selection.
C
24
star
7

beckon

Handle POSIX signals in Clojure.
Java
22
star
8

pvec-perf

Persistent vector performance measurements and analysis
Java
21
star
9

multicompile-example

An example on how to perform multiple java/clj compile steps in Leiningen.
Clojure
18
star
10

go-filecache

LRU filecache for "immutable" file stores
Go
14
star
11

swearjure

Clojure interpreter that does not support alphanumerics.
Haskell
11
star
12

typed-http-server-in-go

It's a typed HTTP server in Go, using generics that is expected to come out with 1.18
Go
9
star
13

rexf

Recursive reducers and transducers
Clojure
7
star
14

hello-swearjure

Hello world in Swearjure.
Clojure
6
star
15

primes

Fetch, locate and use prime numbers in Clojure.
Java
6
star
16

git-multipunchcard

Like git-punchcard, but for a collection of projects
Python
5
star
17

fairbrook

Fine-grained map manipulation for the masses.
Clojure
5
star
18

astyx

Abstract syntax trees from Clojure code.
Clojure
5
star
19

go-errmonad

The bind operation (>>=) for Go's equivalent of Haskell's Either/Error type.
Go
4
star
20

persistencia

Repository with implementations to understand persistent data structures.
C
4
star
21

com.hypirion.io

I/O classes in Java for those with specific needs.
Java
3
star
22

subtex

Parser in Clojure that translates a subset of tex into hiccup-like style
Clojure
3
star
23

errnils

Count number of "err != nil"s in your Go code.
Shell
3
star
24

advent-of-code

Solutions to advent of code in many different styles
Factor
2
star
25

java-bencode

Java library for Bencode streaming
Java
2
star
26

contests

Solutions to some programming contests I've participated in.
Java
1
star
27

tc-solutions

Topcoder solutions by me.
Java
1
star
28

genetica

EA in Erlang
Erlang
1
star
29

moon-castle

(Yet another) Clojure wrapper library for Bouncy Castle
Clojure
1
star
30

gen-java-src

Generate Java code through Clojure test.check-generators.
Clojure
1
star
31

mpi-cheatsheet

Yet another cheatsheet for MPI.
TeX
1
star
32

phenex

A boosting program with diverse classifiers, like music to your ears.
Common Lisp
1
star
33

sc-sugar

A (temporary?) sugar macro library for simple check.
Clojure
1
star
34

lein-miditest

Leiningen plugin which plays a little note whenever tests/retests have finished.
Clojure
1
star
35

tethysthesis

LaTeX-template for larger project documentation/theses
TeX
1
star
36

tethysarticle

LaTeX template for online papers by computer scientists.
TeX
1
star
37

erling

Erling: An IRC bot in Erlang.
Erlang
1
star