-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9240947
commit 74be294
Showing
11 changed files
with
211 additions
and
71 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
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,52 @@ | ||
#' | ||
#' Add HTML snippet for package hex sticker in README | ||
#' | ||
#' @param repo Short remote git repository name. If NULL, is determined based | ||
#' on current git settings. | ||
#' | ||
#' @returns An entry to the first level header section of the README of the | ||
#' repository. | ||
#' | ||
#' @examples | ||
#' if (interactive()) add_logo() | ||
#' | ||
#' @export | ||
#' | ||
|
||
add_logo <- function(repo = NULL) { | ||
## Get repo name ---- | ||
repo_name <- stringr::str_extract(string = repo, pattern = "[^/]*$") | ||
|
||
## Check if logo is available ---- | ||
#if (file.exists("man/figures/logo.png")) | ||
|
||
logo_text <- "<img src='man/figures/logo.png' width='200px' align='right' />" | ||
|
||
## Determine which file to append badge to ---- | ||
if (file.exists("README.Rmd")) { | ||
path <- "README.Rmd" | ||
} else { | ||
path <- "README.md" | ||
} | ||
|
||
## Read file in path ---- | ||
readme_lines <- readLines(path, encoding = "UTF-8") | ||
|
||
if (any(stringr::str_detect(string = readme_lines, pattern = logo_text))) | ||
return(FALSE) | ||
|
||
## Get start and end line of badges ---- | ||
header_line <- stringr::str_detect( | ||
readme_lines, pattern = paste0("# ", repo_name, ":") | ||
) |> | ||
(\(x) seq_len(length(x))[x])() | ||
|
||
## Create replacement text ---- | ||
readme_lines[header_line] <- paste0(readme_lines[header_line], " ", logo_text) | ||
|
||
## Append replacement text ---- | ||
writeLines(text = readme_lines, con = path) | ||
|
||
## Return TRUE if badge was added ---- | ||
TRUE | ||
} |
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
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,35 @@ | ||
# Contributing | ||
|
||
## Bugs | ||
|
||
* Submit an issue on the [issues page](https://github.com/nutriverse/anthrocheckr/issues) | ||
|
||
## Code contributions | ||
|
||
* Fork this repository to your Github account | ||
|
||
* Clone your version on your account down to your machine from your account | ||
|
||
``` | ||
git clone https://github.com/<yourgithubusername>/anthrocheckr.git | ||
``` | ||
|
||
* Make sure to track progress upstream i.e., on our version of `anthrocheckr` | ||
at `nutriverse/anthrocheckr`, by doing | ||
|
||
``` | ||
git remote add upstream https://github.com/nutriverse/anthrocheckr.git | ||
``` | ||
|
||
* Before making changes make sure to pull changes in from `upstream` by doing | ||
either `git fetch upstream` then merge later or `git pull upstream` to fetch | ||
and merge in one step | ||
|
||
* Make your changes on a new feature branch | ||
|
||
* Please write a test or tests for your changes if they affect code and not just | ||
documentation | ||
|
||
* Push up changes to your account | ||
|
||
* Submit a pull request at `nutriverse/anthrocheckr` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.