Inlein is the easiest and fastest way to run Clojure scripts. You only have to inline your dependencies, add in a shebang line, and make the script file executable.
#!/usr/bin/env inlein '{:dependencies [[org.clojure/clojure "1.8.0"] [amazonica "0.3.51"]]} (require '[amazonica.aws.s3 :as s3]) (def bucket-name (first *command-line-args*)) (when-not bucket-name (println "Usage:" (System/getProperty "$0") "s3-bucket") (System/exit 1)) (let [objs (:object-summaries (s3/list-objects :bucket-name bucket-name))] (doseq [{:keys [key size]} objs :when (pos? size)] (println key)))
If you've installed Leiningen before, the installation steps should be familiar:
$PATH
where your shell can find it
(eg. ~/bin
)chmod a+x ~/bin/inlein
)inlein file
or ./file
), inlein will set up and download the necessary
filesFull documentation on how to use Inlein can be found at the Getting Started page on the Inlein wiki. It covers installation, usage, command line options and general tips.
The documentation does not cover learning Clojure itself, but fortunately, good Clojure documentation is easily available.