8
8
# ' artifacts of certain file exensions. Default: \code{FALSE}
9
9
# ' @param git_method (character) One of ssh (default) or https. If a remote already
10
10
# ' exists, we use that remote, and this parameter is ignored.
11
+ # ' @param sleep (integer) Seconds to sleep after creating gist, but before
12
+ # ' collecting metadata on the gist. If uploading a lot of stuff, you may want to
13
+ # ' set this to a higher value, otherwise, you may not get accurate metadata for
14
+ # ' your gist. You can of course always refresh afterwards by calling \code{gist}
15
+ # ' with your gist id.
11
16
# '
12
17
# ' @details Note that when \code{browse=TRUE} there is a slight delay in when
13
18
# ' we open up the gist in your default browser and when the data will display
118
123
gist_create_git <- function (files = NULL , description = " " , public = TRUE , browse = TRUE ,
119
124
knit = FALSE , code = NULL , filename = " code.R" ,
120
125
knitopts = list (), renderopts = list (), include_source = FALSE ,
121
- artifacts = FALSE , imgur_inject = FALSE , git_method = " ssh" , ... ) {
126
+ artifacts = FALSE , imgur_inject = FALSE , git_method = " ssh" ,
127
+ sleep = 1 , ... ) {
122
128
123
129
if (! requireNamespace(" git2r" , quietly = TRUE )) {
124
130
stop(" Please install git2r" , call. = FALSE )
@@ -199,6 +205,9 @@ gist_create_git <- function(files = NULL, description = "", public = TRUE, brows
199
205
}
200
206
}
201
207
208
+ # wait a bit before collecting metadata
209
+ Sys.sleep(sleep )
210
+
202
211
# refresh gist metadata
203
212
gst <- gist(gst $ id )
204
213
message(" The file list for your gist may not be accurate if you are uploading a lot of files" )
@@ -225,6 +234,7 @@ makefiles <- function(x) {
225
234
}
226
235
227
236
unpack <- function (z ) {
237
+ if (! file.exists(z )) stop(sprintf(" '%s' does not exist" , z ), call. = FALSE )
228
238
if (file.info(z )$ isdir ) {
229
239
list.files(z , full.names = TRUE )
230
240
} else {
0 commit comments