<commit_before>(ns aspire.web
  (:require [ring.adapter.jetty :as jetty]
            [ring.middleware.resource :as ring-resource]
            [ring.middleware.content-type :as content-type]
            [ring.middleware.file-info :as file-info]
            [ring.util.response :as response]
            [liberator.core :refer [resource defresource]]
            [liberator.dev :refer [wrap-trace]]
            [compojure.core :refer [defroutes ANY]]
            [hiccup.page]
            [aspire.sqldb :as a-sqldb])
  (:gen-class))

(defresource resource-app
  ;; This is intended to load up the very first page, and kick
  ;; everything off.
  ;; All other templating should be handled client-side.
  :available-media-types ["text/html"]
  :handle-ok (fn [_]
               (hiccup.page/html5
                [:head
                 ;; alt: page.css
                 [:link {:rel "stylesheet" :href "css/global.css"}]]
                [:body
                 [:div#main
                  [:div [:p#loading "Loading..."]]
                 [:script {:src "js/aspire.js"}]]])))

(defresource resource-api
  :available-media-types ["application/edn"]
  :handle-ok (fn [_]
               (println :resource-api)
               (str {:now (.getTime (java.util.Date.))})))

(defresource resource-comps
  ;; demo resource to select some comp records
  :available-media-types ["application/edn"]
  :handle-ok (fn [_]
               (println :resource-comps)
               (a-sqldb/select! {:select [:*] :from [:comp] :limit 2})))

(defroutes app-routes
  (ANY "/" [] resource-app)
  (ANY "/api" [] resource-api)
  (ANY "/comps" [] resource-comps))

(def app
  (-> app-routes
      (ring-resource/wrap-resource "public")
      (file-info/wrap-file-info)
      (wrap-trace :ui)))

(defn run!
  [& args]
  (apply jetty/run-jetty #'app args))
<commit_msg>Small changes to resources for testing.<commit_after>(ns aspire.web
  (:require [ring.adapter.jetty :as jetty]
            [ring.middleware.resource :as ring-resource]
            [ring.middleware.content-type :as content-type]
            [ring.middleware.file-info :as file-info]
            [ring.util.response :as response]
            [liberator.core :refer [resource defresource]]
            [liberator.dev :refer [wrap-trace]]
            [compojure.core :refer [defroutes ANY]]
            [hiccup.page]
            [aspire.sqldb :as a-sqldb])
  (:gen-class))

(defresource resource-app
  ;; This is intended to load up the very first page, and kick
  ;; everything off.
  ;; All other templating should be handled client-side.
  :available-media-types ["text/html"]
  :handle-ok (fn [_]
               (hiccup.page/html5
                [:head
                 ;; alt: page.css
                 [:link {:rel "stylesheet" :href "css/global.css"}]]
                [:body
                 [:div#main
                  [:div [:p#loading "Loading..."]]
                 [:script {:src "js/aspire.js"}]]])))

(defresource resource-api
  :available-media-types ["application/edn"]
  :handle-ok (fn [_]
               (str {:comp_tag {:name "tag name" :version "v7" :description "Herein shall be a description." :cnt-completed 9 :cnt-remaining 20}})
               ))

(defresource resource-comps
  ;; demo resource to select some comp records
  :available-media-types ["application/edn"]
  :handle-ok (fn [_]
               (a-sqldb/select! {:select [:*] :from [:comp]})))

(defroutes app-routes
  (ANY "/" [] resource-app)
  (ANY "/api" [] resource-api)
  (ANY "/comps" [] resource-comps))

(def app
  (-> app-routes
      (ring-resource/wrap-resource "public")
      (file-info/wrap-file-info)
      (wrap-trace :ui)))

(defn run!
  [& args]
  (apply jetty/run-jetty #'app args))

{'fraction_non_alphanumeric': 0.1539286672030035, 'fraction_numerical': 0.0018771788683293108, 'mean_word_length': 2.1636980491942324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5863912', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1186, 'n_words': 284}