Skip to content

Commit

Permalink
release prep
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Oct 15, 2024
1 parent 2bea100 commit 4ee4324
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 45 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
20 changes: 8 additions & 12 deletions R/create_symlink.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,17 @@
#' path is a network drive.
#'
#' @param to target file or directory to which the shortcut should point to.
#' @param name symbolic link folder name. Default folder name is `"secure_data"``
#' @inheritDotParams R.utils::createLink
#' @seealso [R.utils::createLink()]
#' @param name symbolic link folder name. Default folder name is `"secure_data"`
#' @param ... arguments passed on to `R.utils::createLink()`
#' @seealso [`R.utils::createLink()`]
#' @export
#' @author Daniel D. Sjoberg
#' @returns NULL, Places the path or pathname to the link.
#' @examples
#' # only run fn interactively, will place symbolic link in current working dir
#' if (interactive()) {
#' # Using `starter_symlink()` to establish a symbolic link to a
#' # mapped networked data folder.
#' # The default name of the symlink folder is 'secure_data'
#' create_symlink("O:/Outcomes/Project Folder/Data")
#' }

#' @examplesIf interactive()
#' # Using `starter_symlink()` to establish a symbolic link to a
#' # mapped networked data folder.
#' # The default name of the symlink folder is 'secure_data'
#' create_symlink("O:/Outcomes/Project Folder/Data")
create_symlink <- function(to, name = "secure_data", ...) {
# checking inputs ------------------------------------------------------------
# checking folder name a string of length 1
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ create_project(
open = FALSE # don't open project in new RStudio session
)
#> ✔ Using "Default Project Template" template
#> ✔ Writing folder '/var/folders/6f/gdjf_vxj2wl3jhmxdkd1hd_w0000gn/T/Rtmp1h8KQ5/My Project Folder'
#> ✔ Writing folder '/var/folders/6f/gdjf_vxj2wl3jhmxdkd1hd_w0000gn/T/RtmpTUywzl/My Project Folder'
#> ✔ Writing files "README.md", ".gitignore", "My Project Folder.Rproj", and ".Rprofile"
#> ✔ Initialising Git repo
#> ✔ Initialising renv project
#> - Lockfile written to "/private/var/folders/6f/gdjf_vxj2wl3jhmxdkd1hd_w0000gn/T/Rtmp1h8KQ5/My Project Folder/renv.lock".
#> - renv infrastructure has been generated for project "/private/var/folders/6f/gdjf_vxj2wl3jhmxdkd1hd_w0000gn/T/Rtmp1h8KQ5/My Project Folder".
#> - Lockfile written to "/private/var/folders/6f/gdjf_vxj2wl3jhmxdkd1hd_w0000gn/T/RtmpTUywzl/My Project Folder/renv.lock".
#> - renv infrastructure has been generated for project "/private/var/folders/6f/gdjf_vxj2wl3jhmxdkd1hd_w0000gn/T/RtmpTUywzl/My Project Folder".
```

## Example Templates
Expand Down
3 changes: 0 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
## R CMD check results

> checking CRAN incoming feasibility ... NOTE
Maintainer: 'Daniel D. Sjoberg <danield.sjoberg@gmail.com>'
0 errors √ | 0 warnings √ | 0 note √

## Additional Comments
Expand Down
21 changes: 8 additions & 13 deletions man/create_symlink.Rd

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

26 changes: 13 additions & 13 deletions vignettes/create_project.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ vignette: >
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
Expand All @@ -29,7 +29,7 @@ Users can also create a personalized project templates. Instructions for creatin
Let's create a new project and inspect the results.
The new project will be created in a the folder called `"My Project Folder"`.

```{r, message=FALSE}
```{r proj-setup, message=FALSE}
# loading packages
library(starter)
Expand All @@ -39,7 +39,7 @@ project_path <- fs::path(tempdir(), "My Project Folder")

Let's set up our new project.

```{r}
```{r proj-create}
create_project(
path = project_path,
open = FALSE # don't open project in new RStudio session
Expand All @@ -54,15 +54,15 @@ The following is the `README.md` file added the project directory.
It's pre-filled with information specific to this project.
The first line of the file is the project folder name, followed by a R code for creating a symbolic link from the project folder to the secure data folder.

```{r, comment = "", echo=FALSE}
```{r readme, comment = "", echo=FALSE}
readr::read_file(fs::path(project_path, "README.md")) %>% cat()
```

### **`.gitignore`**

The `.gitignore` file is populated with various R files, data file types, and miscellaneous files typically not wanted in a Git repository.

```{r, comment = "", echo=FALSE}
```{r gitignore, comment = "", echo=FALSE}
readr::read_file(fs::path(project_path, ".gitignore")) %>% cat()
```

Expand Down Expand Up @@ -108,7 +108,7 @@ The list elements may be named any proper name within R.
However, the names must be unique and we recommend short names.
These do not need to match/reference any other text in the template file.

```{r}
```{r my_template}
my_template <-
list(
gitignore = list(),
Expand All @@ -128,7 +128,7 @@ The lists contain three important pieces of information about each template file

The metadata for the `README.md` file in the default template looks like this:

```{r, eval=FALSE}
```{r lst-readme, eval=FALSE}
readme <-
list(
template_filename = system.file("project_templates/default_readme.md", package = "starter"),
Expand All @@ -144,7 +144,7 @@ As another example, here's the metadata for the `*.Rproj` file from the default
Note that the file name can be dynamic (the use of `glue::glue()`), while the underlying file is not dynamic (`glue = FALSE`).
The list is stored as an expression so the template meta data is not evaluated until you call the `create_project()` function, allowing files to be dynamically named and template files to be saved within a package.

```{r, eval=FALSE}
```{r rproj, eval=FALSE}
rproj <-
rlang::expr(list(
template_filename = system.file("project_templates/default_rproj.Rproj", package = "starter"),
Expand All @@ -155,7 +155,7 @@ rproj <-

Below is an example of a simple custom template.

```{r}
```{r full-template}
my_template <-
list(
readme = rlang::expr(list(
Expand All @@ -179,7 +179,7 @@ my_template <-
Note that you are able to put files into subfolders by including the subfolder name in the `filename` argument. This can be done for any type of file.
Here's an example of what the metadata could look like if the user has a static Rmarkdown template called `template_analysis.Rmd` that they want to copy into a project subfolder called `scripts`.

```{r, eval = FALSE}
```{r analysis, eval = FALSE}
analysis <-
list(
template_filename = "C:/project_templates/template_analysis.Rmd",
Expand All @@ -206,7 +206,7 @@ For example, if you always want to initialize the git repo and never use renv, a
There is one last step---give your template a label.
The label will be displayed each time the template is called in either `create_project()` or `use_project_file()`.

```{r}
```{r label}
attr(my_template, "label") <- "My 1st Project Template"
```

Expand All @@ -218,11 +218,11 @@ The `'readme'` element is used in the in the `use_project_readme()` function and
Now that you have a folder with your template files stored and you have created a metadata list object, you can use them to create a new project folder with your custom template.
The following code will get you started.

```{r, include=FALSE, echo=FALSE}
```{r unlink, include=FALSE, echo=FALSE}
unlink(project_path, recursive = TRUE)
```

```{r}
```{r create_project}
create_project(
path = project_path,
template = my_template # metadata list created above
Expand Down

0 comments on commit 4ee4324

Please sign in to comment.