Skip to content

Commit

Permalink
Fixed thisRequires() bug by testing for interactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
jhollway committed Oct 5, 2024
1 parent e69dc81 commit 98c53fe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: manynet
Title: Many Ways to Make, Modify, Map, Mark, and Measure Myriad Networks
Version: 1.2.3
Version: 1.2.4
Date: 2024-10-05
Description: Many tools for making, modifying, mapping, marking, measuring,
and motifs and memberships of many different types of networks.
Expand All @@ -11,12 +11,12 @@ Description: Many tools for making, modifying, mapping, marking, measuring,
and describing and visualizing networks with sensible defaults.
URL: https://stocnet.github.io/manynet/
BugReports: https://github.com/stocnet/manynet/issues
Depends: R (>= 3.6.0)
License: MIT + file LICENSE
Language: en-GB
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
Depends: R (>= 3.6.0)
Imports:
cli,
dplyr (>= 1.1.0),
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# manynet 1.2.4

## Package

- Fixed `thisRequires()` bug by testing for interactivity
- Dropped brokerage census examples

## Modifying

- Improved `to_ego()` and `to_egos()` to specify direction

# manynet 1.2.3

## Mapping
Expand Down
4 changes: 2 additions & 2 deletions R/manynet-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ available_methods <- function(fun_vctr) {

# Helper function for checking and downloading packages
thisRequires <- function(pkgname){
if (!requireNamespace(pkgname, quietly = TRUE)) {
if (!requireNamespace(pkgname, quietly = TRUE) & interactive()) {
if(utils::askYesNo(msg = paste("The", pkgname,
"package is required to run this function. Would you like to install", pkgname, "from CRAN?"))) {
utils::install.packages(pkgname)
Expand All @@ -27,7 +27,7 @@ thisRequires <- function(pkgname){
}

thisRequiresBio <- function(pkgname) {
if (!requireNamespace(pkgname, quietly = TRUE)) {
if (!requireNamespace(pkgname, quietly = TRUE) & interactive()) {
if(utils::askYesNo(msg = paste("The", pkgname,
"package is required to run this function. Would you like to install", pkgname, "from BioConductor?"))) {
thisRequires("BiocManager")
Expand Down

0 comments on commit 98c53fe

Please sign in to comment.