-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve bootstrap-datepicker update tools, add docs
- Loading branch information
1 parent
4cd92a1
commit 20329fe
Showing
4 changed files
with
68 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env Rscript | ||
# Applies patches stored in tools/datepicker-patches | ||
# Should be run after running tools/updateBootstrapDatepicker.R | ||
|
||
library(rprojroot) | ||
|
||
patch_dir <- rprojroot::find_package_root_file("tools/datepicker-patches") | ||
|
||
for (patch in list.files(patch_dir, full.names = TRUE)) { | ||
tryCatch({ | ||
message(sprintf("Applying %s", basename(patch))) | ||
system(sprintf("git apply '%s'", patch)) | ||
}, | ||
error = function(e) { | ||
quit(save = "no", status = 1) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
#!/usr/bin/env Rscript | ||
# Retrieves a particular version of bootstrap-datepicker: | ||
# https://github.com/uxsolutions/bootstrap-datepicker | ||
# After retrieving, applies the series of patches contained | ||
# in tools/datepicker-patches to inst/www/shared/datepicker/ | ||
# After retrieving, you can apply patches stored in | ||
# tools/datepicker-patches with applyDatepickerPatches.R | ||
|
||
library(rprojroot) | ||
|
||
version <- "1.6.4" | ||
patch_dir <- rprojroot::find_package_root_file("tools/datepicker-patches") | ||
dest_dir <- rprojroot::find_package_root_file("inst/www/shared/datepicker") | ||
tag <- paste0("v", version) | ||
dest_file <- file.path(tempdir(), paste0("bootstrap-datepicker-", version, ".zip")) | ||
url <- sprintf("https://github.com/uxsolutions/bootstrap-datepicker/releases/download/%s/bootstrap-datepicker-%s-dist.zip", tag, version) | ||
|
||
fetch_datepicker <- function() { | ||
tag <- paste0("v", version) | ||
dest_file <- file.path(tempdir(), paste0("bootstrap-datepicker-", version, ".zip")) | ||
url <- sprintf("https://github.com/uxsolutions/bootstrap-datepicker/releases/download/%s/bootstrap-datepicker-%s-dist.zip", tag, version) | ||
download.file(url, dest_file) | ||
unzip( | ||
dest_file, | ||
files = c( | ||
"js/bootstrap-datepicker.js", | ||
"css/bootstrap-datepicker3.css", | ||
"css/bootstrap-datepicker3.min.css" | ||
), | ||
exdir = dest_dir | ||
) | ||
} | ||
|
||
apply_patches <- function() { | ||
} | ||
|
||
fetch_datepicker() | ||
apply_patches() | ||
download.file(url, dest_file) | ||
unzip( | ||
dest_file, | ||
files = c( | ||
"js/bootstrap-datepicker.js", | ||
"css/bootstrap-datepicker3.css", | ||
"css/bootstrap-datepicker3.min.css" | ||
), | ||
exdir = dest_dir | ||
) |