<commit_before>(ns distillery.view.dependencies
  (:import java.nio.file.Files)
  (:require [clojure.java.io :as io])
  (:require [distillery.files :refer :all]))

(def static-resources
  ["reset.css"
   "base.css"
   "layout.css"
   "distillery.css"
   "jquery.js"
   "distillery.js"
;   "video.js"
;   "video-js.min.css"
;   "video-js.png"
;   "video-js.swf"
;   "vjs.eot"
;   "vjs.woff"
;   "vjs.ttf"
;   "vjs.svg"
   ])

(defn- copy-stream-to-file
  [^java.io.InputStream s ^java.nio.file.Path p]
  (java.nio.file.Files/copy s p (into-array java.nio.file.CopyOption [])))

(defn- save-dependency
  "Saves a static resource dependency relative to the given HTML file path."
  [^String target-dir ^String rn]
  (let [src-s (.getResourceAsStream (.getContextClassLoader (Thread/currentThread)) rn)
        trg (get-path target-dir rn)]
    (copy-stream-to-file src-s trg)
    (.close src-s)))

(defn save-dependencies
  "Saves all static resource dependencies relative to the given HTML file path."
  [^String target-dir]
  (doseq [rn static-resources]
    (save-dependency target-dir rn)))
<commit_msg>bugfix override existing dependency<commit_after>(ns distillery.view.dependencies
  (:import java.nio.file.Files)
  (:require [clojure.java.io :as io])
  (:require [distillery.files :refer :all]))

(def static-resources
  ["reset.css"
   "base.css"
   "layout.css"
   "distillery.css"
   "jquery.js"
   "distillery.js"
;   "video.js"
;   "video-js.min.css"
;   "video-js.png"
;   "video-js.swf"
;   "vjs.eot"
;   "vjs.woff"
;   "vjs.ttf"
;   "vjs.svg"
   ])

(defn- copy-stream-to-file
  [^java.io.InputStream s ^java.nio.file.Path p]
  (java.nio.file.Files/copy s p (into-array java.nio.file.CopyOption [java.nio.file.StandardCopyOption/REPLACE_EXISTING])))

(defn- save-dependency
  "Saves a static resource dependency relative to the given HTML file path."
  [^String target-dir ^String rn]
  (let [src-s (.getResourceAsStream (.getContextClassLoader (Thread/currentThread)) rn)
        trg (get-path target-dir rn)]
    (copy-stream-to-file src-s trg)
    (.close src-s)))

(defn save-dependencies
  "Saves all static resource dependencies relative to the given HTML file path."
  [^String target-dir]
  (doseq [rn static-resources]
    (save-dependency target-dir rn)))

{'fraction_non_alphanumeric': 0.15620886353663888, 'fraction_numerical': 0.0, 'mean_word_length': 3.453125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4875290', 'n_tokens_mistral': 871, 'n_tokens_neox': 846, 'n_words': 192}