From 57707ea89b49239dabd21c6304af79b5ebf0be51 Mon Sep 17 00:00:00 2001 From: denise-khuu <74537227+denise-khuu@users.noreply.github.com> Date: Tue, 22 Dec 2020 15:17:50 +0100 Subject: [PATCH 1/5] restore Workspace --- runners/katacoda/index.ts | 21 ++++++++++++++++++- .../templates/scripts/restoreWorkspace.sh | 12 +++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 runners/katacoda/templates/scripts/restoreWorkspace.sh diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index d0450eab..5b37c7e8 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -67,9 +67,28 @@ export class Katacoda extends Runner { fs.writeFileSync(this.outputPathTutorial + 'index.json', JSON.stringify(indexJsonObject, null, 2)); } + runRestoreWorkspace(step: Step, command: Command): RunResult { + let tools = command.parameters[0].join(" ").replace(/vscode/,"").replace(/eclipse/, "").trim(); + + // create script to download devonfw ide settings. + this.renderTemplate(path.join("scripts", "cloneDevonfwIdeSettings.sh"), path.join(this.setupDir, "cloneDevonfwIdeSettings.sh"), { tools: tools, cloneDir: "/root/devonfw-settings/"}); + this.renderTemplate(path.join("scripts", "restoreWorkspace.sh"), path.join(this.setupDir, "restoreWorkspace.sh"), {}); + + // add the script to the setup scripts for executing it at the beginning of the tutorial + this.setupScripts.push({ + "name": "Clone devonfw IDE settings", + "script": "cloneDevonfwIdeSettings.sh" + }); + this.setupScripts.push({ + "name": "Restore Workspace", + "script": "restoreWorkspace.sh" + }); + + return null; + } + runInstallDevonfwIde(step: Step, command: Command): RunResult { let cdCommand = this.changeCurrentDir("/root"); - let tools = command.parameters[0].join(" ").replace(/vscode/,"").replace(/eclipse/, "").trim(); // create script to download devonfw ide settings diff --git a/runners/katacoda/templates/scripts/restoreWorkspace.sh b/runners/katacoda/templates/scripts/restoreWorkspace.sh new file mode 100644 index 00000000..2570d663 --- /dev/null +++ b/runners/katacoda/templates/scripts/restoreWorkspace.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +mkdir devonfw +cd devonfw + +wget -c https://bit.ly/2BCkFa9 -O - | tar -xz + +yes | bash setup /root/devonfw-settings/settings.git + +. ~/.bashrc + +exit 0 \ No newline at end of file From bd27eec85c4efacce7eef2c04cc481f4a72e40ad Mon Sep 17 00:00:00 2001 From: denise-khuu <74537227+denise-khuu@users.noreply.github.com> Date: Tue, 22 Dec 2020 16:19:56 +0100 Subject: [PATCH 2/5] restore Workspace --- runners/katacoda/templates/scripts/restoreWorkspace.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/runners/katacoda/templates/scripts/restoreWorkspace.sh b/runners/katacoda/templates/scripts/restoreWorkspace.sh index 2570d663..c68d775b 100644 --- a/runners/katacoda/templates/scripts/restoreWorkspace.sh +++ b/runners/katacoda/templates/scripts/restoreWorkspace.sh @@ -7,6 +7,7 @@ wget -c https://bit.ly/2BCkFa9 -O - | tar -xz yes | bash setup /root/devonfw-settings/settings.git + . ~/.bashrc exit 0 \ No newline at end of file From ee0a17efcf9cc073d42f906fdc46e3d331c9e0c3 Mon Sep 17 00:00:00 2001 From: denise-khuu <74537227+denise-khuu@users.noreply.github.com> Date: Wed, 23 Dec 2020 12:56:44 +0100 Subject: [PATCH 3/5] RestoreDevon IDE for Katacoda --- runners/katacoda/index.ts | 8 ++++---- .../templates/scripts/intro_foreground.sh | 2 +- .../templates/scripts/restoreDevonfwIde.sh | 15 +++++++++++++++ .../templates/scripts/restoreWorkspace.sh | 13 ------------- 4 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 runners/katacoda/templates/scripts/restoreDevonfwIde.sh delete mode 100644 runners/katacoda/templates/scripts/restoreWorkspace.sh diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 5b37c7e8..a3fd476b 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -67,12 +67,12 @@ export class Katacoda extends Runner { fs.writeFileSync(this.outputPathTutorial + 'index.json', JSON.stringify(indexJsonObject, null, 2)); } - runRestoreWorkspace(step: Step, command: Command): RunResult { + runRestoreDevonfwIde(step: Step, command: Command): RunResult { let tools = command.parameters[0].join(" ").replace(/vscode/,"").replace(/eclipse/, "").trim(); // create script to download devonfw ide settings. this.renderTemplate(path.join("scripts", "cloneDevonfwIdeSettings.sh"), path.join(this.setupDir, "cloneDevonfwIdeSettings.sh"), { tools: tools, cloneDir: "/root/devonfw-settings/"}); - this.renderTemplate(path.join("scripts", "restoreWorkspace.sh"), path.join(this.setupDir, "restoreWorkspace.sh"), {}); + this.renderTemplate(path.join("scripts", "restoreDevonfwIde.sh"), path.join(this.setupDir, "restoreDevonfwIde.sh"), {}); // add the script to the setup scripts for executing it at the beginning of the tutorial this.setupScripts.push({ @@ -80,8 +80,8 @@ export class Katacoda extends Runner { "script": "cloneDevonfwIdeSettings.sh" }); this.setupScripts.push({ - "name": "Restore Workspace", - "script": "restoreWorkspace.sh" + "name": "Restore Devonfw IDE", + "script": "restoreDevonfwIde.sh" }); return null; diff --git a/runners/katacoda/templates/scripts/intro_foreground.sh b/runners/katacoda/templates/scripts/intro_foreground.sh index 7d12ac2d..a9045904 100644 --- a/runners/katacoda/templates/scripts/intro_foreground.sh +++ b/runners/katacoda/templates/scripts/intro_foreground.sh @@ -1,3 +1,3 @@ #!/bin/sh while [ ! -f /root/setup/setup.sh ] ; do sleep 1 ; done -sh /root/setup/setup.sh \ No newline at end of file +sh /root/setup/setup.sh diff --git a/runners/katacoda/templates/scripts/restoreDevonfwIde.sh b/runners/katacoda/templates/scripts/restoreDevonfwIde.sh new file mode 100644 index 00000000..0e34ccac --- /dev/null +++ b/runners/katacoda/templates/scripts/restoreDevonfwIde.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +mkdir devonfw +cd devonfw + +mkdir -p /root/.devon/ +touch /root/.devon/.license.agreement +echo "you accepted the devonfw-ide License.https://github.com/devonfw/ide/blob/master/documentation/LICENSE.asciidoc" >> /root/.devon/.license.agreement + +wget -c https://bit.ly/2BCkFa9 -O - | tar -xz + +bash setup /root/devonfw-settings/settings.git + + +. ~/.bashrc \ No newline at end of file diff --git a/runners/katacoda/templates/scripts/restoreWorkspace.sh b/runners/katacoda/templates/scripts/restoreWorkspace.sh deleted file mode 100644 index c68d775b..00000000 --- a/runners/katacoda/templates/scripts/restoreWorkspace.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -mkdir devonfw -cd devonfw - -wget -c https://bit.ly/2BCkFa9 -O - | tar -xz - -yes | bash setup /root/devonfw-settings/settings.git - - -. ~/.bashrc - -exit 0 \ No newline at end of file From fa001c51c1ec9f50c73c472971eefc0e85e0a00c Mon Sep 17 00:00:00 2001 From: denise-khuu <74537227+denise-khuu@users.noreply.github.com> Date: Wed, 23 Dec 2020 13:00:32 +0100 Subject: [PATCH 4/5] restoreDevonIDE --- runners/katacoda/templates/scripts/intro_foreground.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/katacoda/templates/scripts/intro_foreground.sh b/runners/katacoda/templates/scripts/intro_foreground.sh index a9045904..7d12ac2d 100644 --- a/runners/katacoda/templates/scripts/intro_foreground.sh +++ b/runners/katacoda/templates/scripts/intro_foreground.sh @@ -1,3 +1,3 @@ #!/bin/sh while [ ! -f /root/setup/setup.sh ] ; do sleep 1 ; done -sh /root/setup/setup.sh +sh /root/setup/setup.sh \ No newline at end of file From ffc93caaef484368cc1cab16de4188a302485629 Mon Sep 17 00:00:00 2001 From: denise-khuu <74537227+denise-khuu@users.noreply.github.com> Date: Wed, 23 Dec 2020 13:41:15 +0100 Subject: [PATCH 5/5] changed position --- runners/katacoda/index.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index a3fd476b..fd7fdc54 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -67,48 +67,48 @@ export class Katacoda extends Runner { fs.writeFileSync(this.outputPathTutorial + 'index.json', JSON.stringify(indexJsonObject, null, 2)); } - runRestoreDevonfwIde(step: Step, command: Command): RunResult { + runInstallDevonfwIde(step: Step, command: Command): RunResult { + let cdCommand = this.changeCurrentDir("/root"); let tools = command.parameters[0].join(" ").replace(/vscode/,"").replace(/eclipse/, "").trim(); - // create script to download devonfw ide settings. + // create script to download devonfw ide settings this.renderTemplate(path.join("scripts", "cloneDevonfwIdeSettings.sh"), path.join(this.setupDir, "cloneDevonfwIdeSettings.sh"), { tools: tools, cloneDir: "/root/devonfw-settings/"}); - this.renderTemplate(path.join("scripts", "restoreDevonfwIde.sh"), path.join(this.setupDir, "restoreDevonfwIde.sh"), {}); // add the script to the setup scripts for executing it at the beginning of the tutorial this.setupScripts.push({ "name": "Clone devonfw IDE settings", "script": "cloneDevonfwIdeSettings.sh" }); - this.setupScripts.push({ - "name": "Restore Devonfw IDE", - "script": "restoreDevonfwIde.sh" - }); + this.steps.push({ + "title": "Install devonfw IDE", + "text": "step" + this.stepsCount + ".md", + }); + this.renderTemplate("installDevonfwIde.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand}); + + //update current directory + this.currentDir = path.join(this.currentDir, "devonfw"); + return null; } - runInstallDevonfwIde(step: Step, command: Command): RunResult { - let cdCommand = this.changeCurrentDir("/root"); + runRestoreDevonfwIde(step: Step, command: Command): RunResult { let tools = command.parameters[0].join(" ").replace(/vscode/,"").replace(/eclipse/, "").trim(); - // create script to download devonfw ide settings + // create script to download devonfw ide settings. this.renderTemplate(path.join("scripts", "cloneDevonfwIdeSettings.sh"), path.join(this.setupDir, "cloneDevonfwIdeSettings.sh"), { tools: tools, cloneDir: "/root/devonfw-settings/"}); + this.renderTemplate(path.join("scripts", "restoreDevonfwIde.sh"), path.join(this.setupDir, "restoreDevonfwIde.sh"), {}); // add the script to the setup scripts for executing it at the beginning of the tutorial this.setupScripts.push({ "name": "Clone devonfw IDE settings", "script": "cloneDevonfwIdeSettings.sh" }); - - this.steps.push({ - "title": "Install devonfw IDE", - "text": "step" + this.stepsCount + ".md", + this.setupScripts.push({ + "name": "Restore Devonfw IDE", + "script": "restoreDevonfwIde.sh" }); - this.renderTemplate("installDevonfwIde.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand}); - - //update current directory - this.currentDir = path.join(this.currentDir, "devonfw"); - + return null; }