-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rprofile
72 lines (46 loc) · 1.29 KB
/
.Rprofile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
if (interactive()) {
if (requireNamespace("gert", quietly = TRUE)) {
library(gert)
gca <- function(x, ...) {
gert::git_commit_all(x, ...)
}
gp <- function(x = NULL, ...) {
gert::git_push(x, ...)
}
ga <- function(...) {
gert::git_add(gert::git_status(...)$file)
}
gi <- function() {
gert::git_info()$upstream
}
gs <- function() {
gert::git_status()
}
}
}
if (requireNamespace("pushoverr", quietly = TRUE)) {
render_book <- function(rmd = "index") {
# debugonce(rmarkdown:::create_output_format)
file <- fs::path(rmd, ext = "Rmd")
s <- Sys.time()
start <- format(s, "%H:%M")
rs <- try({
bookdown::render_book(file, "bookdown::gitbook")
})
f <- Sys.time()
finish <- format(f, "%H:%M")
d <- f - s
msg <- paste0("Finished rendering \nStarted at ", start,
"\nFinished at ", finish,
"\nDifference ", d)
pushoverr::pushover(msg)
msg <- paste0("Finished rendering {.file {file}} \nStarted at ", start,
"\nFinished at ", finish,
"\nDifference ", d)
cli::cli_alert(msg)
if (isFALSE(inherits(rs, "try-error"))) {
browseURL("docs/index.html")
}
return(invisible(TRUE))
}
}