Skip to content
Browse files

check.for.updates.R function updated - added a date for the latest R …

…version in the window prompt.
  • Loading branch information...
1 parent 744e709 commit 08d85f992fc8aa16eee252c454a896baee9eb1bc @talgalili committed Jul 3, 2013
Showing with 24 additions and 12 deletions.
  1. +3 −0 NEWS
  2. +12 −4 R/updateR.r
  3. +9 −8 R/zzz.r
View
3 NEWS
@@ -5,6 +5,9 @@ NEW FUNCTIONS ADDED:
* uninstall.R
* is.empty - function added for checking if an object is empty (e.g: of zero length)
+UPDATED FUNCTIONS:
+ * check.for.updates.R - added a date for the latest R version in the window prompt.
+
OTHER NOTES:
* Moving to the versioning scheme suggested by Yihui (see: http://yihui.name/en/2013/06/r-package-versioning/)
* is.x.r file created - moving various "is.*" functions to this file.
View
16 R/updateR.r
@@ -142,6 +142,13 @@ check.for.updates.R <- function(notify_user = TRUE,
latest_R_version <- regmatches(target_line, m)
latest_R_version <- gsub(pattern="R-|-win" ,"", latest_R_version) # remove junk text
+ pat <- "Last change: [0-9.]+-[0-9.]+-[0-9.]+";
+ target_line <- grep(pat, page, value = TRUE);
+ m <- regexpr(pat, target_line);
+ latest_R_date <- regmatches(target_line, m)
+ latest_R_date <- gsub(pattern="Last change: " ,"", latest_R_date) # remove junk text
+
+
current_R_version <- as.character(getRversion()) # paste(R.version$major, R.version$minor, sep=".")
# Turn the version character into a number
@@ -151,9 +158,10 @@ check.for.updates.R <- function(notify_user = TRUE,
there_is_a_newer_version <- current_R_version_long < latest_R_version_long # TRUE = there IS a need to update (since the latest version is higher then what we currently have)
if(there_is_a_newer_version) {
- message_text <- paste("There is a newer version of R for you to download!\n",
- "You are using R version: ", gsub("R version", "", R.version$version.string), "\n",
- "And the latest R version is: ", latest_R_version, "\n")
+ message_text <- paste("There is a newer version of R for you to download!\n\n",
+ "You are using R version: \t", gsub("R version", "", R.version$version.string), "\n",
+ "And the latest R version is:\t ", latest_R_version, " (",latest_R_date,")", "\n",
+ sep = "")
} else {
message_text <- paste("No need to update. You are using the latest R version: \n", R.version$version.string)
}
@@ -171,7 +179,7 @@ check.for.updates.R <- function(notify_user = TRUE,
return(there_is_a_newer_version)
}
-
+# check.for.updates.R()
View
17 R/zzz.r
@@ -91,15 +91,15 @@ installrWelcomeMessage <- function(){
# "Type ?installr to access the overall documentation and\n",
# "vignette('installr') for the package vignette.\n",
# "You can execute a demo of the package via: demo(installr)\n",
- "\n",
+ # "\n",
"More information is available on the installr project web-site:\n",
"https://github.com/talgalili/installr/\n",
"\n",
"Contact: <tal.galili@gmail.com>\n",
"Suggestions and bug-reports can be submitted at: https://github.com/talgalili/installr/issues\n",
"\n",
- "To suppress the this message use:\n",
- "suppressPackageStartupMessages(library(installr))\n",
+ "\t\t\tTo suppress the this message use:\n",
+ "\t\t\tsuppressPackageStartupMessages(library(installr))\n",
sep="")
}
@@ -124,15 +124,16 @@ installrWelcomeMessage <- function(){
# 'install.r'
# 'updateR.r'
-# when a function is renamed, its document in man must be removed - otherwise it may cause problems with the built check (it will try to run the code in the example, and will fail.)
-# When all is done, run:
-# require(devtools)
-# build_win()
-# release()
# IMPORTANT NOTICE: this will add Collate to the DESCRIPTION file, and if any new r file is added - it will need to be updated.
# Collate:
# + 'create.global.library.r'
# + 'install.r'
# + 'updateR.r'
# + 'zzz.r'
+
+# when a function is renamed, its document in man must be removed - otherwise it may cause problems with the built check (it will try to run the code in the example, and will fail.)
+# When all is done, run:
+# require(devtools)
+# build_win()
+# release()

0 comments on commit 08d85f9

Please sign in to comment.
Something went wrong with that request. Please try again.