diff --git a/.gitignore b/.gitignore index 5e043fb..cb77d57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ lib app bin +*.sublime-workspace + diff --git a/www/.keep b/assets/.keep similarity index 100% rename from www/.keep rename to assets/.keep diff --git a/www/favicon.ico b/assets/favicon.ico similarity index 100% rename from www/favicon.ico rename to assets/favicon.ico diff --git a/www/sg.png b/assets/sg.png similarity index 100% rename from www/sg.png rename to assets/sg.png diff --git a/os-probe.sublime-project b/os-probe.sublime-project new file mode 100644 index 0000000..d93edd2 --- /dev/null +++ b/os-probe.sublime-project @@ -0,0 +1,60 @@ +{ + "folders": + [ + { + "path": "spec", + "name": "Tests" + }, + { + "path": "src", + "name": "Source Code" + }, + { + "path": "assets", + "name": "Static Files" + } + ], + "settings": + { + "tab_size": 2 + }, + "build_systems": + [ + { + "name": "Spider-Gazelle (dev)", + "shell_cmd": "crystal build --error-trace ./src/app.cr", + "working_dir": "$project_path", + "quiet": false + }, + { + "name": "Spider-Gazelle (release)", + "shell_cmd": "crystal build --release ./src/app.cr", + "working_dir": "$project_path", + "quiet": false + }, + { + "name": "Spider-Gazelle (static)", + "shell_cmd": "crystal build --release --static ./src/app.cr", + "working_dir": "$project_path", + "quiet": false + }, + { + "name": "Spider-Gazelle (start)", + "shell_cmd": "nohup ./app &", + "working_dir": "$project_path", + "quiet": false + }, + { + "name": "Spider-Gazelle (stop)", + "shell_cmd": "pkill -f app", + "working_dir": "$project_path", + "quiet": false + }, + { + "name": "Spider-Gazelle (test)", + "shell_cmd": "curl 127.0.0.1:3000", + "working_dir": "$project_path", + "quiet": false + } + ] +} \ No newline at end of file diff --git a/shard.lock b/shard.lock index adc7a32..5e27088 100644 --- a/shard.lock +++ b/shard.lock @@ -48,6 +48,10 @@ shards: git: https://github.com/icyleaf/popcorn.git version: 0.3.0 + slang: + git: https://github.com/jeromegn/slang.git + version: 1.7.3 + tasker: git: https://github.com/spider-gazelle/tasker.git version: 2.0.5 diff --git a/shard.yml b/shard.yml index 8c980ed..1d7326b 100644 --- a/shard.yml +++ b/shard.yml @@ -20,15 +20,18 @@ dependencies: future: github: crystal-community/future.cr version: ~> 1.0 + hardware: + github: crystal-community/hardware + version: ~> 0.5 kilt: github: jeromegn/kilt version: ~> 0.6 + slang: + github: jeromegn/slang + version: ~> 1.7 totem: github: icyleaf/totem version: ~> 0.7 - hardware: - github: crystal-community/hardware - version: ~> 0.5 development_dependencies: ameba: diff --git a/src/constants.cr b/src/constants.cr index d581289..23507c2 100644 --- a/src/constants.cr +++ b/src/constants.cr @@ -13,7 +13,7 @@ module App DEFAULT_HOST = ENV["SG_SERVER_HOST"]? || "127.0.0.1" DEFAULT_PROCESS_COUNT = (ENV["SG_PROCESS_COUNT"]? || 1).to_i - STATIC_FILE_PATH = ENV["PUBLIC_WWW_PATH"]? || "./www" + STATIC_FILE_PATH = ENV["PUBLIC_WWW_PATH"]? || "./assets" COOKIE_SESSION_KEY = ENV["COOKIE_SESSION_KEY"]? || "_os_probe_" COOKIE_SESSION_SECRET = ENV["COOKIE_SESSION_SECRET"]? || "4f74c0b358d5bab4000dd3c75465dc2c" diff --git a/src/controllers/dashboard.cr b/src/controllers/dashboard.cr index bf23207..0fae97f 100644 --- a/src/controllers/dashboard.cr +++ b/src/controllers/dashboard.cr @@ -1,5 +1,6 @@ -class Dashboard < Application +require "kilt/slang" +class Dashboard < Application def index welcome_text = "You're being trampled by Spider-Gazelle!" Log.warn { "logs can be collated using the request ID" } @@ -10,11 +11,9 @@ class Dashboard < Application Log.debug { "use signals to change log levels at runtime" } respond_with do - html template("welcome.ecr") + html template("welcome.slang") text "Welcome, #{welcome_text}" json({welcome: welcome_text}) end - end - end diff --git a/src/controllers/index.cr b/src/controllers/index.cr new file mode 100644 index 0000000..4f43343 --- /dev/null +++ b/src/controllers/index.cr @@ -0,0 +1,7 @@ +class Index < Application + base "/" + + def index + redirect_to Dashboard.index + end +end diff --git a/src/views/welcome.ecr b/src/views/welcome.ecr deleted file mode 100644 index 440e601..0000000 --- a/src/views/welcome.ecr +++ /dev/null @@ -1,12 +0,0 @@ - - -
-