From 02b3a6a34d22fae9d3764e8e7e00cab4e9870c35 Mon Sep 17 00:00:00 2001
From: Egor Kotov <kotov.egor@gmail.com>
Date: Tue, 3 Sep 2024 19:19:28 +0200
Subject: [PATCH 1/4] swtich this branch to dev version

---
 DESCRIPTION | 2 +-
 NEWS.md     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 42c8f68..dbee341 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: rJavaEnv
 Title: 'Java' Environments for R Projects
-Version: 0.2.1
+Version: 0.2.1.9000
 Authors@R: c(
     person("Egor", "Kotov", , "kotov.egor@gmail.com", role = c("aut", "cre", "cph"),
            comment = c(ORCID = "0000-0001-6690-5345")),
diff --git a/NEWS.md b/NEWS.md
index df004fc..2979d2f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,5 @@
+# rJavaEnv (development version)
+
 # rJavaEnv 0.2.1 (2024-09-03)
 
 * Documentation and description clean-up

From 4dbf0cec6b6c0d7810f794d2870a79f99e763c92 Mon Sep 17 00:00:00 2001
From: Egor Kotov <kotov.egor@gmail.com>
Date: Tue, 3 Sep 2024 19:20:22 +0200
Subject: [PATCH 2/4] readme shows how to install dev branch

---
 README.md  | 2 +-
 README.qmd | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 65cba3f..c51fb2c 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ if (!requireNamespace("remotes", quietly = TRUE)) {
   install.packages("remotes")
 }
 
-remotes::install_github("e-kotov/rJavaEnv", force = TRUE)
+remotes::install_github("e-kotov/rJavaEnv@dev", force = TRUE)
 ```
 
 ## Simple Example
diff --git a/README.qmd b/README.qmd
index 0828b8b..58ecb93 100644
--- a/README.qmd
+++ b/README.qmd
@@ -69,7 +69,7 @@ if (!requireNamespace("remotes", quietly = TRUE)) {
   install.packages("remotes")
 }
 
-remotes::install_github("e-kotov/rJavaEnv", force = TRUE)
+remotes::install_github("e-kotov/rJavaEnv@dev", force = TRUE)
 ```
 
 ## Simple Example

From 54e904c8b8e7ab2d9fe1b2629f0629587149b98d Mon Sep 17 00:00:00 2001
From: Egor Kotov <kotov.egor@gmail.com>
Date: Fri, 13 Sep 2024 20:46:49 +0200
Subject: [PATCH 3/4] fix java_env_set_session

---
 R/java_env.R | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/R/java_env.R b/R/java_env.R
index 5edcc5f..9727244 100644
--- a/R/java_env.R
+++ b/R/java_env.R
@@ -84,13 +84,14 @@ java_env_set <- function(
 java_env_set_session <- function(java_home) {
   
   # check if rJava is installed and alread initialized
-  if (requireNamespace("rJava", quietly = TRUE)) {
-    if( getFromNamespace(".jniInitialized", "rJava") == TRUE ) {
-      cli::cli_inform(c("!" = "You have already initialised `rJava` directly or via your Java-dependent R package in the current session. `Java` version can only be set once per session for packages that rely on `rJava`. Unless you restart the R session or run your code in a new R subprocess using `targets` or `callr`, the new `JAVA_HOME` and `PATH` will not take effect."))
+  if (any(installed.packages()[, 1] == "rJava")) {
+    if( "rJava" %in% loadedNamespaces() == TRUE ) {
+      cli::cli_inform(c("!" = "You have `rJava` R package loaded in the current session. If you have already initialised it directly with ``rJava::.jinit()` or via your Java-dependent R package in the current session, you may not be able to switch to a different `Java` version unless you restart R. `Java` version can only be set once per session for packages that rely on `rJava`. Unless you restart the R session or run your code in a new R subprocess using `targets` or `callr`, the new `JAVA_HOME` and `PATH` will not take effect."))
     }
   }
   
   Sys.setenv(JAVA_HOME = java_home)
+
   old_path <- Sys.getenv("PATH")
   new_path <- file.path(java_home, "bin")
   Sys.setenv(PATH = paste(new_path, old_path, sep = .Platform$path.sep))

From fd6148fe69ec9b8e863c4fa9686e8791659ce1d2 Mon Sep 17 00:00:00 2001
From: Egor Kotov <kotov.egor@gmail.com>
Date: Fri, 13 Sep 2024 20:54:29 +0200
Subject: [PATCH 4/4] add release and meta tools

---
 .Rbuildignore                           |  1 +
 tools/meta-data-update-and-submission.R | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 tools/meta-data-update-and-submission.R

diff --git a/.Rbuildignore b/.Rbuildignore
index 3ebf95b..5ffb68d 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -24,3 +24,4 @@
 ^vignettes/.quarto$
 ^revdep$
 ^man/figures/card.png$
+^tools$
diff --git a/tools/meta-data-update-and-submission.R b/tools/meta-data-update-and-submission.R
new file mode 100644
index 0000000..6ae5193
--- /dev/null
+++ b/tools/meta-data-update-and-submission.R
@@ -0,0 +1,14 @@
+# before release
+# usethis::use_version("patch")
+cffr::cff_write()
+codemetar::write_codemeta(write_minimeta = T)
+usethis::use_tidy_description()
+# urlchecker::url_check()
+# devtools::check(remote = TRUE, manual = TRUE)
+# devtools::check_win_devel()
+# revdepcheck::revdep_check(num_workers = 4)
+
+# devtools::submit_cran()
+
+# usethis::use_github_release()
+# usethis::use_dev_version(push = TRUE)