From dd2646a11066c678abeb26051a7bd44d609d6033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9tro?= <yann.roberge@polymtl.ca> Date: Mon, 9 Nov 2020 22:31:37 -0500 Subject: [PATCH] =?UTF-8?q?gjout=20d'un=20script=20de=20t=C3=A9l=C3=A9char?= =?UTF-8?q?gement=20du=20r=C3=A9po=20parce=20qu'il=20y=20a=20pas=20git=20s?= =?UTF-8?q?ur=20les=20tortues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fichiersCode.config | 11 +++++++++++ gitpull.lua | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 fichiersCode.config create mode 100644 gitpull.lua diff --git a/fichiersCode.config b/fichiersCode.config new file mode 100644 index 0000000..3c5c20d --- /dev/null +++ b/fichiersCode.config @@ -0,0 +1,11 @@ +bucher.lua +essais.lua +gitpull.lua +poseurDeRail.lua +salleCarree.lua +carreler.lua +excaver.lua +printf.lua +test.lua +macros.lua +rsiTurtle.lua diff --git a/gitpull.lua b/gitpull.lua new file mode 100644 index 0000000..54ef9b4 --- /dev/null +++ b/gitpull.lua @@ -0,0 +1,29 @@ +-- gitpull.lua +-- Created on: 2020-11-06 +-- Author: Rétro +-- +-- Télécharger le répo git +-- +local fileList = "fichiersCode.config" +local urlStub = "https://git.step.polymtl.ca/Retro/tortues-cc/raw/master/" + +local fileName +local textRead, err +local fileHandle + +local fileListHandle = fs.open(fileList, "r") + +fileName = fileListHandle.readLine() +while (fileName) +do + print("URL: " .. urlStub .. fileName) + textRead, err = http.get(urlStub .. fileName) + if not textRead then error(err) end + + -- Écrire le même fichier + fileHandle = fs.open(fileName, "w") + fileHandle.write(textRead) + fileHandle.close() + + fileName = fileListHandle.readLine() +end -- GitLab