summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorAmrykid <amrykid@gmail.com>2011-12-24 12:14:17 -0600
committerAmrykid <amrykid@gmail.com>2011-12-24 12:14:17 -0600
commit2e0f9c8bf77a4baad539bfa162866f324ee94225 (patch)
tree1394b4947953c16a6e1bbb2618cfe8c679d7fcbf /koch.nim
parent76f91b90e2a411a6d2ca82f075f55abe63d8f6a5 (diff)
downloadNim-2e0f9c8bf77a4baad539bfa162866f324ee94225.tar.gz
- Added extractFile and extractAll to zipfiles.nim
-- Need to wait until libzip_all.c is updated to support Windows.

- Started working on "koch update".
-- Waiting on above to finish work.
Diffstat (limited to 'koch.nim')
-rwxr-xr-xkoch.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/koch.nim b/koch.nim
index d3caa27df..2e67cd3d4 100755
--- a/koch.nim
+++ b/koch.nim
@@ -34,6 +34,7 @@ Possible Commands:
   zip                      builds the installation ZIP package
   inno [options]           builds the Inno Setup installer (for Windows)
   tests                    run the testsuite
+  update                   updates nimrod to the latest version from the repo.	
 Boot options:
   -d:release               produce a release version of the compiler
   -d:tinyc                 include the Tiny C backend (not supported on Windows)
@@ -78,6 +79,24 @@ proc web(args: string) =
   exec("nimrod cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" %
        NimrodVersion)
 
+proc update(args: string) =
+  if ExistFile("./.git"):
+    # use git to download latest source
+    exec("git pull")
+  else:
+    # use dom96's httpclient to download zip
+    import httpclient
+    import zipfiles
+    downloadFile("https://github.com/Araq/Nimrod/zipball/master","./update.zip")
+    
+    var zip :TZipArchive
+    discard open(zip,fmRead) # will add error checking later
+    extractAll(zip,"./")
+
+  exec("./koch boot -d:release")
+
+
+
 # -------------- boot ---------------------------------------------------------
 
 const
@@ -204,6 +223,7 @@ of cmdArgument:
   of "inno": inno(op.cmdLineRest)
   of "install": install(op.cmdLineRest)
   of "test", "tests": tests(op.cmdLineRest)
+  of "update", "up": update(op.cmdLineRest)
   else: showHelp()
 of cmdEnd: showHelp()