Title: | Management tools for missions |
---|---|
Description: | Management tools for missions (internal and external). Includes weekly, GL projects, etc. |
Authors: | Sébastien Rochette [aut, cre] , Margot Brard [aut] , Murielle Delmotte [aut] , Swann Floc'hlay [aut] , Yohann Mansiaux [aut] , ThinkR [cph] |
Maintainer: | Sébastien Rochette <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.3.0.9001 |
Built: | 2024-12-04 05:13:47 UTC |
Source: | https://github.com/ThinkR-open/lozen |
Add board in the correct order
add_board( project_id, name = "Development", labels_order = c("Bloqué", "Prêt", "En cours", "Révision", "Pré-validation", "A valider"), lg = "fr" )
add_board( project_id, name = "Development", labels_order = c("Bloqué", "Prêt", "En cours", "Révision", "Pré-validation", "A valider"), lg = "fr" )
project_id |
project_id |
name |
Name of the Board |
labels_order |
Name of the labels already existing in the project |
lg |
language of the board, "fr" or "en" |
## Not run: add_board( project_id = project_id ) ## End(Not run)
## Not run: add_board( project_id = project_id ) ## End(Not run)
add_board_github
add_board_github( owner, repo, columns = c("Open", "Blocked", "Meta", "Ready", "In Progress", "Review", "Validation") )
add_board_github( owner, repo, columns = c("Open", "Blocked", "Meta", "Ready", "In Progress", "Review", "Validation") )
owner |
Owner of the repository |
repo |
Repository name |
columns |
Names of columns to create in the Board |
## Not run: add_board_github( owner = "ghowner", repo = "areponame" ) ## End(Not run)
## Not run: add_board_github( owner = "ghowner", repo = "areponame" ) ## End(Not run)
Add MR GitLab or GitHub template and local issue template
add_git_templates( project_path = ".", type = c("commit", "mr"), target_dir = ".gitlab" )
add_git_templates( project_path = ".", type = c("commit", "mr"), target_dir = ".gitlab" )
project_path |
project_path |
type |
type |
target_dir |
Directory name where to save templates |
Side effect: template in .gitlab/.github and in .git
## Not run: add_git_templates( project_path = project_path, type = c("commit", "mr") ) ## End(Not run)
## Not run: add_git_templates( project_path = project_path, type = c("commit", "mr") ) ## End(Not run)
Add First issue client for GitLab
add_issue_clients(project_id, project_name, group_url)
add_issue_clients(project_id, project_name, group_url)
project_id |
project_id |
project_name |
project_name |
group_url |
group_url |
A tibble with the issue added and GitLab infos
## Not run: add_issue_clients( project_id = "<get_your_id_project>", project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
## Not run: add_issue_clients( project_id = "<get_your_id_project>", project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
Add First issue client for GitHub
add_issue_clients_github(owner, repo)
add_issue_clients_github(owner, repo)
owner |
GitHub owner (username or organisation) |
repo |
Name of the repository |
A tibble with the issue added and GitLab infos
## Not run: add_issue_clients_github( owner = "owner", repo = "repo" ) ## End(Not run)
## Not run: add_issue_clients_github( owner = "owner", repo = "repo" ) ## End(Not run)
Create issue for developers to initiate the project
add_issue_dev(project_id, project_name, group_url)
add_issue_dev(project_id, project_name, group_url)
project_id |
project_id |
project_name |
project_name |
group_url |
group_url |
Side effect: new issue on GitLab
# exemple nécessite des opérations sur gitlab : à voir ## Not run: add_issue_dev( project_id = "<get_your_id_project>", project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
# exemple nécessite des opérations sur gitlab : à voir ## Not run: add_issue_dev( project_id = "<get_your_id_project>", project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
Create dev first issue in github
add_issue_dev_github(owner, repo)
add_issue_dev_github(owner, repo)
owner |
owner of the project |
repo |
name of the project |
tibble with github issue info
## Not run: add_issue_dev_github( owner = "owner", repo = "repo" ) ## End(Not run)
## Not run: add_issue_dev_github( owner = "owner", repo = "repo" ) ## End(Not run)
Add Kickoff issue client for GitLab
add_issue_kickoff(project_id)
add_issue_kickoff(project_id)
project_id |
project_id |
A tibble with the issue added and GitLab infos
## Not run: add_issue_kickoff(project_id = "<get_your_id_project>") ## End(Not run)
## Not run: add_issue_kickoff(project_id = "<get_your_id_project>") ## End(Not run)
Add Kickoff issue for GitHub
add_issue_kickoff_github(owner, repo)
add_issue_kickoff_github(owner, repo)
owner |
GitHub owner (username or organisation) |
repo |
Name of the repository |
A tibble with the issue added and GitHub infos
## Not run: add_issue_kickoff_github( owner = "owner", repo = "repo" ) ## End(Not run)
## Not run: add_issue_kickoff_github( owner = "owner", repo = "repo" ) ## End(Not run)
Add files necessary for a package, including golem
add_kit_package( project_path = ".", type = c("package", "renv"), pkgdown_yml = NULL )
add_kit_package( project_path = ".", type = c("package", "renv"), pkgdown_yml = NULL )
project_path |
project_path |
type |
Type of dev_history. Multiple types possible among "package", "book", "renv". |
pkgdown_yml |
path to yaml conf for pkgdown |
Side Effect, add new files :
dev/dev_history
templates for pkgdown if pkgodwn_yml is not null
testthat
withr::with_tempdir({ project_path <- getwd() usethis::create_package(path = project_path, open = FALSE) add_kit_package(project_path, type = c("package", "book", "renv")) })
withr::with_tempdir({ project_path <- getwd() usethis::create_package(path = project_path, open = FALSE) add_kit_package(project_path, type = c("package", "book", "renv")) })
Add necessary files for any R project
add_kit_project(project_path = ".", name_licence, type_licence)
add_kit_project(project_path = ".", name_licence, type_licence)
project_path |
project_path |
name_licence |
Name for the licence |
type_licence |
should be a function, example : type_licence = usethis::use_proprietary_license |
Side Effect, add new files :
gitattributes
NEWS.md
withr::with_tempdir({ project_path <- getwd() usethis::create_project(path = project_path, open = FALSE) add_kit_project( project_path, name_licence = "Bob", type_licence = usethis::use_proprietary_license ) })
withr::with_tempdir({ project_path <- getwd() usethis::create_project(path = project_path, open = FALSE) add_kit_project( project_path, name_licence = "Bob", type_licence = usethis::use_proprietary_license ) })
Add labels to project
add_labels(project_id, lg = "fr")
add_labels(project_id, lg = "fr")
project_id |
project_id |
lg |
by default, fr to get labels in french. Use en for english |
Table of added labels. Side effect: labels added on GitLab.
## Not run: add_labels( project_id = project_id ) ## End(Not run)
## Not run: add_labels( project_id = project_id ) ## End(Not run)
Add Wiki
add_wikis( project_id, project_name, group_url, group = basename(group_url), type = c("home", "cr", "keys") )
add_wikis( project_id, project_name, group_url, group = basename(group_url), type = c("home", "cr", "keys") )
project_id |
project_id |
project_name |
project_name |
group_url |
group_url |
group |
group |
type |
type |
Types:
home: Home Page
cr: Comptes-rendus
keys: Key dates of the project
Tibble with wikis and GitLab infos.
## Not run: add_wikis( project_id = project_id, project_name = project_name, group_url = group_url, group = basename(group_url) ) ## End(Not run)
## Not run: add_wikis( project_id = project_id, project_name = project_name, group_url = group_url, group = basename(group_url) ) ## End(Not run)
add_wikis_github
add_wikis_github(owner, repo, type = c("home", "cr", "keys", "weekly"))
add_wikis_github(owner, repo, type = c("home", "cr", "keys", "weekly"))
owner |
Owner of the repository |
repo |
Repository name |
type |
Wiki type to add |
## Not run: add_wikis_github( owner = "ghowner", repo = "areponame" ) ## End(Not run)
## Not run: add_wikis_github( owner = "ghowner", repo = "areponame" ) ## End(Not run)
combien, if needed, to an existing .gitlab-ci.yml file
amend_yaml(path_to_yaml, connect_ci_list)
amend_yaml(path_to_yaml, connect_ci_list)
path_to_yaml |
pat to .gtilab-ci.yml file |
connect_ci_list |
list, output of |
# amend_yaml()
# amend_yaml()
Render bookdown bs4book
bs4_book_template( theme = bs4_book_theme(), repo = NULL, ..., lib_dir = "libs", pandoc_args = NULL, extra_dependencies = NULL, template = "default", split_bib = FALSE, footnotes_inline = TRUE )
bs4_book_template( theme = bs4_book_theme(), repo = NULL, ..., lib_dir = "libs", pandoc_args = NULL, extra_dependencies = NULL, template = "default", split_bib = FALSE, footnotes_inline = TRUE )
theme |
A named list or |
repo |
Either link to repository where book is hosted, used to generate
view source and edit buttons or a list with repository |
lib_dir , pandoc_args , extra_dependencies , split_bib , ...
|
Passed on to |
template |
Pandoc template to use for rendering. Pass |
footnotes_inline |
By default, footnotes will be set inline and shown on
hover. Set to |
A pagedown template
Build a pkgdown with extra reports tab for testdown and coverage output
build_pkgdown_with_reports( pkg = ".", pkgdown_path = "public", assets_path = "pkgdown/assets", reports = c("coverage", "testdown", "gitdown"), git_branch_ref = "main", overwrite_assets = TRUE )
build_pkgdown_with_reports( pkg = ".", pkgdown_path = "public", assets_path = "pkgdown/assets", reports = c("coverage", "testdown", "gitdown"), git_branch_ref = "main", overwrite_assets = TRUE )
pkg |
character The path to the package to be build and reported |
pkgdown_path |
character The relative path inside the package to store the final site |
assets_path |
character The relative path within the package to store the reports outputs |
reports |
character A vector of reports to be produced, can be any subset of |
git_branch_ref |
character A vector of the git branch to use, 'main' by default |
overwrite_assets |
logical Whether the assets directory to store reports should be overwritten |
None Generate a pkgdown with test and coverage reports
## Not run: # build_pkgdown_with_reports( # pkg = ".", # pkgdown_path = "public", # assets_path = "pkgdown/assets", # reports = c("testdown","coverage") ## End(Not run)
## Not run: # build_pkgdown_with_reports( # pkg = ".", # pkgdown_path = "public", # assets_path = "pkgdown/assets", # reports = c("testdown","coverage") ## End(Not run)
Check if yaml file already exist and ask permission for overwriting
check_if_yaml_exists(dir = ".", file_name = ".gitlab-ci.yml", append = TRUE)
check_if_yaml_exists(dir = ".", file_name = ".gitlab-ci.yml", append = TRUE)
dir |
directory to scan |
file_name |
filename to use .gitlab-ci.yml |
append |
boolean do we allow to append stage to existing ci file. TRUE by default |
# check_if_yaml_exists()
# check_if_yaml_exists()
Manage image in yaml
clean_image(ci)
clean_image(ci)
ci |
List of CI parameters, imported from yaml file |
list the list of CI parameters with a unique docker image
# pkgdown yml full <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-pkg.yml", package = "lozen")) # shiny yaml connect <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-shiny.yml", package = "lozen")) ci_list <- combine_ci(ci1 = full, ci2 = connect) ci_list <- clean_image(ci_list)
# pkgdown yml full <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-pkg.yml", package = "lozen")) # shiny yaml connect <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-shiny.yml", package = "lozen")) ci_list <- combine_ci(ci1 = full, ci2 = connect) ci_list <- clean_image(ci_list)
Clone project locally
clone_locally(project_name, group_url, full_url, project_path, open = TRUE)
clone_locally(project_name, group_url, full_url, project_path, open = TRUE)
project_name |
project_name |
group_url |
group_url |
full_url |
Full url to the repository. Superseeds group_url and project_name if used. |
project_path |
project_path |
open |
Logical. Whether to open the RStudio project. |
project_path. Side effect: clone the project.
## Not run: project_path <- clone_locally( project_name = the_project[["name"]], group_url = group_url, open = TRUE ) ## End(Not run)
## Not run: project_path <- clone_locally( project_name = the_project[["name"]], group_url = group_url, open = TRUE ) ## End(Not run)
Merge two yaml as a list into a combined list
combine_ci(ci1, ci2)
combine_ci(ci1, ci2)
ci1 |
List of initial CI parameters |
ci2 |
List of CI parameters to append to the initial CI |
list list of combined CI parameters
# pkgdown yml full <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-pkg.yml", package = "lozen")) # shiny yaml connect <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-shiny.yml", package = "lozen")) ci_list <- combine_ci(ci1 = full, ci2 = connect)
# pkgdown yml full <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-pkg.yml", package = "lozen")) # shiny yaml connect <- yaml::read_yaml(file = system.file("yaml", ".gitlab-ci-shiny.yml", package = "lozen")) ci_list <- combine_ci(ci1 = full, ci2 = connect)
Transform project as book with lozen template
create_book_project( project_path, bookdown_path = system.file("lozendown", package = "lozen"), css = NULL, footer = NULL, logo = NULL, index = NULL, output_yml = NULL )
create_book_project( project_path, bookdown_path = system.file("lozendown", package = "lozen"), css = NULL, footer = NULL, logo = NULL, index = NULL, output_yml = NULL )
project_path |
project_path |
bookdown_path |
a path to a bookdown |
css |
path(s) for css to copy |
footer |
path for footer to copy |
logo |
path for logo to copy |
index |
path for index to copy |
output_yml |
path for output_yml to copy |
Side Effect: Transform project as book
withr::with_tempdir({ project_path <- getwd() create_book_project(project_path) })
withr::with_tempdir({ project_path <- getwd() create_book_project(project_path) })
Title
create_deploy_ci_stage( image, deploy_function, stage_name = deploy_function, ... )
create_deploy_ci_stage( image, deploy_function, stage_name = deploy_function, ... )
image |
image#' |
deploy_function |
deploy_function |
stage_name |
stage_name |
... |
dots not used |
create_deploy_ci_stage( image = "rocker/verse", deploy_function = "deploy_connect_shiny" )
create_deploy_ci_stage( image = "rocker/verse", deploy_function = "deploy_connect_shiny" )
Create new project in a group
create_group_project( project_name, namespace_id, gitlab_con = "default", default_branch = "main" )
create_group_project( project_name, namespace_id, gitlab_con = "default", default_branch = "main" )
project_name |
name of the project to create |
namespace_id |
id of the group in which to add the project |
gitlab_con |
Connection credentials to GitLab.
Better use |
default_branch |
Default branch for the project created. Default to "main". |
project_id. Side effect: Create a project on GitLab if not exists.
## Not run: create_group_project( project_name = project_name, namespace_id = namespace_id, default_branch = "main" ) ## End(Not run)
## Not run: create_group_project( project_name = project_name, namespace_id = namespace_id, default_branch = "main" ) ## End(Not run)
Create new project on GitHub
create_group_project_github(repo, owner)
create_group_project_github(repo, owner)
repo |
name of the project to create |
owner |
Owner of the repo |
project_id. Side effect: Create a project on GitHub if not exists.
## Not run: create_group_project_github( repo = "areponame", owner = "ghowner" ) ## End(Not run)
## Not run: create_group_project_github( repo = "areponame", owner = "ghowner" ) ## End(Not run)
Generate text for client first issue in gitlab
create_issue_content_clients(project_name, group_url)
create_issue_content_clients(project_name, group_url)
project_name |
name of the project |
group_url |
url to gitlab website |
character vector of the issue content
## Not run: create_issue_content_clients( project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
## Not run: create_issue_content_clients( project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
Generate text for client first issue in github
create_issue_content_clients_github(owner, repo)
create_issue_content_clients_github(owner, repo)
owner |
owner of the project |
repo |
name of the project |
character vector of the issue content
## Not run: create_issue_content_clients_github( owner = "owner", repo = "repo" ) ## End(Not run)
## Not run: create_issue_content_clients_github( owner = "owner", repo = "repo" ) ## End(Not run)
Generate text for devs first issue in gitlab
create_issue_content_dev(project_id, group_url, project_name)
create_issue_content_dev(project_id, group_url, project_name)
project_id |
project_id |
group_url |
group_url |
project_name |
project_name |
character vector of the issue content
## Not run: create_issue_content_dev( project_id = "<get_your_id_project>", project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
## Not run: create_issue_content_dev( project_id = "<get_your_id_project>", project_name = "<get_your_project_name>", group_url = "<group_url_repo>" # should looks like "https://gitlab.com/cervan.girard/" ) ## End(Not run)
Generate text for dev first issue in github
create_issue_content_dev_github(owner, repo)
create_issue_content_dev_github(owner, repo)
owner |
owner of the project |
repo |
name of the project |
character vector of the issue content
## Not run: create_issue_content_dev_github( owner = "owner", repo = "repo" ) ## End(Not run)
## Not run: create_issue_content_dev_github( owner = "owner", repo = "repo" ) ## End(Not run)
Generate text for kickoff issue
create_issue_content_kickoff()
create_issue_content_kickoff()
character vector of the issue content
create_issue_content_kickoff()
create_issue_content_kickoff()
Create branch production from master
create_production(project_path)
create_production(project_path)
project_path |
project_path |
Side effect: New branch on the server
## Not run: create_production( project_path = project_path ) ## End(Not run)
## Not run: create_production( project_path = project_path ) ## End(Not run)
Create a R project with full content skeleton
create_r_project( project_path, type = c("package", "golem", "book"), name_licence, type_licence )
create_r_project( project_path, type = c("package", "golem", "book"), name_licence, type_licence )
project_path |
project_path |
type |
type |
name_licence |
name for the licence |
type_licence |
type of the licence, should be a function like usethis::use_mit_licence |
Side Effect: Transform project as package or book:
With package, golem or book skeleton
git necessary files
pkgdown or book template
GitLab CI
## Not run: # path to your local project project_path <- tempfile("my.local.project") ### R package skeleton create_r_project( project_path = project_path, type = c("package"), name_licence = "Bob", type_licence = usethis::use_proprietary_license ) ### Shiny app create_r_project( project_path = project_path, type = c("golem"), name_licence = "Bob", type_licence = usethis::use_proprietary_license ) ### Bookdown create_r_project( project_path = project_path, type = c("book"), name_licence = "Bob", type_licence = usethis::use_proprietary_license ) ## End(Not run)
## Not run: # path to your local project project_path <- tempfile("my.local.project") ### R package skeleton create_r_project( project_path = project_path, type = c("package"), name_licence = "Bob", type_licence = usethis::use_proprietary_license ) ### Shiny app create_r_project( project_path = project_path, type = c("golem"), name_licence = "Bob", type_licence = usethis::use_proprietary_license ) ### Bookdown create_r_project( project_path = project_path, type = c("book"), name_licence = "Bob", type_licence = usethis::use_proprietary_license ) ## End(Not run)
Before using it, please follow these steps :
deploy_connect_bookdown( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = NULL, deploy_dir = file.path(getwd(), "_book"), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), file_to_ignore_regex = ".Rprofile$|^.Renviron$|renv/|rstudio_.*/|deliverables/|dev/|data-raw/|dockerfiles/", forceUpdate = FALSE, lint = FALSE, ... )
deploy_connect_bookdown( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = NULL, deploy_dir = file.path(getwd(), "_book"), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), file_to_ignore_regex = ".Rprofile$|^.Renviron$|renv/|rstudio_.*/|deliverables/|dev/|data-raw/|dockerfiles/", forceUpdate = FALSE, lint = FALSE, ... )
connect_url |
URL of the Connect server |
connect_user |
User name to use to connect to the Connect server |
connect_api_token |
API token to use to connect to the Connect server |
app_name |
Name of the app to deploy |
deploy_dir |
Directory to deploy |
connect_name |
Name of the Connect server |
file_to_ignore_regex |
Regex to use to ignore files |
forceUpdate |
What should happen if there's no deployment record for
the app, but there's an app with the same name on the server? If Defaults to |
lint |
Lint the project before initiating deployment, to identify potentially problematic code? |
... |
Other arguments to pass to rsconnect::deployApp |
Ask the Mission Lead Dev for their deployment token on Connect, this is the one you will need to use.
Add the environment variables to your personal ".Renviron" to manually deploy to Connect:
Add CONNECT_USER
with username.
Add CONNECT_TOKEN
with the token.
Add CONNECT_URL
with the connect url
TODO
used for side effects
## Not run: if ( Sys.getenv("CONNECT_URL") != "" & Sys.getenv("CONNECT_USER") != "" & Sys.getenv("CONNECT_TOKEN") != "" ) { project_name <- "lozen-example-bookdown" tmpdir <- tempfile(pattern = "book-") dir.create(tmpdir) project_path <- file.path(tmpdir, project_name) bookdown::create_bs4_book(path = project_path) bookdown::render_book(input = project_path) deploy_connect_bookdown( app_name = project_name, deploy_dir = file.path(project_path, "_book") ) } ## End(Not run)
## Not run: if ( Sys.getenv("CONNECT_URL") != "" & Sys.getenv("CONNECT_USER") != "" & Sys.getenv("CONNECT_TOKEN") != "" ) { project_name <- "lozen-example-bookdown" tmpdir <- tempfile(pattern = "book-") dir.create(tmpdir) project_path <- file.path(tmpdir, project_name) bookdown::create_bs4_book(path = project_path) bookdown::render_book(input = project_path) deploy_connect_bookdown( app_name = project_name, deploy_dir = file.path(project_path, "_book") ) } ## End(Not run)
Before using it, please follow these steps :
deploy_connect_pkgdown( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = NULL, deploy_dir = c(file.path(getwd(), "public"), file.path(getwd(), "docs"), file.path(getwd(), "inst/site/"), file.path(getwd(), ".")), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), file_to_ignore_regex = ".Rprofile$|^.Renviron$|renv/|rstudio_.*/|deliverables/|dev/|data-raw/|dockerfiles/", forceUpdate = FALSE, lint = FALSE, app_primary_doc = "index.html", ... )
deploy_connect_pkgdown( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = NULL, deploy_dir = c(file.path(getwd(), "public"), file.path(getwd(), "docs"), file.path(getwd(), "inst/site/"), file.path(getwd(), ".")), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), file_to_ignore_regex = ".Rprofile$|^.Renviron$|renv/|rstudio_.*/|deliverables/|dev/|data-raw/|dockerfiles/", forceUpdate = FALSE, lint = FALSE, app_primary_doc = "index.html", ... )
connect_url |
URL of the Connect server |
connect_user |
User name to use to connect to the Connect server |
connect_api_token |
API token to use to connect to the Connect server |
app_name |
Name of the app to deploy |
deploy_dir |
vectoro Directory path to deploy, the first available with be used. default is c(file.path(getwd(), "public"), file.path(getwd(), "docs"), file.path(getwd(), "inst/site/"), file.path(getwd(), ".") ) |
connect_name |
Name of the Connect server |
file_to_ignore_regex |
Regex to use to ignore files |
forceUpdate |
What should happen if there's no deployment record for
the app, but there's an app with the same name on the server? If Defaults to |
lint |
Lint the project before initiating deployment, to identify potentially problematic code? |
app_primary_doc |
If the application contains more than one document, this parameter indicates the primary one, as a path relative to appDir. Can be NULL, in which case the primary document is inferred from the contents being deployed. |
... |
Other arguments to pass to rsconnect::deployApp |
Ask the Mission Lead Dev for their deployment token on Connect, this is the one you will need to use.
Add the environment variables to your personal ".Renviron" to manually deploy to Connect:
Add CONNECT_USER
with username.
Add CONNECT_TOKEN
with the token.
Add CONNECT_URL
with the connect url
TODO
used for side effects
## Not run: # We assume that you are working on a R package # if not done yet, create your pkgdown pkgdown::build_site( pkg = ".", override = list(destination = "inst/site/") ) if (Sys.getenv("CONNECT_URL") != "" & Sys.getenv("CONNECT_USER") != "" & Sys.getenv("CONNECT_TOKEN") != "") { deploy_connect_pkgdown( app_name = "titi", deploy_dir = file.path(project_path, "inst/site/") ) } ## End(Not run)
## Not run: # We assume that you are working on a R package # if not done yet, create your pkgdown pkgdown::build_site( pkg = ".", override = list(destination = "inst/site/") ) if (Sys.getenv("CONNECT_URL") != "" & Sys.getenv("CONNECT_USER") != "" & Sys.getenv("CONNECT_TOKEN") != "") { deploy_connect_pkgdown( app_name = "titi", deploy_dir = file.path(project_path, "inst/site/") ) } ## End(Not run)
Before using it, please follow these steps :
deploy_connect_shiny( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = NULL, deploy_dir = getwd(), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), file_to_ignore_regex = ".Rprofile$|^.Renviron$|renv/|rstudio_.*/|deliverables/|dev/|data-raw/|dockerfiles/", forceUpdate = FALSE, lint = FALSE, ... )
deploy_connect_shiny( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = NULL, deploy_dir = getwd(), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), file_to_ignore_regex = ".Rprofile$|^.Renviron$|renv/|rstudio_.*/|deliverables/|dev/|data-raw/|dockerfiles/", forceUpdate = FALSE, lint = FALSE, ... )
connect_url |
URL of the Connect server |
connect_user |
User name to use to connect to the Connect server |
connect_api_token |
API token to use to connect to the Connect server |
app_name |
Name of the app to deploy |
deploy_dir |
Directory to deploy |
connect_name |
Name of the Connect server |
file_to_ignore_regex |
Regex to use to ignore files |
forceUpdate |
What should happen if there's no deployment record for
the app, but there's an app with the same name on the server? If Defaults to |
lint |
Lint the project before initiating deployment, to identify potentially problematic code? |
... |
Other arguments to pass to rsconnect::deployApp |
Ask the Mission Lead Dev for their deployment token on Connect, this is the one you will need to use.
Add the environment variables to your personal ".Renviron" to manually deploy to Connect:
Add CONNECT_USER
with username.
Add CONNECT_TOKEN
with the token.
Add CONNECT_URL
with the connect url
TODO
used for side effects
## Not run: deploy_connect_shiny( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = "app_test" ) ## End(Not run)
## Not run: deploy_connect_shiny( connect_url = Sys.getenv("CONNECT_URL"), connect_user = Sys.getenv("CONNECT_USER"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), app_name = "app_test" ) ## End(Not run)
Fetch deployment status on Connect of a given app
fetch_connect( app_name, connect_api_token = Sys.getenv("CONNECT_TOKEN"), connect_url = Sys.getenv("CONNECT_URL") )
fetch_connect( app_name, connect_api_token = Sys.getenv("CONNECT_TOKEN"), connect_url = Sys.getenv("CONNECT_URL") )
app_name |
character Name of the app to be fetched |
connect_api_token |
character API token to enable access to Connect |
connect_url |
character URL to Connect server |
list A list containing the HTTP code status and the guid of the app
## Not run: fetch_connect(app_name = "my_app_name") ## End(Not run)
## Not run: fetch_connect(app_name = "my_app_name") ## End(Not run)
Create the template for standard issue on gitlab
gh_add_template_issue( project_path = ".", language = c("fr", "en"), type = c("full", "light") )
gh_add_template_issue( project_path = ".", language = c("fr", "en"), type = c("full", "light") )
project_path |
Path to the project |
language |
Language. Should be one of 'fr' or 'en' |
type |
Verbosity of comments in the template. Should be 'full' or 'light'. |
Side effect: create the template
# Try with a temp project ## Create temp dir and file project_path <- tempfile("myproject") dir.create(project_path) ## Add the full template in french gh_add_template_issue(project_path, language = "fr", type = "full") ## Add the full template in english gh_add_template_issue(project_path, language = "en", type = "full") ## Add the light template in french gh_add_template_issue(project_path, language = "fr", type = "light") ## Add the light template in english gh_add_template_issue(project_path, language = "en", type = "light") # suppress tmp folder unlink(project_path, recursive = TRUE)
# Try with a temp project ## Create temp dir and file project_path <- tempfile("myproject") dir.create(project_path) ## Add the full template in french gh_add_template_issue(project_path, language = "fr", type = "full") ## Add the full template in english gh_add_template_issue(project_path, language = "en", type = "full") ## Add the light template in french gh_add_template_issue(project_path, language = "fr", type = "light") ## Add the light template in english gh_add_template_issue(project_path, language = "en", type = "light") # suppress tmp folder unlink(project_path, recursive = TRUE)
Create a weekly issues summary for GitHub
gh_create_weekly( date_min = Sys.Date() - 7, date_max = Sys.Date(), user = "thinkr-open", repo = "fusen", verbose = FALSE, board_url )
gh_create_weekly( date_min = Sys.Date() - 7, date_max = Sys.Date(), user = "thinkr-open", repo = "fusen", verbose = FALSE, board_url )
date_min |
Minimal date to look for issues |
date_max |
Maximal date to look for issues |
user |
username or company name as shown on GitHub |
repo |
GitHub repository |
verbose |
Logical. Whether to return output in the console too. |
board_url |
url of the GitHub board. If using the "classic" board, which is deprecated by GitHub, you may want to use this url: |
A Weekly to copy-paste in a Wiki and a tibble
## Not run: if (Sys.getenv("GITHUB_PAT") != "") { user <- "ThinkR-open" repo <- "example-weekly" weekly <- gh_create_weekly( date_min = "2022-06-30", date_max = "2022-06-30", user = user, repo = repo, board_url = glue::glue("/repos/{user}/{repo}/projects") ) } ## End(Not run) # Copier dans le presse papier pour copier directement # clipr::write_clip(weekly$weekly_info)
## Not run: if (Sys.getenv("GITHUB_PAT") != "") { user <- "ThinkR-open" repo <- "example-weekly" weekly <- gh_create_weekly( date_min = "2022-06-30", date_max = "2022-06-30", user = user, repo = repo, board_url = glue::glue("/repos/{user}/{repo}/projects") ) } ## End(Not run) # Copier dans le presse papier pour copier directement # clipr::write_clip(weekly$weekly_info)
Create a weekly issues summary for GitHub (new board)
gh_create_weekly_new_projects_board( date_min, date_max, user, repo, board_url, github_token = Sys.getenv("GITHUB_PAT"), verbose = FALSE )
gh_create_weekly_new_projects_board( date_min, date_max, user, repo, board_url, github_token = Sys.getenv("GITHUB_PAT"), verbose = FALSE )
date_min |
Minimal date to look for issues |
date_max |
Maximal date to look for issues |
user |
username or company name as shown on GitHub |
repo |
GitHub repository |
board_url |
url of the GitHub board. |
github_token |
token access to graphQL API |
verbose |
Logical. Whether to return output in the console too. |
A Weekly to copy-paste in a Wiki and a tibble
## Not run: board_url <- "https://github.com/orgs/ThinkR-open/projects/4/" date_min <- "2022-06-30" date_max <- "2022-06-30" user <- "ThinkR-open" repo <- "example-weekly" if (Sys.getenv("GITHUB_PAT") != "") { weekly <- gh_create_weekly_new_projects_board( date_min = date_min, date_max = date_max, user = user, repo = repo, board_url = board_url, github_token = Sys.getenv("GITHUB_PAT"), verbose = FALSE ) } ## End(Not run) # Copier dans le presse papier pour copier directement # clipr::write_clip(weekly$weekly_info)
## Not run: board_url <- "https://github.com/orgs/ThinkR-open/projects/4/" date_min <- "2022-06-30" date_max <- "2022-06-30" user <- "ThinkR-open" repo <- "example-weekly" if (Sys.getenv("GITHUB_PAT") != "") { weekly <- gh_create_weekly_new_projects_board( date_min = date_min, date_max = date_max, user = user, repo = repo, board_url = board_url, github_token = Sys.getenv("GITHUB_PAT"), verbose = FALSE ) } ## End(Not run) # Copier dans le presse papier pour copier directement # clipr::write_clip(weekly$weekly_info)
Create a weekly issues summary for GitHub
gh_create_weekly_old_and_new_boards( date_min, date_max, user, repo, board_url, new_board = TRUE, regex_done = "close|closed|done", regex_validation = "a valider|validation", regex_blocked = "blocked|bloque|bloqu\\\\u00e9", regex_inprogress = "in progress|en cours|review|revision|r\\\\u00e9vision|r\\\\u00e9-validation", regex_ready = "ready|pret|pr\\\\u00eat", github_token = Sys.getenv("GITHUB_PAT"), verbose = FALSE )
gh_create_weekly_old_and_new_boards( date_min, date_max, user, repo, board_url, new_board = TRUE, regex_done = "close|closed|done", regex_validation = "a valider|validation", regex_blocked = "blocked|bloque|bloqu\\\\u00e9", regex_inprogress = "in progress|en cours|review|revision|r\\\\u00e9vision|r\\\\u00e9-validation", regex_ready = "ready|pret|pr\\\\u00eat", github_token = Sys.getenv("GITHUB_PAT"), verbose = FALSE )
date_min |
Minimal date to look for issues |
date_max |
Maximal date to look for issues |
user |
username or company name as shown on GitHub |
repo |
GitHub repository |
board_url |
url of the GitHub board. If using the "classic" board, which is deprecated by GitHub, you may want to use this url: |
new_board |
logical. Are you working with the classic board or the new board. |
regex_done |
Regular expression to detect labels for issues done by developers (and potentially awaiting validation by clients) |
regex_validation |
Regular expression to detect labels for issues waiting for validation |
regex_blocked |
Regular expression to detect labels for issues blocked (and potentially awaiting information by clients) |
regex_inprogress |
Regular expression to detect labels for issues in progress (and potentially awaiting review by lead dev.) |
regex_ready |
Regular expression to detect labels for issues ready (and potentially reorder by lead dev.) |
github_token |
token access to github API (read:project scope is required for the new github board). |
verbose |
Logical. Whether to return output in the console too. |
A Weekly to copy-paste in a Wiki and a tibble
## Not run: user <- "ThinkR-open" repo <- "example-weekly" date_min <- "2022-06-30" date_max <- "2022-06-30" board_url_old <- glue::glue("/repos/{user}/{repo}/projects") board_url_new <- "https://github.com/orgs/ThinkR-open/projects/4/" # old board weekly_old <- gh_create_weekly_old_and_new_boards( date_min = date_min, date_max = date_max, user = user, repo = repo, board_url = board_url_old, new_board = FALSE, verbose = FALSE ) cat(weekly_old$weekly_info) # clipr::write_clip(weekly_old$weekly_info) # new board weekly_new <- gh_create_weekly_old_and_new_boards( date_min = date_min, date_max = date_max, user = user, repo = repo, board_url = board_url_new, github_token = Sys.getenv("GITHUB_PAT"), new_board = TRUE, verbose = FALSE ) cat(weekly_new$weekly_info) # clipr::write_clip(weekly_new$weekly_info) ## End(Not run)
## Not run: user <- "ThinkR-open" repo <- "example-weekly" date_min <- "2022-06-30" date_max <- "2022-06-30" board_url_old <- glue::glue("/repos/{user}/{repo}/projects") board_url_new <- "https://github.com/orgs/ThinkR-open/projects/4/" # old board weekly_old <- gh_create_weekly_old_and_new_boards( date_min = date_min, date_max = date_max, user = user, repo = repo, board_url = board_url_old, new_board = FALSE, verbose = FALSE ) cat(weekly_old$weekly_info) # clipr::write_clip(weekly_old$weekly_info) # new board weekly_new <- gh_create_weekly_old_and_new_boards( date_min = date_min, date_max = date_max, user = user, repo = repo, board_url = board_url_new, github_token = Sys.getenv("GITHUB_PAT"), new_board = TRUE, verbose = FALSE ) cat(weekly_new$weekly_info) # clipr::write_clip(weekly_new$weekly_info) ## End(Not run)
Create the template for standard issue on gitlab
gl_add_template_issue( project_path = ".", language = c("fr", "en"), type = c("full", "light") )
gl_add_template_issue( project_path = ".", language = c("fr", "en"), type = c("full", "light") )
project_path |
Path to the project |
language |
Language. Should be one of 'fr' or 'en' |
type |
Verbosity of comments in the template. Should be 'full' or 'light'. |
Side effect: create the template
# Try with a temp project ## Create temp dir and file project_path <- tempfile("myproject") dir.create(project_path) ## Add the template in full french gl_add_template_issue(project_path, language = "fr", type = "full") ## Add the template in full english gl_add_template_issue(project_path, language = "en", type = "full") ## Add the template in light french gl_add_template_issue(project_path, language = "fr", type = "light") ## Add the template in light english gl_add_template_issue(project_path, language = "en", type = "light") # Suppress tmp folder unlink(project_path, recursive = TRUE)
# Try with a temp project ## Create temp dir and file project_path <- tempfile("myproject") dir.create(project_path) ## Add the template in full french gl_add_template_issue(project_path, language = "fr", type = "full") ## Add the template in full english gl_add_template_issue(project_path, language = "en", type = "full") ## Add the template in light french gl_add_template_issue(project_path, language = "fr", type = "light") ## Add the template in light english gl_add_template_issue(project_path, language = "en", type = "light") # Suppress tmp folder unlink(project_path, recursive = TRUE)
Create a Weekly/Daily summary of what happened in your GitLab Board
gl_create_weekly( project_id, date_min = Sys.Date() - 7, date_max = Sys.Date(), language = c("fr", "en"), gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), private_token = Sys.getenv("GITLAB_TOKEN"), verbose = FALSE, regex_done = "close|closed|done", regex_validation = "a valider|validation", regex_blocked = "blocked|bloque|bloqu\\\\u00e9", regex_inprogress = "in progress|en cours|review|revision|r\\\\u00e9vision|r\\\\u00e9-validation", regex_ready = "ready|pret|pr\\\\u00eat", daily = FALSE, date_daily = Sys.Date(), max_page_opened = 10, max_page_closed = 5 ) gl_create_daily(...)
gl_create_weekly( project_id, date_min = Sys.Date() - 7, date_max = Sys.Date(), language = c("fr", "en"), gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), private_token = Sys.getenv("GITLAB_TOKEN"), verbose = FALSE, regex_done = "close|closed|done", regex_validation = "a valider|validation", regex_blocked = "blocked|bloque|bloqu\\\\u00e9", regex_inprogress = "in progress|en cours|review|revision|r\\\\u00e9vision|r\\\\u00e9-validation", regex_ready = "ready|pret|pr\\\\u00eat", daily = FALSE, date_daily = Sys.Date(), max_page_opened = 10, max_page_closed = 5 ) gl_create_daily(...)
project_id |
Id of the GitLab project |
date_min |
Minimal date to search from. The oldest date. |
date_max |
Maximal date to search to. The more recent date. |
language |
Character. Language: 'fr' ou 'en'. |
gitlab_url |
URL of the GitLab Forge |
private_token |
Your private GitLab instance token allowed to use the "api". |
verbose |
Logical. Whether to show the outputs in the console. |
regex_done |
Regular expression to detect labels for issues done by developers (and potentially awaiting validation by clients) |
regex_validation |
Regular expression to detect labels for issues waiting for validation |
regex_blocked |
Regular expression to detect labels for issues blocked (and potentially awaiting information by clients) |
regex_inprogress |
Regular expression to detect labels for issues in progress (and potentially awaiting review by lead dev.) |
regex_ready |
Regular expression to detect labels for issues ready (and potentially reorder by lead dev.) |
daily |
Logical. Create the daily issues summary for GitLab |
date_daily |
Date to search from. |
max_page_opened |
a numeric. The maximum number of pages to retrieve for open issues. Defaults to 10. |
max_page_closed |
a numeric. The maximum number of pages to retrieve for close issues. Defaults to 5. |
... |
Additional arguments |
A Weekly to copy-paste in a Wiki and a tibble
Visualise the progress of the milestones for GitLab
gl_get_milestones_progress( project_id, language = c("fr", "en"), gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), private_token = Sys.getenv("GITLAB_TOKEN"), color = "#f15522" )
gl_get_milestones_progress( project_id, language = c("fr", "en"), gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), private_token = Sys.getenv("GITLAB_TOKEN"), color = "#f15522" )
project_id |
Id of the GitLab project |
language |
Character. Language: 'fr' ou 'en'. |
gitlab_url |
URL of the GitLab Forge |
private_token |
Your private GitLab instance token allowed to use the "api". |
color |
by defaut, warning color |
A ggplot
## Not run: gl_get_milestones_progress( project_id = "<get_your_id_project>", private_token = Sys.getenv("GITLAB_TOKEN") ) ## End(Not run)
## Not run: gl_get_milestones_progress( project_id = "<get_your_id_project>", private_token = Sys.getenv("GITLAB_TOKEN") ) ## End(Not run)
This function helps you retrieving the status of a project board within the organization
graphql_to_tibble(board_url, github_token = Sys.getenv("GITHUB_PAT"))
graphql_to_tibble(board_url, github_token = Sys.getenv("GITHUB_PAT"))
board_url |
url of the github project board |
github_token |
access token to the graphql api |
a tibble
## Not run: # Example with board hosted in an organization github account board_url_organization <- "https://github.com/orgs/ThinkR-open/projects/4/" github_token <- Sys.getenv("GITHUB_PAT") graphql_to_tibble( board_url = board_url_organization, github_token = github_token ) # Example with board hosted in a user github account board_url_user <- "https://github.com/users/the-thinkr/projects/1" github_token <- Sys.getenv("GITHUB_PAT") graphql_to_tibble( board_url = board_url_user, github_token = github_token ) ## End(Not run)
## Not run: # Example with board hosted in an organization github account board_url_organization <- "https://github.com/orgs/ThinkR-open/projects/4/" github_token <- Sys.getenv("GITHUB_PAT") graphql_to_tibble( board_url = board_url_organization, github_token = github_token ) # Example with board hosted in a user github account board_url_user <- "https://github.com/users/the-thinkr/projects/1" github_token <- Sys.getenv("GITHUB_PAT") graphql_to_tibble( board_url = board_url_user, github_token = github_token ) ## End(Not run)
Convert html to odt with template
html_to_odt(input_html = "_main.html", output_odt = "_main.odt")
html_to_odt(input_html = "_main.html", output_odt = "_main.odt")
input_html |
Path to html file to convert |
output_odt |
Path to odt to create |
## Not run: html_to_odt(input_html = "_main.html", output_odt = "_main.odt") ## End(Not run)
## Not run: html_to_odt(input_html = "_main.html", output_odt = "_main.odt") ## End(Not run)
Init a new project with everything in one command
init_project_with_all( project_name, project_gitlab_id = NULL, config_path, project_path = tempfile("clone"), ... )
init_project_with_all( project_name, project_gitlab_id = NULL, config_path, project_path = tempfile("clone"), ... )
project_name |
The name of the project to be created |
project_gitlab_id |
GitLab ID of the project if it already exist on your Forge |
config_path |
The path to the yaml configuration file to use with your options to modify the default one. See details. |
project_path |
The path to the project if your want to keep it locally. Default to temporary directory. |
... |
Any parameter existing in the configuration file that you would like to use to override your config files |
By default, the project is a R package created on https://gitlab.com/about/ in your personal repository. Use your own configuration file to amend the default one.
The configuration file is a yaml file with all possible options. You do not have to specify all options as it will be combined with our default ones. Open the default one to see what is in it: file.edit(system.file("config_default_thinkr_gitlab.yml", package = "lozen"))
if (interactive()) { # Default on GitLab.com init_project_with_all(project_name = "newprojectpkg") # Change default options with your own config file init_project_with_all(project_name = "newprojectpkg", config_path = "<my-config-path>") # Add any extra option to override values of your config file once init_project_with_all(project_name = "newprojectpkg", config_path = "<my-config-path>", gitlab_namespace_id = "000") }
if (interactive()) { # Default on GitLab.com init_project_with_all(project_name = "newprojectpkg") # Change default options with your own config file init_project_with_all(project_name = "newprojectpkg", config_path = "<my-config-path>") # Add any extra option to override values of your config file once init_project_with_all(project_name = "newprojectpkg", config_path = "<my-config-path>", gitlab_namespace_id = "000") }
modify_autoclose_and_coverage on GitLab
modify_autoclose_and_coverage( project_id, autoclose = FALSE, build_coverage_regex = "Coverage: \\d+\\.\\d+" )
modify_autoclose_and_coverage( project_id, autoclose = FALSE, build_coverage_regex = "Coverage: \\d+\\.\\d+" )
project_id |
project_id |
autoclose |
Logical. Whether to autoclose issues when merged to main |
build_coverage_regex |
Character. regex used to retrieve code coverage in Ci logs. |
Side Effect on GitLab
## Not run: modify_autoclose_and_coverage( project_id = project_id ) ## End(Not run)
## Not run: modify_autoclose_and_coverage( project_id = project_id ) ## End(Not run)
Move Issues from GitLab to GitHub
move_issues_from_gitlab_to_github( gitlab_url = "https://gitlab.com/", github_url = "https://github.com/", gitlab_group, gitlab_repo, gitlab_project_id, github_owner, github_repo, gitlab_private_token = Sys.getenv("GITLAB_TOKEN"), github_token = NULL, sleep_time = 60, issue_start_over = 1, max_page = 10, force = FALSE )
move_issues_from_gitlab_to_github( gitlab_url = "https://gitlab.com/", github_url = "https://github.com/", gitlab_group, gitlab_repo, gitlab_project_id, github_owner, github_repo, gitlab_private_token = Sys.getenv("GITLAB_TOKEN"), github_token = NULL, sleep_time = 60, issue_start_over = 1, max_page = 10, force = FALSE )
gitlab_url |
GitLab instance URL |
github_url |
GitHub URL, default to <github.com> |
gitlab_group |
group name. Can be sub-group with "group/sub-group" format |
gitlab_repo |
Repo name on GitLab |
gitlab_project_id |
Repo ID on GitLab |
github_owner |
Owner of the project on GitHub |
github_repo |
Repo name of the project on GitHub. It should already exists. |
gitlab_private_token |
GitLab Token with API permissions |
github_token |
GitHub token. If NULL, will search for |
sleep_time |
Time in second to wait between each set of 5 issues. This is to reduce risk of being banned by GitHub. If you have time, Set to 60s by default. |
issue_start_over |
For debug. Number of the issue in GitLab to start over with in case of temporary ban by GitHub. |
max_page |
Maximum number of pages of issues to retrieve from GitLab. |
force |
Whether to force writing issue to GitHub, even if issue numbers mismatch with GitLab. |
Used for side effects. Issues are dowloaded and copied to GitHub
## Not run: move_issues_from_gitlab_to_github( gitlab_url = "https://gitlab.com/", github_url = "https://github.com/", gitlab_group = "thinkr-open", gitlab_repo = "example-weekly", gitlab_project_id = 37585948, github_owner = "ThinkR-open", github_repo = "example.mirror.issues.gl.gh", gitlab_private_token = Sys.getenv("GITLAB_TOKEN"), github_token = Sys.getenv("GITHUB_PAT"), sleep_time = 60, issue_start_over = 1, max_page = 10, force = FALSE ) ## End(Not run)
## Not run: move_issues_from_gitlab_to_github( gitlab_url = "https://gitlab.com/", github_url = "https://github.com/", gitlab_group = "thinkr-open", gitlab_repo = "example-weekly", gitlab_project_id = 37585948, github_owner = "ThinkR-open", github_repo = "example.mirror.issues.gl.gh", gitlab_private_token = Sys.getenv("GITLAB_TOKEN"), github_token = Sys.getenv("GITHUB_PAT"), sleep_time = 60, issue_start_over = 1, max_page = 10, force = FALSE ) ## End(Not run)
Render pagedown html_paged
paged_template( ..., css = c("default-fonts", "default-page", "default"), theme = NULL, template = pkg_resource("html", "paged.html"), csl = NULL, front_cover = NULL, back_cover = NULL )
paged_template( ..., css = c("default-fonts", "default-page", "default"), theme = NULL, template = pkg_resource("html", "paged.html"), csl = NULL, front_cover = NULL, back_cover = NULL )
... |
Arguments passed to
|
css |
A character vector of CSS and Sass file paths. If a path
does not contain the ‘.css’, ‘.sass’, or ‘.scss’ extension,
it is assumed to be a built-in CSS file. For example, |
theme |
The Bootstrap theme. By default, Bootstrap is not used. |
template |
The path to the Pandoc template to convert Markdown to HTML. |
csl |
The path of the Citation Style Language (CSL) file used to format citations and references (see the Pandoc documentation). |
front_cover , back_cover
|
Paths or urls to image files to be used as front or back covers. Theses images are available through CSS variables (see Details). |
A pagedown template
Define project status for a user
project_options(project_id, level = "watch")
project_options(project_id, level = "watch")
project_id |
project_id |
level |
The notification levels among disabled, participating, watch, global, mention, custom |
Side Effect on GitLab, allow reception of notifications.
## Not run: project_options( project_id, level = "watch" ) ## End(Not run)
## Not run: project_options( project_id, level = "watch" ) ## End(Not run)
Protect 'main' and 'production' from push on server
protect_branches(project_id, unprotect = FALSE)
protect_branches(project_id, unprotect = FALSE)
project_id |
project_id |
unprotect |
Logical. Whether to unprotect branches or not. |
Side effect: Branches protected from push on server.
## Not run: protect_branches( project_id = project_id ) # unprotect if wanted # protect_branches(project_id, unprotect = TRUE) ## End(Not run)
## Not run: protect_branches( project_id = project_id ) # unprotect if wanted # protect_branches(project_id, unprotect = TRUE) ## End(Not run)
Push everything on a branch
push_all_to_branch( project_path, branch = "main", main_branch = "main", message = "Init repo" )
push_all_to_branch( project_path, branch = "main", main_branch = "main", message = "Init repo" )
project_path |
project_path |
branch |
branch name. main by default |
main_branch |
main branch name. main by default |
message |
commit message |
Side effect: commit output
## Not run: push_all_to_branch( project_path = project_path ) ## End(Not run)
## Not run: push_all_to_branch( project_path = project_path ) ## End(Not run)
Push main to server
push_main( project_path, branch = "main", main_branch = "main", message = "Init repo" )
push_main( project_path, branch = "main", main_branch = "main", message = "Init repo" )
project_path |
project_path |
branch |
branch name. main by default |
main_branch |
main branch name. main by default |
message |
commit message |
Push master to server
push_master( project_path, branch = "master", main_branch = "master", message = "Init repo" )
push_master( project_path, branch = "master", main_branch = "master", message = "Init repo" )
project_path |
project_path |
branch |
branch name. main by default |
main_branch |
main branch name. main by default |
message |
commit message |
Import yaml CI files as list
read_ci(path = "./.gitlab-ci.yml")
read_ci(path = "./.gitlab-ci.yml")
path |
Path to the yaml file |
list a list of all CI parameters
yaml_path <- system.file("yaml", ".gitlab-ci-shiny.yml", package = "lozen") ci_list <- read_ci(path = yaml_path)
yaml_path <- system.file("yaml", ".gitlab-ci-shiny.yml", package = "lozen") ci_list <- read_ci(path = yaml_path)
Render a book with lozen formats
render_book( rmd_to_render = "index.Rmd", output_format = c("lozen::bs4_book_template", "lozen::paged_template"), output_dir = "_book", ... )
render_book( rmd_to_render = "index.Rmd", output_format = c("lozen::bs4_book_template", "lozen::paged_template"), output_dir = "_book", ... )
rmd_to_render |
rmd file to render |
output_format |
format to be user to render the book |
output_dir |
output directory |
... |
extra params to be used in bookdown::render_book |
a rendered book
## Not run: render_book("index.Rmd", output_format = "lozen::bs4_book_template") render_book("index.Rmd", output_format = "lozen::paged_template") ## End(Not run)
## Not run: render_book("index.Rmd", output_format = "lozen::bs4_book_template") render_book("index.Rmd", output_format = "lozen::paged_template") ## End(Not run)
Une a dev histroy file
Une a dev histroy file
use_dev_history(path = ".", type = c("package", "renv")) use_dev_history(path = ".", type = c("package", "renv"))
use_dev_history(path = ".", type = c("package", "renv")) use_dev_history(path = ".", type = c("package", "renv"))
path |
Path to project to add dev_history in |
type |
Type of dev_history. Multiple types possible among "package", "book", "renv". |
withr::with_tempdir({ use_dev_history(path = ".", type = c("package", "book", "renv")) }) withr::with_tempdir({ use_dev_history(path = ".", type = c("package", "book", "renv")) })
withr::with_tempdir({ use_dev_history(path = ".", type = c("package", "book", "renv")) }) withr::with_tempdir({ use_dev_history(path = ".", type = c("package", "book", "renv")) })
Set gitlab continuous integration
use_gitlab_ci( image = "rocker/verse", repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", project_path = ".", type = "check-coverage-pkgdown", bookdown_output_format = c("lozen::paged_template", "lozen::bs4_book_template"), overwrite = TRUE )
use_gitlab_ci( image = "rocker/verse", repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", project_path = ".", type = "check-coverage-pkgdown", bookdown_output_format = c("lozen::paged_template", "lozen::bs4_book_template"), overwrite = TRUE )
image |
Docker image used as basis. See https://github.com/rocker-org/rocker |
repo_name |
REPO_NAME environment variable for R CRAN mirror used |
project_path |
Path of the project to add CI in. |
type |
type of the CI template to use |
bookdown_output_format |
If type="bookdown" it corresponds to the function used to output the bookdown |
overwrite |
whether to overwrite existing GitLab CI yml file |
See use_gitlab_ci
withr::with_tempdir({ use_gitlab_ci(image = "r-base") }) withr::with_tempdir({ use_gitlab_ci( image = "rocker/verse", repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", type = "check-coverage-pkgdown" ) })
withr::with_tempdir({ use_gitlab_ci(image = "r-base") }) withr::with_tempdir({ use_gitlab_ci( image = "rocker/verse", repo_name = "https://packagemanager.rstudio.com/all/__linux__/focal/latest", type = "check-coverage-pkgdown" ) })
This function creates a file .gitlab-ci.yml
that will deploy something on Connect using a lozen::deploy_connect_*
functions.
use_gitlab_ci_deploy_connect( deploy_function = c("deploy_connect_shiny", "deploy_connect_pkgdown", "deploy_connect_bookdown"), stage_name = "deploy_connect", image = "rocker/verse:latest", dir = ".", append = TRUE, file_name = ".gitlab-ci.yml", ... ) use_gitlab_ci_deploy_connect_bookdown(...) use_gitlab_ci_deploy_connect_pkgdown(...) use_gitlab_ci_deploy_connect_shiny(...)
use_gitlab_ci_deploy_connect( deploy_function = c("deploy_connect_shiny", "deploy_connect_pkgdown", "deploy_connect_bookdown"), stage_name = "deploy_connect", image = "rocker/verse:latest", dir = ".", append = TRUE, file_name = ".gitlab-ci.yml", ... ) use_gitlab_ci_deploy_connect_bookdown(...) use_gitlab_ci_deploy_connect_pkgdown(...) use_gitlab_ci_deploy_connect_shiny(...)
deploy_function |
string caracter name of the |
stage_name |
name of the CI stage (need to be unique in the .gitlab-ci.yml file) |
image |
Docker image to use |
dir |
Directory to deploy |
append |
append the file .gitlab-ci.yml if it already exists |
file_name |
Name of the yaml file |
... |
param to pass to deploy_function |
Before using it, please follow these steps :
Ask the Mission Lead Dev for their deployment token on Connect, this is the one you will need to use.
Add the environment variables in the private variable hidden in the GitLab repository: Settings > CI/CD > Variables > Expand > Add variable /!\ if you check "Protected" when you create the variable, then it will be active only for protected branches
Add CONNECT_USER
with username.
Add CONNECT_TOKEN
with the token.
If you want to deploy an app
Be sure to have an app.R to deploy at the root of the folder, (if needed: use golem::add_rstudioconnect_file()
)
NB: The environment variable CONNECT_URL
is already defined generically on forge (only for group "thinkr").
used for side effects
# use_gitlab_ci_deploy_connect_bookdown() # Exemple avec pkgdown deployed_pkgdown <- tempfile(pattern = "pkgdown") dir.create(deployed_pkgdown) # rstudioapi::filesPaneNavigate(deployed_pkgdown) withr::with_dir(deployed_pkgdown, { use_gitlab_ci(type = "check-coverage-pkgdown") use_gitlab_ci_deploy_connect_pkgdown() }) deployed_shiny <- tempfile(pattern = "shiny") dir.create(deployed_shiny) # rstudioapi::filesPaneNavigate(deployed_shiny) # Exemple avec shiny withr::with_dir(deployed_shiny, { use_gitlab_ci(type = "check-coverage-pkgdown") use_gitlab_ci_deploy_connect_shiny() })
# use_gitlab_ci_deploy_connect_bookdown() # Exemple avec pkgdown deployed_pkgdown <- tempfile(pattern = "pkgdown") dir.create(deployed_pkgdown) # rstudioapi::filesPaneNavigate(deployed_pkgdown) withr::with_dir(deployed_pkgdown, { use_gitlab_ci(type = "check-coverage-pkgdown") use_gitlab_ci_deploy_connect_pkgdown() }) deployed_shiny <- tempfile(pattern = "shiny") dir.create(deployed_shiny) # rstudioapi::filesPaneNavigate(deployed_shiny) # Exemple avec shiny withr::with_dir(deployed_shiny, { use_gitlab_ci(type = "check-coverage-pkgdown") use_gitlab_ci_deploy_connect_shiny() })
Visualise the nature of the developments (conventional commits)
visualise_commits( project_id, gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), private_token = Sys.getenv("GITLAB_TOKEN"), path, ref = NULL, date_min = Sys.Date() - 7, date_max = Sys.Date(), language = c("fr", "en"), conv_tags = c("feat", "fix", "doc", "test", "ci", "refactor", "style", "chore"), color = "#15b7d6" )
visualise_commits( project_id, gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), private_token = Sys.getenv("GITLAB_TOKEN"), path, ref = NULL, date_min = Sys.Date() - 7, date_max = Sys.Date(), language = c("fr", "en"), conv_tags = c("feat", "fix", "doc", "test", "ci", "refactor", "style", "chore"), color = "#15b7d6" )
project_id |
Id of the GitLab project |
gitlab_url |
URL of the GitLab Forge |
private_token |
Your private GitLab instance token allowed to use the "api". |
path |
Path of the project if already pulled locally |
ref |
Branch name (or commit sha) from which to explore commits. By default NULL, it use the default branch |
date_min |
Minimal date to search from. The oldest date. |
date_max |
Maximal date to search to. The more recent date. |
language |
Character. Language: 'fr' ou 'en'. |
conv_tags |
Conventional commits tags |
color |
blue color for a graph |
A ggplot
## Not run: visualise_commits( project_id = "<get_your_id_project>", gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), date_min = "2022-09-22", date_max = "2022-09-29", private_token = Sys.getenv("GITLAB_TOKEN") ) # Or on project already cloned tempdir <- clone_locally(full_url = "https://gitlab.com/my_name/my_repo", open = FALSE) visualise_commits( path = tempdir, date_min = "2022-09-22", date_max = "2022-09-29" ) ## End(Not run)
## Not run: visualise_commits( project_id = "<get_your_id_project>", gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), date_min = "2022-09-22", date_max = "2022-09-29", private_token = Sys.getenv("GITLAB_TOKEN") ) # Or on project already cloned tempdir <- clone_locally(full_url = "https://gitlab.com/my_name/my_repo", open = FALSE) visualise_commits( path = tempdir, date_min = "2022-09-22", date_max = "2022-09-29" ) ## End(Not run)
This functions allows its users to launch an expression to initiate a given gitlab ci workflow within a dummy project on a #' gitlab instance.
with_gitlab_project( gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), namespace_id, private_token = Sys.getenv("GITLAB_TOKEN"), connect_url = Sys.getenv("CONNECT_URL"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), connect_user = Sys.getenv("CONNECT_USER"), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), project_name = "lozen.test.project", branch_focus_for_ci = "main", exp )
with_gitlab_project( gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), namespace_id, private_token = Sys.getenv("GITLAB_TOKEN"), connect_url = Sys.getenv("CONNECT_URL"), connect_api_token = Sys.getenv("CONNECT_TOKEN"), connect_user = Sys.getenv("CONNECT_USER"), connect_name = Sys.getenv("CONNECT_NAME", unset = "connect"), project_name = "lozen.test.project", branch_focus_for_ci = "main", exp )
gitlab_url |
A character string. The url of the gilab instance. |
namespace_id |
An integer. The id of the gitlab group to create the project in. |
private_token |
A character string. The token to gain access to the gitlab api. |
connect_url |
A character string. The URL to the Connect server. |
connect_api_token |
A character string. The token to gain access to the Connect API. The token must be granted admin access. |
connect_user |
A character string. User name on Connect. |
connect_name |
A character string. Name of the Connect server (default "connect") |
project_name |
A character string. The name of the project to be created. |
branch_focus_for_ci |
Name of the branch to be targeted for the CI pipeline. |
exp |
A valid R expression initializing a project and a gitlab ci workflow. |
A data.frame containing information about jobs of the gitlab project.
## Not run: output <- with_gitlab_project( gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), namespace_id = NULL, private_token = Sys.getenv("GITLAB_TOKEN"), project_name = "bookdown.test.project", exp = { lozen::create_r_project( project_path = getwd(), type = "book", name_licence = "Bobo", type_licence = usethis::use_mit_license ) lozen::use_gitlab_ci(type = "bookdown", bookdown_output_format = "lozen::paged_template") } ) output ## End(Not run)
## Not run: output <- with_gitlab_project( gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"), namespace_id = NULL, private_token = Sys.getenv("GITLAB_TOKEN"), project_name = "bookdown.test.project", exp = { lozen::create_r_project( project_path = getwd(), type = "book", name_licence = "Bobo", type_licence = usethis::use_mit_license ) lozen::use_gitlab_ci(type = "bookdown", bookdown_output_format = "lozen::paged_template") } ) output ## End(Not run)