Skip to content

Commit

Permalink
Merge pull request #42 from e-kotov/2024-08-19-cran-resubmission
Browse files Browse the repository at this point in the history
CRAN resubmission fixes
  • Loading branch information
e-kotov authored Aug 20, 2024
2 parents 311d8c5 + 4c76005 commit bc203d9
Show file tree
Hide file tree
Showing 48 changed files with 1,199 additions and 731 deletions.
6 changes: 5 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
^README\.qmd$
^cran-comments\.md$
^_pkgdown\.yml$
^docs$
Expand All @@ -15,4 +16,7 @@
^doc$
^Meta$
^CODE_OF_CONDUCT\.md$
^vignettes/why-rJavaEnv\.Rmd$
^vignettes/why-rJavaEnv\.qmd$
^vignettes/data-for-vignettes$
^vignettes/bibliography.bib$
^vignettes/media$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ renv
rjavaenv
/doc/
/Meta/

/.quarto/
91 changes: 29 additions & 62 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ cff-version: 1.2.0
message: 'To cite package "rJavaEnv" in publications use:'
type: software
license: MIT
title: 'rJavaEnv: Java Environments for R Projects'
version: 0.1.0
title: 'rJavaEnv: ''Java'' Environments for R Projects'
version: 0.1.1
doi: 10.5281/zenodo.11403010
abstract: Install specific version of Java runtime environment at the R project level.
The goal of rJavaEnv is to manage multiple Java JDKs in R projects by automating
the process of downloading, installing, and configuring Java environments on a per-project
basis. This package is inspired by the renv <https://rstudio.github.io/renv/> package
for managing R environments in R projects. You can request a specific Java Development
Kit (JDK) in your project, and rJavaEnv will download and install the requested
Java environment in a project-specific directory and set the PATH and JAVA_HOME
for when you are using this project. Therefore, you can have different Java versions
for different projects without contaminating your system with different Java versions.
abstract: 'The ''rJavaEnv'' package addresses common issues with ''Java'' environment
management in ''R'' for users of ''Java''/''rJava''-dependent ''R'' packages such
as ''r5r'', ''opentripplanner'', ''xlsx'', ''openNLP'', ''rWeka'', ''RJDBC'', ''tabulapdf'',
and many more. It resolves common problems like ''Java'' not found, ''Java'' version
conflicts, missing ''Java'' installations, and the inability to install ''Java''
due to lack of administrative privileges. ''rJavaEnv'' automates the download, installation,
and setup of the ''Java Development Kit'' (''JDK'') on a per-project basis by setting
the relevant ''JAVA_HOME'' in the current ''R'' session or the current working directory
(via ''.Rprofile'', with the user''s consent). Similar to what ''renv'' does for
''R'' packages, ''rJavaEnv'' allows different ''Java'' versions to be used across
different projects, but can also be configured to allow multiple versions within
the same project (e.g. with the help of ''targets'' package). Note: there are a
few extra steps for ''Linux'' users, who don''t have any ''Java'' previously installed
in their systemm, and who prefer package installation from source, rather then installing
binaries from ''Posit Package Manager''. See documentation for details.'
authors:
- family-names: Kotov
given-names: Egor
Expand Down Expand Up @@ -107,16 +113,20 @@ references:
address: Vienna, Austria
year: '2024'
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
title: quarto
abstract: 'quarto: R Interface to ''Quarto'' Markdown Publishing System'
notes: Suggests
url: https://yihui.org/knitr/
repository: https://CRAN.R-project.org/package=knitr
url: https://quarto-dev.github.io/quarto-r/
repository: https://CRAN.R-project.org/package=quarto
authors:
- family-names: Xie
given-names: Yihui
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
- family-names: Allaire
given-names: JJ
email: [email protected]
orcid: https://orcid.org/0000-0003-0174-9868
- family-names: Dervieux
given-names: Christophe
email: [email protected]
orcid: https://orcid.org/0000-0003-4474-2498
year: '2024'
- type: software
title: rJava
Expand All @@ -129,49 +139,6 @@ references:
given-names: Simon
email: [email protected]
year: '2024'
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
notes: Suggests
url: https://pkgs.rstudio.com/rmarkdown/
repository: https://CRAN.R-project.org/package=rmarkdown
authors:
- family-names: Allaire
given-names: JJ
email: [email protected]
- family-names: Xie
given-names: Yihui
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
- family-names: Dervieux
given-names: Christophe
email: [email protected]
orcid: https://orcid.org/0000-0003-4474-2498
- family-names: McPherson
given-names: Jonathan
email: [email protected]
- family-names: Luraschi
given-names: Javier
- family-names: Ushey
given-names: Kevin
email: [email protected]
- family-names: Atkins
given-names: Aron
email: [email protected]
- family-names: Wickham
given-names: Hadley
email: [email protected]
- family-names: Cheng
given-names: Joe
email: [email protected]
- family-names: Chang
given-names: Winston
email: [email protected]
- family-names: Iannone
given-names: Richard
email: [email protected]
orcid: https://orcid.org/0000-0003-3925-190X
year: '2024'
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
Expand Down
38 changes: 22 additions & 16 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
Package: rJavaEnv
Title: Java Environments for R Projects
Version: 0.1.0
Title: 'Java' Environments for R Projects
Version: 0.1.1
Authors@R: c(
person("Egor", "Kotov", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-6690-5345")),
person("Mauricio", "Vargas", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0003-1017-7574"))
)
Description: Install specific version of Java runtime environment at the R
project level. The goal of rJavaEnv is to manage multiple Java JDKs in
R projects by automating the process of downloading, installing, and
configuring Java environments on a per-project basis. This package is
inspired by the renv <https://rstudio.github.io/renv/> package for
managing R environments in R projects. You can request a specific Java
Development Kit (JDK) in your project, and rJavaEnv will download and
install the requested Java environment in a project-specific directory
and set the PATH and JAVA_HOME for when you are using this project.
Therefore, you can have different Java versions for different projects
without contaminating your system with different Java versions.
Description: The 'rJavaEnv' package addresses common issues with 'Java'
environment management in 'R' for users of 'Java'/'rJava'-dependent
'R' packages such as 'r5r', 'opentripplanner', 'xlsx', 'openNLP',
'rWeka', 'RJDBC', 'tabulapdf', and many more. It resolves common
problems like 'Java' not found, 'Java' version conflicts, missing
'Java' installations, and the inability to install 'Java' due to lack
of administrative privileges. 'rJavaEnv' automates the download,
installation, and setup of the 'Java Development Kit' ('JDK') on a
per-project basis by setting the relevant 'JAVA_HOME' in the current
'R' session or the current working directory (via '.Rprofile', with
the user's consent). Similar to what 'renv' does for 'R' packages,
'rJavaEnv' allows different 'Java' versions to be used across
different projects, but can also be configured to allow multiple
versions within the same project (e.g. with the help of 'targets'
package). Note: there are a few extra steps for 'Linux' users, who
don't have any 'Java' previously installed in their systemm, and who
prefer package installation from source, rather then installing
binaries from 'Posit Package Manager'. See documentation for details.
License: MIT + file LICENSE
URL: https://github.com/e-kotov/rJavaEnv, https://www.ekotov.pro/rJavaEnv/
BugReports: https://github.com/e-kotov/rJavaEnv/issues
Expand All @@ -28,12 +35,11 @@ Imports:
jsonlite,
utils
Suggests:
knitr,
quarto,
rJava,
rmarkdown,
testthat (>= 3.0.0)
VignetteBuilder:
knitr
quarto
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
6 changes: 0 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
export(java_check_version_cmd)
export(java_check_version_rjava)
export(java_clear)
export(java_clear_distrib_cache)
export(java_clear_in_project)
export(java_clear_installed_cache)
export(java_download)
export(java_env_set)
export(java_env_unset)
export(java_install)
export(java_list)
export(java_list_distrib_cache)
export(java_list_in_project)
export(java_list_installed_cache)
export(java_quick_install)
export(rje_consent)
importFrom(utils,getFromNamespace)
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# rJavaEnv 0.1.1

* Improved documentation

* Better handling of cache directory

* Bug fixes and changes to address CRAN reviewer's comments to the first submission

# rJavaEnv 0.1.0

* Initial release
18 changes: 13 additions & 5 deletions R/consent.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
#' @return `TRUE` if consent is given, otherwise an error is raised.
#'
#' @export
#' @examples
#' \dontrun{
#'
#' # to provide consent and prevent other functions from interrupting to get the consent
#' rje_consent(provided = TRUE)
#' }
#'
rje_consent <- function(provided = FALSE) {

# Check if consent is already given via environment variable
Expand All @@ -33,16 +40,17 @@ rje_consent <- function(provided = FALSE) {
}

# Check if consent is already given via cache directory
user_pacakge_cache_dir <- tools::R_user_dir("rJavaEnv", which = "cache")
if (dir.exists(user_pacakge_cache_dir)) {
user_package_cache_path <- getOption("rJavaEnv.cache_path")
user_package_cache_path <- normalizePath(user_package_cache_path, winslash = "/", mustWork = FALSE)
if (dir.exists(user_package_cache_path)) {
cli::cli_inform("Consent for using rJavaEnv has already been provided.")
return(invisible(TRUE))
}

# write welcome message
template <- system.file("resources/consent-info", package = "rJavaEnv")
contents <- readLines(template)
contents <- gsub("\\$\\{rJavaEnv_CACHE\\}", user_pacakge_cache_dir, contents)
contents <- gsub("\\$\\{rJavaEnv_CACHE\\}", user_package_cache_path, contents)
cli::cli_inform(contents)

# Request user consent if not already provided
Expand All @@ -57,7 +65,7 @@ rje_consent <- function(provided = FALSE) {

# Save user consent
options(rJavaEnv.consent = TRUE)
dir.create(user_pacakge_cache_dir, recursive = TRUE, showWarnings = FALSE)
dir.create(user_package_cache_path, recursive = TRUE, showWarnings = FALSE)
cli::cli_inform("Consent has been granted and recorded.")

invisible(TRUE)
Expand All @@ -79,7 +87,7 @@ rje_consent_check <- function() {
if (getOption("rJavaEnv.consent", FALSE)) {
return(TRUE)
}
if (dir.exists(tools::R_user_dir("rJavaEnv", which = "cache"))){
if (dir.exists(getOption("rJavaEnv.cache_path"))) {
return(TRUE)
}

Expand Down
10 changes: 10 additions & 0 deletions R/global_params.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#' @title Global Quiet Parameter
#'
#' @description
#' Documentation for the `quiet` parameter, used globally.
#'
#' @param quiet A `logical` value indicating whether to suppress messages. Can be `TRUE` or `FALSE`.
#' @keywords internal
global_quiet_param <- function(quiet){
# this is just a placeholder for global quiet parameter
}
6 changes: 3 additions & 3 deletions R/internal_utilities.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' Detect platform and architecture
#'
#' @inheritParams global_quiet_param
#' @keywords internal
#' @param verbose Whether to print detailed messages. Defaults to FALSE.
#' @return A list of length 2 with the detected platform and architecture.
#'
platform_detect <- function(verbose = FALSE) {
platform_detect <- function(quiet = TRUE) {
sys_info <- tolower(Sys.info())

os <- switch(sys_info["sysname"],
Expand All @@ -24,7 +24,7 @@ platform_detect <- function(verbose = FALSE) {
stop(cli::cli_abort("Unsupported architecture"))
)

if (verbose) {
if (isFALSE(quiet)) {
cli::cli_inform("Detected platform: {os}")
cli::cli_inform("Detected architecture: {arch}")
}
Expand Down
Loading

0 comments on commit bc203d9

Please sign in to comment.