Merge pull request #39 from markokocic/no-reflection
Clear reflection warnings
This commit is contained in:
commit
7c3cf47db4
9 changed files with 20 additions and 20 deletions
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
(defn parse-post-date
|
(defn parse-post-date
|
||||||
"Parses the post date from the post's file name and returns the corresponding java date object"
|
"Parses the post date from the post's file name and returns the corresponding java date object"
|
||||||
[file-name date-fmt]
|
[^String file-name date-fmt]
|
||||||
(let [fmt (java.text.SimpleDateFormat. date-fmt)]
|
(let [fmt (java.text.SimpleDateFormat. date-fmt)]
|
||||||
(.parse fmt (.substring file-name 0 10))))
|
(.parse fmt (.substring file-name 0 10))))
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
(defn page-content
|
(defn page-content
|
||||||
"Returns a map with the given page's file-name, metadata and content parsed from
|
"Returns a map with the given page's file-name, metadata and content parsed from
|
||||||
the file with the given markup."
|
the file with the given markup."
|
||||||
[page config markup]
|
[^java.io.File page config markup]
|
||||||
(with-open [rdr (java.io.PushbackReader. (reader page))]
|
(with-open [rdr (java.io.PushbackReader. (reader page))]
|
||||||
(let [page-name (.getName page)
|
(let [page-name (.getName page)
|
||||||
file-name (s/replace page-name (re-pattern-from-ext (m/ext markup)) ".html")
|
file-name (s/replace page-name (re-pattern-from-ext (m/ext markup)) ".html")
|
||||||
|
@ -359,7 +359,7 @@
|
||||||
"Generates all the html and copies over resources specified in the config"
|
"Generates all the html and copies over resources specified in the config"
|
||||||
[]
|
[]
|
||||||
(println (green "compiling assets..."))
|
(println (green "compiling assets..."))
|
||||||
(let [{:keys [site-url blog-prefix rss-name recent-posts sass-src sass-dest keep-files ignored-files previews?] :as config} (read-config)
|
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-src sass-dest keep-files ignored-files previews?] :as config} (read-config)
|
||||||
posts (add-prev-next (read-posts config))
|
posts (add-prev-next (read-posts config))
|
||||||
pages (add-prev-next (read-pages config))
|
pages (add-prev-next (read-pages config))
|
||||||
[navbar-pages sidebar-pages] (group-pages pages)
|
[navbar-pages sidebar-pages] (group-pages pages)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
(catch Exception e {:error (.getMessage e)}))]
|
(catch Exception e {:error (.getMessage e)}))]
|
||||||
(when-not (:error git-resp)
|
(when-not (:error git-resp)
|
||||||
(if-let [git-src (json/parse-string git-resp)]
|
(if-let [git-src (json/parse-string git-resp)]
|
||||||
{:content (String. (Base64/decodeBase64 (get git-src "content")) "UTF-8")
|
{:content (String. ^bytes (Base64/decodeBase64 ^String (get git-src "content")) "UTF-8")
|
||||||
:name (get git-src "name")
|
:name (get git-src "name")
|
||||||
:uri (get (get git-src "_links") "html")}))))
|
:uri (get (get git-src "_links") "html")}))))
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
(-> resource io/resource io/file))
|
(-> resource io/resource io/file))
|
||||||
|
|
||||||
(defn ignore [ignored-files]
|
(defn ignore [ignored-files]
|
||||||
(fn [file]
|
(fn [^java.io.File file]
|
||||||
(let [name (.getName file)
|
(let [name (.getName file)
|
||||||
matches (map #(re-find % name) ignored-files)]
|
matches (map #(re-find % name) ignored-files)]
|
||||||
(not (some seq matches)))))
|
(not (some seq matches)))))
|
||||||
|
@ -27,12 +27,12 @@
|
||||||
extension (ext) ignoring any files that match the given (ignored-files).
|
extension (ext) ignoring any files that match the given (ignored-files).
|
||||||
First make sure that the root directory exists, if yes: process as normal;
|
First make sure that the root directory exists, if yes: process as normal;
|
||||||
if no, return empty vector."
|
if no, return empty vector."
|
||||||
[f ext ignored-files]
|
[f ^String ext ignored-files]
|
||||||
(if-let [root (get-resource f)]
|
(if-let [root (get-resource f)]
|
||||||
(->> (get-resource f)
|
(->> (get-resource f)
|
||||||
file-seq
|
file-seq
|
||||||
(filter (ignore ignored-files))
|
(filter (ignore ignored-files))
|
||||||
(filter (fn [file] (-> file .getName (.endsWith ext)))))
|
(filter (fn [^java.io.File file] (-> file .getName (.endsWith ext)))))
|
||||||
[]))
|
[]))
|
||||||
|
|
||||||
(defn create-folder [folder]
|
(defn create-folder [folder]
|
||||||
|
@ -47,9 +47,9 @@
|
||||||
|
|
||||||
(defn copy-dir [src target ignored-files]
|
(defn copy-dir [src target ignored-files]
|
||||||
(fs/mkdirs target)
|
(fs/mkdirs target)
|
||||||
(let [filename-filter (apply reject-re-filter ignored-files)
|
(let [^java.io.FileFilter filename-filter (apply reject-re-filter ignored-files)
|
||||||
files (.listFiles (io/file src) filename-filter)]
|
files (.listFiles (io/file src) filename-filter)]
|
||||||
(doseq [f files]
|
(doseq [^java.io.File f files]
|
||||||
(let [out (io/file target (.getName f))]
|
(let [out (io/file target (.getName f))]
|
||||||
(if (.isDirectory f)
|
(if (.isDirectory f)
|
||||||
(copy-dir f out ignored-files)
|
(copy-dir f out ignored-files)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[clojure.string :as s]
|
[clojure.string :as s]
|
||||||
[text-decoration.core :refer :all]))
|
[text-decoration.core :refer :all]))
|
||||||
|
|
||||||
(defn load-plugin [url]
|
(defn load-plugin [^java.net.URL url]
|
||||||
(let [{:keys [description init]} (edn/read-string (slurp url))]
|
(let [{:keys [description init]} (edn/read-string (slurp url))]
|
||||||
(println (green (str "loading module: " description)))
|
(println (green (str "loading module: " description)))
|
||||||
(-> init str (s/split #"/") first symbol require)
|
(-> init str (s/split #"/") first symbol require)
|
||||||
|
@ -13,6 +13,6 @@
|
||||||
(defn load-plugins []
|
(defn load-plugins []
|
||||||
(let [plugins (.getResources (ClassLoader/getSystemClassLoader) "plugin.edn")]
|
(let [plugins (.getResources (ClassLoader/getSystemClassLoader) "plugin.edn")]
|
||||||
(loop []
|
(loop []
|
||||||
(load-plugin (.. plugins nextElement openStream))
|
(load-plugin (. ^java.net.URL (. plugins nextElement) openStream))
|
||||||
(when (.hasMoreElements plugins)
|
(when (.hasMoreElements plugins)
|
||||||
(recur)))))
|
(recur)))))
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(:import java.util.Date))
|
(:import java.util.Date))
|
||||||
|
|
||||||
|
|
||||||
(defn posts-to-items [site-url posts]
|
(defn posts-to-items [^String site-url posts]
|
||||||
(map
|
(map
|
||||||
(fn [{:keys [uri title content date enclosure]}]
|
(fn [{:keys [uri title content date enclosure]}]
|
||||||
(let [link (str (if (.endsWith site-url "/") (apply str (butlast site-url)) site-url) uri)
|
(let [link (str (if (.endsWith site-url "/") (apply str (butlast site-url)) site-url) uri)
|
||||||
|
|
|
@ -23,11 +23,11 @@
|
||||||
"Given a Diretory, gets files, Filtered to those having scss or sass
|
"Given a Diretory, gets files, Filtered to those having scss or sass
|
||||||
extention. Ignores files matching any ignored regexps."
|
extention. Ignores files matching any ignored regexps."
|
||||||
[base-dir dir ignored-files]
|
[base-dir dir ignored-files]
|
||||||
(let [filename-filter (match-re-filter #"(?i:s[ca]ss$)")]
|
(let [^java.io.FileFilter filename-filter (match-re-filter #"(?i:s[ca]ss$)")]
|
||||||
(->> (.listFiles (io/file base-dir dir) filename-filter)
|
(->> (.listFiles (io/file base-dir dir) filename-filter)
|
||||||
(filter #(not (.isDirectory %)))
|
(filter #(not (.isDirectory ^java.io.File %)))
|
||||||
(filter (ignore ignored-files))
|
(filter (ignore ignored-files))
|
||||||
(map #(.getName %)))))
|
(map #(.getName ^java.io.File %)))))
|
||||||
|
|
||||||
(defn compile-sass-file!
|
(defn compile-sass-file!
|
||||||
"Given a sass file which might be in src-sass directory,
|
"Given a sass file which might be in src-sass directory,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
(let [fmt (java.text.SimpleDateFormat. "yyyy-MM-dd")]
|
(let [fmt (java.text.SimpleDateFormat. "yyyy-MM-dd")]
|
||||||
(.format fmt date)))
|
(.format fmt date)))
|
||||||
|
|
||||||
(defn loc [f]
|
(defn loc [^java.io.File f]
|
||||||
(-> f (.getAbsolutePath) (.split "resources/public/") second))
|
(-> f (.getAbsolutePath) (.split "resources/public/") second))
|
||||||
|
|
||||||
(defn generate [site-url ignored-files]
|
(defn generate [site-url ignored-files]
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
{:tag :urlset
|
{:tag :urlset
|
||||||
:attrs {:xmlns "http://www.sitemaps.org/schemas/sitemap/0.9"}
|
:attrs {:xmlns "http://www.sitemaps.org/schemas/sitemap/0.9"}
|
||||||
:content
|
:content
|
||||||
(for [f (find-assets "public" ".html" ignored-files)]
|
(for [^java.io.File f (find-assets "public" ".html" ignored-files)]
|
||||||
{:tag :url
|
{:tag :url
|
||||||
:content
|
:content
|
||||||
[{:tag :loc
|
[{:tag :loc
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[hiccup.core :as hiccup]))
|
[hiccup.core :as hiccup]))
|
||||||
|
|
||||||
(def _h [:h1 :h2 :h3 :h4 :h5 :h6])
|
(def _h [:h1 :h2 :h3 :h4 :h5 :h6])
|
||||||
(defn- compare_index [i1 i2] (- (.indexOf _h i2) (.indexOf _h i1)))
|
(defn- compare_index [i1 i2] (- (.indexOf ^clojure.lang.APersistentVector _h i2) (.indexOf ^clojure.lang.APersistentVector _h i1)))
|
||||||
|
|
||||||
(defn- get-headings
|
(defn- get-headings
|
||||||
"Turn a body of html content into a vector of elements whose tags are
|
"Turn a body of html content into a vector of elements whose tags are
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
(hiccup/html entry)) tag)))))
|
(hiccup/html entry)) tag)))))
|
||||||
(str acc "</ol>"))))
|
(str acc "</ol>"))))
|
||||||
|
|
||||||
(defn generate-toc [html]
|
(defn generate-toc [^String html]
|
||||||
(-> html
|
(-> html
|
||||||
(.getBytes "UTF-8")
|
(.getBytes "UTF-8")
|
||||||
(java.io.ByteArrayInputStream.)
|
(java.io.ByteArrayInputStream.)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(->> path
|
(->> path
|
||||||
file
|
file
|
||||||
file-seq
|
file-seq
|
||||||
(filter #(not (.isDirectory %)))
|
(filter #(not (.isDirectory ^java.io.File %)))
|
||||||
(filter (ignore ignored-files))))
|
(filter (ignore ignored-files))))
|
||||||
|
|
||||||
(defn checksums [path ignored-files]
|
(defn checksums [path ignored-files]
|
||||||
|
|
Loading…
Reference in a new issue