Compare commits

...

7 commits

Author SHA1 Message Date
6af6569b0f Merge remote-tracking branch 'upstream/master' 2021-03-31 22:36:00 -03:00
Serdar Dogruyol - Sedo セド
3fee068636
Release 1.0.0 (#601) 2021-03-22 23:20:46 +03:00
Sijawusz Pur Rahnama
2d46beea5d
Migrate from Travis CI to GitHub Actions (#603) 2021-03-15 08:47:14 +03:00
Sijawusz Pur Rahnama
0764091e03
Bump ameba dependency (#602) 2021-03-15 08:45:35 +03:00
jinn999
8d0875f64c
Fix StaticFileHandler failing spec (#599) 2021-03-07 14:29:49 +03:00
Luis Lavena
f71a83e2c4
Use latest version of Ameba dependency (dev) (#597) 2021-02-13 11:18:51 +03:00
Luis Lavena
1da32e5246
Use Radix v0.4.0 (#596)
Use latest release version of Radix in order to address some of the
routing bugs presented in previous versions of the dependency

See:

- luislavena/radix#23
- luislavena/radix#27
2021-02-13 11:18:04 +03:00
8 changed files with 61 additions and 27 deletions

41
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: CI
on:
push:
pull_request:
schedule:
- cron: "0 3 * * 1" # Every monday at 3 AM
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
crystal: [latest, nightly]
runs-on: ${{ matrix.os }}
steps:
- name: Install Crystal
uses: oprypin/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Download source
uses: actions/checkout@v2
- name: Install dependencies
run: shards install
env:
SHARDS_OPTS: --ignore-crystal-version
- name: Run specs
run: |
crystal spec
crystal spec --release --no-debug
- name: Check formatting
run: crystal tool format --check
- name: Run ameba linter
run: bin/ameba

View file

@ -1,14 +0,0 @@
language: crystal
crystal:
- latest
- nightly
script:
- crystal spec
- crystal spec --release --no-debug
- crystal tool format --check
- bin/ameba src
matrix:
allow_failures:
- crystal: nightly

View file

@ -1,3 +1,10 @@
# 1.0.0 (??-03-2021)
- Crystal 1.0.0 support :tada:
- Update Radix to use latest 0.4.0 [#596](https://github.com/kemalcr/kemal/pull/596). Thanks @luislavena :pray:
- Use latest version of Ameba dependency (dev) [#597](https://github.com/kemalcr/kemal/pull/597). Thanks @luislavena :pray:
- Fix StaticFileHandler failing spec [#599](https://github.com/kemalcr/kemal/pull/599). Thanks @jinn999 :pray:
# 0.27.0 (28-11-2020) # 0.27.0 (28-11-2020)
- Crystal 0.35.x support :tada: Thanks @bcardiff :pray: - Crystal 0.35.x support :tada: Thanks @bcardiff :pray:

View file

@ -5,7 +5,7 @@
Lightning Fast, Super Simple web framework. Lightning Fast, Super Simple web framework.
[![Build Status](https://travis-ci.org/kemalcr/kemal.svg?branch=master)](https://travis-ci.org/kemalcr/kemal) [![CI](https://github.com/kemalcr/kemal/actions/workflows/ci.yml/badge.svg)](https://github.com/kemalcr/kemal/actions/workflows/ci.yml)
[![Join the chat at https://gitter.im/sdogruyol/kemal](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sdogruyol/kemal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/sdogruyol/kemal](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sdogruyol/kemal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# Super Simple ⚡️ # Super Simple ⚡️

View file

@ -1,5 +1,5 @@
name: kemal name: kemal
version: 0.27.0 version: 1.0.0
authors: authors:
- Serdar Dogruyol <dogruyolserdar@gmail.com> - Serdar Dogruyol <dogruyolserdar@gmail.com>
@ -7,7 +7,7 @@ authors:
dependencies: dependencies:
radix: radix:
github: luislavena/radix github: luislavena/radix
version: ~> 0.3.8 version: ~> 0.4.0
kilt: kilt:
github: jeromegn/kilt github: jeromegn/kilt
version: ~> 0.4.0 version: ~> 0.4.0
@ -18,8 +18,8 @@ dependencies:
development_dependencies: development_dependencies:
ameba: ameba:
github: crystal-ameba/ameba github: crystal-ameba/ameba
version: ~> 0.12.0 version: ~> 0.14.0
crystal: 0.35.0 crystal: ">= 0.36.0"
license: MIT license: MIT

View file

@ -1,6 +1,6 @@
require "./spec_helper" require "./spec_helper"
private def handle(request, fallthrough = true) private def handle(request, fallthrough = true, decompress = true)
io = IO::Memory.new io = IO::Memory.new
response = HTTP::Server::Response.new(io) response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response) context = HTTP::Server::Context.new(request, response)
@ -8,7 +8,7 @@ private def handle(request, fallthrough = true)
handler.call context handler.call context
response.close response.close
io.rewind io.rewind
HTTP::Client::Response.from_io(io) HTTP::Client::Response.from_io(io, decompress: decompress)
end end
describe Kemal::StaticFileHandler do describe Kemal::StaticFileHandler do
@ -51,7 +51,7 @@ describe Kemal::StaticFileHandler do
it "should gzip a file if config is true, headers accept gzip and file is > 880 bytes" do it "should gzip a file if config is true, headers accept gzip and file is > 880 bytes" do
serve_static({"gzip" => true, "dir_listing" => true}) serve_static({"gzip" => true, "dir_listing" => true})
headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"} headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"}
response = handle HTTP::Request.new("GET", "/dir/bigger.txt", headers) response = handle HTTP::Request.new("GET", "/dir/bigger.txt", headers), decompress: false
response.status_code.should eq(200) response.status_code.should eq(200)
response.headers["Content-Encoding"].should eq "gzip" response.headers["Content-Encoding"].should eq "gzip"
end end
@ -59,7 +59,7 @@ describe Kemal::StaticFileHandler do
it "should not gzip a file if config is true, headers accept gzip and file is < 880 bytes" do it "should not gzip a file if config is true, headers accept gzip and file is < 880 bytes" do
serve_static({"gzip" => true, "dir_listing" => true}) serve_static({"gzip" => true, "dir_listing" => true})
headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"} headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"}
response = handle HTTP::Request.new("GET", "/dir/test.txt", headers) response = handle HTTP::Request.new("GET", "/dir/test.txt", headers), decompress: false
response.status_code.should eq(200) response.status_code.should eq(200)
response.headers["Content-Encoding"]?.should be_nil response.headers["Content-Encoding"]?.should be_nil
end end
@ -67,7 +67,7 @@ describe Kemal::StaticFileHandler do
it "should not gzip a file if config is false, headers accept gzip and file is > 880 bytes" do it "should not gzip a file if config is false, headers accept gzip and file is > 880 bytes" do
serve_static({"gzip" => false, "dir_listing" => true}) serve_static({"gzip" => false, "dir_listing" => true})
headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"} headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"}
response = handle HTTP::Request.new("GET", "/dir/bigger.txt", headers) response = handle HTTP::Request.new("GET", "/dir/bigger.txt", headers), decompress: false
response.status_code.should eq(200) response.status_code.should eq(200)
response.headers["Content-Encoding"]?.should be_nil response.headers["Content-Encoding"]?.should be_nil
end end

View file

@ -22,8 +22,8 @@ describe "Kemal::WebSocketHandler" do
it "matches on given route" do it "matches on given route" do
handler = Kemal::WebSocketHandler::INSTANCE handler = Kemal::WebSocketHandler::INSTANCE
ws "/" { |socket| socket.send("Match") } ws("/", &.send("Match"))
ws "/no_match" { |socket| socket.send "No Match" } ws("/no_match", &.send("No Match"))
headers = HTTP::Headers{ headers = HTTP::Headers{
"Upgrade" => "websocket", "Upgrade" => "websocket",
"Connection" => "Upgrade", "Connection" => "Upgrade",

View file

@ -66,7 +66,7 @@ module Kemal
end end
def self.display_startup_message(config, server) def self.display_startup_message(config, server)
addresses = server.addresses.map { |address| "#{config.scheme}://#{address}" }.join ", " addresses = server.addresses.join ", " { |address| "#{config.scheme}://#{address}" }
log "[#{config.env}] Kemal is ready to lead at #{addresses}" log "[#{config.env}] Kemal is ready to lead at #{addresses}"
end end