From 875e84b1b5ad5c646f12bc883fd13bdb8580cdc9 Mon Sep 17 00:00:00 2001 From: Adrian Date: Wed, 11 Mar 2020 21:48:54 +0100 Subject: [PATCH] v0.28 --- Project.toml | 3 ++- src/Router.jl | 2 +- src/genie_types.jl | 31 ------------------------------- src/renderers/Html.jl | 2 +- src/renderers/Js.jl | 4 ++-- test/fileuploads/test.jl | 2 +- test/htmlrendering/test.jl | 2 +- test/inlinecache/test.jl | 2 +- test/json-error/test.jl | 2 +- test/postform/test.jl | 2 +- 10 files changed, 11 insertions(+), 41 deletions(-) diff --git a/Project.toml b/Project.toml index 85e9a3d82..b20a5da24 100755 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Genie" uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e" authors = ["Adrian Salceanu "] -version = "0.27.0" +version = "0.28.0" [deps] ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" @@ -27,6 +27,7 @@ Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" URIParser = "30578b45-9adc-5946-b283-645ec420af67" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" [compat] ArgParse = "1" diff --git a/src/Router.jl b/src/Router.jl index 36f556d43..805025191 100755 --- a/src/Router.jl +++ b/src/Router.jl @@ -169,7 +169,7 @@ function route_ws_request(req, msg::String, ws_client, ip::Sockets.IPv4 = Socket Genie.Configuration.isdev() && Revise.revise() for f in unique(pre_match_hooks) - req, res, params.collection = f(req, res, params.collection) + req, msg, params.collection = f(req, msg, params.collection) end match_channels(req, msg, ws_client, params) diff --git a/src/genie_types.jl b/src/genie_types.jl index b753dd47c..94c75d482 100755 --- a/src/genie_types.jl +++ b/src/genie_types.jl @@ -1,40 +1,9 @@ import Base.string import Base.print import Base.show - -export GenieType, GenieController, Controller - -abstract type GenieType end -string(io::IO, t::T) where {T<:GenieType} = "$(typeof(t)) <: $(super(typeof(t)))" -print(io::IO, t::T) where {T<:GenieType} = print(io, "$(typeof(t)) <: $(super(typeof(t)))") -show(io::IO, t::T) where {T<:GenieType} = print(io, genietype_to_print(t)) - -mutable struct GenieController <: GenieType -end - -const Controller = GenieController - -mutable struct GenieChannel <: GenieType -end - -# const Channel = GenieChannel - import Millboard -""" - genietype_to_print{T<:GenieType}(m::T) :: String - -Pretty printing of Genie types. -""" -function genietype_to_print(m::T) :: String where {T<:GenieType} - output = "\n" * "$(typeof(m))" * "\n" - output *= string(Millboard.table(to_string_dict(m)), "\n") - - output -end - - """ to_dict(m::Any) :: Dict{String,Any} to_string_dict(m::Any; all_output::Bool = false) :: Dict{String,String} diff --git a/src/renderers/Html.jl b/src/renderers/Html.jl index 7b5efee6d..534fd1b6b 100644 --- a/src/renderers/Html.jl +++ b/src/renderers/Html.jl @@ -2,7 +2,7 @@ module Html import Revise -import Markdown, Logging, Gumbo, Reexport, OrderedCollections, Millboard, HTTP +import Markdown, Logging, Gumbo, Reexport, OrderedCollections, Millboard, HTTP, YAML import Genie, Genie.Renderer import Genie.Renderer: @vars Reexport.@reexport using HttpCommon diff --git a/src/renderers/Js.jl b/src/renderers/Js.jl index 61571207d..c13646ed6 100644 --- a/src/renderers/Js.jl +++ b/src/renderers/Js.jl @@ -32,8 +32,8 @@ function get_template(path::String; context::Module = @__MODULE__) :: Function f_path = joinpath(Genie.config.path_build, Genie.Renderer.BUILD_NAME, mod_name) f_stale = Genie.Renderer.build_is_stale(path, f_path) - if f_stale || ! isdefined(context, func_name) - f_stale && Genie.Renderer.build_module(to_js(data), path, mod_name) + if f_stale || ! isdefined(context, f_name) + f_stale && Genie.Renderer.build_module(to_js(read(path, String)), path, mod_name) return Base.include(context, joinpath(Genie.config.path_build, Genie.Renderer.BUILD_NAME, mod_name)) end diff --git a/test/fileuploads/test.jl b/test/fileuploads/test.jl index 093895738..1b2cc0fdb 100644 --- a/test/fileuploads/test.jl +++ b/test/fileuploads/test.jl @@ -1,7 +1,7 @@ using Pkg Pkg.activate(".") -using Genie, Genie.Router, Genie.Renderer +using Genie, Genie.Router, Genie.Renderer, Genie.Renderer.Html form = """
diff --git a/test/htmlrendering/test.jl b/test/htmlrendering/test.jl index fdb5c7306..07a70da68 100644 --- a/test/htmlrendering/test.jl +++ b/test/htmlrendering/test.jl @@ -1,7 +1,7 @@ using Pkg Pkg.activate(".") -using Genie, Genie.Router, Genie.Renderer +using Genie, Genie.Router, Genie.Renderer, Genie.Renderer.Html markup = """""" markup *= """""" diff --git a/test/inlinecache/test.jl b/test/inlinecache/test.jl index 10f4a763f..b90c3ed17 100644 --- a/test/inlinecache/test.jl +++ b/test/inlinecache/test.jl @@ -4,7 +4,7 @@ Pkg.activate(".") using Revise Revise.track(@__FILE__) -using Genie, Genie.Router, Genie.Renderer +using Genie, Genie.Router, Genie.Renderer, Genie.Renderer.Html route("/") do view = "

Hello Genie!!

" diff --git a/test/json-error/test.jl b/test/json-error/test.jl index bc5c40e4b..466d8cb6c 100644 --- a/test/json-error/test.jl +++ b/test/json-error/test.jl @@ -1,7 +1,7 @@ using Pkg Pkg.activate(".") -using Genie, HTTP +using Genie, HTTP, Test import Genie.Router: route, POST, @params import Genie.Requests: jsonpayload diff --git a/test/postform/test.jl b/test/postform/test.jl index 9fee9ae1d..69278cbb6 100644 --- a/test/postform/test.jl +++ b/test/postform/test.jl @@ -1,7 +1,7 @@ using Pkg Pkg.activate(".") -using Genie, Genie.Router, Genie.Renderer +using Genie, Genie.Router, Genie.Renderer, Genie.Renderer.Html form = """