Compare commits
7 commits
65ff5b9b2b
...
6af6569b0f
Author | SHA1 | Date | |
---|---|---|---|
6af6569b0f | |||
|
3fee068636 | ||
|
2d46beea5d | ||
|
0764091e03 | ||
|
8d0875f64c | ||
|
f71a83e2c4 | ||
|
1da32e5246 |
8 changed files with 61 additions and 27 deletions
41
.github/workflows/ci.yml
vendored
Normal file
41
.github/workflows/ci.yml
vendored
Normal 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
|
14
.travis.yml
14
.travis.yml
|
@ -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
|
|
|
@ -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:
|
||||||
|
|
|
@ -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 ⚡️
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue