From 23b0eec2b06b7217591a39df60962ea6f5f4ddd0 Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Wed, 11 Nov 2020 15:44:19 -0800 Subject: [PATCH] Don't init .auth object until .onLoad Creating the .auth object directly at the top-level means the code from gargle is snapshotted at build time. --- DESCRIPTION | 2 +- R/aaa.R | 8 ++++++++ R/gm-auth.R | 7 +++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ec8de38..99f17f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 Description: An interface to the 'Gmail' 'RESTful' API. Allows diff --git a/R/aaa.R b/R/aaa.R index 639ae6c..5f8bd54 100644 --- a/R/aaa.R +++ b/R/aaa.R @@ -1 +1,9 @@ the <- new.env(parent = emptyenv()) + +.onLoad <- function(libname, pkgname) { + + .auth <<- gargle::init_AuthState( + package = "gmailr", + auth_active = TRUE + ) +} diff --git a/R/gm-auth.R b/R/gm-auth.R index 77ad197..97566e1 100644 --- a/R/gm-auth.R +++ b/R/gm-auth.R @@ -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.