pkgload::load_all() source("dev/testor_tools.R")
You will need a environment variable named "FORGE_THINKR_TOKEN"
with your token.
gitlab_forge_url <- "https://forge.thinkr.fr" set_gitlab_connection( gitlab_url = gitlab_forge_url, private_token = Sys.getenv("FORGE_THINKR_TOKEN") )
project_name <- "example-bookdown" project_url <- gl_list_group_projects(27) %>% # thinkrverse filter(name == project_name) %>% pull(path_with_namespace) if (length(project_url) != 0) { message("The project already exists") } else { project_info <- gl_new_project( name = project_name, default_branch = "main", namespace_id = 27, # thinkrverse initialize_with_readme = TRUE ) project_url <- project_info$path_with_namespace }
## Create tmp dir tmpdir <- tempfile(pattern = "book-") dir.create(tmpdir) project_path <- file.path(tmpdir, project_name) ## Clone in tmp dir clone_locally( project_name = project_url, group_url = gitlab_forge_url, project_path = project_path, open = FALSE )
## Create bookdown bookdown::create_bs4_book( path = project_path ) ## Try to render bookdown bookdown::render_book( input = project_path )
push_to_repo( project_path, message = 'Init bookdown repo' )
project_id <- gl_get_project_id( project_name = project_name ) gitlab(req = paste0("projects/", project_id), verb = httr::DELETE) ## Clean the tmpdir unlink(project_path, recursive = TRUE)
You will need a environment variable named "GITLAB_COM_TOKEN"
with your token.
gitlab_url <- "https://gitlab.com" ## Set connection set_gitlab_connection( gitlab_url = gitlab_url, private_token = Sys.getenv("GITLAB_COM_TOKEN") )
project_name <- "example-bookdown" project_url <- gl_list_group_projects(15567755) %>% # thinkr-open filter(name == project_name) %>% pull(path_with_namespace) if (length(project_url) != 0) { message("The project already exists") } else { project_info <- gl_new_project( name = project_name, default_branch = "main", namespace_id = 15567755, # thinkr-open initialize_with_readme = TRUE ) project_url <- project_info$path_with_namespace }
## Create tmp dir tmpdir <- tempfile(pattern = "book-") dir.create(tmpdir) project_path <- file.path(tmpdir, project_name) ## Clone in tmp dir clone_locally( project_name = project_info$path, group_url = "https://gitlab.com/thinkr-open", project_path = project_path, open = FALSE )
## Create bookdown bookdown::create_bs4_book( path = project_path ) ## Try to render bookdown bookdown::render_book( input = project_path )
push_to_repo( project_path, message = 'Init bookdown repo' )
project_id <- gl_get_project_id( project_name = project_name ) gitlab(req = paste0("projects/", project_id), verb = httr::DELETE) ## Clean the tmpdir unlink(project_path, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.