Use Ameba on Travis CI (#520)

This commit is contained in:
Sijawusz Pur Rahnama 2019-06-13 13:31:45 +02:00 committed by Serdar Dogruyol
parent c646aad482
commit 06665e81bc
5 changed files with 9 additions and 3 deletions

View file

@ -7,6 +7,7 @@ script:
- crystal spec - crystal spec
- crystal spec --release --no-debug - crystal spec --release --no-debug
- crystal tool format --check - crystal tool format --check
- bin/ameba src
matrix: matrix:
allow_failures: allow_failures:

View file

@ -15,6 +15,11 @@ dependencies:
github: crystal-loot/exception_page github: crystal-loot/exception_page
version: ~> 0.1.1 version: ~> 0.1.1
development_dependencies:
ameba:
github: veelenga/ameba
version: ~> 0.9.0
crystal: 0.27.2 crystal: 0.27.2
license: MIT license: MIT

View file

@ -14,7 +14,7 @@ module Kemal
log("Exception: #{ex.inspect_with_backtrace}") log("Exception: #{ex.inspect_with_backtrace}")
return call_exception_with_status_code(context, ex, 500) if Kemal.config.error_handlers.has_key?(500) return call_exception_with_status_code(context, ex, 500) if Kemal.config.error_handlers.has_key?(500)
verbosity = Kemal.config.env == "production" ? false : true verbosity = Kemal.config.env == "production" ? false : true
return render_500(context, ex, verbosity) render_500(context, ex, verbosity)
end end
private def call_exception_with_status_code(context : HTTP::Server::Context, exception : Exception, status_code : Int32) private def call_exception_with_status_code(context : HTTP::Server::Context, exception : Exception, status_code : Int32)

View file

@ -1,7 +1,7 @@
class HTTP::Server::Response class HTTP::Server::Response
class Output class Output
def close def close
unless response.wrote_headers? && !response.headers.has_key?("Content-Range") if !response.wrote_headers? && response.headers.has_key?("Content-Range")
response.content_length = @out_count response.content_length = @out_count
end end

View file

@ -52,7 +52,7 @@ module Kemal
context.response.content_type = "text/html" context.response.content_type = "text/html"
directory_listing(context.response, request_path, file_path) directory_listing(context.response, request_path, file_path)
else else
return call_next(context) call_next(context)
end end
elsif File.exists?(file_path) elsif File.exists?(file_path)
last_modified = modification_time(file_path) last_modified = modification_time(file_path)