Skip to content

Commit

Permalink
renamed asset folder, converted views to slang, added redirect, creat…
Browse files Browse the repository at this point in the history
…ed build tasks for sublime text
  • Loading branch information
gabriel-aires committed Nov 22, 2021
1 parent a891cde commit e63b0ba
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
lib
app
bin
*.sublime-workspace

File renamed without changes.
File renamed without changes.
File renamed without changes
60 changes: 60 additions & 0 deletions os-probe.sublime-project
Original file line number Diff line number Diff line change
@@ -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
}
]
}
4 changes: 4 additions & 0 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/constants.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 3 additions & 4 deletions src/controllers/dashboard.cr
Original file line number Diff line number Diff line change
@@ -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" }
Expand All @@ -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
7 changes: 7 additions & 0 deletions src/controllers/index.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Index < Application
base "/"

def index
redirect_to Dashboard.index
end
end
12 changes: 0 additions & 12 deletions src/views/welcome.ecr

This file was deleted.

11 changes: 11 additions & 0 deletions src/views/welcome.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
doctype html
html lang="en"
head
title Welcome
link rel="shortcut icon" href="/favicon.ico"
body style="text-align: center"
img src="/sg.png" alt="OS-Probe"
br
h1 style="color: red"
= welcome_text

0 comments on commit e63b0ba

Please sign in to comment.