Skip to content

Commit

Permalink
Merge branch 'master' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
GegznaV committed May 27, 2024
2 parents 9b25bd6 + a6229cd commit 20bd5bc
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 39 deletions.
4 changes: 2 additions & 2 deletions R/get_os.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ get_os_type <- function() {
if (os == "Darwin") {os <- "mac"}
} else {
os <- .Platform$OS.type
if (grepl("^darwin", R.version$os)) {os <- "mac"}
if (grepl("linux-gnu", R.version$os)) {os <- "linux"}
if (grepl("^darwin", R.version$os, useBytes = TRUE)) {os <- "mac"}
if (grepl("linux-gnu", R.version$os, useBytes = TRUE)) {os <- "linux"}
}
unname(tolower(os))
}
Expand Down
6 changes: 4 additions & 2 deletions R/helpers--make_unique_obj_names.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
make_unique_obj_names <- function(names, prefix = "", suffix = "",
list_of_choices = objects(all.names = TRUE,
envir = .GlobalEnv),
list_of_choices = objects(
all.names = TRUE,
envir = .GlobalEnv
),
all_numbered = TRUE) {
if (length(names) == 0) {
return(NULL)
Expand Down
6 changes: 3 additions & 3 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ ui_msg_restart_rstudio <- function() {
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# str_glue_eval ==============================================================
str_glue_eval <- function(..., envir = parent.frame(), .sep = "",
.open = "{", .close = "}", envir_eval = envir, envir_glue = envir) {

str_glue_eval <- function(
..., envir = parent.frame(), .sep = "",
.open = "{", .close = "}", envir_eval = envir, envir_glue = envir) {
commands_as_text <- glue::glue(...,
.envir = envir_glue,
.open = .open,
Expand Down
2 changes: 1 addition & 1 deletion R/packages--check.R
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ get_pkgs_installation_code <- function(x = NULL, ..., to_clipboard = FALSE,
# help("options") # Opens help on options
options(
repos = "https://cran.rstudio.com/",
pkgType = "{ifelse(get_os_type() == "linux", "source", "both")}",
pkgType = "{ifelse(get_os_type() == "windows", "both", "source")}",
install.packages.check.source = "yes",
install.packages.compile.from.source = "always"
)
Expand Down
11 changes: 5 additions & 6 deletions R/packages--find.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ list_pkgs_used_in_dir_code <- function(path = ".", regexp = "(?i)[.](rmd|r)$", .
# TODO: ignore code in comments
list_pkgs_used_in_files <- function(files) {
files %>%
purrr::map(~readr::read_file(.)) %>%
purrr::map(~ readr::read_file(.)) %>%
stringr::str_extract_all(
paste0(
"(?<=(library|require|require2)\\()(.*?)(?=\\))|", # library(dplyr)
Expand All @@ -74,10 +74,10 @@ list_pkgs_used_in_files <- function(files) {

list_pkgs_used_in_files_code <- function(files) {
files %>%
purrr::map(~readr::read_file(.)) %>%
purrr::map(~ readr::read_file(.)) %>%
stringr::str_extract_all(
paste0(
"(library|require|require2)\\((.*?)\\)|", # library(dplyr)
"(library|require|require2)\\((.*?)\\)|", # library(dplyr)
"(\\s|\\n|\\(|\\{|\\[)[a-zA-Z0-9.]*?( )*:{2,3}[a-zA-Z0-9._]*|", # dplyr::select
"package\\s*=\\s*(\"|')[a-zA-Z0-9.]*?(\"|')" # data(package = "dplyr")
)
Expand All @@ -90,7 +90,6 @@ list_pkgs_used_in_files_code <- function(files) {
get_pkg_dependencies <- function(pkg) {
pkg <- stringr::str_replace(pkg, "[.]", "[.]")
desc::desc_get_deps(fs::dir_ls(.libPaths(), regexp = glue::glue("/{pkg}$"))) %>%
dplyr::filter(.data$type %in% c("Depends", "Imports")) %>%
dplyr::pull(.data$package)
dplyr::filter(.data$type %in% c("Depends", "Imports")) %>%
dplyr::pull(.data$package)
}

4 changes: 2 additions & 2 deletions R/programs.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ check_r_version <- function(v_recommended = "4.3.0",
)
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check_quarto_version <- function(v_recommended = "1.2.313",
check_quarto_version <- function(v_recommended = "1.4.549",
skip_online_check = FALSE) {

check_program_version(
Expand All @@ -301,7 +301,7 @@ check_quarto_version <- function(v_recommended = "1.2.313",
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check_rs_version <- function(v_recommended = "2022.7.1", skip_online_check = FALSE) {
check_rs_version <- function(v_recommended = "2023.12.1", skip_online_check = FALSE) {

if (!rstudioapi::isAvailable()) {
ui_oops("Program {red('RStudio')} is not installed or is not running. ")
Expand Down
5 changes: 2 additions & 3 deletions R/restart_reload.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @concept utilities
#'
rstudio_restart_r <- function() {
if (rstudioapi::isAvailable(version_needed = "1.2.1261") ) {
if (rstudioapi::isAvailable(version_needed = "1.2.1261")) {
invisible(rstudioapi::executeCommand("restartR", quiet = TRUE))
}
}
Expand All @@ -19,7 +19,7 @@ rstudio_restart_r <- function() {
#' @export
#' @concept utilities
rstudio_reload_ui <- function() {
if (rstudioapi::isAvailable(version_needed = "1.2.1261") ) {
if (rstudioapi::isAvailable(version_needed = "1.2.1261")) {
invisible(rstudioapi::executeCommand("reloadUi", quiet = TRUE))
}
}
Expand All @@ -35,4 +35,3 @@ restart_r <- function() {
restart_rstudio <- function() {
rstudio_restart_r()
}

8 changes: 5 additions & 3 deletions R/settings--preferences.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ rstudio_set_preferences <- function(file) {
pref <- jsonlite::fromJSON(file)
purrr::walk2(
names(pref), unname(pref),
~{
~ {
tryCatch(
rstudioapi::writeRStudioPreference(.x, .y),
error = function(e) {
Expand Down Expand Up @@ -206,14 +206,16 @@ rstudio_set_preferences <- function(file) {
#' }}
rstudio_compare_user_settings <- function(to = "bio-default") {
to <- match.arg(to, c("bio-default", "rstudio-default"))

file <- get_path_rstudio_config_file(which = to)
default_prefs <-
jsonlite::fromJSON(file) %>%
purrr::map_if(is.integer, as.numeric)
purrr::map_if(is.integer, as.numeric) |>
purrr::map_at("busy_exclusion_list", as.list)

pref_names <- names(default_prefs) %>% purrr::set_names(., .)
current_prefs <-
purrr::map(pref_names, ~rstudioapi::readRStudioPreference(., NULL)) %>%
purrr::map(pref_names, ~rstudioapi::readRStudioPreference(., NULL)) %>%
purrr::map_if(is.integer, as.numeric)

usethis::ui_info(
Expand Down
14 changes: 7 additions & 7 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Options:
```{r README-7a, eval=FALSE}
bio::check_installed_programs()
## ✔ Program R (4.3.1) is installed (recommended >= 4.3.1).
## ✖ Program RStudio is not installed or is not running.
## ✖ Program RStudio is not installed or is not running.
## ✔ Tool Quarto (1.4.268) is installed (recommended >= 1.3.336).
## ✔ Tool Rtools is installed.
```
Expand Down Expand Up @@ -157,13 +157,13 @@ cat(res)

```{r README-8a, eval=FALSE, paged.print=FALSE}
bio::check_packages_by_topic("mini")
## ℹ Reading list 'mini'
## ℹ Reading list 'mini'
## ✔ Minimal required versions of all 19 packages (from list 'mini') are already installed.
```

```{r README-8b, eval=FALSE, paged.print=FALSE}
bio::check_packages_by_topic("mini", include = "newer_on_cran")
## ℹ Reading list 'mini'
## ℹ Reading list 'mini'
## ✔ Minimal required versions of all 19 packages (from list 'mini') are already installed.
## ℹ Note: 1 package has newer version on CRAN.
```
Expand All @@ -186,9 +186,9 @@ Check if there are updates for **bio** or its dependency packages.
```{r README-3b, eval=FALSE, paged.print=FALSE}
bio::check_updates_pkg_bio()
## ℹ Analyzing dependencies of package bio
##
##
## [... truncated ...]
##
##
## ✔ Minimal required versions of all 26 packages (from list 'bio') are already installed.
```

Expand Down Expand Up @@ -221,7 +221,7 @@ bio::rstudio_install_spellcheck_dictionaries()
Install improved Lithuanian dictionary.
```{r eval=FALSE}
bio::rstudio_install_spellcheck_dictionary_lt()
## ✔ lt_LT dictionary installed.
## ✔ lt_LT dictionary installed.
## 'C:/Users/ViG/AppData/Roaming/RStudio/dictionaries/languages-system/lt_LT.dic'
```

Expand Down Expand Up @@ -348,7 +348,7 @@ snippets::install_snippets_from_package("snippets", backup = TRUE)
## 'C:/Users/User/AppData/Roaming/RStudio/snippets/markdown.snippets'
## ✔ File with r snippets was updated:
## 'C:/Users/User/AppData/Roaming/RStudio/snippets/r.snippets'
##
##
## ℹ You will be able to use the snippets after RStudio is closed and reopened.
```

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Package ***bio***
<!-- badges: start -->

[![GitHub
version](https://img.shields.io/badge/GitHub-0.2.2.3-brightgreen.svg)](https://github.com/mokymai/bio)
version](https://img.shields.io/badge/GitHub-0.2.4-brightgreen.svg)](https://github.com/mokymai/bio)
[![R-CMD-check](https://github.com/mokymai/bio/workflows/R-CMD-check/badge.svg)](https://github.com/mokymai/bio/actions)
[![Updated-on](https://img.shields.io/badge/Updated%20on-2023--08--24-yellowgreen.svg)](/commits/master)
[![Updated-on](https://img.shields.io/badge/Updated%20on-2024--02--08-yellowgreen.svg)](/commits/master)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![R-CMD-check](https://github.com/mokymai/bio/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mokymai/bio/actions/workflows/R-CMD-check.yaml)
Expand Down Expand Up @@ -91,7 +91,7 @@ Options:
``` r
bio::check_installed_programs()
## ✔ Program R (4.3.1) is installed (recommended >= 4.3.1).
## ✖ Program RStudio is not installed or is not running.
## ✖ Program RStudio is not installed or is not running.
## ✔ Tool Quarto (1.4.268) is installed (recommended >= 1.3.336).
## ✔ Tool Rtools is installed.
```
Expand Down Expand Up @@ -149,13 +149,13 @@ Details

``` r
bio::check_packages_by_topic("mini")
## ℹ Reading list 'mini'
## ℹ Reading list 'mini'
## ✔ Minimal required versions of all 19 packages (from list 'mini') are already installed.
```

``` r
bio::check_packages_by_topic("mini", include = "newer_on_cran")
## ℹ Reading list 'mini'
## ℹ Reading list 'mini'
## ✔ Minimal required versions of all 19 packages (from list 'mini') are already installed.
## ℹ Note: 1 package has newer version on CRAN.
```
Expand All @@ -176,9 +176,9 @@ Check if there are updates for **bio** or its dependency packages.
``` r
bio::check_updates_pkg_bio()
## ℹ Analyzing dependencies of package bio
##
##
## [... truncated ...]
##
##
## ✔ Minimal required versions of all 26 packages (from list 'bio') are already installed.
```

Expand Down Expand Up @@ -213,7 +213,7 @@ Install improved Lithuanian dictionary.

``` r
bio::rstudio_install_spellcheck_dictionary_lt()
## ✔ lt_LT dictionary installed.
## ✔ lt_LT dictionary installed.
## 'C:/Users/ViG/AppData/Roaming/RStudio/dictionaries/languages-system/lt_LT.dic'
```

Expand Down Expand Up @@ -336,7 +336,7 @@ snippets::install_snippets_from_package("snippets", backup = TRUE)
## 'C:/Users/User/AppData/Roaming/RStudio/snippets/markdown.snippets'
## ✔ File with r snippets was updated:
## 'C:/Users/User/AppData/Roaming/RStudio/snippets/r.snippets'
##
##
## ℹ You will be able to use the snippets after RStudio is closed and reopened.
```

Expand Down
10 changes: 10 additions & 0 deletions inst/install-r/programs-required-version.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
title: "Minimal required versions of programs"
<<<<<<< HEAD
date: 2024-05-27
=======
date: 2024-02-08
>>>>>>> master
notes: ""


Expand All @@ -9,7 +13,13 @@ notes: ""
---
# This text must be in line 10 -----------------------------------------------
program | required_version | ignore | notes_version
<<<<<<< HEAD
R | 4.3.3 | FALSE |
RStudio | 2023.12.1 | FALSE | For 32-bit systems v 1.1.463
Quarto | 1.4.554 | FALSE |
=======
R | 4.3.2 | FALSE |
RStudio | 2023.12.1 | FALSE | For 32-bit systems v 1.1.463
Quarto | 1.4.549 | FALSE |
>>>>>>> master

2 changes: 1 addition & 1 deletion man/bio-package.Rd

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

0 comments on commit 20bd5bc

Please sign in to comment.