Commit c174db02 authored by Nong Hoang Tu's avatar Nong Hoang Tu
Browse files

create dir for log file

parent 2d8fb6cf
import configs import configs
import .. / interfaces / logutils import .. / interfaces / logutils
import os
proc updateProjectAll(config: ProgConf) = proc doUpdateProject(project: DebPackage): bool =
let resultLog = initResultLogs(config.logPath)
discard discard
proc updateProjectSingle(config: ProgConf) = proc updateProjectAll(config: ProgConf) =
let
resultLog = initResultLogs(config.logPath)
fullLog = initFullLogs(config.logPath)
var project: DebPackage
project.log = fullLog
for kind, path in walkDir(config.rootPath):
if kind == pcDir:
project.path = path
project.name = path.splitPath.tail
if doUpdateProject(project):
# TODO use more status return for update status
resultLog.logInfo("[" & project.name & "] Update success")
proc updateProjectArr(config: ProgConf) =
let resultLog = initResultLogs(config.logPath) let resultLog = initResultLogs(config.logPath)
discard discard
...@@ -15,12 +30,15 @@ proc updateProjectSingle(config: ProgConf) = ...@@ -15,12 +30,15 @@ proc updateProjectSingle(config: ProgConf) =
proc pullProjectAll(config: ProgConf) = proc pullProjectAll(config: ProgConf) =
discard discard
proc pullProjectSingle(config: ProgConf) = proc pullProjectSingle(config: ProgConf) =
discard discard
proc cloneProject*() = proc cloneProject*() =
discard discard
proc handleUpdateProject*(projects: seq[string]) = proc handleUpdateProject*(projects: seq[string]) =
var config: ProgConf var config: ProgConf
if not initConfig(config): if not initConfig(config):
...@@ -28,12 +46,13 @@ proc handleUpdateProject*(projects: seq[string]) = ...@@ -28,12 +46,13 @@ proc handleUpdateProject*(projects: seq[string]) =
if len(projects) == 0: if len(projects) == 0:
updateProjectAll(config) updateProjectAll(config)
else: else:
updateProjectSingle(config) updateProjectArr(config)
# init project (log file, parse settings) # init project (log file, parse settings)
# TODO log project is started # TODO log project is started
# do the loop # do the loop
discard discard
proc handlePullProject*(projects: seq[string]) = proc handlePullProject*(projects: seq[string]) =
var config: ProgConf var config: ProgConf
if not initConfig(config): if not initConfig(config):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment