@@ -196,17 +196,18 @@ install_hugo_bin = function(exec, version) {
196196# ' @param version A version number. The default is to automatically detect the
197197# ' latest version. Versions before v0.17 are not supported.
198198# ' @return A data frame containing columns \code{os} (operating system),
199- # ' \code{arch} (architecture), and \code{extended} (extended version or not).
200- # ' If your R version is lower than 4.1.0, a character vector of the installer
201- # ' filenames will be returned instead.
199+ # ' \code{arch} (architecture), \code{extended} (extended version or not),
200+ # ' \code{withdeploy} (with the deploy feature or not). If your R version is
201+ # ' lower than 4.1.0, a character vector of the installer filenames will be
202+ # ' returned instead.
202203# ' @export
203204# ' @examplesIf interactive()
204205# ' blogdown::hugo_installers()
205206# ' blogdown::hugo_installers('0.89.0')
206207# ' blogdown::hugo_installers('0.17')
207208hugo_installers = function (version = ' latest' ) {
208209 repo = ' gohugoio/hugo'
209- if (version == ' latest' ) version = xfun :: github_releases(repo , ' latest' )
210+ if (version == ' latest' ) version = xfun :: github_releases(repo , ' latest' )[ 1 ]
210211 version = sub(' ^[vV]?' , ' v' , version )
211212 json = xfun :: loadable(' jsonlite' )
212213 res = xfun :: github_api(sprintf(' /repos/%s/releases/tags/%s' , repo , version ), raw = ! json )
@@ -216,19 +217,20 @@ hugo_installers = function(version = 'latest') {
216217 res = strsplit(res , ' "browser_download_url":"' )
217218 xfun :: grep_sub(' ^(https://[^"]+)".*' , ' \\ 1' , unlist(res ))
218219 }
219- res = grep(' [.](zip|tar[.]gz)$' , unlist(res ), value = TRUE )
220+ res = grep(' [.](zip|tar[.]gz|pkg )$' , unlist(res ), value = TRUE )
220221 res = basename(res )
221222 if (! ' gregexec' %in% ls(baseenv())) {
222223 warning(' Your R version is too low (< 4.1.0) and does not have gregexec().' )
223224 return (res )
224225 gregexec = regexec # a hack to pass R CMD check without NOTE
225226 }
226- m = gregexec(' ^hugo_(extended_)?([^_]+)_([^-]+)-([^.]+)[.](zip|tar[.]gz )$' , res )
227- res = lapply(regmatches(res , m ), function (x ) if (length(x ) > = 6 ) x [c(1 , 3 , 4 , 5 , 2 )])
227+ m = gregexec(' ^hugo_(extended_)?(withdeploy_)?( [^_]+)_([^-]+)-([^.]+)[.]([a-z.]+ )$' , res )
228+ res = lapply(regmatches(res , m ), function (x ) if (length(x ) > = 6 ) x [c(1 , 4 , 5 , 6 , 2 , 3 )])
228229 res = do.call(rbind , res )
229- colnames(res ) = c(' installer' , ' version' , ' os' , ' arch' , ' extended' )
230+ colnames(res ) = c(' installer' , ' version' , ' os' , ' arch' , ' extended' , ' withdeploy ' )
230231 res = as.data.frame(res )
231232 res $ extended = res $ extended == ' extended_'
233+ res $ withdeploy = res $ withdeploy == ' withdeploy_'
232234 rownames(res ) = res $ installer
233235 res = res [, - 1 ]
234236 res
0 commit comments