Skip to content

Commit

Permalink
Don't init .auth object until .onLoad
Browse files Browse the repository at this point in the history
Creating the .auth object directly at the top-level means the code
from gargle is snapshotted at build time.
  • Loading branch information
jcheng5 authored and jimhester committed Nov 12, 2020
1 parent 7716a67 commit 23b0eec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: gmailr
Title: Access the 'Gmail' 'RESTful' API
Version: 1.0.0.9000
Version: 1.0.0.9001
Author: Jim Hester
Maintainer: Jim Hester <james.f.hester@gmail.com>
Description: An interface to the 'Gmail' 'RESTful' API. Allows
Expand Down
8 changes: 8 additions & 0 deletions R/aaa.R
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
the <- new.env(parent = emptyenv())

.onLoad <- function(libname, pkgname) {

.auth <<- gargle::init_AuthState(
package = "gmailr",
auth_active = TRUE
)
}
7 changes: 3 additions & 4 deletions R/gm-auth.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# This file is the interface between gmailr and the
# auth functionality in gargle.
.auth <- gargle::init_AuthState(
package = "gmailr",
auth_active = TRUE
)

# Initialization happens in .onLoad
.auth <- NULL

# The roxygen comments for these functions are mostly generated from data
# in this list and template text maintained in gargle.
Expand Down

0 comments on commit 23b0eec

Please sign in to comment.