Skip to content

Commit c50d034

Browse files
committed
install_prebuilt() also supports macOS
1 parent ccc0945 commit c50d034

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

R/install.R

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,22 +339,35 @@ install_yihui_pkgs = function() {
339339
# install a prebuilt version of TinyTeX
340340
install_prebuilt = function() {
341341
if (is_windows()) {
342-
installer = 'TinyTeX.zip'
343-
download_file('https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip', installer)
344-
install_windows_zip(installer)
342+
install_windows_zip()
345343
} else if (is_linux()) {
346344
system('wget -qO- https://yihui.org/gh/tinytex/tools/download-travis-linux.sh | sh')
345+
} else if (is_macos()) {
346+
install_macos_tgz()
347347
} else {
348348
stop('TinyTeX was not prebuilt for this platform.')
349349
}
350350
}
351351

352+
download_installer = function(file, extra = '') {
353+
download_file(paste0(
354+
'https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/', file, URLencode(extra)
355+
), file)
356+
}
357+
352358
# if you have already downloaded the zip archive, use this function to install it
353359
install_windows_zip = function(path = 'TinyTeX.zip') {
360+
if (missing(path) && !file.exists(path)) download_installer(path, '?job=image: Visual Studio 2019')
354361
unzip(path, exdir = win_app_dir())
355362
tlmgr_path(); texhash(); fmtutil(); updmap(); fc_cache()
356363
}
357364

365+
install_macos_tgz = function(path = 'TinyTeX.tar.gz') {
366+
if (missing(path) && !file.exists(path)) download_installer(path, '?job=image: macos')
367+
untar(path, exdir = path.expand('~/Library'))
368+
tlmgr_path()
369+
}
370+
358371
#' Copy TinyTeX to another location and use it in another system
359372
#'
360373
#' The function \code{copy_tinytex()} copies the existing TinyTeX installation

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ for:
6464

6565
test_script:
6666
- Rscript "tools/test-basic.R"
67-
- tar zcf TinyTeX-macOS.tar.gz -C ~/Library TinyTeX
67+
- tar zcf TinyTeX.tar.gz -C ~/Library TinyTeX
6868

6969
artifacts:
70-
- path: TinyTeX-macOS.tar.gz
71-
name: TinyTeX-macOS
70+
- path: TinyTeX.tar.gz
71+
name: TinyTeX

0 commit comments

Comments
 (0)