mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-14 09:28:02 -05:00
29 lines
836 B
R
Executable File
29 lines
836 B
R
Executable File
#!/usr/bin/env Rscript
|
|
|
|
# This script downloads strftime-min.js from its GitHub repository,
|
|
# https://github.com/samsonjs/strftime
|
|
|
|
# This script can be sourced from RStudio, or run with Rscript.
|
|
|
|
# Returns the file currently being sourced or run with Rscript
|
|
thisFile <- function() {
|
|
cmdArgs <- commandArgs(trailingOnly = FALSE)
|
|
needle <- "--file="
|
|
match <- grep(needle, cmdArgs)
|
|
if (length(match) > 0) {
|
|
# Rscript
|
|
return(normalizePath(sub(needle, "", cmdArgs[match])))
|
|
} else {
|
|
# 'source'd via R console
|
|
return(normalizePath(sys.frames()[[1]]$ofile))
|
|
}
|
|
}
|
|
|
|
ref <- "v0.9.2"
|
|
destdir <- file.path(dirname(thisFile()), "../inst/www/shared/strftime/")
|
|
|
|
download.file(
|
|
paste0("https://raw.githubusercontent.com/samsonjs/strftime/", ref, "/strftime-min.js"),
|
|
destfile = file.path(destdir, "strftime-min.js")
|
|
)
|