The objective of {lozen} is to centralize project management tools for Devs and Lead Devs.
To use the package, as user or as developer, you will have to define some tokens and environment variables. Go to the dedicated section below “Use {lozen} as user” or “Use {lozen} as developer”.
Installation
From Github
remotes::install_github(
repo = "ThinkR-open/lozen",
build_vignettes = TRUE
)
From r-universe
install.packages(
"lozen",
repos = c("https://thinkr-open.r-universe.dev", "https://cloud.r-project.org")
)
#> Installation du package dans 'C:/Users/yohann/AppData/Local/R/win-library/4.2'
#> (car 'lib' n'est pas spécifié)
#> le package 'lozen' a été décompressé et les sommes MD5 ont été vérifiées avec succés
#>
#> Les packages binaires téléchargés sont dans
#> C:\Users\yohann\AppData\Local\Temp\Rtmp86E83L\downloaded_packages
Use of the package, depending if you are a user or a developer
Use {lozen} as user
You need to use this kind of .Renviron
file:
="my.token.generated.in.gitlab"
GITLAB_TOKEN="https://my.gitlab.url"
GITLAB_URL="my.personal.access.token.generated.in.github"
GITHUB_PAT="https://my.connect.url"
CONNECT_URL="my.connect.server.name"
CONNECT_NAME="my.connect.username"
CONNECT_USER="my.api.key.generated.in.connect" CONNECT_TOKEN
You can use the command line usethis::edit_r_environ()
to open a .Renviron
file. Save the values inside as mentioned above, and restart your R session.
Depending on your needs, you will have to set all of them (GitLab, GitHub and Posit Connect), or just some of them. See the details sections below to have more information about how to create them.
If you wish to use function related to Posit Connect, you must set your Connect account manually within Rstudio.
Use {lozen} as developer
Note that unit tests will create and publish some elements on your own instances (GitLab, GitHub, Posit Connect). These objects will be automatically deleted at the end of the tests.
You need to use this kind of .Renviron
file:
="my.token.generated.in.gitlab"
GITLAB_TOKEN="https://my.gitlab.url"
GITLAB_URL="TRUE"
ALLOW_CI_TESTS_ON_GITLAB="my.personal.access.token.generated.in.github"
GITHUB_PAT="https://my.connect.url"
CONNECT_URL="my.connect.server.name"
CONNECT_NAME="my.connect.username"
CONNECT_USER="my.api.key.generated.in.connect"
CONNECT_TOKEN="TRUE" ALLOW_TESTS_TO_DEPLOY_ON_CONNECT
You can use the command line usethis::edit_r_environ()
to open a .Renviron
file. Save the values inside as mentioned above, and restart your R session.
You will have to set all of them (GitLab, GitHub and Posit Connect), to be sure all unit tests can be launched. See the details sections below to have more information about how to create them.
Please note that unit tests using gert might show a prompt asking for your gitlab username and password. For the latter, you must provide your gitlab password, not a token.
For tests deploying content on Posit Connect, you must set your Connect account manually within Rstudio and must have deployed manually a content at least once before being able to run the tests.
More details about how to create tokens and define environment variables
GitLab
-
GITLAB_TOKEN
: Create a personal access token on GitLab, with the rights: “read_repository”, “write_repository”, “api”, “read_api” -
GITLAB_URL
: url of your gitlab instance - if this isgitlab.com
, you do not have to specify it, because this is the default value used by the package
GitHub
-
GITHUB_PAT
: Create a personal access token on GitHub - the following scopes must be granted with your token “admin:org”, “delete_repo”, “project”, “repo”, “user”, “workflow.”
Posit Connect
-
CONNECT_URL
: Url of your Posit Connect -
CONNECT_NAME
: Name of your Posit Connect server - to know this information, please usersconnect::accounts()$server
. if this isconnect
, you do not have to specify it, because this is the default value defined by Posit Connect once a first connection has been made to the server -
CONNECT_USER
: Your username in your Posit Connect -
CONNECT_TOKEN
: Personal access token of your Posit Connect - please follow the official documentation to create it
Documentation
Access to the pkgdown: https://thinkr-open.github.io/lozen/
Vignettes/articles
Documentation dedicated to the users (Devs, Lead Devs)
-
aa - Create a new project with GitLab
: Create a new R project for a mission - managed on GitLab, with everything needed (the R project skeleton, the init of git, the init of the project on GitLab, etc.) -
ab - Create a new project with GitHub
: Create a new R project for a mission - managed on GitHub, with everything needed (the R project skeleton, the init of git, the init of the project on GitLab, etc.) (WIP) -
ac - Create the skeleton of the R project (package, app, book)
: Add the skeleton of a R product in your project -
ad - Set up continuous integration and continuous deployment for Gitlab CI/CD
: Set up the publication of your product -
ae - Create Weekly with GitHub or GitLab
: Generate a weekly/daily for a mission -
af - Build a pkgdown with reports
: Build a pkgdown with coverage and test reports -
ba - Manage forge board and wiki
: Create and manage your communication tools on Gitlab -
bb - Manage git tools (branches, commits, etc.)
: Manage your repository on Gitlab