[education/rkward] rkward/plugins/rkwarddev_scripts: added support for GitLab

m.eik michalke null at kde.org
Mon May 9 21:03:23 BST 2022


Git commit 04657d8f275c25c82078600b5708d888fee1ea41 by m.eik michalke.
Committed on 24/10/2018 at 19:01.
Pushed by tfry into branch 'master'.

added support for GitLab

  - also generalized the syntax generated for GitHub and GitLab
  - fixed a logic issue with the auth frame
  - updated german translation

M  +20   -13   rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R

https://invent.kde.org/education/rkward/commit/04657d8f275c25c82078600b5708d888fee1ea41

diff --git a/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R b/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
index 2716de4f..a87f7909 100644
--- a/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
+++ b/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
@@ -45,6 +45,7 @@ rk.set.comp("Install from git")
 packageSource <- rk.XML.dropdown("Package source",
   options=list(
     "GitHub"=c(val="github", chk=TRUE),
+    "GitLab"=c(val="gitlab"),
     "Bitbucket"=c(val="bitbucket"),
     "git (generic)"=c(val="git"),
     "subversion (generic)"=c(val="svn")
@@ -57,12 +58,12 @@ gitUserRepo <- rk.XML.row(
   gitUser <- rk.XML.input("Git user name",
     required=TRUE,
     id.name="gitUser",
-    help="Specify the user name (GitHub and Bitbucket only)."
+    help="Specify the user name (GitHub, GitLab and Bitbucket only)."
   ),
   gitRepo <- rk.XML.input("Repository",
     required=TRUE,
     id.name="gitRepo",
-    help="Give the repository name (GitHub and Bitbucket only)."
+    help="Give the repository name (GitHub, GitLab and Bitbucket only)."
   )
 )
 
@@ -100,7 +101,7 @@ authPassword <- rk.XML.input("Password",
 
 authToken <- rk.XML.input("Personal access token (PAT)",
   required=TRUE,
-  help="To install from a private repository, set your personal access token (PAT, GitHub only)."
+  help="To install from a private repository, set your personal access token (PAT, GitHub and GitLab only)."
 )
 
 authFrame <- rk.XML.frame(
@@ -132,8 +133,11 @@ logicSection <- rk.XML.logic(
   rk.XML.connect(governor=lgcRequireURL, client=gitUserRepo, set="visible", not=TRUE),
   rk.XML.connect(governor=lgcRequireURL, client=fullURL, set="visible"),
   lgcIsGithub <- rk.XML.convert(sources=list(string=packageSource), mode=c(equals="github"), id.name="lgcIsGithub"),
+  lgcIsGitlab <- rk.XML.convert(sources=list(string=packageSource), mode=c(equals="gitlab"), id.name="lgcIsGitlab"),
+  lgcIsGithubOrGitlab <- rk.XML.convert(sources=list(lgcIsGithub, lgcIsGitlab), mode=c(or=""), id.name="lgcIsGithubOrGitlab"),
   lgcIsBitbucket <- rk.XML.convert(sources=list(string=packageSource), mode=c(equals="bitbucket"), id.name="lgcIsBitbucket"),
-  rk.XML.connect(governor=lgcIsGithub, client=authToken, set="enabled"),
+  lgcEnableAuthToken <- rk.XML.convert(sources=list(checked=authFrame, lgcIsGithubOrGitlab), mode=c(and=""), id.name="lgcEnableAuthToken"),
+  rk.XML.connect(governor=lgcEnableAuthToken, client=authToken, set="enabled"),
   rk.XML.connect(governor=lgcIsBitbucket, client=authUser, set="enabled"),
   rk.XML.connect(governor=lgcIsBitbucket, client=authPassword, set="enabled"),
   rk.XML.connect(governor=lgcRequireURL, client=authFrame, set="enabled", not=TRUE)
@@ -147,14 +151,20 @@ JScalculate <- rk.paste.JS(
   authFrameChecked,
   echo("\tinstall_", packageSource, "(\n"),
   js(
-    if(packageSource == "github" || packageSource == "bitbucket"){
-      echo("\t\trepo=\"", gitUser, "/", gitRepo, "\"")
+    if(packageSource == "github" || packageSource == "gitlab" || packageSource == "bitbucket"){
+      echo("\t\trepo=\"", gitUser, "/", gitRepo)
+      if(gitSubdir){
+        echo("/", gitSubdir)
+      } else {}
       if(gitReference){
-        echo(",\n\t\tref=\"", gitReference, "\"")
+        echo("@", gitReference)
       } else {}
+      echo("\"")
       if(authFrameChecked){
-        if(packageSource == "github" && authToken){
-          echo(",\n\t\tauth_token=\"", authToken, "\"")
+        if(packageSource == "github" || packageSource == "gitlab"){
+          if(authToken){
+            echo(",\n\t\tauth_token=\"", authToken, "\"")
+          } else {}
         } else if(packageSource == "bitbucket"){
           if(authUser){
             echo(",\n\t\tauth_user=\"", authUser, "\"")
@@ -169,9 +179,6 @@ JScalculate <- rk.paste.JS(
       if(gitReference){
         echo(",\n\t\tbranch=\"", gitReference, "\"")
       } else {}
-    } else {},
-    if(gitSubdir){
-      echo(",\n\t\tsubdir=\"", gitSubdir, "\"")
     } else {}
   ),
   echo("\n\t)"),
@@ -232,4 +239,4 @@ plugin.dir <- rk.plugin.skeleton(
     rk.updatePluginMessages(file.path(output.dir,"rk.gitInstall","inst","rkward","rk.gitInstall.pluginmap"))
   } else {}
 
-})
\ No newline at end of file
+})



More information about the rkward-tracker mailing list