<commit_before>;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.

(ns containium.standalone
  (:require 
    [containium.systems                :refer (with-systems)]
    [containium.systems.config         :refer (map-config)]
    [containium.systems.repl           :as repl]
    [containium.systems.elasticsearch  :as elastic]
    [containium.systems.cassandra      :as cassandra]
    [containium.systems.ring           :refer (test-http-kit)]
    [ring.middleware.session.memory   :refer (memory-store)]
    [clojure.java.io                  :as io]
    ))

(defn run [spec containium-map]
  (prn "Ring handler: " (-> containium-map :ring :handler))
  (with-systems systems [:config (map-config spec)
                         :repl repl/nrepl
                         :session-store (memory-store)
                         :ring (test-http-kit (-> containium-map :ring :handler))
                         :elastic elastic/embedded
                         :cassandra cassandra/embedded12
                         ]
    ((:start containium-map) systems {
      :file (io/as-file ".")
      :profiles []
      :active-profiles []
      :dev? true
      :containium containium-map
      })
    (read-line)
    ((:stop containium-map) systems))
  (shutdown-agents))<commit_msg>Update standalone to new Cassandra system structure + indend fix<commit_after>;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.

(ns containium.standalone
  (:require [containium.systems :refer (with-systems)]
            [containium.systems.config :refer (map-config)]
            [containium.systems.repl :as repl]
            [containium.systems.elasticsearch :as elastic]
            [containium.systems.cassandra.embedded12 :as cassandra]
            [containium.systems.ring :refer (test-http-kit)]
            [ring.middleware.session.memory :refer (memory-store)]
            [clojure.java.io :as io]))


(defn run [spec containium-map]
  (prn "Ring handler: " (-> containium-map :ring :handler))
  (with-systems systems [:config (map-config spec)
                         :repl repl/nrepl
                         :session-store (memory-store)
                         :ring (test-http-kit (-> containium-map :ring :handler))
                         :elastic elastic/embedded
                         :cassandra cassandra/embedded12]
    (let [start-fn (:start containium-map)
          stop-fn (:stop containium-map)]
      (start-fn systems
                {:file (io/as-file ".")
                 :profiles []
                 :active-profiles []
                 :dev? true
                 :containium containium-map})
      (read-line)
      (stop-fn systems)))
  (shutdown-agents))
{'fraction_non_alphanumeric': 0.1175680214981525, 'fraction_numerical': 0.0047027208599261005, 'mean_word_length': 1.9455984174085064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3687134', 'n_tokens_mistral': 914, 'n_tokens_neox': 856, 'n_words': 224}