#' Push Changes to Github
#'
#' @return
#' @export
#' @import stringi dplyr
#' @importFrom glue glue
#' @importFrom stringi stri_rand_strings
#' @examples
push_website_changes_to_github <-
function() {
word_length <- sample(x = 2:16, 1)
string_length <- sample(1:4, 1)
commit_message <- stri_rand_strings(n = string_length, length = word_length)
system_text <-
glue(' cd
cd Desktop/abresler.github.io/
ls
git add .
git commit -m "{commit_message}"
git push origin
cd
')
system(command = system_text)
}
#' Push Based Musings Blog Changes to Github
#'
#' Pushes changes to `based_musings` quarto blog to github
#'
#' @return
#' @export
#'
#' @examples
push_musings_changes_to_github <-
function() {
word_length <- sample(x = 2:16, 1)
string_length <- sample(1:4, 1)
commit_message <- stri_rand_strings(n = string_length, length = word_length)
system_text <-
glue(' cd
cd Desktop/based_musings/
ls
git add .
git commit -m "{commit_message}"
git push origin
cd
')
system(command = system_text)
}
#' Sheldon
#'
#' @return
#' @export
#'
#' @examples
push_sheldon_changes_to_github <-
function() {
word_length <- sample(x = 2:16, 1)
string_length <- sample(1:4, 1)
commit_message <- stri_rand_strings(n = string_length, length = word_length)
system_text <-
glue(' cd
cd Desktop/sheldon_website/
ls
git add .
git commit -m "{commit_message}"
git push origin
cd
')
system(command = system_text)
}
#' Push r package or repo to github
#'
#' @param base_path base path of the folder
#' @param repo name of the repo folder
#'
#' @return
#' @export
#'
#' @examples
push_repo_to_github <-
function(repo = NULL, base_path = "Desktop/r_packages") {
if (length(repo) == 0) {
message("Enter repo")
return(invisible())
}
actual_repo <-
glue::glue("{base_path}/{repo}")
word_length <- sample(x = 2:16, 1)
string_length <- sample(1:4, 1)
commit_message <-
stri_rand_strings(n = string_length, length = word_length)
system_text <-
glue(' cd
cd {actual_repo}
ls
git add .
git commit -m "{commit_message}"
git push origin
cd
')
system(command = system_text)
}
#' Return Tree Path
#'
#' @param path
#'
#' @return
#' @export
#'
#' @examples
#'
#' tree_path(path = "Desktop/data/usa_spending/fpds/")
#'
tree_path <-
function(path = NULL) {
if (length(path) == 0) {
return(invisible())
}
oldwd <- getwd()
setwd("~")
system(glue::glue("tree {path}"))
if (getwd() != oldwd) {
setwd(oldwd)
}
invisible()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.