<commit_before>
require 'jellyfish'

class Tank
  include Jellyfish
  handle_exceptions false

  get '/' do
    "<NAME>\n"
  end

  get %r{^/(?<id>\d+)$} do |match|
    "Jelly ##{match[:id]}\n"
  end

  post '/' do
    headers       'X-Jellyfish-Life' => '100'
    headers_merge 'X-Jellyfish-Mana' => '200'
    body "Jellyfish 100/200\n"
    status 201
    'return is ignored if body has already been set'
  end

  get '/env' do
    "#{env.inspect}\n"
  end

  get '/lookup' do
    found "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}/"
  end

  get '/crash' do
    raise 'crash'
  end

  handle NameError do |e|
    status 403
    "No one hears you: #{e.backtrace.first}\n"
  end

  get '/yell' do
    yell
  end

  class Matcher
    def match path
      path.reverse == 'match/'
    end
  end
  get Matcher.new do |match|
    "#{match}\n"
  end

  class Body
    def each
      if Object.const_defined?(:Rainbows)
        (0..4).each{ |i| yield "#{i}\n"; Rainbows.sleep(0.1) }
      else
        yield "You need Rainbows + FiberSpawn (or so) for this\n"
      end
    end
  end
  get '/chunked' do
    Body.new
  end
end

class Heater
  include Jellyfish
  get '/status' do
    temperature
  end

  def controller; Controller; end
  class Controller < Jellyfish::Controller
    def temperature
      "30\u{2103}\n"
    end
  end
end

HugeTank = Rack::Builder.new do
  use Rack::Chunked
  use Rack::ContentLength
  use Rack::ContentType, 'text/plain'
  use Heater
  run Tank.new
end

run HugeTank
<commit_msg>poor man's test. `curl -v http://localhost:8080/overheat`<commit_after>
require 'jellyfish'

Overheat = Class.new(RuntimeError)

class Tank
  include Jellyfish
  handle_exceptions false

  get '/' do
    "<NAME>\n"
  end

  get %r{^/(?<id>\d+)$} do |match|
    "Jelly ##{match[:id]}\n"
  end

  post '/' do
    headers       'X-Jellyfish-Life' => '100'
    headers_merge 'X-Jellyfish-Mana' => '200'
    body "Jellyfish 100/200\n"
    status 201
    'return is ignored if body has already been set'
  end

  get '/env' do
    "#{env.inspect}\n"
  end

  get '/lookup' do
    found "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}/"
  end

  get '/crash' do
    raise 'crash'
  end

  handle NameError do |e|
    status 403
    "No one hears you: #{e.backtrace.first}\n"
  end

  get '/yell' do
    yell
  end

  class Matcher
    def match path
      path.reverse == 'match/'
    end
  end
  get Matcher.new do |match|
    "#{match}\n"
  end

  class Body
    def each
      if Object.const_defined?(:Rainbows)
        (0..4).each{ |i| yield "#{i}\n"; Rainbows.sleep(0.1) }
      else
        yield "You need Rainbows + FiberSpawn (or so) for this\n"
      end
    end
  end
  get '/chunked' do
    Body.new
  end

  get '/overheat' do
    raise Overheat
  end
end

class Heater
  include Jellyfish
  handle Overheat do
    status 500
    "It's overheated\n"
  end

  get '/status' do
    temperature
  end

  def controller; Controller; end
  class Controller < Jellyfish::Controller
    def temperature
      "30\u{2103}\n"
    end
  end
end

HugeTank = Rack::Builder.new do
  use Rack::Chunked
  use Rack::ContentLength
  use Rack::ContentType, 'text/plain'
  use Heater
  run Tank.new
end

run HugeTank

{'fraction_non_alphanumeric': 0.12771908017402114, 'fraction_numerical': 0.019577377252952145, 'mean_word_length': 2.417197452229299, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '2437207', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1198, 'n_words': 343}