diff --git a/src/loguepkg/create.nim b/src/loguepkg/create.nim index b297698..1c45140 100644 --- a/src/loguepkg/create.nim +++ b/src/loguepkg/create.nim @@ -1,4 +1,5 @@ import os, strformat +import tml / [app, urls, views] proc getEnvContent(appName: string): string = @@ -21,15 +22,13 @@ proc initProject(projName: string) = viewsFile = projName / "views.nim" envFile = projName / ".env" - let path = currentSourcePath().splitPath.head + # let path = currentSourcePath().splitPath.head - copyFile(path / "tml" / "app.nim", appFile) - copyFile(path / "tml" / "urls.nim", urlsFile) - copyFile(path / "tml" / "views.nim", viewsFile) + writeFile(appFile, appStr) + writeFile(urlsFile, urlsStr) + writeFile(viewsFile, viewsStr) writeFile(envFile, getEnvContent(projName)) - - proc init*(name: seq[string]) = if name.len == 0: echo "Please give the name of your project!" diff --git a/src/loguepkg/tml/.env b/src/loguepkg/tml/.env deleted file mode 100644 index d83c354..0000000 --- a/src/loguepkg/tml/.env +++ /dev/null @@ -1,9 +0,0 @@ -# Don't commit this to source control. -# Eg. Make sure ".env" in your ".gitignore" file. -# If you want to release you programs, make sure debug=false. -debug=true -address=127.0.0.2 -port=8787 -appName=HelloWorld -staticDir=/static -secretKey=Pr435ol67ogue \ No newline at end of file diff --git a/src/loguepkg/tml/app.nim b/src/loguepkg/tml/app.nim index 9ebf8ea..92618e7 100644 --- a/src/loguepkg/tml/app.nim +++ b/src/loguepkg/tml/app.nim @@ -1,3 +1,4 @@ +const appStr* = """ import prologue import ./urls @@ -15,3 +16,4 @@ let var app = newApp(settings = settings) app.addRoute(urls.urlPatterns, "/") app.run() +""" \ No newline at end of file diff --git a/src/loguepkg/tml/urls.nim b/src/loguepkg/tml/urls.nim index 1cb6a08..89db411 100644 --- a/src/loguepkg/tml/urls.nim +++ b/src/loguepkg/tml/urls.nim @@ -1,3 +1,4 @@ +const urlsStr* = """ import prologue import ./views @@ -7,3 +8,4 @@ let urlPatterns* = @[ # strip latter pattern("/", hello) ] +""" diff --git a/src/loguepkg/tml/views.nim b/src/loguepkg/tml/views.nim index d9cee4f..96b27f1 100644 --- a/src/loguepkg/tml/views.nim +++ b/src/loguepkg/tml/views.nim @@ -1,5 +1,7 @@ +const viewsStr* = """ import prologue proc hello*(ctx: Context) {.async.} = resp "

Hello, Prologue!

" +"""