Skip to content

Commit

Permalink
move onLoad() to onAttach() for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
leeper committed Apr 2, 2018
1 parent 20d8877 commit aabb66d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: aws.ec2metadata
Type: Package
Title: Get EC2 Instance Metadata
Version: 0.1.3
Version: 0.1.4
Date: 2018-04-02
Authors@R: c(person("Thomas J.", "Leeper", role = c("aut", "cre"),
email = "thosjleeper@gmail.com"))
Expand Down
10 changes: 7 additions & 3 deletions NEWS.md
@@ -1,12 +1,16 @@
# CHANGES TO aws.ec2metadata 0.1.3
# aws.ec2metadata 0.1.4

* Previous `.onLoad()` functionality added in 0.1.3 is now moved to `.onAttach()` to comply with CRAN policy.

# aws.ec2metadata 0.1.3

* Added a function `instance_document()` that returns a list of the ["instance identity document"](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html) information. This is useful for identifying the region an instance is running in.
* When the package is loaded on an EC2 instance (as identified by `is_ec2()` during package load), the package attempts to set the `AWS_DEFAULT_REGION` environment variable if it has not already been specified. This helps handle request signing.

# CHANGES TO aws.ec2metadata 0.1.2
# aws.ec2metadata 0.1.2

* Added a function `is_ec2()` that returns a logical based on whether metadata is retrievable.

# CHANGES TO aws.ec2metadata 0.1.1
# aws.ec2metadata 0.1.1

* Initial release.
2 changes: 1 addition & 1 deletion R/onLoad.R
@@ -1,4 +1,4 @@
.onLoad <- function(libname, pkgname) {
.onAttach <- function(libname, pkgname) {
if (is_ec2() && Sys.getenv("AWS_DEFAULT_REGION") == "") {
reg <- try(instance_document()$region, silent = TRUE)
if (!inherits(reg, "try-error")) {
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -41,10 +41,10 @@ install.packages("aws.ec2metadata", repos = c(cloudyr = "http://cloudyr.github.i
Or, to pull a potentially unstable version directly from GitHub:

```R
if (!require("ghit")) {
install.packages("ghit")
if (!require("remotes")) {
install.packages("remotes")
}
ghit::install_github("cloudyr/aws.ec2metadata")
remotes::install_github("cloudyr/aws.ec2metadata")
```

---
Expand Down

0 comments on commit aabb66d

Please sign in to comment.