Skip to content

Commit

Permalink
removed functionality of opening RStudio after create_survey(), bug…
Browse files Browse the repository at this point in the history
… fix on ignoring survey.Rproj
  • Loading branch information
jhelvy committed Jul 16, 2024
1 parent e190cfa commit 9a9acc6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
^data-raw$
^.*\.Rproj$
surveydown.Rproj
^\.Rproj\.user$
^docs$
^notes$
Expand Down
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Imports:
markdown,
readr,
RPostgres,
rstudioapi,
rvest,
shiny,
shinyjs,
Expand Down
10 changes: 1 addition & 9 deletions R/templates.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' This function creates a survey template in a specified directory. It can use
#' different templates, with `"simple"` being the default. The function prompts
#' the user to confirm the use of the current working directory if no path is
#' specified. It also opens the new project in RStudio.
#' specified.
#'
#' @param path A character string specifying the directory in which to create
#' the survey template. Defaults to the current working directory.
Expand Down Expand Up @@ -52,12 +52,4 @@ create_survey <- function(path = getwd(), template = "simple") {
file.copy(list.files(source_dir, full.names = TRUE), path, recursive = TRUE)

usethis::ui_done(paste("Survey template created at", path))

# Change to the new project if running in RStudio
if (requireNamespace("rstudioapi", quietly = TRUE) && rstudioapi::isAvailable()) {
proj_file <- file.path(path, "survey.Rproj")
if (file.exists(proj_file)) {
rstudioapi::openProject(proj_file)
}
}
}
2 changes: 1 addition & 1 deletion man/create_survey.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a9acc6

Please sign in to comment.