Clear reflection warnings
This commit is contained in:
parent
85ede46a9e
commit
f4888b26d9
9 changed files with 20 additions and 20 deletions
|
@ -44,7 +44,7 @@
|
|||
|
||||
(defn parse-post-date
|
||||
"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)]
|
||||
(.parse fmt (.substring file-name 0 10))))
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
(defn page-content
|
||||
"Returns a map with the given page's file-name, metadata and content parsed from
|
||||
the file with the given markup."
|
||||
[page config markup]
|
||||
[^java.io.File page config markup]
|
||||
(with-open [rdr (java.io.PushbackReader. (reader page))]
|
||||
(let [page-name (.getName page)
|
||||
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"
|
||||
[]
|
||||
(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))
|
||||
pages (add-prev-next (read-pages config))
|
||||
[navbar-pages sidebar-pages] (group-pages pages)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
(catch Exception e {:error (.getMessage e)}))]
|
||||
(when-not (:error 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")
|
||||
:uri (get (get git-src "_links") "html")}))))
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
(-> resource io/resource io/file))
|
||||
|
||||
(defn ignore [ignored-files]
|
||||
(fn [file]
|
||||
(fn [^java.io.File file]
|
||||
(let [name (.getName file)
|
||||
matches (map #(re-find % name) ignored-files)]
|
||||
(not (some seq matches)))))
|
||||
|
@ -27,12 +27,12 @@
|
|||
extension (ext) ignoring any files that match the given (ignored-files).
|
||||
First make sure that the root directory exists, if yes: process as normal;
|
||||
if no, return empty vector."
|
||||
[f ext ignored-files]
|
||||
[f ^String ext ignored-files]
|
||||
(if-let [root (get-resource f)]
|
||||
(->> (get-resource f)
|
||||
file-seq
|
||||
(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]
|
||||
|
@ -47,9 +47,9 @@
|
|||
|
||||
(defn copy-dir [src target ignored-files]
|
||||
(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)]
|
||||
(doseq [f files]
|
||||
(doseq [^java.io.File f files]
|
||||
(let [out (io/file target (.getName f))]
|
||||
(if (.isDirectory f)
|
||||
(copy-dir f out ignored-files)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
[clojure.string :as s]
|
||||
[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))]
|
||||
(println (green (str "loading module: " description)))
|
||||
(-> init str (s/split #"/") first symbol require)
|
||||
|
@ -13,6 +13,6 @@
|
|||
(defn load-plugins []
|
||||
(let [plugins (.getResources (ClassLoader/getSystemClassLoader) "plugin.edn")]
|
||||
(loop []
|
||||
(load-plugin (.. plugins nextElement openStream))
|
||||
(load-plugin (. ^java.net.URL (. plugins nextElement) openStream))
|
||||
(when (.hasMoreElements plugins)
|
||||
(recur)))))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(:import java.util.Date))
|
||||
|
||||
|
||||
(defn posts-to-items [site-url posts]
|
||||
(defn posts-to-items [^String site-url posts]
|
||||
(map
|
||||
(fn [{:keys [uri title content date enclosure]}]
|
||||
(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
|
||||
extention. Ignores files matching any ignored regexps."
|
||||
[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)
|
||||
(filter #(not (.isDirectory %)))
|
||||
(filter #(not (.isDirectory ^java.io.File %)))
|
||||
(filter (ignore ignored-files))
|
||||
(map #(.getName %)))))
|
||||
(map #(.getName ^java.io.File %)))))
|
||||
|
||||
(defn compile-sass-file!
|
||||
"Given a sass file which might be in src-sass directory,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
(let [fmt (java.text.SimpleDateFormat. "yyyy-MM-dd")]
|
||||
(.format fmt date)))
|
||||
|
||||
(defn loc [f]
|
||||
(defn loc [^java.io.File f]
|
||||
(-> f (.getAbsolutePath) (.split "resources/public/") second))
|
||||
|
||||
(defn generate [site-url ignored-files]
|
||||
|
@ -19,7 +19,7 @@
|
|||
{:tag :urlset
|
||||
:attrs {:xmlns "http://www.sitemaps.org/schemas/sitemap/0.9"}
|
||||
:content
|
||||
(for [f (find-assets "public" ".html" ignored-files)]
|
||||
(for [^java.io.File f (find-assets "public" ".html" ignored-files)]
|
||||
{:tag :url
|
||||
:content
|
||||
[{:tag :loc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[hiccup.core :as hiccup]))
|
||||
|
||||
(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
|
||||
"Turn a body of html content into a vector of elements whose tags are
|
||||
|
@ -41,7 +41,7 @@
|
|||
(hiccup/html entry)) tag)))))
|
||||
(str acc "</ol>"))))
|
||||
|
||||
(defn generate-toc [html]
|
||||
(defn generate-toc [^String html]
|
||||
(-> html
|
||||
(.getBytes "UTF-8")
|
||||
(java.io.ByteArrayInputStream.)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(->> path
|
||||
file
|
||||
file-seq
|
||||
(filter #(not (.isDirectory %)))
|
||||
(filter #(not (.isDirectory ^java.io.File %)))
|
||||
(filter (ignore ignored-files))))
|
||||
|
||||
(defn checksums [path ignored-files]
|
||||
|
|
Loading…
Reference in a new issue