all repos — nimhttpd @ d3faad88718122ee7ce93b524f5ef0e3a0515e87

A useful static file web server.

Fixed project structure.
h3rald h3rald@h3rald.com
Sun, 06 May 2018 13:23:59 +0200
commit

d3faad88718122ee7ce93b524f5ef0e3a0515e87

parent

159f166858849633718ee6d0ec2ac953f88251dd

5 files changed, 37 insertions(+), 16 deletions(-)

jump to
M nimhttpd.nimsrc/nimhttpd.nim

@@ -12,16 +12,19 @@ strutils

from httpcore import HttpMethod, HttpHeaders +import + nimhttpdpkg/config + const - name = "NimHTTPd" - version = "1.0.5" + name = pkgTitle + version = pkgVersion style = "style.css".slurp - description = "A tiny static file web server" - -let usage = name & " v" & version & " - " & description & """ + description = pkgDescription + author = pkgAuthor - (c) 2014-2018 Fabio Cevasco +let usage = """ $1 v$2 - $3 + (c) 2014-2018 $4 Usage: nimhttpd [-p:port] [directory]

@@ -31,7 +34,7 @@ directory The directory to serve (default: current directory).

Options: -p, --port The port to listen to (default: 1337). -""" +""" % [name, version, description, author] type
M nimhttpd.nimblenimhttpd.nimble

@@ -1,8 +1,21 @@

+import + ospaths + +template thisModuleFile: string = instantiationInfo(fullPaths = true).filename + +when fileExists(thisModuleFile.parentDir / "src/nimhttpdpkg/config.nim"): + # In the git repository the Nimble sources are in a ``src`` directory. + import src/nimhttpdpkg/config +else: + # When the package is installed, the ``src`` directory disappears. + import nimhttpdpkg/config + + # Package -version = "1.0.5" -author = "Fabio Cevasco" -description = "A tiny static file web server." +version = pkgVersion +author = pkgAuthor +description = pkgDescription license = "MIT" bin = @["nimhttpd"] srcDir = "src"

@@ -12,13 +25,13 @@

requires "nim >= 0.18.0" const compile = "nim c -d:release" -const linux_x86 = "--cpu:i386 --os:linux" -const linux_x64 = "--cpu:amd64 --os:linux" -const linux_arm = "--cpu:arm --os:linux" -const windows_x64 = "--cpu:amd64 --os:windows" -const macosx_x64 = "" +const linux_x86 = "--cpu:i386 --os:linux -o:nimhttpd" +const linux_x64 = "--cpu:amd64 --os:linux -o:nimhttpd" +const linux_arm = "--cpu:arm --os:linux -o:nimhttpd" +const windows_x64 = "--cpu:amd64 --os:windows -o:nimhttpd.exe" +const macosx_x64 = "-o:nimhttpd" const program = "nimhttpd" -const program_file = "nimhttpd.nim" +const program_file = "src/nimhttpd.nim" const zip = "zip -X" proc shell(command, args: string, dest = "") =
A src/nimhttpdpkg/config.nim

@@ -0,0 +1,5 @@

+const + pkgTitle* = "NimHTTPd" + pkgVersion* = "1.0.5" + pkgAuthor* = "Fabio Cevasco" + pkgDescription* = "A tiny static file web server."