<commit_before># This example shows how you might keep a local development Rails server up
# and running on your Mac.

RAILS_ROOT = "/Users/tom/dev/gravatar2"

God.meddle do |god|
  god.interval = 60 # seconds
  
  god.watch do |w|
    w.name = "local-3000"
    w.cwd = RAILS_ROOT
    w.start = "mongrel_rails start -P ./log/mongrel.pid -d"
    w.stop = "mongrel_rails stop -P ./log/mongrel.pid"
    w.grace = 5
    
    pid_file = File.join(RAILS_ROOT, "log/mongrel.pid")
  
    w.start_if do |start|
      start.condition(:process_not_running) do |c|
        c.pid_file = pid_file
      end
    end
    
    w.restart_if do |restart|
      restart.condition(:memory_usage) do |c|
        c.pid_file = pid_file
        c.above = (50 * 1024) # 50mb
        c.times = [3, 5]
      end
      
      restart.condition(:cpu_usage) do |c|
        c.pid_file = pid_file
        c.above = 10 # percent
        c.times = [3, 5]
      end
    end
  end
end<commit_msg>brought examples/local.god up to date<commit_after># This example shows how you might keep a local development Rails server up
# and running on your Mac.

# Run with:
# god local.god

RAILS_ROOT = "/Users/tom/dev/gravatar2"

God.meddle do |god|
  god.interval = 5 # seconds
  
  god.watch do |w|
    w.name = "local-3000"
    w.cwd = RAILS_ROOT
    w.start = "mongrel_rails start -P ./log/mongrel.pid -d"
    w.stop = "mongrel_rails stop -P ./log/mongrel.pid"
    w.grace = 5
    
    pid_file = File.join(RAILS_ROOT, "log/mongrel.pid")
    
    # clean pid files before start if necessary
    w.behavior(:clean_pid_file) do |b|
      b.pid_file = pid_file
    end
  
    # start if process is not running
    w.start_if do |start|
      start.condition(:process_not_running) do |c|
        c.pid_file = pid_file
      end
    end
    
    # restart if memory or cpu is too high
    w.restart_if do |restart|
      restart.condition(:memory_usage) do |c|
        c.pid_file = pid_file
        c.above = (50 * 1024) # 50mb
        c.times = [3, 5]
      end
      
      restart.condition(:cpu_usage) do |c|
        c.pid_file = pid_file
        c.above = 10 # percent
        c.times = [3, 5]
      end
    end
  end
  
  # clear old session files
  god.watch do |w|    
    w.name = "local-session-cleanup"
    w.cwd = File.join(RAILS_ROOT, 'tmp/sessions')
    w.start = lambda do
      Dir['ruby_sess.*'].select { |f| File.mtime(f) < Time.now - (7 * 24 * 60 * 60) }.each { |f| File.delete(f) }
    end
    
    w.start_if do |start|
      start.condition(:always)
    end
  end
end
{'fraction_non_alphanumeric': 0.11447678992918961, 'fraction_numerical': 0.01966955153422502, 'mean_word_length': 2.097442143727162, 'pattern_counts': {'":': 0, '<': 4, '<?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': '2596066', 'n_tokens_mistral': 988, 'n_tokens_neox': 938, 'n_words': 249}