From 36917daa89f60b43f1a6c9630320cc13ffbfee8a Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 2 Oct 2022 16:17:02 +0800 Subject: [PATCH] Update to Genie 5 --- Manifest.toml | 270 ++++++++++++--------- Project.toml | 2 - app/resources/results/Results.jl | 19 +- app/resources/results/ResultsController.jl | 6 +- app/resources/surveys/SurveysController.jl | 9 +- bin/server | 2 +- bootstrap.jl | 2 +- config/env/dev.jl | 21 +- config/env/global.jl | 3 +- config/env/prod.jl | 26 +- config/env/test.jl | 16 +- config/initializers/autoload.jl | 2 +- config/initializers/converters.jl | 0 config/initializers/inflector.jl | 0 config/initializers/logging.jl | 26 +- config/initializers/searchlight.jl | 32 +-- config/initializers/ssl.jl | 23 -- db/connection.yml | 13 +- lib/Surveys.jl | 3 + routes.jl | 13 +- src/EmacsSurvey.jl | 10 +- test/Project.toml | 5 + test/results_test.jl | 8 - test/runtests.jl | 30 ++- 24 files changed, 282 insertions(+), 259 deletions(-) mode change 100644 => 100755 config/env/dev.jl mode change 100644 => 100755 config/env/global.jl mode change 100644 => 100755 config/env/prod.jl mode change 100644 => 100755 config/env/test.jl mode change 100644 => 100755 config/initializers/autoload.jl mode change 100644 => 100755 config/initializers/converters.jl mode change 100644 => 100755 config/initializers/inflector.jl mode change 100644 => 100755 config/initializers/logging.jl mode change 100644 => 100755 config/initializers/searchlight.jl delete mode 100644 config/initializers/ssl.jl mode change 100644 => 100755 db/connection.yml delete mode 100644 test/results_test.jl diff --git a/Manifest.toml b/Manifest.toml index aaa9877..b72c87a 100755 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,7 +1,8 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.8.2" manifest_format = "2.0" +project_hash = "7fa9bc39e3ae741288470877e398ff9f29579821" [[deps.ArgParse]] deps = ["Logging", "TextWrap"] @@ -11,6 +12,7 @@ version = "1.1.4" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.1" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" @@ -18,17 +20,16 @@ uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" -[[deps.BinaryProvider]] -deps = ["Libdl", "Logging", "SHA"] -git-tree-sha1 = "ecdec412a9abc8db54c0efc5548c64dfce072058" -uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" -version = "0.5.10" +[[deps.BitFlags]] +git-tree-sha1 = "84259bb6172806304b9101094a7cc4bc6f56dbc6" +uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" +version = "0.1.5" [[deps.CSTParser]] deps = ["Tokenize"] -git-tree-sha1 = "b66abc140f8b90a1d6bc7bfad5c80070f8c1ddc6" +git-tree-sha1 = "3ddd48d200eb8ddf9cb3e0189fc059fd49b97c1f" uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f" -version = "3.3.3" +version = "3.3.6" [[deps.CSV]] deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings"] @@ -38,21 +39,21 @@ version = "0.10.4" [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "9950387274246d08af38f6eef8cb5480862a435f" +git-tree-sha1 = "e7ff6cadf743c098e08fca25c91103ee4303c9bb" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.14.0" +version = "1.15.6" [[deps.ChangesOfVariables]] deps = ["ChainRulesCore", "LinearAlgebra", "Test"] -git-tree-sha1 = "1e315e3f4b0b7ce40feded39c73049692126cf53" +git-tree-sha1 = "38f7a08f19d8810338d4f5085211c7dfa5d5bdd8" uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" -version = "0.1.3" +version = "0.1.4" [[deps.CodeTracking]] deps = ["InteractiveUtils", "UUIDs"] -git-tree-sha1 = "6d4fa04343a7fc9f9cb9cff9558929f3d2752717" +git-tree-sha1 = "1833bda4a027f4b2a1c984baddcf755d77266818" uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" -version = "1.0.9" +version = "1.1.0" [[deps.CodecZlib]] deps = ["TranscodingStreams", "Zlib_jll"] @@ -67,14 +68,15 @@ uuid = "a80b9123-70ca-4bc0-993e-6e3bcb318db6" version = "0.8.6" [[deps.Compat]] -deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] -git-tree-sha1 = "b153278a25dd42c65abbf4e62344f9d22e59191b" +deps = ["Dates", "LinearAlgebra", "UUIDs"] +git-tree-sha1 = "5856d3031cdb1f3b2b6340dfdc66b6d9a149a374" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "3.43.0" +version = "4.2.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "0.5.2+0" [[deps.Crayons]] git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" @@ -87,21 +89,21 @@ uuid = "a10d1c49-ce27-4219-8d33-6db1a4562965" version = "2.5.0" [[deps.DataAPI]] -git-tree-sha1 = "fb5f5316dd3fd4c5e7c30a24d50643b73e37cd40" +git-tree-sha1 = "1106fa7e1256b402a86a8e7b15c00c85036fef49" uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.10.0" +version = "1.11.0" [[deps.DataFrames]] deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "daa21eb85147f72e41f6352a57fccea377e310a9" +git-tree-sha1 = "db2a9cb664fcea7836da4b414c3278d71dd602d2" uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "1.3.4" +version = "1.3.6" [[deps.DataStructures]] deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "cc1a8e22627f33c789ab60b36a9132ac050bbf75" +git-tree-sha1 = "d1fff3a548102f48987a52a2e0d114fa97d730f0" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.12" +version = "0.18.13" [[deps.DataValueInterfaces]] git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" @@ -112,23 +114,25 @@ version = "1.0.0" deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" -[[deps.DelimitedFiles]] -deps = ["Mmap"] -uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" - [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[deps.DocStringExtensions]] deps = ["LibGit2"] -git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b" +git-tree-sha1 = "5158c2b41018c5f7eb1470d558127ac274eca0c9" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.8.6" +version = "0.9.1" [[deps.Downloads]] -deps = ["ArgTools", "LibCURL", "NetworkOptions"] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" + +[[deps.ExprTools]] +git-tree-sha1 = "56559bbef6ca5ea0c0818fa5c90320398a6fbf8d" +uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" +version = "0.1.8" [[deps.EzXML]] deps = ["Printf", "XML2_jll"] @@ -138,9 +142,9 @@ version = "1.1.0" [[deps.FilePathsBase]] deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"] -git-tree-sha1 = "129b104185df66e408edd6625d480b7f9e9823a0" +git-tree-sha1 = "e27c4ebe80e8699540f2d6c805cc12203b614f12" uuid = "48062228-2e41-5def-b9a4-89aafe57970f" -version = "0.9.18" +version = "0.9.20" [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" @@ -158,20 +162,19 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[deps.GMP_jll]] deps = ["Artifacts", "Libdl"] uuid = "781609d7-10c4-51f6-84f2-b8444358ff6d" +version = "6.2.1+2" [[deps.Genie]] -deps = ["ArgParse", "Dates", "Distributed", "EzXML", "FilePathsBase", "HTTP", "HttpCommon", "Inflector", "JSON3", "JuliaFormatter", "Logging", "Markdown", "MbedTLS", "Millboard", "Nettle", "OrderedCollections", "Pkg", "REPL", "Random", "Reexport", "Revise", "SHA", "Serialization", "Sockets", "UUIDs", "Unicode", "VersionCheck", "YAML"] -git-tree-sha1 = "f8d159274359ff7b3a094c9eccf5237aab5d3326" -repo-rev = "master" -repo-url = "https://github.com/GenieFramework/Genie.jl.git" +deps = ["ArgParse", "Dates", "Distributed", "EzXML", "FilePathsBase", "HTTP", "HttpCommon", "Inflector", "JSON3", "JuliaFormatter", "Logging", "LoggingExtras", "Markdown", "Millboard", "Nettle", "OrderedCollections", "Pkg", "REPL", "Random", "Reexport", "Revise", "SHA", "Serialization", "Sockets", "UUIDs", "Unicode", "YAML"] +git-tree-sha1 = "65193d5e54b8a7fd2aa0b4831bdd0a9d13a5b397" uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e" -version = "4.18.0" +version = "5.6.2" [[deps.HTTP]] -deps = ["Base64", "Dates", "IniFile", "Logging", "MbedTLS", "NetworkOptions", "Sockets", "URIs"] -git-tree-sha1 = "0fa77022fe4b511826b39c894c90daf5fce3334a" +deps = ["Base64", "CodecZlib", "Dates", "IniFile", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] +git-tree-sha1 = "4abede886fcba15cd5fd041fef776b230d004cee" uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" -version = "0.9.17" +version = "1.4.0" [[deps.HttpCommon]] deps = ["Dates", "Nullables", "Test", "URIParser"] @@ -192,19 +195,25 @@ version = "0.5.1" [[deps.InlineStrings]] deps = ["Parsers"] -git-tree-sha1 = "61feba885fac3a407465726d0c330b3055df897f" +git-tree-sha1 = "d19f9edd8c34760dca2de2b503f969d8700ed288" uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" -version = "1.1.2" +version = "1.1.4" [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +[[deps.Intervals]] +deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"] +git-tree-sha1 = "f3c7f871d642d244e7a27e3fb81e8441e13230d8" +uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5" +version = "1.8.0" + [[deps.InverseFunctions]] deps = ["Test"] -git-tree-sha1 = "336cc738f03e069ef2cac55a104eb823455dca75" +git-tree-sha1 = "49510dfcb407e572524ba94aeae2fced1f3feb0f" uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.4" +version = "0.1.8" [[deps.InvertedIndices]] git-tree-sha1 = "bee5f1ef5bf65df56bdd2e40447590b272a5471f" @@ -235,29 +244,35 @@ version = "0.21.3" [[deps.JSON3]] deps = ["Dates", "Mmap", "Parsers", "StructTypes", "UUIDs"] -git-tree-sha1 = "8c1f668b24d999fb47baf80436194fdccec65ad2" +git-tree-sha1 = "f1572de22c866dc92aea032bc89c2b137cbddd6a" uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" -version = "1.9.4" +version = "1.10.0" [[deps.JuliaFormatter]] deps = ["CSTParser", "CommonMark", "DataStructures", "Pkg", "Tokenize"] -git-tree-sha1 = "64613299ded610bc40afeea529918d4baf3cf4e5" +git-tree-sha1 = "1ec2cb3b87d0c38e3b01c76d9b11639f1eaeec96" uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899" -version = "0.22.10" +version = "1.0.10" [[deps.JuliaInterpreter]] deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] -git-tree-sha1 = "52617c41d2761cc05ed81fe779804d3b7f14fff7" +git-tree-sha1 = "0f960b1404abb0b244c1ece579a0ec78d056a5d1" uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" -version = "0.9.13" +version = "0.9.15" + +[[deps.LazyArtifacts]] +deps = ["Artifacts", "Pkg"] +uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.3" [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "7.84.0+0" [[deps.LibGit2]] deps = ["Base64", "NetworkOptions", "Printf", "SHA"] @@ -266,6 +281,7 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.10.2+0" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -282,18 +298,18 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LogExpFunctions]] deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "09e4b894ce6a976c354a69041a04748180d43637" +git-tree-sha1 = "94d9c52ca447e23eac0c0f074effbcd38830deb5" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.15" +version = "0.3.18" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" [[deps.LoggingExtras]] deps = ["Dates", "Logging"] -git-tree-sha1 = "e9437ef53c3b29a838f4635e748bb38d29d11384" +git-tree-sha1 = "5d4d2d9904227b8bd66386c1138cf4d5ffa826bf" uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" -version = "0.4.8" +version = "0.4.9" [[deps.LoweredCodeUtils]] deps = ["JuliaInterpreter"] @@ -306,14 +322,15 @@ deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[deps.MbedTLS]] -deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"] -git-tree-sha1 = "1c38e51c3d08ef2278062ebceade0e46cefc96fe" +deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "Random", "Sockets"] +git-tree-sha1 = "6872f9594ff273da6d13c7c1a1545d5a8c7d0c1c" uuid = "739be429-bea8-5141-9913-cc70e7f3736d" -version = "1.0.3" +version = "1.1.6" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.28.0+0" [[deps.Millboard]] git-tree-sha1 = "ea6a5b7e56e76d8051023faaa11d91d1d881dac3" @@ -329,14 +346,21 @@ version = "1.0.2" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" +[[deps.Mocking]] +deps = ["ExprTools"] +git-tree-sha1 = "748f6e1e4de814b101911e64cc12d83a6af66782" +uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" +version = "0.7.2" + [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2022.2.1" [[deps.Nettle]] deps = ["Libdl", "Nettle_jll"] -git-tree-sha1 = "a68340b9edfd98d0ed96aee8137cb716ea3b6dea" +git-tree-sha1 = "6fa48cbae828267848ee32c1bb31d1652e210d7d" uuid = "49dea1ee-f6fa-5aa6-9a11-8816cee7d4b9" -version = "0.5.1" +version = "1.0.0" [[deps.Nettle_jll]] deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "Pkg"] @@ -346,6 +370,7 @@ version = "3.7.2+0" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" [[deps.Nullables]] git-tree-sha1 = "8f87854cc8f3685a60689d8edecaa29d2251979b" @@ -355,6 +380,19 @@ version = "1.0.0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" +version = "0.3.20+0" + +[[deps.OpenSSL]] +deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] +git-tree-sha1 = "02be9f845cb58c2d6029a6d5f67f4e0af3237814" +uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c" +version = "1.1.3" + +[[deps.OpenSSL_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "e60321e3f2616584ff98f0a4f18d98ae6f89bbb3" +uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" +version = "1.1.17+0" [[deps.OrderedCollections]] git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c" @@ -363,13 +401,14 @@ version = "1.4.1" [[deps.Parsers]] deps = ["Dates"] -git-tree-sha1 = "1285416549ccfcdf0c50d4997a94331e88d68413" +git-tree-sha1 = "3d5bf43e3e8b412656404ed9466f1dcbf7c50269" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.3.1" +version = "2.4.0" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.8.0" [[deps.PooledArrays]] deps = ["DataAPI", "Future"] @@ -393,12 +432,6 @@ version = "1.3.1" deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" -[[deps.ProgressMeter]] -deps = ["Distributed", "Printf"] -git-tree-sha1 = "d7a7aef8f8f2d537104f170139553b14dfe39fe9" -uuid = "92933f4c-e287-5a05-a399-4b506db050ca" -version = "1.7.2" - [[deps.REPL]] deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" @@ -407,6 +440,12 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +[[deps.RecipesBase]] +deps = ["SnoopPrecompile"] +git-tree-sha1 = "612a4d76ad98e9722c8ba387614539155a59e30c" +uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" +version = "1.3.0" + [[deps.Reexport]] git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" uuid = "189a3867-3050-52da-a836-e630ba90ab69" @@ -420,55 +459,62 @@ version = "1.3.0" [[deps.Revise]] deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "Requires", "UUIDs", "Unicode"] -git-tree-sha1 = "4d4239e93531ac3e7ca7e339f15978d0b5149d03" +git-tree-sha1 = "dad726963ecea2d8a81e26286f625aee09a91b7c" uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" -version = "3.3.3" +version = "3.4.0" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" [[deps.SQLite]] -deps = ["BinaryProvider", "DBInterface", "Dates", "Libdl", "Random", "SQLite_jll", "Serialization", "Tables", "Test", "WeakRefStrings"] -git-tree-sha1 = "c19088908cde014f8807e6dc57b90cb5b5c90565" +deps = ["DBInterface", "Dates", "Libdl", "Random", "SQLite_jll", "Serialization", "Tables", "Test", "WeakRefStrings"] +git-tree-sha1 = "93863dea19851aa45d67d70e638e16666f33731e" uuid = "0aa819cd-b072-5ff4-a722-6bc24af294d9" -version = "1.4.1" +version = "1.4.2" [[deps.SQLite_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] -git-tree-sha1 = "b6d006c4c57278d532de38912e16adf626c949c7" +git-tree-sha1 = "e7c1d14d4c93e2d0f85970f818052de200eba5d2" uuid = "76ed43ae-9a5d-5a62-8c75-30186b810ce8" -version = "3.38.4+0" +version = "3.39.2+0" [[deps.Scratch]] deps = ["Dates"] -git-tree-sha1 = "0b4b7f1393cff97c33891da2a0bf69c6ed241fda" +git-tree-sha1 = "f94f779c94e58bf9ea243e77a37e16d9de9126bd" uuid = "6c6a2e73-6563-6170-7368-637461726353" -version = "1.1.0" +version = "1.1.1" [[deps.SearchLight]] -deps = ["DataFrames", "Dates", "Distributed", "Inflector", "JSON3", "Logging", "Millboard", "OrderedCollections", "Reexport", "SHA", "Unicode", "YAML"] -git-tree-sha1 = "232478f3c672441fe88b23a8a75a74845c3b4d49" +deps = ["DataFrames", "Dates", "Distributed", "Inflector", "Intervals", "JSON3", "Logging", "Millboard", "OrderedCollections", "Reexport", "SHA", "Unicode", "YAML"] +git-tree-sha1 = "86ed053297e072920e853e1569121458badc0e65" uuid = "340e8cb6-72eb-11e8-37ce-c97ebeb32050" -version = "2.2.0" +version = "2.7.1" [[deps.SearchLightSQLite]] deps = ["DBInterface", "DataFrames", "Logging", "SQLite", "SearchLight"] -git-tree-sha1 = "2cf3ef86c54855fc9bbb4a5bedc8f121a75bc88e" +git-tree-sha1 = "44a6505ff99e16316d6af7a42247917de57862c7" uuid = "21a827c4-482a-11ea-3a19-4d2243a4a2c5" -version = "2.1.0" +version = "2.2.0" [[deps.SentinelArrays]] deps = ["Dates", "Random"] -git-tree-sha1 = "6a2f7d70512d205ca8c7ee31bfa9f142fe74310c" +git-tree-sha1 = "c0f56940fc967f3d5efed58ba829747af5f8b586" uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" -version = "1.3.12" +version = "1.3.15" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" -[[deps.SharedArrays]] -deps = ["Distributed", "Mmap", "Random", "Serialization"] -uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" +[[deps.SimpleBufferStream]] +git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1" +uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" +version = "1.1.0" + +[[deps.SnoopPrecompile]] +git-tree-sha1 = "f604441450a3c0569830946e5b33b78c928e1a85" +uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c" +version = "1.0.1" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" @@ -489,15 +535,15 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StatsAPI]] deps = ["LinearAlgebra"] -git-tree-sha1 = "c82aaa13b44ea00134f8c9c89819477bd3986ecd" +git-tree-sha1 = "f9af7f195fb13589dd2e2d57fdb401717d2eb1f6" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" -version = "1.3.0" +version = "1.5.0" [[deps.StatsBase]] deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] -git-tree-sha1 = "8977b17906b0a1cc74ab2e3a05faa16cf08a8291" +git-tree-sha1 = "d1bf48bfcc554a3761a133fe3a9bb01488e06916" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -version = "0.33.16" +version = "0.33.21" [[deps.StringEncodings]] deps = ["Libiconv_jll"] @@ -507,13 +553,14 @@ version = "0.3.5" [[deps.StructTypes]] deps = ["Dates", "UUIDs"] -git-tree-sha1 = "d24a825a95a6d98c385001212dc9020d609f2d4f" +git-tree-sha1 = "ca4bccb03acf9faaf4137a9abc1881ed1841aa70" uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" -version = "1.8.1" +version = "1.10.0" [[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.0" [[deps.TableTraits]] deps = ["IteratorInterfaceExtensions"] @@ -523,13 +570,14 @@ version = "1.0.1" [[deps.Tables]] deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] -git-tree-sha1 = "5ce79ce186cc678bbb5c5681ca3379d1ddae11a1" +git-tree-sha1 = "2d7164f7b8a066bcfa6224e67736ce0eb54aef5b" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.7.0" +version = "1.9.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.1" [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] @@ -540,6 +588,12 @@ git-tree-sha1 = "9250ef9b01b66667380cf3275b3f7488d0e25faf" uuid = "b718987f-49a8-5099-9789-dcd902bef87d" version = "1.0.1" +[[deps.TimeZones]] +deps = ["Dates", "Downloads", "InlineStrings", "LazyArtifacts", "Mocking", "Printf", "RecipesBase", "Scratch", "Unicode"] +git-tree-sha1 = "d634a3641062c040fc8a7e2a3ea17661cc159688" +uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" +version = "1.9.0" + [[deps.Tokenize]] git-tree-sha1 = "2b3af135d85d7e70b863540160208fa612e736b9" uuid = "0796e94c-ce3b-5d07-9a54-7f471281c624" @@ -547,9 +601,9 @@ version = "0.5.24" [[deps.TranscodingStreams]] deps = ["Random", "Test"] -git-tree-sha1 = "216b95ea110b5972db65aa90f88d8d89dcb8851c" +git-tree-sha1 = "8a75929dcd3c38611db2f8d08546decb514fcadf" uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" -version = "0.9.6" +version = "0.9.9" [[deps.URIParser]] deps = ["Unicode"] @@ -558,9 +612,9 @@ uuid = "30578b45-9adc-5946-b283-645ec420af67" version = "0.4.1" [[deps.URIs]] -git-tree-sha1 = "97bbe755a53fe859669cd907f2d96aee8d2c1355" +git-tree-sha1 = "e59ecc5a41b000fa94423a578d29290c7266fc10" uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" -version = "1.3.0" +version = "1.4.0" [[deps.UUIDs]] deps = ["Random", "SHA"] @@ -569,18 +623,6 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" -[[deps.UrlDownload]] -deps = ["HTTP", "ProgressMeter"] -git-tree-sha1 = "05f86730c7a53c9da603bd506a4fc9ad0851171c" -uuid = "856ac37a-3032-4c1c-9122-f86d88358c8b" -version = "1.0.0" - -[[deps.VersionCheck]] -deps = ["Dates", "JSON3", "Logging", "Pkg", "Random", "Scratch", "UrlDownload"] -git-tree-sha1 = "89ef2431dd59344ebaf052d0737205854ded0c62" -uuid = "a637dc6b-bca1-447e-a4fa-35264c9d0580" -version = "0.2.0" - [[deps.WeakRefStrings]] deps = ["DataAPI", "InlineStrings", "Parsers"] git-tree-sha1 = "b1be2855ed9ed8eac54e5caff2afcdb442d52c23" @@ -589,9 +631,9 @@ version = "1.4.2" [[deps.XML2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"] -git-tree-sha1 = "1acf5bdf07aa0907e0a37d3718bb88d4b687b74a" +git-tree-sha1 = "58443b63fb7e465a8a7210828c91c08b92132dff" uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" -version = "2.9.12+0" +version = "2.9.14+0" [[deps.YAML]] deps = ["Base64", "Dates", "Printf", "StringEncodings"] @@ -602,15 +644,19 @@ version = "0.4.7" [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.12+3" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" +version = "5.1.1+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.48.0+0" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+0" diff --git a/Project.toml b/Project.toml index 8e525dd..9d7e263 100755 --- a/Project.toml +++ b/Project.toml @@ -12,8 +12,6 @@ HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" Inflector = "6d011eab-0732-4556-8808-e463c76bf3b6" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" -LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" -MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d" SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" SearchLight = "340e8cb6-72eb-11e8-37ce-c97ebeb32050" SearchLightSQLite = "21a827c4-482a-11ea-3a19-4d2243a4a2c5" diff --git a/app/resources/results/Results.jl b/app/resources/results/Results.jl index dc38209..f2f1f35 100644 --- a/app/resources/results/Results.jl +++ b/app/resources/results/Results.jl @@ -1,7 +1,7 @@ module Results using SearchLight -using Surveys, Dates +using ..Main.UserApp.Surveys, Dates using DataFrames, CSV, JSON3, SQLite export surveys, questions, responseids, results, @@ -29,8 +29,8 @@ function questions(survey::SurveyID; cache::Bool=true) if !haskey(QUESTIONS, survey) || !cache qns = SearchLight.query("SELECT id, type, prompt, input FROM questions WHERE survey=$survey") qns.id = Symbol.(qns.id) - qns.type = Vector{Type}(@. eval(Meta.parse(qns.type))) - qns.input = Vector{Type}(@. eval(Meta.parse(qns.input))) + qns.type = Vector{Type}(@. Surveys.eval(Meta.parse(qns.type))) + qns.input = Vector{Type}(@. Surveys.eval(Meta.parse.(qns.input))) QUESTIONS[survey] = Dict(q.id => Dict(:type => q.type, :prompt => q.prompt, :input => q.input) for q in eachrow(qns)) end QUESTIONS[survey] @@ -100,6 +100,7 @@ function results(survey::SurveyID, resids::Vector{ResponseID}; res = response.(survey, resids; cache) qids = keys(questions(survey; cache)) data = Dict(q => map(r -> r[q].value, res) for q in qids) + @info "" DataFrame(data) DataFrame(data) |> if format == :DataFrame identity elseif format == :csv @@ -113,7 +114,12 @@ function results(survey::SurveyID, resids::Vector{ResponseID}; for i in 1:size(df, 1)]) elseif format == :sqlite df -> (mktemp() do path, io - SQLite.load!(df, SQLite.DB(path), "results") + df_plain = DataFrame() + for (name, col) in zip(names(df), eachcol(df)) + df_plain[!, name] = if eltype(col) <: Union{Int, String} + col else sprint.(print, col) end + end + SQLite.load!(df_plain, SQLite.DB(path), "results") read(path) end) end @@ -133,13 +139,14 @@ function register!(survey::Survey) if survey.id ∉ keys(surveys()) name = if isnothing(survey.name) "NULL" else SearchLight.escape_value(survey.name) end - srepr = repr(survey) |> SearchLight.escape_value + srepr = repr(survey, context = :module => Surveys) |> SearchLight.escape_value SearchLight.query("INSERT INTO surveys (id, name, repr) VALUES ($(survey.id), $name, $srepr)") for (qid, q) in survey.questions qid_s = string(qid) |> SearchLight.escape_value prompt = q.prompt |> SearchLight.escape_value type = string(qvaltype(q)) |> SearchLight.escape_value - field = string(typeof(q.field)) |> SearchLight.escape_value + field = sprint(print, typeof(q.field), context = :module => Surveys) |> SearchLight.escape_value + field = sprint(print, typeof(q.field), context = :module => Surveys) |> SearchLight.escape_value SearchLight.query("INSERT INTO questions (survey, id, type, prompt, input) VALUES ($(survey.id), $qid_s, $type, $prompt, $field)") end SURVEYS[survey.id] = survey.name diff --git a/app/resources/results/ResultsController.jl b/app/resources/results/ResultsController.jl index 3584d0d..a862560 100644 --- a/app/resources/results/ResultsController.jl +++ b/app/resources/results/ResultsController.jl @@ -2,7 +2,7 @@ module ResultsController using Genie, Genie.Renderer, Genie.Renderers.Html, HTTP, JSON3, StatsBase -using Results, Surveys +using ..Main.UserApp.Results, ..Main.UserApp.Surveys function resultsindex(survey::Union{SurveyID, Nothing}=nothing) if isnothing(survey) @@ -34,8 +34,8 @@ function resultsfile(survey::SurveyID, format::AbstractString) end function resultsfile(survey::SurveyID, responseid::ResponseID, format::AbstractString) - @assert survey == Main.SurveysController.SURVEY.id - thesurvey = Main.SurveysController.SURVEY + thesurvey = Surveys.current_survey + @assert survey == thesurvey.id response = Results.response(survey, responseid) if format == "txt" WebRenderable(sprint(show, thesurvey => response), :text) |> diff --git a/app/resources/surveys/SurveysController.jl b/app/resources/surveys/SurveysController.jl index dd73478..7efe11a 100644 --- a/app/resources/surveys/SurveysController.jl +++ b/app/resources/surveys/SurveysController.jl @@ -2,7 +2,7 @@ module SurveysController using Genie.Router, Genie.Requests, Genie.Renderers.Html, HTTP -using Results, Surveys, Dates +using ..Main.UserApp.Results, ..Main.UserApp.Surveys, Dates const SURVEY = include("../../../config/survey.jl") const INPROGRESS = Dict{Surveys.ResponseID, Surveys.Response}() @@ -15,6 +15,7 @@ donesetup = false function setup() global donesetup if !donesetup + Surveys.set_current_survey!(SURVEY) register!(SURVEY) for rid in responseids(SURVEY.id, :incomplete) INPROGRESS[rid] = Results.response(SURVEY.id, rid) @@ -50,8 +51,8 @@ function completed(uid) end res = html(:surveys, :thanks, layout=:base; uid=uidstr, survey=SURVEY, resultlinks=links) - Genie.Cookies.set!(res, "response-id", "", Dict{String, Any}("maxage" => -1)) Genie.Cookies.set!(res, "response-page", 0, Dict{String, Any}("maxage" => -1)) + Genie.Cookies.set!(res, "response-id", "", Dict{String, Any}("maxage" => -1)) end function serve(forminfo::Dict) @@ -88,10 +89,10 @@ function serve(forminfo::Dict) res = html(:surveys, :survey, layout=:base, uid=uid_str, survey=SURVEY, response=INPROGRESS[uid], page=page) - Genie.Cookies.set!(res, "response-id", uid_str, + Genie.Cookies.set!(res, "response-page", INPROGRESS[uid].page, Dict{String, Any}("maxage" => RESUME_COOKIE_MAX_AGE, "httponly" => true)) - Genie.Cookies.set!(res, "response-page", INPROGRESS[uid].page, + Genie.Cookies.set!(res, "response-id", uid_str, Dict{String, Any}("maxage" => RESUME_COOKIE_MAX_AGE, "httponly" => true)) end diff --git a/bin/server b/bin/server index 8e7ef9f..4dfd7c8 100755 --- a/bin/server +++ b/bin/server @@ -1,2 +1,2 @@ #!/bin/sh -julia --color=yes --depwarn=no --project=@. -q -i -- $(dirname $0)/../bootstrap.jl s "$@" \ No newline at end of file +julia --color=yes --depwarn=no --project=@. -q -i -- $(dirname $0)/../bootstrap.jl -s=true "$@" \ No newline at end of file diff --git a/bootstrap.jl b/bootstrap.jl index 769fb7a..764572a 100644 --- a/bootstrap.jl +++ b/bootstrap.jl @@ -1,5 +1,5 @@ (pwd() != @__DIR__) && cd(@__DIR__) # allow starting app from bin/ dir using EmacsSurvey -push!(Base.modules_warned_for, Base.PkgId(EmacsSurvey)) +const UserApp = EmacsSurvey EmacsSurvey.main() diff --git a/config/env/dev.jl b/config/env/dev.jl old mode 100644 new mode 100755 index 1147ddc..a0fcae1 --- a/config/env/dev.jl +++ b/config/env/dev.jl @@ -1,14 +1,15 @@ -using Genie.Configuration, Logging +using Genie, Logging -const config = Settings( - server_port = 8088, - server_host = "0.0.0.0", - log_level = Logging.Info, - log_to_file = false, - server_handle_static_files = true, - path_build = "build", - format_julia_builds = true, - format_html_output = true, +Genie.Configuration.config!( + server_port = 8000, + server_host = "0.0.0.0", + log_level = Logging.Info, + log_to_file = false, + server_handle_static_files = true, + path_build = "build", + format_julia_builds = true, + format_html_output = true, + watch = true ) ENV["JULIA_REVISE"] = "auto" diff --git a/config/env/global.jl b/config/env/global.jl old mode 100644 new mode 100755 index 028ee97..8ed43e0 --- a/config/env/global.jl +++ b/config/env/global.jl @@ -1,3 +1,2 @@ # Place here configuration options that will be set for all environments - -ENV["HOST"] = "" +# ENV["GENIE_ENV"] = "prod" diff --git a/config/env/prod.jl b/config/env/prod.jl old mode 100644 new mode 100755 index bda168a..23ee1bf --- a/config/env/prod.jl +++ b/config/env/prod.jl @@ -1,19 +1,19 @@ -using Genie.Configuration, Logging +using Genie, Logging -const config = Settings( - server_port = 8000, - server_host = "0.0.0.0", - log_level = Logging.Error, - log_to_file = false, - server_handle_static_files = true, # for best performance set up Nginx or Apache web proxies and set this to false - path_build = "build", - format_julia_builds = false, - format_html_output = false +Genie.Configuration.config!( + server_port = 8000, + server_host = "0.0.0.0", + log_level = Logging.Error, + log_to_file = false, + server_handle_static_files = true, # for best performance set up Nginx or Apache web proxies and set this to false + path_build = "build", + format_julia_builds = false, + format_html_output = false ) -if config.server_handle_static_files - @warn("For performance reasons Genie should not serve static files (.css, .js, .jpg, .png, etc) in production. +if Genie.config.server_handle_static_files + @warn("For performance reasons Genie should not serve static files (.css, .js, .jpg, .png, etc) in production. It is recommended to set up Apache or Nginx as a reverse proxy and cache to serve static assets.") end -ENV["JULIA_REVISE"] = "off" +ENV["JULIA_REVISE"] = "off" \ No newline at end of file diff --git a/config/env/test.jl b/config/env/test.jl old mode 100644 new mode 100755 index fa7e578..218829f --- a/config/env/test.jl +++ b/config/env/test.jl @@ -1,11 +1,11 @@ -using Genie.Configuration, Logging +using Genie, Logging -const config = Settings( - server_port = 8000, - server_host = "127.0.0.1", - log_level = Logging.Debug, - log_to_file = true, - server_handle_static_files = true +Genie.Configuration.config!( + server_port = 8000, + server_host = "127.0.0.1", + log_level = Logging.Debug, + log_to_file = true, + server_handle_static_files = true ) -ENV["JULIA_REVISE"] = "off" +ENV["JULIA_REVISE"] = "off" \ No newline at end of file diff --git a/config/initializers/autoload.jl b/config/initializers/autoload.jl old mode 100644 new mode 100755 index 248d744..59f9db6 --- a/config/initializers/autoload.jl +++ b/config/initializers/autoload.jl @@ -1,2 +1,2 @@ # Optional flat/non-resource MVC folder structure -# push!(LOAD_PATH, "controllers", "views", "views/layouts", "models") \ No newline at end of file +# Genie.Loader.autoload(abspath("models"), abspath("controllers")) \ No newline at end of file diff --git a/config/initializers/converters.jl b/config/initializers/converters.jl old mode 100644 new mode 100755 diff --git a/config/initializers/inflector.jl b/config/initializers/inflector.jl old mode 100644 new mode 100755 diff --git a/config/initializers/logging.jl b/config/initializers/logging.jl old mode 100644 new mode 100755 index bad26fe..575879e --- a/config/initializers/logging.jl +++ b/config/initializers/logging.jl @@ -1,27 +1,3 @@ import Genie -import Logging, LoggingExtras -import Dates -function initialize_logging() - date_format = "yyyy-mm-dd HH:MM:SS" - - logger = if Genie.config.log_to_file - isdir(Genie.config.path_log) || mkpath(Genie.config.path_log) - LoggingExtras.TeeLogger( - LoggingExtras.FileLogger(joinpath(Genie.config.path_log, "$(Genie.config.app_env)-$(Dates.today()).log"), always_flush = true, append = true), - Logging.ConsoleLogger(stdout, Genie.config.log_level) - ) - else - Logging.ConsoleLogger(stdout, Genie.config.log_level) - end - - timestamp_logger(logger) = LoggingExtras.TransformerLogger(logger) do log - merge(log, (; message = "$(Dates.format(Dates.now(), date_format)) $(log.message)")) - end - - LoggingExtras.TeeLogger(LoggingExtras.MinLevelLogger(logger, Genie.config.log_level)) |> timestamp_logger |> global_logger - - nothing -end - -initialize_logging() \ No newline at end of file +Genie.Logger.initialize_logging() \ No newline at end of file diff --git a/config/initializers/searchlight.jl b/config/initializers/searchlight.jl old mode 100644 new mode 100755 index 0cc5b75..ec695f0 --- a/config/initializers/searchlight.jl +++ b/config/initializers/searchlight.jl @@ -1,19 +1,19 @@ using SearchLight +using Genie -try - SearchLight.Configuration.load() - - if SearchLight.config.db_config_settings["adapter"] !== nothing - eval(Meta.parse("using SearchLight$(SearchLight.config.db_config_settings["adapter"])")) - SearchLight.connect() - - if !(SearchLight.config.db_migrations_table_name in - SearchLight.query("SELECT name FROM sqlite_master WHERE type='table'").name) - SearchLight.Migration.create_migrations_table() - SearchLight.Migrations.last_up() # probably a good idea - end - - end -catch ex - @error ex +function Genie.Renderer.Json.JSON3.StructTypes.StructType(::Type{T}) where {T<:SearchLight.AbstractModel} + Genie.Renderer.Json.JSON3.StructTypes.Struct() +end + +function Genie.Renderer.Json.JSON3.StructTypes.StructType(::Type{SearchLight.DbId}) + Genie.Renderer.Json.JSON3.StructTypes.Struct() +end + +SearchLight.Configuration.load(context = @__MODULE__) +SearchLight.connect() + +if !(SearchLight.config.db_migrations_table_name in + SearchLight.query("SELECT name FROM sqlite_master WHERE type='table'").name) + SearchLight.Migration.create_migrations_table() + SearchLight.Migrations.last_up() # probably a good idea end diff --git a/config/initializers/ssl.jl b/config/initializers/ssl.jl deleted file mode 100644 index f99636e..0000000 --- a/config/initializers/ssl.jl +++ /dev/null @@ -1,23 +0,0 @@ -using Genie, MbedTLS - -function configure_dev_ssl() - cert = Genie.Assets.embedded_path(joinpath("files", "ssl", "localhost.crt")) |> MbedTLS.crt_parse_file - key = Genie.Assets.embedded_path(joinpath("files", "ssl", "localhost.key")) |> MbedTLS.parse_keyfile - - ssl_config = MbedTLS.SSLConfig(true) - entropy = MbedTLS.Entropy() - rng = MbedTLS.CtrDrbg() - MbedTLS.config_defaults!(ssl_config, endpoint=MbedTLS.MBEDTLS_SSL_IS_SERVER) - - MbedTLS.authmode!(ssl_config, MbedTLS.MBEDTLS_SSL_VERIFY_NONE) - MbedTLS.seed!(rng, entropy) - MbedTLS.rng!(ssl_config, rng) - MbedTLS.own_cert!(ssl_config, cert, key) - MbedTLS.ca_chain!(ssl_config) - - Genie.config.ssl_config = ssl_config - - nothing -end - -Genie.Configuration.isdev() && Genie.config.ssl_enabled && configure_dev_ssl() \ No newline at end of file diff --git a/db/connection.yml b/db/connection.yml old mode 100644 new mode 100755 index 32d8776..e52c397 --- a/db/connection.yml +++ b/db/connection.yml @@ -1,16 +1,5 @@ env: ENV["GENIE_ENV"] dev: - adapter: SQLite + adapter: SQLite database: db/results.sqlite - config: - -prod: - adapter: - database: - config: - -test: - adapter: - database: - config: diff --git a/lib/Surveys.jl b/lib/Surveys.jl index 5bc3287..16f477e 100644 --- a/lib/Surveys.jl +++ b/lib/Surveys.jl @@ -820,4 +820,7 @@ function show(io::IO, m::MIME"text/org", (s, response)::Pair{Survey, Response}) end end +current_survey::Union{Survey, Nothing} = nothing +set_current_survey!(s::Survey) = global current_survey = s + end diff --git a/routes.jl b/routes.jl index 44a4cc8..0c048cc 100755 --- a/routes.jl +++ b/routes.jl @@ -1,7 +1,7 @@ using Genie.Router, Genie.Requests, Genie.Renderers.Html -using SurveysController -using ResultsController +using ..Main.UserApp.SurveysController +using ..Main.UserApp.ResultsController route("/") do SurveysController.index() @@ -27,7 +27,14 @@ route("/results/:survey#([A-Za-z0-9]+)", ResultsController.resultsindex(surveyid) end -route("/results/:survey#([A-Za-z0-9]+)\\.:format#([a-z]+)", +route("/results/:surveyandformat#([A-Za-z0-9]+\\.[a-z]+)") do + @info "" payload(:surveyandformat) + survey, format = match(r"([A-Za-z0-9]+)\.([a-z]+)", payload(:surveyandformat)).captures + surveyid = tryparse(SurveysController.SurveyID, survey, base=10) + ResultsController.resultsfile(surveyid, format) +end + +route("/results/:survey#([A-Za-z0-9]+)/:format#([a-z]+)", named = :surveyresult) do surveyid = tryparse(SurveysController.SurveyID, payload(:survey), base=10) ResultsController.resultsfile(surveyid, payload(:format)) diff --git a/src/EmacsSurvey.jl b/src/EmacsSurvey.jl index 10b5c83..dbcb079 100644 --- a/src/EmacsSurvey.jl +++ b/src/EmacsSurvey.jl @@ -1,14 +1,12 @@ module EmacsSurvey -using Genie, Logging, LoggingExtras +using Genie + +const up = Genie.up +export up function main() - Core.eval(Main, :(const UserApp = $(@__MODULE__))) - Genie.genie(; context = @__MODULE__) - - Core.eval(Main, :(const Genie = UserApp.Genie)) - Core.eval(Main, :(using Genie)) end end diff --git a/test/Project.toml b/test/Project.toml index 0c36332..88ae101 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,2 +1,7 @@ [deps] +Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +SearchLight = "340e8cb6-72eb-11e8-37ce-c97ebeb32050" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" diff --git a/test/results_test.jl b/test/results_test.jl deleted file mode 100644 index 7caf01e..0000000 --- a/test/results_test.jl +++ /dev/null @@ -1,8 +0,0 @@ -using Test, SearchLight, Results - -@testset "Result unit tests" begin - - ### Your tests here - @test 1 == 1 - -end; diff --git a/test/runtests.jl b/test/runtests.jl index 344715f..3c8bc9b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,3 +1,27 @@ -using EmacsSurvey, Test -# implement your tests here -@test 1 == 1 +# This file is autogenerated to run all tests in the context of your Genie app. +# It is not necessary to edit this file. +# To create tests, simply add `.jl` test files in the `test/` folder. +# All `.jl` files in the `test/` folder will be automaticlaly executed by running `$ julia --project runtests.jl` +# If you want to selectively run tests, use `$ julia --project runtests.jl test_file_1 test_file_2` + +ENV["GENIE_ENV"] = "test" +push!(LOAD_PATH, abspath(normpath(joinpath("..", "src")))) + +cd("..") +using Pkg +Pkg.activate(".") + +using Genie +Genie.loadapp("..") + +cd(@__DIR__) +Pkg.activate(".") + +# !!! Main.UserApp is configured as an alias for Main.EmacsSurvey and you might encounter it in some tests +using Main.EmacsSurvey, Test, TestSetExtensions, Logging + +Logging.global_logger(NullLogger()) + +@testset ExtendedTestSet "EmacsSurvey tests" begin + @includetests ARGS +end