diff --git a/DESCRIPTION b/DESCRIPTION index 7c792c3..e129fdc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,7 +34,9 @@ Imports: shiny.i18n (>= 0.2.0), shiny (>= 1.3.2), stringr (>= 1.4.0), - shinyWidgets (>= 0.2.1) + shinyWidgets (>= 0.2.1), + purrr (>= 0.3.4), + gert (>= 1.5.0) Suggests: knitr (>= 1.23), readr (>= 1.3.1), diff --git a/R/get_instance.R b/R/get_instance.R index 873cb75..de1ff6d 100644 --- a/R/get_instance.R +++ b/R/get_instance.R @@ -7,7 +7,6 @@ #' @return a character of the active issue in the session #' @export #' -#' @examples get_instance <- function() { diff --git a/R/git.R b/R/git.R index eb0ccaf..b50f88c 100644 --- a/R/git.R +++ b/R/git.R @@ -12,36 +12,12 @@ add_upstream <- function(instance = "saved") { # Look for instance --------------------------------------------------------- if (instance == "saved") { - # It looks in session - if (Sys.getenv("ixplorer_instance") != "") { - - instance <- Sys.getenv("ixplorer_instance") - message ("You are currently on ", instance) - - # If there is no enviroment variable it means user is looking for - # a previously saved instance - } else if (Sys.getenv("ixplorer_instance") == "") { - - saved_instances <- keyring::keyring_list() %>% - filter(stringr::str_detect(keyring, "ixplorer_")) - - # if there are saved instances, then it chooses the instance that was last saved - if (nrow(saved_instances) > 0) { - - last_saved <- saved_instances[1,1] - instance <- last_saved - message("You are currently on ", instance) - - # When there are no saved instances, then a message is printed - } else { - message("There are no saved instances, try the authentication gadget") - } + instance <- get_instance() + if (instance == "none") { + stop("There are no saved instances. Try the authentication gadget") } - # If the user chooses an instance other than "saved" then it looks for - # the specified instance in previously saved keyrings - } else { saved_instances <- keyring::keyring_list() %>% @@ -49,12 +25,14 @@ add_upstream <- function(instance = "saved") { filter(keyring == paste0("ixplorer_",instance)) if (nrow(saved_instances) > 0) { + instance <- toString(saved_instances[1]) - # If the instance specified was not found a message is printed - } else { - message("No credentials for ", instance) + } else { + + stop("No credentials for ", instance) } + } # Completing the repo url --------------------------------------------------- @@ -77,27 +55,6 @@ add_upstream <- function(instance = "saved") { git2r::remote_add(repo = camino, name = "upstream", url = proyecto_madre) - # previous code ------------------------------------------------------------- - # credentials <- tryCatch( - # keyring::key_get(paste0("token_", instance)), - # error = function(cond) "no_credentials") - - - # if (credentials != "no_credentials") { - # credentials <- credentials %>% - # stringr::str_split("/", simplify = TRUE) %>% - # tibble::as_tibble() %>% - # magrittr::set_names(c("url", "token", - # "user", "persistence")) %>% - # dplyr::mutate(persistence = as.logical(persistence)) - # - # } else { - # stop(paste("No credentials yet for", instance)) - # } - # - # if (credentials$persistence == FALSE) { - # keyring::key_delete(paste0("token_", instance)) - # } } @@ -123,11 +80,12 @@ incluye_upstream <- function(instancia = "guardada") { #' @title Extend git credential cache time-out +#' #' @description Set the number of seconds before the git credential cache times #' out. Note that this is written for work on remote servers where we do not -#' want to store our git credentials (other might have acces to it, or -#' impersonate us). On a trusted machine the most common setting would be ( on -#' a linux machine) . However, some caching is +#' want to store our git credentials because other might have access to it, or +#' impersonate us. On a trusted machine the most common setting would be (on +#' a linux machine) git credential.helper store. However, some caching is #' required when working on a remote server because frequent commit-push #' cycles where you have to write out your username and password every time is #' not nice. @@ -153,13 +111,14 @@ set_git_timeout <- function(timeout = 14400, global = FALSE) { #' @title Extienda el tiempo de sus credenciales de git -#' @description Esta es una función traducida que llama a set_git_timeout(). +#' +#' @description Esta es una función traducida que llama a set_git_timeout. #' Establezca la cantidad de segundos para que se agote el #' tiempo de espera del caché de credenciales de git. Tenga en cuenta que #' esto está escrito para trabajar en servidores remotos donde no queremos #' almacenar nuestras credenciales de git (otros pueden tener acceso o #' hacerse pasar por nosotros). En una máquina confiable, la configuración más -#' común sería (en una máquina Linux) . Sin +#' común sería (en una máquina Linux) git credential.helper store. Sin #' embargo, se requiere algo de almacenamiento en caché cuando se trabaja en #' un servidor remoto porque los ciclos frecuentes de envío y confirmación en #' los que tiene que escribir su nombre de usuario y contraseña cada vez no son @@ -170,16 +129,16 @@ set_git_timeout <- function(timeout = 14400, global = FALSE) { #' desea. También por defecto, el tiempo de espera se establece en 4 horas #' (14400 segundos). #' -#' @param detencion -#' @param global +#' @param detencion número de segundos antes del tiempo de espera +#' @param global si el cambio debe ser global o local para el repositorio #' #' @export fijar_tiempo_credenciales <- function(pausa = 14000, global = FALSE) { if (global == FALSE) { - set_git_timeout(tiempo = detencion, global = FALSE) + set_git_timeout(timeout = pausa, global = FALSE) } else { - set_git_timeout(tiempo = dentencion, global = TRUE) + set_git_timeout(timeout = pausa, global = TRUE) } } diff --git a/R/list_closed_tickets.R b/R/list_closed_tickets.R index 56fde75..966cea9 100644 --- a/R/list_closed_tickets.R +++ b/R/list_closed_tickets.R @@ -26,7 +26,7 @@ if (instance == "saved") { instance <- get_instance() if (instance == "none") { - stop("There are no saved instances") + stop("There are no saved instances. Try the authentication gadget") } } else { diff --git a/man/fijar_tiempo_credenciales.Rd b/man/fijar_tiempo_credenciales.Rd index 139281e..63a8619 100644 --- a/man/fijar_tiempo_credenciales.Rd +++ b/man/fijar_tiempo_credenciales.Rd @@ -7,16 +7,18 @@ fijar_tiempo_credenciales(pausa = 14000, global = FALSE) } \arguments{ -\item{global}{} +\item{global}{si el cambio debe ser global o local para el repositorio} + +\item{detencion}{número de segundos antes del tiempo de espera} } \description{ -Esta es una función traducida que llama a set_git_timeout(). +Esta es una función traducida que llama a set_git_timeout. Establezca la cantidad de segundos para que se agote el tiempo de espera del caché de credenciales de git. Tenga en cuenta que esto está escrito para trabajar en servidores remotos donde no queremos almacenar nuestras credenciales de git (otros pueden tener acceso o hacerse pasar por nosotros). En una máquina confiable, la configuración más -común sería (en una máquina Linux) . Sin +común sería (en una máquina Linux) git credential.helper store. Sin embargo, se requiere algo de almacenamiento en caché cuando se trabaja en un servidor remoto porque los ciclos frecuentes de envío y confirmación en los que tiene que escribir su nombre de usuario y contraseña cada vez no son diff --git a/man/set_git_timeout.Rd b/man/set_git_timeout.Rd index 1c1b61f..b4704fa 100644 --- a/man/set_git_timeout.Rd +++ b/man/set_git_timeout.Rd @@ -14,9 +14,9 @@ set_git_timeout(timeout = 14400, global = FALSE) \description{ Set the number of seconds before the git credential cache times out. Note that this is written for work on remote servers where we do not -want to store our git credentials (other might have acces to it, or -impersonate us). On a trusted machine the most common setting would be ( on -a linux machine) . However, some caching is +want to store our git credentials because other might have access to it, or +impersonate us. On a trusted machine the most common setting would be (on +a linux machine) git credential.helper store. However, some caching is required when working on a remote server because frequent commit-push cycles where you have to write out your username and password every time is not nice. diff --git a/man/synch_branch.Rd b/man/synch_branch.Rd index 0ab2baf..a682b25 100644 --- a/man/synch_branch.Rd +++ b/man/synch_branch.Rd @@ -4,7 +4,7 @@ \alias{synch_branch} \title{Synch your master branch with upstream} \usage{ -synch_branch() +synch_branch(default_branch_name = "master") } \value{ diff --git a/tests/testthat.R b/tests/testthat.R deleted file mode 100644 index 0805668..0000000 --- a/tests/testthat.R +++ /dev/null @@ -1,4 +0,0 @@ -library(testthat) -library(ixplorer) - -test_check("ixplorer") diff --git a/tests/testthat/.ixplorer_api b/tests/testthat/.ixplorer_api deleted file mode 100644 index 33118c0..0000000 --- a/tests/testthat/.ixplorer_api +++ /dev/null @@ -1,6 +0,0 @@ -V1 -IXTOKEN= -IXURL= https://gitear.ixpantia.com/ -IXOWNER= ixplorer -IXREPO= sitio_pruebas -IXUSER= ronny diff --git a/tests/testthat/.ixplorer_project b/tests/testthat/.ixplorer_project deleted file mode 100644 index bc04e1f..0000000 --- a/tests/testthat/.ixplorer_project +++ /dev/null @@ -1,6 +0,0 @@ -V1 -IXTOKEN= 47c0be813944aaa0132d77a8110d48e9d3a644af -IXURL= https://gitear.ixpantia.com/ -IXOWNER= -IXREPO= sitio_pruebas -IXUSER= ronny diff --git a/tests/testthat/.ixplorer_repo b/tests/testthat/.ixplorer_repo deleted file mode 100644 index d7a9315..0000000 --- a/tests/testthat/.ixplorer_repo +++ /dev/null @@ -1,6 +0,0 @@ -V1 -IXTOKEN= 47c0be813944aaa0132d77a8110d48e9d3a644af -IXURL= https://gitear.ixpantia.com/ -IXOWNER= ixplorer -IXREPO= -IXUSER= ronny diff --git a/tests/testthat/.ixplorer_url b/tests/testthat/.ixplorer_url deleted file mode 100644 index b875ab8..0000000 --- a/tests/testthat/.ixplorer_url +++ /dev/null @@ -1,6 +0,0 @@ -V1 -IXTOKEN= 47c0be813944aaa0132d77a8110d48e9d3a644af -IXURL= -IXOWNER= ixplorer -IXREPO= sitio_pruebas -IXUSER= ronny diff --git a/tests/testthat/.ixplorer_user b/tests/testthat/.ixplorer_user deleted file mode 100644 index efb8777..0000000 --- a/tests/testthat/.ixplorer_user +++ /dev/null @@ -1,6 +0,0 @@ -V1 -IXTOKEN= 47c0be813944aaa0132d77a8110d48e9d3a644af -IXURL= https://gitear.ixpantia.com/ -IXOWNER= ixplorer -IXREPO= sitio_pruebas -IXUSER= diff --git a/tests/testthat/test-verify.R b/tests/testthat/test-verify.R deleted file mode 100644 index dd4e88e..0000000 --- a/tests/testthat/test-verify.R +++ /dev/null @@ -1,56 +0,0 @@ -context("verificacion") - -# Como hago para que el archivo lo busque en testdata, o lo dejo en este wd? -test_that("Finds file .ixplorer", { - skip("no hay ixplorer") - working_directory <- rstudioapi::getActiveProject() - ixplorer_file <- paste0(working_directory, "/.ixplorer") - file <- verify_ixplorer_file(ixplorer_file) - expect_true(any(class(file) == "data.frame")) -}) - -test_that("Detects missing data TOKEN access value", { - skip("no hay ixplorer") - file <- readr::read_csv(".ixplorer_api") %>% - tidyr::separate(col = V1, into = c("object", "value"), sep = " ") - expect_true(verify_ixtoken(file) == "There is no ixplorer TOKEN, please use the Authentication gadget") -}) - -test_that("Detects missing data URL access value", { - skip("no hay ixplorer") - file <- readr::read_csv(".ixplorer_url") %>% - tidyr::separate(col = V1, into = c("object", "value"), sep = " ") - expect_true(verify_ixurl(file) == "There is no ixplorer URL, please use the Authentication gadget") -}) - -test_that("Detects missing data PROJECT access value", { - skip("no hay ixplorer") - file <- readr::read_csv(".ixplorer_project") %>% - tidyr::separate(col = V1, into = c("object", "value"), sep = " ") - expect_true(verify_ixproject(file) == "There is no ixplorer PROJECT name, please use the Authentication gadget") -}) - -test_that("Detects missing data REPOSITORY access value", { - skip("no hay ixplorer") - file <- readr::read_csv(".ixplorer_repo") %>% - tidyr::separate(col = V1, into = c("object", "value"), sep = " ") - expect_true(verify_ixrepo(file) == "There is no ixplorer REPOSITORY, please use the Authentication gadget") -}) - -test_that("Detects missing data USER access value", { - skip("no hay .ixplorer") - file <- readr::read_csv(".ixplorer_user") %>% - tidyr::separate(col = V1, into = c("object", "value"), sep = " ") - expect_true(verify_ixuser(file) == "There is no ixplorer USER, please use the Authentication gadget") -}) - - - - -# Hay un error o paso para verificar con posiciones de datos -# Si eliminio una linea, la posicion varia y queda mal las condiciones -# dentro de los verify. - -# el msj de set_authentication se esta repitiendo. YO habia provocado eso -# adrede porque no hacia un print del msj y tuve que hacerlo explicito -# ahora se esta comportando imprimiendo dos veces. diff --git a/vignettes/img/clone_wiki.png b/vignettes/img/clone_wiki.png new file mode 100644 index 0000000..c96d948 Binary files /dev/null and b/vignettes/img/clone_wiki.png differ diff --git a/vignettes/ixplorer.Rmd b/vignettes/ixplorer.Rmd index 10a475e..f4a1f0e 100644 --- a/vignettes/ixplorer.Rmd +++ b/vignettes/ixplorer.Rmd @@ -240,7 +240,16 @@ instancia guardada en credenciales de git en su servior remoto. El default es de 4 horas. La función toma su tiempo en segundos. - - - +#### Publicar un wiki + +* **publica_wiki()**. Los wikis son de especial importancia cuando se quiere +documentar de manera sencilla lo que sucede en el repositorio. Para publicar un +wiki con publica_wiki(), el primer paso es crear la primera página manualmente. +Esto se logra en la pestaña de "wiki" en el repositorio. +El siguiente paso es clonar el repositorio del wiki. +Este url para clonar el wiki es diferente al que usamos para clonar el repositorio +donde encontramos nuestro código. Una vez que clonamos este repositorio podemos +usar publica_wiki(). + +![](img/clone_wiki.png) diff --git a/vignettes/ixplorer_en.Rmd b/vignettes/ixplorer_en.Rmd index 8f4a468..6532534 100644 --- a/vignettes/ixplorer_en.Rmd +++ b/vignettes/ixplorer_en.Rmd @@ -240,7 +240,17 @@ instance saved. git credentials on your remote server. The default is 4 hours. The function takes its time in seconds. +#### Publishing on wiki * **publish_wiki()**: Allows you to publish a wiki in your repo from an Rmarkdown. +Wikis are especially important when you want to easily document what happens in +the repository. To publish a wiki with publish_wiki(), the first step is to create +the first page manually. This is accomplished in the "wiki" tab in the repository. +The next step is to clone the wiki repository. +This url to clone the wiki is different from the one we use to clone the +repository where we find our code. Once we clone this repository we can use +publish_wiki(). + +![](img/clone_wiki.png)