Skip to content

Commit 1ee0fa3

Browse files
committed
Trying to remove red logo
1 parent 505ac50 commit 1ee0fa3

8 files changed

Lines changed: 90 additions & 136 deletions

File tree

R/rstan_create_package.R

Lines changed: 80 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' @aliases rstan_package_skeleton
2222
#'
2323
#' @description
24-
#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}}
24+
#' \if{html}{\figure{logo.svg.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}}
2525
#' The `rstan_create_package()` function helps get you started developing a
2626
#' new \R package that interfaces with Stan via the \pkg{rstan} package. First
2727
#' the basic package structure is set up via [usethis::create_package()].
@@ -118,26 +118,32 @@
118118
#' @template seealso-vignettes
119119
#' @template seealso-get-help
120120
#'
121-
rstan_create_package <- function(path,
122-
fields = NULL,
123-
rstudio = TRUE,
124-
open = TRUE,
125-
stan_files = character(),
126-
roxygen = TRUE,
127-
travis = FALSE,
128-
license = TRUE,
129-
auto_config = TRUE) {
121+
rstan_create_package <- function(
122+
path,
123+
fields = NULL,
124+
rstudio = TRUE,
125+
open = TRUE,
126+
stan_files = character(),
127+
roxygen = TRUE,
128+
travis = FALSE,
129+
license = TRUE,
130+
auto_config = TRUE
131+
) {
130132
if (!requireNamespace("usethis", quietly = TRUE)) {
131-
stop("Please install package 'usethis' to use function 'rstan_create_package'.",
132-
call. = FALSE)
133+
stop(
134+
"Please install package 'usethis' to use function 'rstan_create_package'.",
135+
call. = FALSE
136+
)
133137
}
134138
DIR <- dirname(path)
135139
name <- basename(path)
136140
.check_stan_ext(stan_files)
137141

138142
if (rstudio && !requireNamespace("rstudioapi", quietly = TRUE)) {
139-
stop("Please install package 'rstudioapi' to use option 'rstudio = TRUE'.",
140-
call. = FALSE)
143+
stop(
144+
"Please install package 'rstudioapi' to use option 'rstudio = TRUE'.",
145+
call. = FALSE
146+
)
141147
rstudio <- rstudio && rstudioapi::isAvailable()
142148
}
143149
if (open && rstudio) {
@@ -169,28 +175,48 @@ rstan_create_package <- function(path,
169175
# check stan extensions
170176
.check_stan_ext <- function(stan_files) {
171177
if (length(stan_files) && !all(grepl("\\.stan$", stan_files))) {
172-
stop("All files named in 'stan_files' must end ",
173-
"with a '.stan' extension.", call. = FALSE)
178+
stop(
179+
"All files named in 'stan_files' must end ",
180+
"with a '.stan' extension.",
181+
call. = FALSE
182+
)
174183
}
175184
}
176185

177186
# add travis file
178187
.add_travis <- function(pkgdir) {
179188
travis_file <- readLines(.system_file("travis.yml"))
180-
.add_stanfile(gsub("RSTAN_PACKAGE_NAME", basename(pkgdir), travis_file),
181-
pkgdir, ".travis.yml",
182-
noedit = FALSE, msg = TRUE, warn = FALSE)
189+
.add_stanfile(
190+
gsub("RSTAN_PACKAGE_NAME", basename(pkgdir), travis_file),
191+
pkgdir,
192+
".travis.yml",
193+
noedit = FALSE,
194+
msg = TRUE,
195+
warn = FALSE
196+
)
183197
}
184198

185199
# add .gitignore and .Rbuildignore files
186200
.add_gitignore_Rbuildignore <- function(pkgdir, travis) {
187201
gitignore_files <- c("^rcppExports.cpp$", "^stanExports_*")
188-
.add_stanfile(gitignore_files, pkgdir, ".gitignore",
189-
noedit = FALSE, msg = TRUE, warn = FALSE)
202+
.add_stanfile(
203+
gitignore_files,
204+
pkgdir,
205+
".gitignore",
206+
noedit = FALSE,
207+
msg = TRUE,
208+
warn = FALSE
209+
)
190210

191211
Rbuildignore_files <- c(gitignore_files, if (travis) "^\\.travis\\.yml$")
192-
.add_stanfile(Rbuildignore_files, pkgdir, ".Rbuildignore",
193-
noedit = FALSE, msg = TRUE, warn = FALSE)
212+
.add_stanfile(
213+
Rbuildignore_files,
214+
pkgdir,
215+
".Rbuildignore",
216+
noedit = FALSE,
217+
msg = TRUE,
218+
warn = FALSE
219+
)
194220
}
195221

196222
# add R/mypkg-package.R file with roxygen import comments
@@ -199,9 +225,15 @@ rstan_create_package <- function(path,
199225
pkg_file <- readLines(.system_file("rstanpkg-package.R"))
200226
pkg_file <- gsub("RSTAN_PACKAGE_NAME", basename(pkgdir), pkg_file)
201227
pkg_file <- gsub("RSTAN_REFERENCE", .rstan_reference(), pkg_file)
202-
.add_stanfile(pkg_file, pkgdir,
203-
"R", paste0(basename(pkgdir), "-package.R"),
204-
noedit = FALSE, msg = TRUE, warn = FALSE)
228+
.add_stanfile(
229+
pkg_file,
230+
pkgdir,
231+
"R",
232+
paste0(basename(pkgdir), "-package.R"),
233+
noedit = FALSE,
234+
msg = TRUE,
235+
warn = FALSE
236+
)
205237
desc_pkg <- desc::description$new(file.path(pkgdir, "DESCRIPTION"))
206238
desc_pkg$set(Encoding = "UTF-8")
207239
desc_pkg$write()
@@ -210,25 +242,40 @@ rstan_create_package <- function(path,
210242
# reference to rstan package
211243
.rstan_reference <- function() {
212244
has_version <- utils::packageDescription("rstan", fields = "Version")
213-
version_year <- substr(utils::packageDescription("rstan", fields = "Date"), 1, 4)
245+
version_year <- substr(
246+
utils::packageDescription("rstan", fields = "Date"),
247+
1,
248+
4
249+
)
214250
paste0(
215-
"Stan Development Team (", version_year,"). ",
251+
"Stan Development Team (",
252+
version_year,
253+
"). ",
216254
"RStan: the R interface to Stan. ",
217-
"R package version ", has_version, ". ",
255+
"R package version ",
256+
has_version,
257+
". ",
218258
"https://mc-stan.org"
219259
)
220260
}
221261

222262
# add stan functionality to package
223-
.rstan_make_pkg <- function(pkgdir, stan_files,
224-
roxygen, travis, license, auto_config) {
225-
263+
.rstan_make_pkg <- function(
264+
pkgdir,
265+
stan_files,
266+
roxygen,
267+
travis,
268+
license,
269+
auto_config
270+
) {
226271
use_rstan(pkgdir, license = license, auto_config = auto_config)
227272
file.copy(
228273
from = stan_files,
229274
to = file.path(pkgdir, "inst", "stan", basename(stan_files))
230275
)
231-
if (roxygen) .add_roxygen(pkgdir)
276+
if (roxygen) {
277+
.add_roxygen(pkgdir)
278+
}
232279
if (travis) {
233280
.add_travis(pkgdir)
234281
warning(
@@ -301,7 +348,6 @@ rstan_create_package <- function(path,
301348
## error:
302349
## - when {dir/file}.create fails even though it doesn't exist
303350

304-
305351
## ok stan_meta_header.hpp is problematic, because want to warn if already exists, but only if it's there from before...
306352

307353
## so .add_stanfile(file_lines, pkgdir, ...,

R/rstantools-package.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#'
66
#' @description
77
#' \if{html}{
8-
#' \figure{stanlogo.png}{options: width="50" alt="mc-stan.org"}
8+
#' \figure{logo.svg.png}{options: width="50" alt="mc-stan.org"}
99
#' } *Stan Development Team*
1010
#'
1111
#' The \pkg{rstantools} package provides various tools for developers of \R
@@ -26,7 +26,8 @@
2626
# internal ----------------------------------------------------------------
2727

2828
# release reminders (for devtools)
29-
release_questions <- function() { # nocov start
29+
release_questions <- function() {
30+
# nocov start
3031
c(
3132
"Have you updated the developer guidelines in the vignette?"
3233
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# rstantools <img src="man/figures/stanlogo.png" align="right" width="120" />
1+
# rstantools <img src="man/figures/logo.svg.png" align="right" width="120" />
22

33
<!-- badges: start -->
44
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/rstantools?color=blue)](https://cran.r-project.org/web/packages/rstantools)

_pkgdown.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ destination: "."
55
template:
66
package: pkgdownconfig
77

8+
development:
9+
mode: auto
10+
811
navbar:
912
title: "rstantools"
1013

man/figures/logo.svg

Lines changed: 0 additions & 96 deletions
This file was deleted.

man/figures/stanlogo.png

-15.8 KB
Binary file not shown.

man/rstan_create_package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/rstantools-package.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)