Skip to content

Commit

Permalink
update counts immediately after files are deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Jan 6, 2016
1 parent 56e3c87 commit 2972b33
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions inst/examples/upload-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ if (file.exists('download_count.csv')) {
counts = counts[!duplicated(counts$file), ]
}
rownames(counts) = FILES[match(basename(FILES), counts$file)]
.Last = function() {
counts = counts[order(counts$file), , drop = FALSE]
write.csv(counts, 'download_count.csv', row.names = FALSE)
}

library(httr)
token = Sys.getenv('GH_TOKEN', NA)
Expand Down Expand Up @@ -65,6 +61,11 @@ for (i in x$assets) {
DELETE(i$url)
Sys.sleep(1)
}

# update download counts
counts = counts[order(counts$file), , drop = FALSE]
write.csv(counts, 'download_count.csv', row.names = FALSE)

# upload files
for (f in FILES) {
message('uploading ', f)
Expand Down

0 comments on commit 2972b33

Please sign in to comment.