Sha256: 9a0b1b9f2ba85652c6d22139c36c33594e5c58cdd6e17f66bcf11962216ae4e9

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

require 'rubygems'
require 'rack'

module MyApp
  module Test
    class Server
      def call(env)
        @root = "#{File.expand_path(File.dirname(__FILE__))}/../docs/"
        path = Rack::Utils.unescape(env['PATH_INFO'])
        path += 'index.html' if path == '/'
        file = @root + "#{path}"

        if File.exists?(file)
          [ 200, {'Content-Type' => 'text/html'}, File.read(file) ]
        else
          [ 404, {'Content-Type' => 'text/plain'}, 'file not found' ]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sw_ruby_tika_app-1.14.0 spec/support/test_server.rb
ruby_tika_app-1.5.0 spec/support/test_server.rb
ruby_tika_app-1.4.0 spec/support/test_server.rb
ruby_tika_app-1.3.0 spec/support/test_server.rb