Browse Source

clean and go

master
boB Rudis 6 years ago
parent
commit
b0f1e7c499
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 1
      NAMESPACE
  2. 19
      R/cleanAndGo.R
  3. 5
      inst/rstudio/addins.dcf
  4. 11
      man/cleanAndGo.Rd

1
NAMESPACE

@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand
export(bare_combine)
export(cleanAndGo)
export(enslave)
export(join_rows)
export(rantAddin)

19
R/cleanAndGo.R

@ -0,0 +1,19 @@
#' Clean the environment and run the active script
#'
#' @export
cleanAndGo <- function() {
ctx <- rstudioapi::getActiveDocumentContext()
if (!is.null(ctx)) {
do.call(rm, as.list(ls(all.names = TRUE, envir = .GlobalEnv)), envir = .GlobalEnv)
tf <- tempfile(fileext = ".R")
writeLines(ctx$contents, con = tf)
source(tf, local = FALSE)
}
}

5
inst/rstudio/addins.dcf

@ -26,4 +26,9 @@ Interactive: true
Name: Enslave
Description: Run a code selection as an RStudio background job task
Binding: enslave
Interactive: false
Name: CleanAndGo
Description: Cleanse the environment and execute the script
Binding: cleanAndGo
Interactive: false

11
man/cleanAndGo.Rd

@ -0,0 +1,11 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cleanAndGo.R
\name{cleanAndGo}
\alias{cleanAndGo}
\title{Clean the environment and run the active script}
\usage{
cleanAndGo()
}
\description{
Clean the environment and run the active script
}
Loading…
Cancel
Save