Skip to content

Commit

Permalink
Merge pull request #5 from eddelbuettel/master
Browse files Browse the repository at this point in the history
adding a dependencies badge
  • Loading branch information
GuangchuangYu committed Jan 9, 2019
2 parents 8742c2f + f146705 commit 917c59b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(badge_coveralls)
export(badge_cran_download)
export(badge_cran_release)
export(badge_custom)
export(badge_dependencies)
export(badge_devel)
export(badge_doi)
export(badge_download_bioc)
Expand Down
16 changes: 15 additions & 1 deletion R/badge.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,24 @@ badge_coveralls <- function(ref) {
##' @export
##' @author Gregor de Cillia
badge_cran_download <- function(pkg, type = c("last-month", "last-week", "grand-total"),
color = "green") {
color = "green") {
type <- match.arg(type)
svg <- paste0("http://cranlogs.r-pkg.org/badges/", type, "/", pkg, "?color=", color)
url <- paste0("https://cran.r-project.org/package=", pkg)
placeholder <- "CRAN link"
paste0("[![](", svg, ")](", url, ")")
}

##' dependency badge
##'
##' @title badge_depedencies
##' @param pkg package
##' @return badge in markdown syntax
##' @export
##' @author Dirk Eddelbuettel
badge_dependencies <- function(pkg) {
badge <- paste0("https://tinyverse.netlify.com/badge/", pkg)
url <- paste0("https://cran.r-project.org/package=", pkg)
placeholder <- "Dependencies"
paste0("[![", placeholder, "](", badge, ")](", url, ")")
}
20 changes: 20 additions & 0 deletions man/badge_dependencies.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 917c59b

Please sign in to comment.