Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to version 0.0.2 #31

Merged
merged 11 commits into from
Jan 2, 2024
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: NPSdataverse
Title: Tools and Packages for Data and Metadata Manipulation
Version: 0.0.1
Version: 0.0.2
Authors@R: c(
person(given="Robert", family="Baker", email="[email protected]",
role = c("aut", "cre"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

export(NPSdataverse_packages)
export(detach_NPSdataverse)
export(is_online)
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# NPSdatavers 0.0.1
# NPSdataverse 0.0.2

2024-01-02

* Added function ability to load NPSdataverse (using library()) when offline
* Now dynamically checks for github username rather than hardcoding in NPS
* Fixed operands so that updates actually get checked

# NPSdataverse 0.0.1

2023-09-12

Expand Down
20 changes: 20 additions & 0 deletions R/attach.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,23 @@ NPSdataverse_packages <- function() {
return(names)

}

#' Check internet connectivity
#'
#' @description Checks whether the system can ping github.com. Adapted from:https://stackoverflow.com/questions/5076593/how-to-determine-if-you-have-an-internet-connection-in-r

#' @param site string defaults to https://github.com
#'
#' @return logical
#' @export
#'
#' @examples
#' is_online()
is_online <- function(site="https://github.com/") {
tryCatch({
readLines(site,n=1)
TRUE
},
warning = function(w) invokeRestart("muffleWarning"),
error = function(e) FALSE)
}
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ check_loaded <- function() {
is_attached <- function(x) {
paste0("package:", x) %in% search()
}


9 changes: 8 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
.onAttach <- function(...) {
#if internet access is available, check for updated packages:
#check for github packages that need updating
.update_git_repos()

if(is_online()){
.update_git_repos()
} else {
packageStartupMessage("Warning: You are offline. Cannot check for package updates.\n")
}

# See if any packages are needed
needed <- pkgs[!is_attached(pkgs)]
Expand All @@ -17,3 +23,4 @@
}

}

2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ location and delete the offending package. Then try to re-install.
## Updating NPSdataverse packages

Many of the NPSdataverse packages are in a phase of rapid development. When you
load the NPSdataverse (using `library(NPSdataverse)`), NPSdataverse will check
load the NPSdataverse (using `library(NPSdataverse)`), if you are online, NPSdataverse will check
for new versions of the packages stored on GitHub (all the packages except
r/EML). NPSdataverse will tell you if all your packages are up to date.
Conversely if any of the NPSdataverse packages need to be updated, NPSdataverse
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ re-install.
## Updating NPSdataverse packages

Many of the NPSdataverse packages are in a phase of rapid development.
When you load the NPSdataverse (using `library(NPSdataverse)`),
NPSdataverse will check for new versions of the packages stored on
GitHub (all the packages except r/EML). NPSdataverse will tell you if
all your packages are up to date. Conversely if any of the NPSdataverse
packages need to be updated, NPSdataverse will indicate which packages
need updating and how to perform the updates. If you do not get any
notices about whether your packages are up to date or not, then the
NPSdataverse package itself needs to be updated. See Installation for
instructions on how to update the NPSdataverse package.
When you load the NPSdataverse (using `library(NPSdataverse)`), if you
are online, NPSdataverse will check for new versions of the packages
stored on GitHub (all the packages except r/EML). NPSdataverse will tell
you if all your packages are up to date. Conversely if any of the
NPSdataverse packages need to be updated, NPSdataverse will indicate
which packages need updating and how to perform the updates. If you do
not get any notices about whether your packages are up to date or not,
then the NPSdataverse package itself needs to be updated. See
Installation for instructions on how to update the NPSdataverse package.

## Creating data packages

Expand Down
4 changes: 2 additions & 2 deletions docs/404.html

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

4 changes: 2 additions & 2 deletions docs/LICENSE-text.html

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

4 changes: 2 additions & 2 deletions docs/LICENSE.html

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

4 changes: 2 additions & 2 deletions docs/articles/NPSdataverse.html

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

4 changes: 2 additions & 2 deletions docs/articles/index.html

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

12 changes: 6 additions & 6 deletions docs/authors.html

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

6 changes: 3 additions & 3 deletions docs/index.html

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

18 changes: 16 additions & 2 deletions docs/news/index.html

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

6 changes: 3 additions & 3 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pandoc: 3.1.1
pkgdown: 2.0.6.9000
pkgdown_sha: 5bb671b1a8bac8e926479868681936f7c9ee41b3
pkgdown: 2.0.7
pkgdown_sha: ~
articles:
NPSdataverse: NPSdataverse.html
last_built: 2023-09-12T22:27Z
last_built: 2024-01-02T20:16Z

4 changes: 2 additions & 2 deletions docs/reference/NPSdataverse_packages.html

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

4 changes: 2 additions & 2 deletions docs/reference/detach_NPSdataverse.html

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

4 changes: 2 additions & 2 deletions docs/reference/dot-print_cust_package_deps.html

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

4 changes: 2 additions & 2 deletions docs/reference/dot-update_git_repos.html

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

Loading