public
Created

Download fixtures

  • Download Gist
company_fixtures.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
(ns leiningen.company-fixtures
(:require [leiningen.core.project :as project]
[me.raynes.fs :as fs]
[me.raynes.fs.compression :as compress]
[clojure.java.io :as io]))
 
(def ^:const url
"http://example-company.com/url.zip")
 
(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))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.