Sha256: f77e284f0f6e4013904028d1787ee21e2697eaa63134bb06068e9207e883fed6

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

module Utter
  class Application
    def call(env)
      req = Rack::Request.new(env)
      return [405, {"Allow" => 'POST', "Content-Type" => 'text/plain'}, "Not Acceptable"] unless req.post?
      
      if req.path_info =~ /^\/([a-z\d]+)$/
        site = Site[$1]
        if site
          site.regenerate
          return [200, {"Content-Type" => 'text/plain'}, "OK"]
        end
      end
            
      not_found
    end
    
    def not_found
      return [404, {"Content-Type" => 'text/plain'}, "Not Found!\n"]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tooky-utter-0.0.1 lib/utter/application.rb