From d8e6768d1d716bcfe979fbdc9ceace663043b3bb Mon Sep 17 00:00:00 2001 From: Alan Thompson Date: Mon, 16 Sep 2019 23:19:06 -0700 Subject: [PATCH 1/2] misc --- project.clj | 28 ++++++++++++++++------------ src/flatland/useful/compress.clj | 18 ++++++++++-------- test/flatland/_bootstrap.clj | 17 +++++++++++++++++ 3 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 test/flatland/_bootstrap.clj diff --git a/project.clj b/project.clj index 2bb4e07..a3b9f90 100644 --- a/project.clj +++ b/project.clj @@ -1,20 +1,24 @@ (defproject org.flatland/useful "0.11.7-SNAPSHOT" :description "A collection of generally-useful Clojure utility functions" - :license {:name "Eclipse Public License - v 1.0" - :url "http://www.eclipse.org/legal/epl-v10.html" + :license {:name "Eclipse Public License - v 1.0" + :url "http://www.eclipse.org/legal/epl-v10.html" :distribution :repo} :url "https://github.com/amalloy/useful" - :dependencies [[org.clojure/clojure "1.9.0"] - [org.clojure/tools.macro "0.1.1"] - [org.clojure/tools.reader "0.7.2"]] + :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"] + [org.clojure/tools.macro "0.1.5"] + [org.clojure/tools.reader "1.3.2"]] :aliases {"testall" ["with-profile" "1.6:1.7:1.8:1.9:1.10" "test"]} - :profiles {:1.10 {:dependencies [[org.clojure/clojure "1.10.0-RC3"]]} - :1.9 {} - :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]} - :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} - :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}} + + :profiles {:provided {:dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]]} + :dev {:dependencies [[org.clojure/clojure "1.10.1"]]} + + :1.10 {:dependencies [[org.clojure/clojure "1.10.1"]]} + :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} + :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}} :deploy-repositories [["releases" :clojars] ["snapshots" :clojars]] - :plugins [[codox "0.8.0"]] - :codox {:src-dir-uri "http://github.com/flatland/useful/blob/develop/" + :plugins [[codox "0.8.0"] + [lein-ancient "0.6.15"]] + + :codox {:src-dir-uri "http://github.com/flatland/useful/blob/develop/" :src-linenum-anchor-prefix "L"}) diff --git a/src/flatland/useful/compress.clj b/src/flatland/useful/compress.clj index 3743810..2ee4bf3 100644 --- a/src/flatland/useful/compress.clj +++ b/src/flatland/useful/compress.clj @@ -1,17 +1,19 @@ (ns flatland.useful.compress - (:import [java.util.zip DeflaterOutputStream InflaterInputStream] - [java.io ByteArrayOutputStream ByteArrayInputStream] - [sun.misc BASE64Decoder BASE64Encoder])) + (:import + [java.io ByteArrayOutputStream ByteArrayInputStream] + [java.util Base64] + [java.util.zip DeflaterOutputStream InflaterInputStream] )) -(defn smash [^String str] +(defn smash [str] (let [out (ByteArrayOutputStream.)] (doto (DeflaterOutputStream. out) (.write (.getBytes str)) (.finish)) - (-> (BASE64Encoder.) - (.encodeBuffer (.toByteArray out))))) + (-> (Base64/getEncoder) + (.encode (.toByteArray out))))) -(defn unsmash [^String str] - (let [bytes (-> (BASE64Decoder.) (.decodeBuffer str)) +(defn unsmash [str] + (let [bytes (-> (Base64/getDecoder) (.decode str)) in (ByteArrayInputStream. bytes)] (slurp (InflaterInputStream. in)))) + diff --git a/test/flatland/_bootstrap.clj b/test/flatland/_bootstrap.clj new file mode 100644 index 0000000..55d005b --- /dev/null +++ b/test/flatland/_bootstrap.clj @@ -0,0 +1,17 @@ +(ns flatland._bootstrap + (:require + [clojure.test :refer :all] + [clojure.string :as str] )) + +(defn print-versions [] + (let [version-str (format " Clojure %s Java %s" + (clojure-version) (System/getProperty "java.version")) + num-hyphen (+ 6 (count version-str)) + hyphens (str/join (repeat num-hyphen \-)) ] + (newline) + (println hyphens) + (println version-str) + (println hyphens))) + +(deftest t-bootstrap-16 + (print-versions)) From a0ec0808fbc3ea11eed9401ed10a0e7900e1e154 Mon Sep 17 00:00:00 2001 From: Alan Thompson Date: Mon, 16 Sep 2019 23:47:52 -0700 Subject: [PATCH 2/2] misc --- project.clj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/project.clj b/project.clj index a3b9f90..d6e1ab0 100644 --- a/project.clj +++ b/project.clj @@ -7,11 +7,9 @@ :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"] [org.clojure/tools.macro "0.1.5"] [org.clojure/tools.reader "1.3.2"]] - :aliases {"testall" ["with-profile" "1.6:1.7:1.8:1.9:1.10" "test"]} - - :profiles {:provided {:dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]]} - :dev {:dependencies [[org.clojure/clojure "1.10.1"]]} + :aliases {"testall" ["with-profile" ":1.8:1.9:1.10" "test"]} + :profiles {:dev {:dependencies [[org.clojure/clojure "1.10.1"]]} :1.10 {:dependencies [[org.clojure/clojure "1.10.1"]]} :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}