-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.R
97 lines (87 loc) · 2.09 KB
/
setup.R
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#' Setup dotfiles
#'
#' @param scope Edit globally for the current **user**, or locally for the
#' current **project**
#' @return Invisible NULL.
#' @export
setup_dotfiles <- function(scope = "user") {
purrr::walk(
c(
".Rprofile",
".bash_profile",
".minttyrc",
".nanorc",
".gitconfig",
".gitignore"
),
setup_dotfile,
scope = scope
)
invisible()
}
setup_dotfile <- function(scope, name) {
if (scope == "user") {
folder <- if (name == ".Rprofile") "~" else Sys.getenv("USERPROFILE")
path <- glue::glue("{folder}/{name}")
if (normalizePath("~") != Sys.getenv("USERPROFILE")) {
rui::warn("HOME folder is {.path {normalizePath(\"~\")}} and",
"not {.path {Sys.getenv(\"USERPROFILE\")}}!")
}
}
if (scope == "project") path <- here::here(name)
if (!exists("path", inherits = FALSE)) rui::error("Wrong scope")
download.file(
glue::glue("https://raw.githubusercontent.com/rogiersbart/dotfiles/main/{name}"),
path,
quiet = TRUE
)
}
#' Setup PowerToys
#'
#' @return Invisible NULL.
#' @export
setup_powertoys <- function() {
purrr::walk(
c(
"FancyZones/custom-layouts.json",
"FancyZones/layout-hotkeys.json",
"FancyZones/settings.json",
"Keyboard Manager/default.json"
),
setup_powertoys_json
)
invisible()
}
setup_powertoys_json <- function(json) {
path <- glue::glue("C:/Users/{Sys.getenv('USERNAME')}/AppData/Local/Microsoft/PowerToys/{json}")
json <- gsub(" ", "%20", json)
download.file(
glue::glue("https://raw.githubusercontent.com/rogiersbart/dotfiles/main/PowerToys/{json}"),
path,
quiet = TRUE
)
}
sitrep <- function() {
# report user & machine name
# check the above dotfiles & utils
# check installed applications
# google drive?
# google chrome
# keepassxc?
# r
# rtools
# rstudio
# python/r-miniconda?
# imageglass
# krita
# gimp
# goxel/magicavoxel?
# contact sync
# ogcalc sync
# jabref
# vlc?
# inkscape?
# check git config?
}
setup_rstudio_snippets <- function() {
}