Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Download fixtures
(:require [leiningen.core.project :as project]
[me.raynes.fs :as fs]
[me.raynes.fs.compression :as compress]
[ :as io]))
(def ^:const url
(defn- expand-path [path]
(str (fs/normalized-path path)))
(def fixture-path
(expand-path (io/file "./test/fixtures" (fs/base-name url))))
(defn- unzip [path]
(compress/unzip path))
(defn- download [from to]
(io/copy (io/input-stream from) (io/output-stream to)))
(defn- download-if-missing [from to]
(if-not (fs/exists? to) (download from to)))
(defn company-fixtures [_]
(download-if-missing url fixture-path)
(unzip fixture-path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment