<commit_before>#!/usr/bin/env ruby
# If you need a bit of debugging output in the threads add -d to the line above

# For the benefit of foreman
$stdout.sync = true

$: << File.join(File.dirname(__FILE__), "..", "lib")

require 'cuttlefish_smtp_server'

# Hardcoded to the development environment for the time being
environment = "development"
host = "127.0.0.1"
port = 2525
number_of_connections = 4

activerecord_config = YAML.load(File.read(File.join(File.dirname(__FILE__), '..', 'config', 'database.yml')))
ActiveRecord::Base.establish_connection(activerecord_config[environment])

server = CuttlefishSmtpServer.new(port, host, number_of_connections)
server.audit = true
server.start

puts "My eight arms and two tentacles are quivering in anticipation."
puts "I'm listening for emails via SMTP on #{host} port #{port}" 

server.join
<commit_msg>Move server start code into module<commit_after>#!/usr/bin/env ruby
# If you need a bit of debugging output in the threads add -d to the line above

$: << File.join(File.dirname(__FILE__), "..", "lib")

require 'cuttlefish_smtp_server'

module CuttlefishControl
  def self.smtp_start
    # Hardcoded to the development environment for the time being
    environment = "development"
    host = "127.0.0.1"
    port = 2525
    number_of_connections = 4

    # For the benefit of foreman
    $stdout.sync = true

    activerecord_config = YAML.load(File.read(File.join(File.dirname(__FILE__), '..', 'config', 'database.yml')))
    ActiveRecord::Base.establish_connection(activerecord_config[environment])

    server = CuttlefishSmtpServer.new(port, host, number_of_connections)
    server.audit = true
    server.start

    puts "My eight arms and two tentacles are quivering in anticipation."
    puts "I'm listening for emails via SMTP on #{host} port #{port}" 

    server.join
  end
end

CuttlefishControl.smtp_start
{'fraction_non_alphanumeric': 0.10807918673087212, 'fraction_numerical': 0.011771000535045479, 'mean_word_length': 4.483870967741935, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3686144', 'n_tokens_mistral': 637, 'n_tokens_neox': 573, 'n_words': 176}