<commit_before>(ns foosball.system
  (:use [taoensso.timbre :only [trace debug info warn error fatal spy]])
  (:require [foosball.handler   :as handler]
            [foosball.models.db :as db]
            [ring.adapter.jetty :as jetty]))

(def ^:private uri "datomic:free://localhost:4334/foosball")

(defn system
  "Returns a new instance of the whole application."
  [& {:keys [db-uri handler-wrapper] :or {db-uri uri handler-wrapper identity}}]
  {:db-uri uri
   :handler (handler-wrapper handler/war-handler)})

(defn start
  "Performs side effects to initialize the system, acquire resources, and start it running.
   Returns an updated instance of the system."
  [{:keys [handler db-uri] :as system}]
  (let [dev-port      8080
        db-connection (db/create-db-and-connect db-uri)
        server        (when handler
                        (jetty/run-jetty handler {:port dev-port :join? false}))]
    (when server (info "dev-server running on port" dev-port))
    (merge system {:db-connection db-connection
                   :server server})))

(defn stop
  "Performs side effects to shut down the system and release its resources.
   Returns an updated instance of the system."
  [{:keys [server] :as system}]
  (when server
    (.stop server))
  (merge system {:server nil
                 :db-connection nil}))<commit_msg>use the db-uri destructured parameter (not the straight default parameter)<commit_after>(ns foosball.system
  (:use [taoensso.timbre :only [trace debug info warn error fatal spy]])
  (:require [foosball.handler   :as handler]
            [foosball.models.db :as db]
            [ring.adapter.jetty :as jetty]))

(def ^:private uri "datomic:free://localhost:4334/foosball")

(defn system
  "Returns a new instance of the whole application."
  [& {:keys [db-uri handler-wrapper] :or {db-uri uri handler-wrapper identity}}]
  {:db-uri db-uri
   :handler (handler-wrapper handler/war-handler)})

(defn start
  "Performs side effects to initialize the system, acquire resources, and start it running.
   Returns an updated instance of the system."
  [{:keys [handler db-uri] :as system}]
  (let [dev-port      8080
        db-connection (db/create-db-and-connect db-uri)
        server        (when handler
                        (jetty/run-jetty handler {:port dev-port :join? false}))]
    (when server (info "dev-server running on port" dev-port))
    (merge system {:db-connection db-connection
                   :server server})))

(defn stop
  "Performs side effects to shut down the system and release its resources.
   Returns an updated instance of the system."
  [{:keys [server] :as system}]
  (when server
    (.stop server))
  (merge system {:server nil
                 :db-connection nil}))
{'fraction_non_alphanumeric': 0.11678832116788321, 'fraction_numerical': 0.00583941605839416, 'mean_word_length': 2.9269340974212033, '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': '5595343', 'n_tokens_mistral': 825, 'n_tokens_neox': 795, 'n_words': 288}