Skip to content

Commit

Permalink
v1.4: Genie apps don't need Revise as a dep; AppServer cleanup; app l…
Browse files Browse the repository at this point in the history
…oader cleanup; tweaked tests.
  • Loading branch information
essenciary committed Oct 3, 2020
1 parent 3e0d8df commit 14b93a2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Genie"
uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
authors = ["Adrian Salceanu <[email protected]>"]
version = "1.3.0"
version = "1.4.0"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down
2 changes: 0 additions & 2 deletions files/new_app/genie.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Revise

haskey(ENV, "GENIE_ENV") || (ENV["GENIE_ENV"] = "dev")
if !haskey(ENV, "HOST")
ENV["HOST"] = (ENV["GENIE_ENV"] == "dev") ? "127.0.0.1" : "0.0.0.0"
Expand Down
4 changes: 0 additions & 4 deletions src/AppServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ function startup(port::Int, host::String = Genie.config.server_host;
HTTP.WebSockets.upgrade(http) do ws
setup_ws_handler(http.message, ws)
end

print_server_status("Web Sockets server running at $host:$ws_port")
else
HTTP.handle(HTTP.RequestHandlerFunction(setup_http_handler), http)
end
Expand All @@ -87,10 +85,8 @@ function startup(port::Int, host::String = Genie.config.server_host;

if async
SERVERS.webserver = @async command()
print_server_status("Web Server running at $server_url")
else
SERVERS.webserver = command()
print_server_status("Web Server stopped")
end

open_browser && openbrowser(server_url)
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Configuration
References the current Genie version number.
"""
const GENIE_VERSION = v"1.3"
const GENIE_VERSION = v"1.4"

import Logging
import Genie
Expand Down
1 change: 0 additions & 1 deletion src/Generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ function install_app_dependencies(app_path::String = "."; testmode::Bool = false
Pkg.activate(".")

testmode ? Pkg.develop("Genie") : Pkg.add("Genie")
Pkg.add("Revise")
Pkg.add("LoggingExtras")
Pkg.add("MbedTLS")

Expand Down
18 changes: 4 additions & 14 deletions src/Genie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,11 @@ julia> Genie.loadapp(".")
```
"""
function loadapp(path::String = "."; autostart::Bool = false) :: Nothing
Core.eval(Main, :(import Revise))

try
Core.eval(Main, quote
include(joinpath($path, $(Genie.BOOTSTRAP_FILE_NAME)))
end)
catch ex
rethrow(ex)
end

Core.eval(Main, :(Revise.revise()))
Core.eval(Main, :(using Genie))
Core.eval(Main, quote
include(joinpath($path, $(Genie.BOOTSTRAP_FILE_NAME)))
end)

Core.eval(Main.UserApp, :(Revise.revise()))
Core.eval(Main.UserApp, :($autostart && up()))
autostart && (Core.eval(Main.UserApp, :(up())))

nothing
end
Expand Down
6 changes: 3 additions & 3 deletions test/tests_AppServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
@test Genie.AppServer.SERVERS.webserver.state == :runnable

servers = Genie.AppServer.down()
sleep(1)
sleep(2)
@test servers.webserver.state == :done
@test Genie.AppServer.SERVERS.webserver.state == :done

servers = Genie.AppServer.startup()
Genie.AppServer.down(; webserver = false)
sleep(1)
sleep(2)
@test servers.webserver.state == :runnable
@test Genie.AppServer.SERVERS.webserver.state == :runnable

servers = Genie.AppServer.down(; webserver = true)
sleep(1)
sleep(2)
@test servers.webserver.state == :done
@test Genie.AppServer.SERVERS.webserver.state == :done
end;
Expand Down

2 comments on commit 14b93a2

@essenciary
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/22360

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.4.0 -m "<description of version>" 14b93a29e395b9fc8a4d01198eebf8873990be68
git push origin v1.4.0

Please sign in to comment.