data/data.R

# style
mrup_style <- shiny::tags$head(
  shiny::tags$style(shiny::HTML("
                      .mru_btn {
                        color: #ffffff;
                        background-color: #337ab7;
                        border-color: #2e6da4;
                      }
                      #done {
                        background-color: #3cb371;
                      }
                      input[type=checkbox] {
                        transform: scale(1.6);
                      }
                      ")))


#~/.local/share/rstudio/monitored/lists/project_mru

# Known possible locations of mru file
mon_list <- file.path(c('.rstudio-desktop',
                        '.local/share/rstudio',
                        'RStudio-Desktop',
                        'rstudio'),
                      'monitored/lists')
mon_list <- c(
  file.path(mon_list, 'project_name_mru'),
  file.path(mon_list, 'project_mru')
)  # :sigh: This is bound to cause issues. Need to test more - see mrup.R 358

app_loc <- c(mon_list[1:2], file.path("AppData/Local", mon_list[-(1:2)]))

h_roots <- c('~', 'C:/Users/%s')

mru_path_opts <- unlist(lapply(h_roots, file.path, app_loc))

# Set root dirs ----
# Most paths are specific for me.
# Default for most machines should be path 4 or 5.
# Don't update data on Mac, at least not till I've looked into how to stop overwriting.
root_dirs <- c(`Git repos` = '~/R/ProjectDir/git_repos',
               `Ed repos` = '~/../Documents/repos/repos-ed',
               `JW repos` = '~/../Documents/repos/repos-jw',
               `Documents` = '~/../Documents',
               `Documents` = '~/Documents',
               `Home`  = '~',
               `~/R` = '~/R')

root_dirs <- stats::setNames(file.path(root_dirs),
                             names(root_dirs))

# Dirs to exclude from search ----
excl_dirs <- paste0(
  c(dirname(.libPaths()), '\\.git$', '\\.Rproj\\.user$'),
  collapse = '|')


usethis::use_data(mrup_style, mru_path_opts,
                  root_dirs, excl_dirs,
                  internal = TRUE, overwrite = TRUE)
jmcvw/mrup documentation built on June 5, 2024, 4:26 p.m.