├── .Rbuildignore ├── .github ├── .gitignore ├── CONTRIBUTING.md └── workflows │ └── R-CMD-check.yaml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── DESCRIPTION ├── LICENSE.md ├── Meta └── vignette.rds ├── NAMESPACE ├── NEWS.md ├── R ├── gi_available_templates.R ├── gi_fetch_templates.R ├── gi_write_gitignore.R ├── gitignore-package.R └── zzz.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── codemeta.json ├── cran-comments.md ├── docs ├── 404.html ├── CODE_OF_CONDUCT.html ├── CONTRIBUTING.html ├── LICENSE.html ├── articles │ ├── index.html │ └── introduction.html ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── deps │ ├── bootstrap-5.3.1 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-toc-1.0.1 │ │ └── bootstrap-toc.min.js │ ├── clipboard.js-2.0.11 │ │ └── clipboard.min.js │ ├── data-deps.txt │ ├── font-awesome-6.4.2 │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── headroom-0.11.0 │ │ ├── headroom.min.js │ │ └── jQuery.headroom.min.js │ ├── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map │ └── search-1.0.0 │ │ ├── autocomplete.jquery.min.js │ │ ├── fuse.min.js │ │ └── mark.min.js ├── docsearch.css ├── docsearch.js ├── index.html ├── katex-auto.js ├── lightswitch.js ├── link.svg ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── figures │ │ └── README-pressure-1.png │ ├── gi_available_templates.html │ ├── gi_fetch_templates.html │ ├── gi_write_gitignore.html │ ├── gitignore-package.html │ ├── gitignore.html │ └── index.html ├── search.json └── sitemap.xml ├── gitignore.Rproj ├── inst └── WORDLIST ├── man ├── figures │ └── README-pressure-1.png ├── gi_available_templates.Rd ├── gi_fetch_templates.Rd ├── gi_write_gitignore.Rd └── gitignore-package.Rd ├── tests ├── spelling.R ├── testthat.R └── testthat │ ├── test-gi_available_templates.R │ ├── test-gi_fetch_templates.R │ └── test-gi_write_gitignore.R └── vignettes ├── .gitignore ├── introduction.Rmd └── introduction.Rmd.orig /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.git$ 4 | ^\.github$ 5 | ^\.gitignore$ 6 | ^docs$ 7 | ^CODE_OF_CONDUCT.md$ 8 | ^cran-comments.md$ 9 | ^codemeta\.json$ 10 | ^pkgdown$ 11 | ^README\.md$ 12 | ^README\.Rmd$ 13 | ^LICENSE\.md$ 14 | ^_pkgdown\.yml$ 15 | ^CRAN-SUBMISSION$ 16 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to gitignore 2 | 3 | This outlines how to propose a change to gitignore. For more detailed 4 | info about contributing to this, and other tidyverse packages, please see the 5 | [**development contributing guide**](https://rstd.io/tidy-contrib). 6 | 7 | ### Fixing typos 8 | 9 | Small typos or grammatical errors in documentation may be edited directly using 10 | the GitHub web interface, so long as the changes are made in the _source_ file. 11 | 12 | * YES: you edit a roxygen comment in a `.R` file below `R/`. 13 | * NO: you edit an `.Rd` file below `man/`. 14 | 15 | ### Prerequisites 16 | 17 | Before you make a substantial pull request, you should always file an issue and 18 | make sure someone from the team agrees that it’s a problem. If you’ve found a 19 | bug, create an associated issue and illustrate the bug with a minimal 20 | [reprex](https://www.tidyverse.org/help/#reprex). 21 | 22 | ### Pull request process 23 | 24 | * We recommend that you create a Git branch for each pull request (PR). 25 | * Look at the Travis and AppVeyor build status before and after making changes. 26 | The `README` should contain badges for any continuous integration services used 27 | by the package. 28 | * New code should follow the tidyverse [style guide](http://style.tidyverse.org). 29 | You can use the [styler](https://CRAN.R-project.org/package=styler) package to 30 | apply these styles, but please don't restyle code that has nothing to do with 31 | your PR. 32 | * We use [roxygen2](https://cran.r-project.org/package=roxygen2), with 33 | [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/markdown.html), 34 | for documentation. 35 | * We use [testthat](https://cran.r-project.org/package=testthat). Contributions 36 | with test cases included are easier to accept. 37 | * For user-facing changes, add a bullet to the top of `NEWS.md` below the 38 | current development version header describing the changes made followed by your 39 | GitHub username, and links to relevant issue(s)/PR(s). 40 | 41 | ### Code of Conduct 42 | 43 | Please note that the gitignore project is released with a 44 | [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this 45 | project you agree to abide by its terms. 46 | 47 | ### See tidyverse [development contributing guide](https://rstd.io/tidy-contrib) 48 | for further details. 49 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-CMD-check 10 | 11 | permissions: read-all 12 | 13 | jobs: 14 | R-CMD-check: 15 | runs-on: ${{ matrix.config.os }} 16 | 17 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 18 | 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | config: 23 | - { os: macos-latest, r: "release" } 24 | - { os: windows-latest, r: "release" } 25 | - { os: ubuntu-latest, r: "devel", http-user-agent: "release" } 26 | - { os: ubuntu-latest, r: "release" } 27 | - { os: ubuntu-latest, r: "oldrel-1" } 28 | 29 | env: 30 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 31 | R_KEEP_PKG_SOURCE: yes 32 | 33 | steps: 34 | - uses: actions/checkout@v4 35 | 36 | - uses: r-lib/actions/setup-pandoc@v2 37 | 38 | - uses: r-lib/actions/setup-r@v2 39 | with: 40 | r-version: ${{ matrix.config.r }} 41 | http-user-agent: ${{ matrix.config.http-user-agent }} 42 | use-public-rspm: true 43 | 44 | - uses: r-lib/actions/setup-r-dependencies@v2 45 | with: 46 | extra-packages: any::rcmdcheck 47 | needs: check 48 | 49 | - uses: r-lib/actions/check-r-package@v2 50 | with: 51 | upload-snapshots: true 52 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/r 3 | # Edit at https://www.gitignore.io/?templates=r 4 | 5 | ### R ### 6 | # History files 7 | .Rhistory 8 | .Rapp.history 9 | 10 | # Session Data files 11 | .RData 12 | 13 | # User-specific files 14 | .Ruserdata 15 | 16 | # Example code in package build process 17 | *-Ex.R 18 | 19 | # Output files from R CMD build 20 | /*.tar.gz 21 | 22 | # Output files from R CMD check 23 | /*.Rcheck/ 24 | 25 | # RStudio files 26 | .Rproj.user/ 27 | 28 | # produced vignettes 29 | vignettes/*.html 30 | vignettes/*.pdf 31 | 32 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 33 | .httr-oauth 34 | 35 | # knitr and R markdown default cache directories 36 | /*_cache/ 37 | /cache/ 38 | 39 | # Temporary files created by R markdown 40 | *.utf8.md 41 | *.knit.md 42 | 43 | ### R.Bookdown Stack ### 44 | # R package: bookdown caching files 45 | /*_files/ 46 | 47 | # End of https://www.gitignore.io/api/r 48 | # Created by https://www.gitignore.io/api/r,java 49 | # Edit at https://www.gitignore.io/?templates=r,java 50 | ### Java ### 51 | # Compiled class file 52 | *.class 53 | # Log file 54 | *.log 55 | # BlueJ files 56 | *.ctxt 57 | # Mobile Tools for Java (J2ME) 58 | .mtj.tmp/ 59 | # Package Files # 60 | *.jar 61 | *.war 62 | *.nar 63 | *.ear 64 | *.zip 65 | *.tar.gz 66 | *.rar 67 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 68 | hs_err_pid* 69 | # End of https://www.gitignore.io/api/r,java 70 | doc 71 | Meta 72 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who 4 | contribute through reporting issues, posting feature requests, updating documentation, 5 | submitting pull requests or patches, and other activities. 6 | 7 | We are committed to making participation in this project a harassment-free experience for 8 | everyone, regardless of level of experience, gender, gender identity and expression, 9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 10 | 11 | Examples of unacceptable behavior by participants include the use of sexual language or 12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment, 13 | insults, or other unprofessional conduct. 14 | 15 | Project maintainers have the right and responsibility to remove, edit, or reject comments, 16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this 17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed 18 | from the project team. 19 | 20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by 21 | opening an issue or contacting one or more of the project maintainers. 22 | 23 | This Code of Conduct is adapted from the Contributor Covenant 24 | (https://www.contributor-covenant.org), version 1.0.0, available at 25 | https://contributor-covenant.org/version/1/0/0/. 26 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Type: Package 2 | Package: gitignore 3 | Title: Create Useful .gitignore Files for your Project 4 | Version: 0.1.8.9000 5 | Authors@R: 6 | c(person(given = "Philippe", 7 | family = "Massicotte", 8 | role = c("aut", "cre"), 9 | email = "pmassicotte@hotmail.com", 10 | comment = c(ORCID = "0000-0002-5919-4116")), 11 | person(given = "Amanda", 12 | family = "Dobbyn", 13 | role = "rev", 14 | email = "amanda.e.dobbyn@gmail.com"), 15 | person(given = "Mauro", 16 | family = "Lepore", 17 | role = "rev", 18 | email = "maurolepore@gmail.com", 19 | comment = c(ORCID = "0000-0002-1986-7988"))) 20 | Description: Simple interface to query gitignore.io to fetch 21 | gitignore templates that can be included in the .gitignore file. More 22 | than 450 templates are currently available. 23 | License: GPL-3 24 | URL: https://docs.ropensci.org/gitignore/, https://github.com/ropensci/gitignore 25 | BugReports: https://github.com/ropensci/gitignore/issues 26 | Imports: 27 | cli, 28 | clipr, 29 | curl, 30 | glue, 31 | here, 32 | jsonlite, 33 | purrr, 34 | xfun 35 | Suggests: 36 | covr, 37 | knitr, 38 | rmarkdown, 39 | spelling, 40 | testthat (>= 3.0.0) 41 | VignetteBuilder: 42 | knitr 43 | Encoding: UTF-8 44 | Language: en-US 45 | LazyData: true 46 | RoxygenNote: 7.3.2 47 | Config/testthat/edition: 3 48 | -------------------------------------------------------------------------------- /Meta/vignette.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/Meta/vignette.rds -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(gi_available_templates) 4 | export(gi_fetch_templates) 5 | export(gi_write_gitignore) 6 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # gitignore (development version) 2 | 3 | # gitignore 0.1.8 4 | 5 | - Use testthat edition 3 (@jrdnbradford). 6 | 7 | - Do not run examples if internet is not available. 8 | 9 | # gitignore 0.1.7 10 | 11 | - gitignore now provides clickable links as it uses cli instead of crayon (@olivroy). 12 | 13 | - Upgrading to use Bootstrap 5. 14 | 15 | - Add light and dark themes to the vignette. 16 | 17 | # gitignore 0.1.6 18 | 19 | - Skip or do not execute code chunks in vignettes if the internet or the gitignore API is not available, to fix CRAN problems. 20 | - Update workflow link to point to the v2 branch of r-lib/actions repository. 21 | 22 | # gitignore 0.1.5 23 | 24 | - Using GitHub Actions for continuous integration. 25 | 26 | - Fixing CRAN check results where tests failed when internet connection was not available (#18). 27 | 28 | # gitignore 0.1.4 29 | 30 | - Change backend from https://www.gitignore.io/ to https://www.toptal.com/developers/gitignore as the former now redirects to the latter (#13 @pat-s). 31 | 32 | - Use `file.path()` instead of `paste0()` to build path. @dpprdan 33 | 34 | # gitignore 0.1.3 35 | 36 | - This is a minor update that prevent the use of the clipboard on CRAN Linux systems. 37 | 38 | # gitignore 0.1.2 39 | 40 | - First release on CRAN. 41 | 42 | # gitignore 0.1.1 43 | 44 | - First release on rOpenSci. 45 | -------------------------------------------------------------------------------- /R/gi_available_templates.R: -------------------------------------------------------------------------------- 1 | #' Fetch available templates from gitignore.io 2 | #' 3 | #' This return list of all templates supported by gitignore.io. 4 | #' 5 | #' @details The returned list is returned as lower case characters. 6 | #' 7 | #' @return A character with all templates supported by gitignore.io. 8 | #' @export 9 | #' 10 | #' @examplesIf curl::has_internet() 11 | #' gi_available_templates() 12 | gi_available_templates <- 13 | function() { 14 | url <- glue::glue("{backend_url()}/api/list?format=json") 15 | res <- curl::curl_fetch_memory(url) 16 | 17 | if (res[["status_code"]] != 200L) { 18 | cli::cli_abort("http request failed with status code: {res$status_code}") 19 | } 20 | 21 | json_text <- rawToChar(res[["content"]]) 22 | 23 | if (!jsonlite::validate(json_text)) { 24 | cli::cli_abort( 25 | "Invalid json file returned in gi_available_templates() function." 26 | ) 27 | } 28 | 29 | r <- jsonlite::fromJSON(json_text) 30 | 31 | templates <- tolower(sort(purrr::map_chr(r, "name"))) 32 | unname(templates) 33 | } 34 | -------------------------------------------------------------------------------- /R/gi_fetch_templates.R: -------------------------------------------------------------------------------- 1 | #' Fetch gitignore template(s) from gitignore.io 2 | #' 3 | #' @param template_name A character vector with values included in 4 | #' \code{\link{gi_available_templates}}. 5 | #' @param copy_to_clipboard Logical. Should the returned template(s) be copied 6 | #' to the clipboard? Otherwise, it will be printed in the console. Default is FALSE. 7 | #' @param append_gitignore Logical. Should the .gitignore be modified to include 8 | #' the returned template(s)? 9 | #' @param gitignore_file The path of the .gitignore file to be modified. By 10 | #' default, it will try to find it in the current package/project using 11 | #' `here::here(".gitignore")`. 12 | #' 13 | #' @return A character containing gitignore template(s). 14 | #' @export 15 | #' 16 | #' @examplesIf curl::has_internet() 17 | #' # Fetch template for the R language 18 | #' gi_fetch_templates("R") 19 | #' 20 | #' # You can combine many templates at once 21 | #' gi_fetch_templates(c("R", "python", "java")) 22 | #' 23 | #' # The .gitignore file can be automatically modified with `append_gitignore = TRUE` 24 | #' gi_fetch_templates(c("R", "python", "java")) 25 | gi_fetch_templates <- 26 | function(template_name, 27 | copy_to_clipboard = FALSE, 28 | append_gitignore = FALSE, 29 | gitignore_file = here::here(".gitignore")) { 30 | # Check if vector of char 31 | stopifnot( 32 | is.character(template_name), 33 | is.logical(copy_to_clipboard), 34 | is.logical(append_gitignore) 35 | ) 36 | 37 | template_name <- tolower(template_name) 38 | 39 | # Check is all template_names exist, i.e. supported by gitignore.io 40 | l <- gi_available_templates() 41 | 42 | i <- template_name %in% l 43 | 44 | if (!all(i)) { 45 | # https://cli.r-lib.org/reference/cli_div.html 46 | cli::cli_div( 47 | theme = list(span.emph = list(color = "red", "font-weight" = "bold")) 48 | ) 49 | cli::cli_abort( 50 | "Some template_name were not found on gitignore.io: {.emph {template_name[!i]}}." 51 | ) 52 | } 53 | 54 | # Fetch the gitignore data 55 | template_name <- paste(template_name, collapse = ",") 56 | 57 | r <- curl::curl_fetch_memory( 58 | glue::glue("{backend_url()}/api/{template_name}") 59 | ) 60 | 61 | if (r[["status_code"]] != 200L) { 62 | cli::cli_abort("http request failed with status code: {r$status_code}") 63 | } 64 | 65 | # Copy or not into the clipboard 66 | if (clipr::clipr_available() && copy_to_clipboard) { # nocov start 67 | clipr::write_clip(rawToChar(r[["content"]])) 68 | cli::cli_inform(c( 69 | "v" = "Copied to the clipboard. 70 | You can now paste it in your {.file .gitignore}" 71 | )) # nocov end 72 | } else { 73 | cat(rawToChar(r[["content"]])) 74 | } 75 | 76 | if (append_gitignore) { 77 | gi_write_gitignore(rawToChar(r[["content"]]), gitignore_file) 78 | } 79 | 80 | invisible(rawToChar(r[["content"]])) 81 | } 82 | -------------------------------------------------------------------------------- /R/gi_write_gitignore.R: -------------------------------------------------------------------------------- 1 | #' Append or create a .gitignore file 2 | #' 3 | #' Use the returned template(s) to append the existing .gitignore file. 4 | #' 5 | #' @param fetched_template Template(s) returned by `gi_fetch_templates()`. 6 | #' @param gitignore_file Path of the .gitignore file to modify. 7 | #' 8 | #' @return TRUE if succeeds to write/append the .gitignore, FALSE otherwise. 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' \dontrun{ 14 | #' f <- file.path(tempdir(), ".gitignore") 15 | #' new_lines <- gi_fetch_templates("r") 16 | #' gi_write_gitignore(new_lines, f) 17 | #' 18 | #' unlink(f) 19 | #' } 20 | gi_write_gitignore <- 21 | function(fetched_template, 22 | gitignore_file = here::here(".gitignore")) { 23 | stopifnot(basename(gitignore_file) == ".gitignore") 24 | 25 | if (!file.exists(gitignore_file)) { # nocov start 26 | cli::cli_inform(c( 27 | "x" = "The .gitignore file could not be found in the 28 | project directory {.path {here::here()}}", 29 | i = "Would you like to create it?" 30 | )) 31 | 32 | response <- utils::menu(c("Yes", "No")) 33 | 34 | if (response == 1L) { 35 | file.create(gitignore_file) 36 | } else { 37 | cli::cli_abort( 38 | "Could not find the file: {.file {gitignore_file}}" 39 | ) 40 | } 41 | } # nocov end 42 | 43 | existing_lines <- 44 | readLines(gitignore_file, warn = FALSE, encoding = "UTF-8") 45 | 46 | fetched_template_splitted <- unlist(strsplit( 47 | fetched_template, 48 | "\n", 49 | fixed = TRUE 50 | )) 51 | 52 | new <- setdiff(fetched_template_splitted, existing_lines) 53 | 54 | if (length(new) == 0L) { 55 | cli::cli_inform(c( 56 | "!" = "Nothing to be modified in the {.file .gitignore} file." 57 | )) 58 | return(FALSE) 59 | } 60 | 61 | all <- c(existing_lines, new) 62 | 63 | xfun::write_utf8(all, gitignore_file) 64 | 65 | cli::cli_inform(c( 66 | "v" = "{.file .gitignore} file successfully modified." 67 | )) 68 | 69 | invisible(TRUE) 70 | } 71 | -------------------------------------------------------------------------------- /R/gitignore-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | 4 | # The following block is used by usethis to automatically manage 5 | # roxygen namespace tags. Modify with care! 6 | ## usethis namespace: start 7 | ## usethis namespace: end 8 | NULL 9 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | backend_url <- function() { 2 | "https://www.toptal.com/developers/gitignore" 3 | } 4 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | ``` 15 | # gitignore 16 | 17 | 18 | 19 | [![CRAN status](https://www.r-pkg.org/badges/version/gitignore)](https://cran.r-project.org/package=gitignore) 20 | [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) 21 | [![Codecov test coverage](https://codecov.io/gh/ropensci/gitignore/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/gitignore?branch=main) 22 | [![DOI](https://zenodo.org/badge/184759416.svg)](https://zenodo.org/badge/latestdoi/184759416) 23 | [![rOpenSci peer-review](https://badges.ropensci.org/303_status.svg)](https://github.com/ropensci/software-review/issues/303) 24 | [![R-CMD-check](https://github.com/PMassicotte/gitignore/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/gitignore/actions/workflows/R-CMD-check.yaml) 25 | 26 | 27 | Based on the definition proposed by [freecodecamp](https://www.freecodecamp.org/news/gitignore-what-is-it-and-how-to-add-to-repo/): 28 | 29 | > The .gitignore file is a text file that tells Git which files or folders to ignore in a project. A local .gitignore file is usually placed in the root directory of a project. You can also create a global .gitignore file and any entries in that file will be ignored in all of your Git repositories. 30 | 31 | For any project, it is therefore important to have a `.gitignore` file that is complete and accurate. The package `gitignore` provides a simple R interface to the [gitignore.io](https://www.toptal.com/developers/gitignore) API. It can be used to fetch gitignore templates that can be included into the `.gitignore` file of you git repository. The `gitignore` R package can be used with R package, R Studio project or with any `.gitignore` file. Note that by default, the `usethis` package populates the `.gitignore` for the R language when you create a R project. However, it is common to use many different programming languages in a project such as `LaTeX`, `python`, `matlab`, `julia` and so one. This is where the `gitignore` package shines as it can be used to programmatically modify the `.gitignore` file of your project. 32 | 33 | ## Installation 34 | 35 | The CRAN version of `gitignore` can be installed using: 36 | 37 | ```{r, eval=FALSE} 38 | install.packages("gitignore") 39 | ``` 40 | 41 | The dev version of `gitignore` can be installed from GitHub: 42 | 43 | ```{r, eval=FALSE} 44 | install.packages("devtools") 45 | devtools::install_github("ropensci/gitignore") 46 | ``` 47 | 48 | ## Examples 49 | 50 | There are currently two useful functions in the package: 51 | 52 | - `gi_available_templates()` to fetch all supported gitignore templates. 53 | - `gi_fetch_templates()` to fetch one or many gitignore templates. 54 | 55 | Show the first 25 templates returned by `gi_available_templates()`. 56 | 57 | ```{r} 58 | library(gitignore) 59 | 60 | head(gi_available_templates(), 25) 61 | ``` 62 | 63 | Templates can be fetched using the `gi_fetch_templates()` function. 64 | 65 | ```{r, results='markup', comment=""} 66 | gi_fetch_templates("R") 67 | ``` 68 | 69 | Multiple templates can be fetched by specifying multiple values: 70 | 71 | ```{r, results='markup', comment=""} 72 | gi_fetch_templates(c("java", "c++")) 73 | ``` 74 | 75 | By default, templates are copied into the clipboard. It is also possible to modify a `.gitignore` file using the `gi_write_gitignore()` function. 76 | 77 | ```{r, eval=FALSE} 78 | f <- file.path(tempdir(), ".gitignore") 79 | new_lines <- gi_fetch_templates("r") 80 | gi_write_gitignore(fetched_template = new_lines, gitignore_file = f) 81 | ``` 82 | 83 | If `gitignore_file` is not specified, `gitignore` will try to find the `.gitignore` file of your current project or package. 84 | 85 | More examples are provided in the vignette. 86 | 87 | ```{r, eval=FALSE} 88 | browseVignettes("gitignore") 89 | ``` 90 | 91 | You can also visit the [gitignore website](https://docs.ropensci.org/gitignore/). 92 | 93 | ## Code of conduct 94 | 95 | Please note that the 'gitignore' project is released with a [Contributor Code of Conduct](https://docs.ropensci.org/gitignore/CODE_OF_CONDUCT.html). By [contributing to this project](https://docs.ropensci.org/gitignore/CONTRIBUTING.html), you agree to abide by its terms. 96 | 97 | [![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org) 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # gitignore 5 | 6 | 7 | 8 | [![CRAN 9 | status](https://www.r-pkg.org/badges/version/gitignore)](https://cran.r-project.org/package=gitignore) 10 | [![License: GPL 11 | v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) 12 | [![Codecov test 13 | coverage](https://codecov.io/gh/ropensci/gitignore/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/gitignore?branch=main) 14 | [![DOI](https://zenodo.org/badge/184759416.svg)](https://zenodo.org/badge/latestdoi/184759416) 15 | [![rOpenSci 16 | peer-review](https://badges.ropensci.org/303_status.svg)](https://github.com/ropensci/software-review/issues/303) 17 | [![R-CMD-check](https://github.com/PMassicotte/gitignore/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/gitignore/actions/workflows/R-CMD-check.yaml) 18 | 19 | 20 | Based on the definition proposed by 21 | [freecodecamp](https://www.freecodecamp.org/news/gitignore-what-is-it-and-how-to-add-to-repo/): 22 | 23 | > The .gitignore file is a text file that tells Git which files or 24 | > folders to ignore in a project. A local .gitignore file is usually 25 | > placed in the root directory of a project. You can also create a 26 | > global .gitignore file and any entries in that file will be ignored in 27 | > all of your Git repositories. 28 | 29 | For any project, it is therefore important to have a `.gitignore` file 30 | that is complete and accurate. The package `gitignore` provides a simple 31 | R interface to the 32 | [gitignore.io](https://www.toptal.com/developers/gitignore) API. It can 33 | be used to fetch gitignore templates that can be included into the 34 | `.gitignore` file of you git repository. The `gitignore` R package can 35 | be used with R package, R Studio project or with any `.gitignore` file. 36 | Note that by default, the `usethis` package populates the `.gitignore` 37 | for the R language when you create a R project. However, it is common to 38 | use many different programming languages in a project such as `LaTeX`, 39 | `python`, `matlab`, `julia` and so one. This is where the `gitignore` 40 | package shines as it can be used to programmatically modify the 41 | `.gitignore` file of your project. 42 | 43 | ## Installation 44 | 45 | The CRAN version of `gitignore` can be installed using: 46 | 47 | ``` r 48 | install.packages("gitignore") 49 | ``` 50 | 51 | The dev version of `gitignore` can be installed from GitHub: 52 | 53 | ``` r 54 | install.packages("devtools") 55 | devtools::install_github("ropensci/gitignore") 56 | ``` 57 | 58 | ## Examples 59 | 60 | There are currently two useful functions in the package: 61 | 62 | - `gi_available_templates()` to fetch all supported gitignore templates. 63 | - `gi_fetch_templates()` to fetch one or many gitignore templates. 64 | 65 | Show the first 25 templates returned by `gi_available_templates()`. 66 | 67 | ``` r 68 | library(gitignore) 69 | 70 | head(gi_available_templates(), 25) 71 | #> [1] "1c" "1c-bitrix" "a-frame" 72 | #> [4] "actionscript" "ada" "adobe" 73 | #> [7] "advancedinstaller" "adventuregamestudio" "agda" 74 | #> [10] "al" "alteraquartusii" "altium" 75 | #> [13] "amplify" "android" "androidstudio" 76 | #> [16] "angular" "anjuta" "ansible" 77 | #> [19] "ansibletower" "apachecordova" "apachehadoop" 78 | #> [22] "appbuilder" "appceleratortitanium" "appcode" 79 | #> [25] "appcode+all" 80 | ``` 81 | 82 | Templates can be fetched using the `gi_fetch_templates()` function. 83 | 84 | ``` r 85 | gi_fetch_templates("R") 86 | # Created by https://www.toptal.com/developers/gitignore/api/r 87 | # Edit at https://www.toptal.com/developers/gitignore?templates=r 88 | 89 | ### R ### 90 | # History files 91 | .Rhistory 92 | .Rapp.history 93 | 94 | # Session Data files 95 | .RData 96 | .RDataTmp 97 | 98 | # User-specific files 99 | .Ruserdata 100 | 101 | # Example code in package build process 102 | *-Ex.R 103 | 104 | # Output files from R CMD build 105 | /*.tar.gz 106 | 107 | # Output files from R CMD check 108 | /*.Rcheck/ 109 | 110 | # RStudio files 111 | .Rproj.user/ 112 | 113 | # produced vignettes 114 | vignettes/*.html 115 | vignettes/*.pdf 116 | 117 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 118 | .httr-oauth 119 | 120 | # knitr and R markdown default cache directories 121 | *_cache/ 122 | /cache/ 123 | 124 | # Temporary files created by R markdown 125 | *.utf8.md 126 | *.knit.md 127 | 128 | # R Environment Variables 129 | .Renviron 130 | 131 | # pkgdown site 132 | docs/ 133 | 134 | # translation temp files 135 | po/*~ 136 | 137 | # RStudio Connect folder 138 | rsconnect/ 139 | 140 | ### R.Bookdown Stack ### 141 | # R package: bookdown caching files 142 | /*_files/ 143 | 144 | # End of https://www.toptal.com/developers/gitignore/api/r 145 | ``` 146 | 147 | Multiple templates can be fetched by specifying multiple values: 148 | 149 | ``` r 150 | gi_fetch_templates(c("java", "c++")) 151 | # Created by https://www.toptal.com/developers/gitignore/api/java,c++ 152 | # Edit at https://www.toptal.com/developers/gitignore?templates=java,c++ 153 | 154 | ### C++ ### 155 | # Prerequisites 156 | *.d 157 | 158 | # Compiled Object files 159 | *.slo 160 | *.lo 161 | *.o 162 | *.obj 163 | 164 | # Precompiled Headers 165 | *.gch 166 | *.pch 167 | 168 | # Compiled Dynamic libraries 169 | *.so 170 | *.dylib 171 | *.dll 172 | 173 | # Fortran module files 174 | *.mod 175 | *.smod 176 | 177 | # Compiled Static libraries 178 | *.lai 179 | *.la 180 | *.a 181 | *.lib 182 | 183 | # Executables 184 | *.exe 185 | *.out 186 | *.app 187 | 188 | ### Java ### 189 | # Compiled class file 190 | *.class 191 | 192 | # Log file 193 | *.log 194 | 195 | # BlueJ files 196 | *.ctxt 197 | 198 | # Mobile Tools for Java (J2ME) 199 | .mtj.tmp/ 200 | 201 | # Package Files # 202 | *.jar 203 | *.war 204 | *.nar 205 | *.ear 206 | *.zip 207 | *.tar.gz 208 | *.rar 209 | 210 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 211 | hs_err_pid* 212 | replay_pid* 213 | 214 | # End of https://www.toptal.com/developers/gitignore/api/java,c++ 215 | ``` 216 | 217 | By default, templates are copied into the clipboard. It is also possible 218 | to modify a `.gitignore` file using the `gi_write_gitignore()` function. 219 | 220 | ``` r 221 | f <- file.path(tempdir(), ".gitignore") 222 | new_lines <- gi_fetch_templates("r") 223 | gi_write_gitignore(fetched_template = new_lines, gitignore_file = f) 224 | ``` 225 | 226 | If `gitignore_file` is not specified, `gitignore` will try to find the 227 | `.gitignore` file of your current project or package. 228 | 229 | More examples are provided in the vignette. 230 | 231 | ``` r 232 | browseVignettes("gitignore") 233 | ``` 234 | 235 | You can also visit the [gitignore 236 | website](https://docs.ropensci.org/gitignore/). 237 | 238 | ## Code of conduct 239 | 240 | Please note that the ‘gitignore’ project is released with a [Contributor 241 | Code of 242 | Conduct](https://docs.ropensci.org/gitignore/CODE_OF_CONDUCT.html). By 243 | [contributing to this 244 | project](https://docs.ropensci.org/gitignore/CONTRIBUTING.html), you 245 | agree to abide by its terms. 246 | 247 | [![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org) 248 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://docs.ropensci.org/gitignore/ 2 | template: 3 | bootstrap: 5 4 | light-switch: true 5 | destination: docs 6 | -------------------------------------------------------------------------------- /codemeta.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", 3 | "@type": "SoftwareSourceCode", 4 | "identifier": "gitignore", 5 | "description": "Simple interface to query gitignore.io to fetch gitignore templates that can be included in the .gitignore file. More than 450 templates are currently available.", 6 | "name": "gitignore: Create Useful .gitignore Files for your Project", 7 | "relatedLink": ["https://docs.ropensci.org/gitignore/", "https://CRAN.R-project.org/package=gitignore"], 8 | "codeRepository": "https://github.com/ropensci/gitignore", 9 | "issueTracker": "https://github.com/ropensci/gitignore/issues", 10 | "license": "https://spdx.org/licenses/GPL-3.0", 11 | "version": "0.1.8.9000", 12 | "programmingLanguage": { 13 | "@type": "ComputerLanguage", 14 | "name": "R", 15 | "url": "https://r-project.org" 16 | }, 17 | "runtimePlatform": "R version 4.4.1 (2024-06-14)", 18 | "provider": { 19 | "@id": "https://cran.r-project.org", 20 | "@type": "Organization", 21 | "name": "Comprehensive R Archive Network (CRAN)", 22 | "url": "https://cran.r-project.org" 23 | }, 24 | "author": [ 25 | { 26 | "@type": "Person", 27 | "givenName": "Philippe", 28 | "familyName": "Massicotte", 29 | "email": "pmassicotte@hotmail.com", 30 | "@id": "https://orcid.org/0000-0002-5919-4116" 31 | } 32 | ], 33 | "maintainer": [ 34 | { 35 | "@type": "Person", 36 | "givenName": "Philippe", 37 | "familyName": "Massicotte", 38 | "email": "pmassicotte@hotmail.com", 39 | "@id": "https://orcid.org/0000-0002-5919-4116" 40 | } 41 | ], 42 | "softwareSuggestions": [ 43 | { 44 | "@type": "SoftwareApplication", 45 | "identifier": "covr", 46 | "name": "covr", 47 | "provider": { 48 | "@id": "https://cran.r-project.org", 49 | "@type": "Organization", 50 | "name": "Comprehensive R Archive Network (CRAN)", 51 | "url": "https://cran.r-project.org" 52 | }, 53 | "sameAs": "https://CRAN.R-project.org/package=covr" 54 | }, 55 | { 56 | "@type": "SoftwareApplication", 57 | "identifier": "knitr", 58 | "name": "knitr", 59 | "provider": { 60 | "@id": "https://cran.r-project.org", 61 | "@type": "Organization", 62 | "name": "Comprehensive R Archive Network (CRAN)", 63 | "url": "https://cran.r-project.org" 64 | }, 65 | "sameAs": "https://CRAN.R-project.org/package=knitr" 66 | }, 67 | { 68 | "@type": "SoftwareApplication", 69 | "identifier": "rmarkdown", 70 | "name": "rmarkdown", 71 | "provider": { 72 | "@id": "https://cran.r-project.org", 73 | "@type": "Organization", 74 | "name": "Comprehensive R Archive Network (CRAN)", 75 | "url": "https://cran.r-project.org" 76 | }, 77 | "sameAs": "https://CRAN.R-project.org/package=rmarkdown" 78 | }, 79 | { 80 | "@type": "SoftwareApplication", 81 | "identifier": "spelling", 82 | "name": "spelling", 83 | "provider": { 84 | "@id": "https://cran.r-project.org", 85 | "@type": "Organization", 86 | "name": "Comprehensive R Archive Network (CRAN)", 87 | "url": "https://cran.r-project.org" 88 | }, 89 | "sameAs": "https://CRAN.R-project.org/package=spelling" 90 | }, 91 | { 92 | "@type": "SoftwareApplication", 93 | "identifier": "testthat", 94 | "name": "testthat", 95 | "version": ">= 3.0.0", 96 | "provider": { 97 | "@id": "https://cran.r-project.org", 98 | "@type": "Organization", 99 | "name": "Comprehensive R Archive Network (CRAN)", 100 | "url": "https://cran.r-project.org" 101 | }, 102 | "sameAs": "https://CRAN.R-project.org/package=testthat" 103 | } 104 | ], 105 | "softwareRequirements": { 106 | "1": { 107 | "@type": "SoftwareApplication", 108 | "identifier": "cli", 109 | "name": "cli", 110 | "provider": { 111 | "@id": "https://cran.r-project.org", 112 | "@type": "Organization", 113 | "name": "Comprehensive R Archive Network (CRAN)", 114 | "url": "https://cran.r-project.org" 115 | }, 116 | "sameAs": "https://CRAN.R-project.org/package=cli" 117 | }, 118 | "2": { 119 | "@type": "SoftwareApplication", 120 | "identifier": "clipr", 121 | "name": "clipr", 122 | "provider": { 123 | "@id": "https://cran.r-project.org", 124 | "@type": "Organization", 125 | "name": "Comprehensive R Archive Network (CRAN)", 126 | "url": "https://cran.r-project.org" 127 | }, 128 | "sameAs": "https://CRAN.R-project.org/package=clipr" 129 | }, 130 | "3": { 131 | "@type": "SoftwareApplication", 132 | "identifier": "curl", 133 | "name": "curl", 134 | "provider": { 135 | "@id": "https://cran.r-project.org", 136 | "@type": "Organization", 137 | "name": "Comprehensive R Archive Network (CRAN)", 138 | "url": "https://cran.r-project.org" 139 | }, 140 | "sameAs": "https://CRAN.R-project.org/package=curl" 141 | }, 142 | "4": { 143 | "@type": "SoftwareApplication", 144 | "identifier": "glue", 145 | "name": "glue", 146 | "provider": { 147 | "@id": "https://cran.r-project.org", 148 | "@type": "Organization", 149 | "name": "Comprehensive R Archive Network (CRAN)", 150 | "url": "https://cran.r-project.org" 151 | }, 152 | "sameAs": "https://CRAN.R-project.org/package=glue" 153 | }, 154 | "5": { 155 | "@type": "SoftwareApplication", 156 | "identifier": "here", 157 | "name": "here", 158 | "provider": { 159 | "@id": "https://cran.r-project.org", 160 | "@type": "Organization", 161 | "name": "Comprehensive R Archive Network (CRAN)", 162 | "url": "https://cran.r-project.org" 163 | }, 164 | "sameAs": "https://CRAN.R-project.org/package=here" 165 | }, 166 | "6": { 167 | "@type": "SoftwareApplication", 168 | "identifier": "jsonlite", 169 | "name": "jsonlite", 170 | "provider": { 171 | "@id": "https://cran.r-project.org", 172 | "@type": "Organization", 173 | "name": "Comprehensive R Archive Network (CRAN)", 174 | "url": "https://cran.r-project.org" 175 | }, 176 | "sameAs": "https://CRAN.R-project.org/package=jsonlite" 177 | }, 178 | "7": { 179 | "@type": "SoftwareApplication", 180 | "identifier": "purrr", 181 | "name": "purrr", 182 | "provider": { 183 | "@id": "https://cran.r-project.org", 184 | "@type": "Organization", 185 | "name": "Comprehensive R Archive Network (CRAN)", 186 | "url": "https://cran.r-project.org" 187 | }, 188 | "sameAs": "https://CRAN.R-project.org/package=purrr" 189 | }, 190 | "8": { 191 | "@type": "SoftwareApplication", 192 | "identifier": "xfun", 193 | "name": "xfun", 194 | "provider": { 195 | "@id": "https://cran.r-project.org", 196 | "@type": "Organization", 197 | "name": "Comprehensive R Archive Network (CRAN)", 198 | "url": "https://cran.r-project.org" 199 | }, 200 | "sameAs": "https://CRAN.R-project.org/package=xfun" 201 | }, 202 | "SystemRequirements": null 203 | }, 204 | "fileSize": "70.848KB", 205 | "releaseNotes": "https://github.com/ropensci/gitignore/blob/master/NEWS.md", 206 | "readme": "https://github.com/ropensci/gitignore/blob/main/README.md", 207 | "contIntegration": ["https://app.codecov.io/gh/ropensci/gitignore?branch=main", "https://github.com/ropensci/gitignore/actions/workflows/R-CMD-check.yaml"], 208 | "review": { 209 | "@type": "Review", 210 | "url": "https://github.com/ropensci/software-review/issues/303", 211 | "provider": "https://ropensci.org" 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | This fix an issue reported by CRAN where examples failed to run when internet was not available. 2 | 3 | ## Test environments 4 | 5 | - os: macos-latest, r: "release" 6 | - os: windows-latest, r: "release" 7 | - os: ubuntu-latest, r: "devel", http-user-agent: "release" 8 | - os: ubuntu-latest, r: "release" 9 | - os: ubuntu-latest, r: "oldrel-1" 10 | 11 | - win-builder (devel and release) 12 | 13 | ## R CMD check results 14 | 15 | 0 errors | 0 warnings | 1 note 16 | 17 | ## revdepcheck results 18 | 19 | We checked 0 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 20 | 21 | - We saw 0 new problems 22 | - We failed to check 0 packages 23 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Page not found (404) • gitignore 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Skip to contents 17 | 18 | 19 |
60 |
61 |
66 | 67 | Content not found. Please use links in the navbar. 68 | 69 |
70 |
71 | 72 | 73 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /docs/CODE_OF_CONDUCT.html: -------------------------------------------------------------------------------- 1 | 2 | Contributor Code of Conduct • gitignore 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
44 | 45 |
46 | 47 |

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

48 |

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

49 |

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

50 |

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

51 |

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

52 |

This Code of Conduct is adapted from the Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available at https://contributor-covenant.org/version/1/0/0/.

53 |
54 | 55 |
56 | 57 | 58 |
67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.html: -------------------------------------------------------------------------------- 1 | 2 | Contributing to gitignore • gitignore 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
44 | 45 |
46 | 47 |

This outlines how to propose a change to gitignore. For more detailed info about contributing to this, and other tidyverse packages, please see the development contributing guide.

48 |
49 |

Fixing typos

50 |

Small typos or grammatical errors in documentation may be edited directly using the GitHub web interface, so long as the changes are made in the source file.

51 |
  • YES: you edit a roxygen comment in a .R file below R/.
  • 52 |
  • NO: you edit an .Rd file below man/.
  • 53 |
54 |
55 |

Prerequisites

56 |

Before you make a substantial pull request, you should always file an issue and make sure someone from the team agrees that it’s a problem. If you’ve found a bug, create an associated issue and illustrate the bug with a minimal reprex.

57 |
58 |
59 |

Pull request process

60 |
  • We recommend that you create a Git branch for each pull request (PR).
  • 61 |
  • Look at the Travis and AppVeyor build status before and after making changes. The README should contain badges for any continuous integration services used by the package.
  • 62 |
  • New code should follow the tidyverse style guide. You can use the styler package to apply these styles, but please don’t restyle code that has nothing to do with your PR.
  • 63 |
  • We use roxygen2, with Markdown syntax, for documentation.
  • 64 |
  • We use testthat. Contributions with test cases included are easier to accept.
  • 65 |
  • For user-facing changes, add a bullet to the top of NEWS.md below the current development version header describing the changes made followed by your GitHub username, and links to relevant issue(s)/PR(s).
  • 66 |
67 |
68 |

Code of Conduct

69 |

Please note that the gitignore project is released with a Contributor Code of Conduct. By contributing to this project you agree to abide by its terms.

70 |
71 |
72 |

See tidyverse development contributing guide 73 |

74 |

for further details.

75 |
76 |
77 | 78 |
80 | 81 | 82 |
91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • gitignore 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
43 | 44 |
45 |

All vignettes

46 |
47 | 48 |
Introduction
49 |
50 |
51 |
52 | 53 | 54 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | Authors and Citation • gitignore 3 | Skip to contents 4 | 5 | 6 |
38 |
39 |
43 | 44 |
45 |

Authors

46 | 47 |
  • 48 |

    Philippe Massicotte. Author, maintainer. 49 |

    50 |
  • 51 |
  • 52 |

    Amanda Dobbyn. Reviewer. 53 |

    54 |
  • 55 |
  • 56 |

    Mauro Lepore. Reviewer. 57 |

    58 |
  • 59 |
60 | 61 |
62 |

Citation

63 |

Source: DESCRIPTION

64 | 65 |

Massicotte P (2024). 66 | gitignore: Create Useful .gitignore Files for your Project. 67 | R package version 0.1.6.9000, https://github.com/ropensci/gitignore, https://docs.ropensci.org/gitignore/. 68 |

69 |
@Manual{,
70 |   title = {gitignore: Create Useful .gitignore Files for your Project},
71 |   author = {Philippe Massicotte},
72 |   year = {2024},
73 |   note = {R package version 0.1.6.9000, https://github.com/ropensci/gitignore},
74 |   url = {https://docs.ropensci.org/gitignore/},
75 | }
76 |
77 | 78 |
80 | 81 | 82 |
91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v1.0.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | !function(a){"use strict";window.Toc={helpers:{findOrFilter:function(e,t){var n=e.find(t);return e.filter(t).add(n).filter(":not([data-toc-skip])")},generateUniqueIdBase:function(e){return a(e).text().trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase()||e.tagName.toLowerCase()},generateUniqueId:function(e){for(var t=this.generateUniqueIdBase(e),n=0;;n++){var r=t;if(0')},createChildNavList:function(e){var t=this.createNavList();return e.append(t),t},generateNavEl:function(e,t){var n=a('');n.attr("href","#"+e),n.text(t);var r=a("
  • ");return r.append(n),r},generateNavItem:function(e){var t=this.generateAnchor(e),n=a(e),r=n.data("toc-text")||n.text();return this.generateNavEl(t,r)},getTopLevel:function(e){for(var t=1;t<=6;t++){if(1 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/deps/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.11.0 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodeType}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}(t):function(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrollY(),a={};function c(){var t=Math.round(r.scrollY()),n=r.height(),o=r.scrollHeight();a.scrollY=t,a.lastScrollY=l,a.direction=ls.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestAnimationFrame(c))}var u=!!o&&{passive:!0,capture:!1};return t.addEventListener("scroll",h,u),c(),{destroy:function(){cancelAnimationFrame(n),t.removeEventListener("scroll",h,u)}}}function o(t,n){n=n||{},Object.assign(this,o.options,n),this.classes=Object.assign({},o.options.classes,n.classes),this.elem=t,this.tolerance=function(t){return t===Object(t)?t:{down:t,up:t}}(this.tolerance),this.initialised=!1,this.frozen=!1}return o.prototype={constructor:o,init:function(){return o.cutsTheMustard&&!this.initialised&&(this.addClass("initial"),this.initialised=!0,setTimeout(function(t){t.scrollTracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,Object.keys(this.classes).forEach(this.removeClass,this),this.scrollTracker.destroy()},unpin:function(){!this.hasClass("pinned")&&this.hasClass("unpinned")||(this.addClass("unpinned"),this.removeClass("pinned"),this.onUnpin&&this.onUnpin.call(this))},pin:function(){this.hasClass("unpinned")&&(this.addClass("pinned"),this.removeClass("unpinned"),this.onPin&&this.onPin.call(this))},freeze:function(){this.frozen=!0,this.addClass("frozen")},unfreeze:function(){this.frozen=!1,this.removeClass("frozen")},top:function(){this.hasClass("top")||(this.addClass("top"),this.removeClass("notTop"),this.onTop&&this.onTop.call(this))},notTop:function(){this.hasClass("notTop")||(this.addClass("notTop"),this.removeClass("top"),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){this.hasClass("bottom")||(this.addClass("bottom"),this.removeClass("notBottom"),this.onBottom&&this.onBottom.call(this))},notBottom:function(){this.hasClass("notBottom")||(this.addClass("notBottom"),this.removeClass("bottom"),this.onNotBottom&&this.onNotBottom.call(this))},shouldUnpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceExceeded},shouldPin:function(t){return"up"===t.direction&&t.toleranceExceeded||t.top},addClass:function(t){this.elem.classList.add.apply(this.elem.classList,this.classes[t].split(" "))},removeClass:function(t){this.elem.classList.remove.apply(this.elem.classList,this.classes[t].split(" "))},hasClass:function(t){return this.classes[t].split(" ").every(function(t){return this.classList.contains(t)},this.elem)},update:function(t){t.isOutOfBounds||!0!==this.frozen&&(t.top?this.top():this.notTop(),t.bottom?this.bottom():this.notBottom(),this.shouldUnpin(t)?this.unpin():this.shouldPin(t)&&this.pin())}},o.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},o.cutsTheMustard=!!(t()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame),o}); -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/jQuery.headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&(d[b](),"destroy"===b&&c.removeData("headroom"))})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery); -------------------------------------------------------------------------------- /docs/deps/search-1.0.0/fuse.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fuse.js v6.4.6 - Lightweight fuzzy-search (http://fusejs.io) 3 | * 4 | * Copyright (c) 2021 Kiro Risk (http://kiro.me) 5 | * All Rights Reserved. Apache Software License 2.0 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | */ 9 | var e,t;e=this,t=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,n=Math.pow(10,e);return{get:function(e){var r=e.match(I).length;if(t.has(r))return t.get(r);var i=1/Math.sqrt(r),o=parseFloat(Math.round(i*n)/n);return t.set(r,o),o},clear:function(){t.clear()}}}var E=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?A.getFn:r;t(this,e),this.norm=C(3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return r(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();g(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?A.getFn:r,o=new E({getFn:i});return o.setKeys(e.map(_)),o.setSources(t),o.create(),o}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,a=void 0===c?0:c,s=t.distance,u=void 0===s?A.distance:s,h=t.ignoreLocation,f=void 0===h?A.ignoreLocation:h,l=r/e.length;if(f)return l;var d=Math.abs(a-o);return u?l+d/u:d?1:l}function F(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function P(e){for(var t={},n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,c=void 0===o?A.location:o,a=i.threshold,s=void 0===a?A.threshold:a,u=i.distance,h=void 0===u?A.distance:u,f=i.includeMatches,l=void 0===f?A.includeMatches:f,d=i.findAllMatches,v=void 0===d?A.findAllMatches:d,g=i.minMatchCharLength,y=void 0===g?A.minMatchCharLength:g,p=i.isCaseSensitive,m=void 0===p?A.isCaseSensitive:p,k=i.ignoreLocation,M=void 0===k?A.ignoreLocation:k;if(t(this,e),this.options={location:c,threshold:s,distance:h,includeMatches:l,findAllMatches:v,minMatchCharLength:y,isCaseSensitive:m,ignoreLocation:M},this.pattern=m?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var b=function(e,t){r.chunks.push({pattern:e,alphabet:P(e),startIndex:t})},x=this.pattern.length;if(x>32){for(var L=0,S=x%32,w=x-S;L3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?A.location:i,c=r.distance,a=void 0===c?A.distance:c,s=r.threshold,u=void 0===s?A.threshold:s,h=r.findAllMatches,f=void 0===h?A.findAllMatches:h,l=r.minMatchCharLength,d=void 0===l?A.minMatchCharLength:l,v=r.includeMatches,g=void 0===v?A.includeMatches:v,y=r.ignoreLocation,p=void 0===y?A.ignoreLocation:y;if(t.length>32)throw new Error(L(32));for(var m,k=t.length,M=e.length,b=Math.max(0,Math.min(o,M)),x=u,S=b,w=d>1||g,_=w?Array(M):[];(m=e.indexOf(t,S))>-1;){var O=R(t,{currentLocation:m,expectedLocation:b,distance:a,ignoreLocation:p});if(x=Math.min(O,x),S=m+k,w)for(var j=0;j=K;J-=1){var T=J-1,U=n[e.charAt(T)];if(w&&(_[T]=+!!U),W[J]=(W[J+1]<<1|1)&U,P&&(W[J]|=(I[J+1]|I[J])<<1|1|I[J+1]),W[J]&$&&(C=R(t,{errors:P,currentLocation:T,expectedLocation:b,distance:a,ignoreLocation:p}))<=x){if(x=C,(S=T)<=b)break;K=Math.max(1,2*b-S)}}var V=R(t,{errors:P+1,currentLocation:b,expectedLocation:b,distance:a,ignoreLocation:p});if(V>x)break;I=W}var B={isMatch:S>=0,score:Math.max(.001,C)};if(w){var G=F(_,d);G.length?g&&(B.indices=G):B.isMatch=!1}return B}(e,n,i,{location:c+o,distance:a,threshold:s,findAllMatches:u,minMatchCharLength:h,includeMatches:r,ignoreLocation:f}),p=y.isMatch,m=y.score,k=y.indices;p&&(g=!0),v+=m,p&&k&&(d=[].concat(l(d),l(k)))}));var y={isMatch:g,score:g?v/this.chunks.length:1};return g&&r&&(y.indices=d),y}}]),e}(),D=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return z(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return z(e,this.singleRegex)}}]),e}();function z(e,t){var n=e.match(t);return n?n[1]:null}var K=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),i}(D),q=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),i}(D),W=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),i}(D),J=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),i}(D),T=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),i}(D),U=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),i}(D),V=function(e){a(i,e);var n=f(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,a=void 0===c?A.location:c,s=o.threshold,u=void 0===s?A.threshold:s,h=o.distance,f=void 0===h?A.distance:h,l=o.includeMatches,d=void 0===l?A.includeMatches:l,v=o.findAllMatches,g=void 0===v?A.findAllMatches:v,y=o.minMatchCharLength,p=void 0===y?A.minMatchCharLength:y,m=o.isCaseSensitive,k=void 0===m?A.isCaseSensitive:m,M=o.ignoreLocation,b=void 0===M?A.ignoreLocation:M;return t(this,i),(r=n.call(this,e))._bitapSearch=new N(e,{location:a,threshold:u,distance:f,includeMatches:d,findAllMatches:g,minMatchCharLength:p,isCaseSensitive:k,ignoreLocation:b}),r}return r(i,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),i}(D),B=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),i}(D),G=[K,B,W,J,U,T,q,V],H=G.length,Q=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(Q).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i1&&void 0!==arguments[1]?arguments[1]:{},i=r.isCaseSensitive,o=void 0===i?A.isCaseSensitive:i,c=r.includeMatches,a=void 0===c?A.includeMatches:c,s=r.minMatchCharLength,u=void 0===s?A.minMatchCharLength:s,h=r.ignoreLocation,f=void 0===h?A.ignoreLocation:h,l=r.findAllMatches,d=void 0===l?A.findAllMatches:l,v=r.location,g=void 0===v?A.location:v,y=r.threshold,p=void 0===y?A.threshold:y,m=r.distance,k=void 0===m?A.distance:m;t(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:a,minMatchCharLength:u,findAllMatches:d,ignoreLocation:f,location:g,threshold:p,distance:k},this.pattern=o?n:n.toLowerCase(),this.query=X(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],c=0,a=0,s=t.length;a-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function le(e,t){t.score=e.score}function de(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?A.includeMatches:r,o=n.includeScore,c=void 0===o?A.includeScore:o,a=[];return i&&a.push(fe),c&&a.push(le),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return a.length&&a.forEach((function(t){t(e,r)})),r}))}var ve=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=c({},A,{},r),this.options.useExtendedSearch,this._keyStore=new w(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof E))throw new Error("Incorrect 'index' type");this._myIndex=t||$(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){k(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,c=i.includeScore,a=i.shouldSort,s=i.sortFn,u=i.ignoreFieldNorm,h=g(e)?g(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return he(h,{ignoreFieldNorm:u}),a&&h.sort(s),y(r)&&r>-1&&(h=h.slice(0,r)),de(h,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=te(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(k(n)){var c=t.searchIn(n),a=c.isMatch,s=c.score,u=c.indices;a&&r.push({item:n,idx:i,matches:[{score:s,value:n,norm:o,indices:u}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,i=void 0===r||r,o=function e(n){var r=Object.keys(n),o=ae(n);if(!o&&r.length>1&&!ce(n))return e(ue(n));if(se(n)){var c=o?n[ie]:r[0],a=o?n[oe]:n[c];if(!g(a))throw new Error(x(c));var s={keyId:j(c),pattern:a};return i&&(s.searcher=te(a,t)),s}var u={children:[],operator:r[0]};return r.forEach((function(t){var r=n[t];v(r)&&r.forEach((function(t){u.children.push(e(t))}))})),u};return ce(e)||(e=ue(e)),o(e)}(e,this.options),r=this._myIndex.records,i={},o=[];return r.forEach((function(e){var r=e.$,c=e.i;if(k(r)){var a=function e(n,r,i){if(!n.children){var o=n.keyId,c=n.searcher,a=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(r,o),searcher:c});return a&&a.length?[{idx:i,item:r,matches:a}]:[]}switch(n.operator){case ne:for(var s=[],u=0,h=n.children.length;u1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?A.getFn:n,i=e.keys,o=e.records,c=new E({getFn:r});return c.setKeys(i),c.setIndexRecords(o),c},ve.config=A,function(){ee.push.apply(ee,arguments)}(Z),ve},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); -------------------------------------------------------------------------------- /docs/deps/search-1.0.0/mark.min.js: -------------------------------------------------------------------------------- 1 | /*!*************************************************** 2 | * mark.js v8.11.1 3 | * https://markjs.io/ 4 | * Copyright (c) 2014–2018, Julian Kühnel 5 | * Released under the MIT license https://git.io/vwTVl 6 | *****************************************************/ 7 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Mark=t()}(this,function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this.exclude=i,this.iframesTimeout=o}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach(function(t){var n=e.filter(function(e){return e.contains(t)}).length>0;-1!==e.indexOf(t)||n||e.push(t)}),e}},{key:"getIframeContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var i=e.contentWindow;if(r=i.document,!i||!r)throw new Error("iframe inaccessible")}catch(e){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e){var t=e.getAttribute("src").trim();return"about:blank"===e.contentWindow.location.href&&"about:blank"!==t&&t}},{key:"observeIframeLoad",value:function(e,t,n){var r=this,i=!1,o=null,a=function a(){if(!i){i=!0,clearTimeout(o);try{r.isIframeBlank(e)||(e.removeEventListener("load",a),r.getIframeContents(e,t,n))}catch(e){n()}}};e.addEventListener("load",a),o=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch(e){n()}}},{key:"waitForIframes",value:function(e,t){var n=this,r=0;this.forEachIframe(e,function(){return!0},function(e){r++,n.waitForIframes(e.querySelector("html"),function(){--r||t()})},function(e){e||t()})}},{key:"forEachIframe",value:function(t,n,r){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=t.querySelectorAll("iframe"),s=a.length,c=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&o(c)};s||u(),a.forEach(function(t){e.matches(t,i.exclude)?u():i.onIframeReady(t,function(e){n(t)&&(c++,r(e)),u()},u)})}},{key:"createIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:null===t?e.nextNode():e.nextNode()&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var i=!1,o=!1;return r.forEach(function(e,t){e.val===n&&(i=t,o=e.handled)}),this.compareNodeIframe(e,t,n)?(!1!==i||o?!1===i||o||(r[i].handled=!0):r.push({val:n,handled:!0}),!0):(!1===i&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,n,r){var i=this;e.forEach(function(e){e.handled||i.getIframeContents(e.val,function(e){i.createInstanceOnIframe(e).forEachNode(t,n,r)})})}},{key:"iterateThroughNodes",value:function(e,t,n,r,i){for(var o,a=this,s=this.createIterator(t,e,r),c=[],u=[],l=void 0,h=void 0;void 0,o=a.getIteratorNode(s),h=o.prevNode,l=o.node;)this.iframes&&this.forEachIframe(t,function(e){return a.checkIframeFilter(l,h,e,c)},function(t){a.createInstanceOnIframe(t).forEachNode(e,function(e){return u.push(e)},r)}),u.push(l);u.forEach(function(e){n(e)}),this.iframes&&this.handleOpenIframes(c,e,n,r),i()}},{key:"forEachNode",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),a=o.length;a||i(),o.forEach(function(o){var s=function(){r.iterateThroughNodes(e,o,t,n,function(){--a<=0&&i()})};r.iframes?r.waitForIframes(o,s):s()})}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var i=!1;return n.every(function(t){return!r.call(e,t)||(i=!0,!1)}),i}return!1}}]),e}(),o=function(){function o(e){t(this,o),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(o,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var i in t)if(t.hasOwnProperty(i)){var o=t[i],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this.escapeStr(i),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==a&&""!==s&&(e=e.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+n),r+"("+this.processSynomyms(a)+"|"+this.processSynomyms(s)+")"+r))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,function(e){return"\\"===e.charAt(0)?"?":""})).replace(/(?:\\)*\*/g,function(e){return"\\"===e.charAt(0)?"*":""})}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"})}},{key:"createJoinersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],r=[];return e.split("").forEach(function(i){n.every(function(n){if(-1!==n.indexOf(i)){if(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0})}),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,n=this.opt.accuracy,r="string"==typeof n?n:n.value,i="";switch(("string"==typeof n?[]:n.limiters).forEach(function(e){i+="|"+t.escapeStr(e)}),r){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(i="\\s"+(i||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+e+"[^"+i+"]*)";case"exactly":return"(^|\\s"+i+")("+e+")(?=$|\\s"+i+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach(function(e){t.opt.separateWordSearch?e.split(" ").forEach(function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)}):e.trim()&&-1===n.indexOf(e)&&n.push(e)}),{keywords:n.sort(function(e,t){return t.length-e.length}),length:n.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort(function(e,t){return e.start-t.start}).forEach(function(e){var i=t.callNoMatchOnInvalidRanges(e,r),o=i.start,a=i.end;i.valid&&(e.start=o,e.length=a-o,n.push(e),r=a)}),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var n=void 0,r=void 0,i=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?i=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:i}}},{key:"checkWhitespaceRanges",value:function(e,t,n){var r=void 0,i=!0,o=n.length,a=t-o,s=parseInt(e.start,10)-a;return(r=(s=s>o?o:s)+parseInt(e.length,10))>o&&(r=o,this.log("End range automatically set to the max value of "+o)),s<0||r-s<0||s>o||r>o?(i=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s+/g,"")&&(i=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,end:r,valid:i}}},{key:"getTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})},function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){e({value:n,nodes:r})})}},{key:"matchesExclude",value:function(e){return i.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",i=e.splitText(t),o=i.splitText(n-t),a=document.createElement(r);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=i.textContent,i.parentNode.replaceChild(a,i),o}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,i){var o=this;e.nodes.every(function(a,s){var c=e.nodes[s+1];if(void 0===c||c.start>t){if(!r(a.node))return!1;var u=t-a.start,l=(n>a.end?a.end:n)-a.start,h=e.value.substr(0,a.start),f=e.value.substr(l+a.start);if(a.node=o.wrapRangeInTextNode(a.node,u,l),e.value=h+f,e.nodes.forEach(function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(e.nodes[n].start-=l),e.nodes[n].end-=l)}),n-=l,i(a.node.previousSibling,a.start),!(n>a.end))return!1;t=a.end}return!0})}},{key:"wrapMatches",value:function(e,t,n,r,i){var o=this,a=0===t?0:t+1;this.getTextNodes(function(t){t.nodes.forEach(function(t){t=t.node;for(var i=void 0;null!==(i=e.exec(t.textContent))&&""!==i[a];)if(n(i[a],t)){var s=i.index;if(0!==a)for(var c=1;c"); 125 | background-repeat: no-repeat; 126 | background-position: 50%; 127 | background-size: 100%; 128 | overflow: hidden; 129 | text-indent: -9000px; 130 | width: 100%; 131 | height: 100%; 132 | display: block; 133 | transform: translate(-8px); 134 | } 135 | 136 | .algolia-autocomplete .algolia-docsearch-suggestion--highlight { 137 | color: #FF8C00; 138 | background: rgba(232, 189, 54, 0.1) 139 | } 140 | 141 | 142 | .algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { 143 | box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) 144 | } 145 | 146 | .algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { 147 | background-color: rgba(192, 192, 192, .15) 148 | } 149 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/katex-auto.js: -------------------------------------------------------------------------------- 1 | // https://github.com/jgm/pandoc/blob/29fa97ab96b8e2d62d48326e1b949a71dc41f47a/src/Text/Pandoc/Writers/HTML.hs#L332-L345 2 | document.addEventListener("DOMContentLoaded", function () { 3 | var mathElements = document.getElementsByClassName("math"); 4 | var macros = []; 5 | for (var i = 0; i < mathElements.length; i++) { 6 | var texText = mathElements[i].firstChild; 7 | if (mathElements[i].tagName == "SPAN") { 8 | katex.render(texText.data, mathElements[i], { 9 | displayMode: mathElements[i].classList.contains("display"), 10 | throwOnError: false, 11 | macros: macros, 12 | fleqn: false 13 | }); 14 | }}}); 15 | -------------------------------------------------------------------------------- /docs/lightswitch.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) 4 | * Copyright 2011-2023 The Bootstrap Authors 5 | * Licensed under the Creative Commons Attribution 3.0 Unported License. 6 | * Updates for {pkgdown} by the {bslib} authors, also licensed under CC-BY-3.0. 7 | */ 8 | 9 | const getStoredTheme = () => localStorage.getItem('theme') 10 | const setStoredTheme = theme => localStorage.setItem('theme', theme) 11 | 12 | const getPreferredTheme = () => { 13 | const storedTheme = getStoredTheme() 14 | if (storedTheme) { 15 | return storedTheme 16 | } 17 | 18 | return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 19 | } 20 | 21 | const setTheme = theme => { 22 | if (theme === 'auto') { 23 | document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) 24 | } else { 25 | document.documentElement.setAttribute('data-bs-theme', theme) 26 | } 27 | } 28 | 29 | function bsSetupThemeToggle () { 30 | 'use strict' 31 | 32 | const showActiveTheme = (theme, focus = false) => { 33 | var activeLabel, activeIcon; 34 | 35 | document.querySelectorAll('[data-bs-theme-value]').forEach(element => { 36 | const buttonTheme = element.getAttribute('data-bs-theme-value') 37 | const isActive = buttonTheme == theme 38 | 39 | element.classList.toggle('active', isActive) 40 | element.setAttribute('aria-pressed', isActive) 41 | 42 | if (isActive) { 43 | activeLabel = element.textContent; 44 | activeIcon = element.querySelector('span').classList.value; 45 | } 46 | }) 47 | 48 | const themeSwitcher = document.querySelector('#dropdown-lightswitch') 49 | if (!themeSwitcher) { 50 | return 51 | } 52 | 53 | themeSwitcher.setAttribute('aria-label', activeLabel) 54 | themeSwitcher.querySelector('span').classList.value = activeIcon; 55 | 56 | if (focus) { 57 | themeSwitcher.focus() 58 | } 59 | } 60 | 61 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { 62 | const storedTheme = getStoredTheme() 63 | if (storedTheme !== 'light' && storedTheme !== 'dark') { 64 | setTheme(getPreferredTheme()) 65 | } 66 | }) 67 | 68 | window.addEventListener('DOMContentLoaded', () => { 69 | showActiveTheme(getPreferredTheme()) 70 | 71 | document 72 | .querySelectorAll('[data-bs-theme-value]') 73 | .forEach(toggle => { 74 | toggle.addEventListener('click', () => { 75 | const theme = toggle.getAttribute('data-bs-theme-value') 76 | setTheme(theme) 77 | setStoredTheme(theme) 78 | showActiveTheme(theme, true) 79 | }) 80 | }) 81 | }) 82 | } 83 | 84 | setTheme(getPreferredTheme()); 85 | bsSetupThemeToggle(); 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/news/index.html: -------------------------------------------------------------------------------- 1 | 2 | Changelog • gitignore 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    44 | 45 |
    46 |

    gitignore (development version)

    47 |
    • gitignore now provides clickable links as it uses cli instead of crayon (@olivroy).

    • 48 |
    • Upgrading to use Bootstrap 5.

    • 49 |
    • Add ligth and dark themes to the vignette.

    • 50 |
    51 |
    52 |

    gitignore 0.1.6

    CRAN release: 2023-12-12

    53 |
    • Skip or do not execute code chunks in vignettes if the internet or the gitignore API is not available, to fix CRAN problems.
    • 54 |
    • Update workflow link to point to the v2 branch of r-lib/actions repository.
    • 55 |
    56 |
    57 |

    gitignore 0.1.5

    CRAN release: 2021-10-31

    58 |
    • Using Github Actions for continuous integration.

    • 59 |
    • Fixing CRAN check results where tests failed when internet connection was not available (#18).

    • 60 |
    61 |
    62 |

    gitignore 0.1.4

    CRAN release: 2020-11-04

    63 |
    66 |
    67 |

    gitignore 0.1.3

    CRAN release: 2019-07-29

    68 |
    • This is a minor update that prevent the use of the clipboard on CRAN Linux systems.
    • 69 |
    70 |
    71 |

    gitignore 0.1.2

    CRAN release: 2019-06-28

    72 |
    • First release on CRAN.
    • 73 |
    74 |
    75 |

    gitignore 0.1.1

    76 |
    • First release on rOpenSci.
    • 77 |
    78 |
    80 | 81 | 82 |
    85 | 86 | 89 | 90 |
    91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body { 21 | position: relative; 22 | } 23 | 24 | body > .container { 25 | display: flex; 26 | height: 100%; 27 | flex-direction: column; 28 | } 29 | 30 | body > .container .row { 31 | flex: 1 0 auto; 32 | } 33 | 34 | footer { 35 | margin-top: 45px; 36 | padding: 35px 0 36px; 37 | border-top: 1px solid #e5e5e5; 38 | color: #666; 39 | display: flex; 40 | flex-shrink: 0; 41 | } 42 | footer p { 43 | margin-bottom: 0; 44 | } 45 | footer div { 46 | flex: 1; 47 | } 48 | footer .pkgdown { 49 | text-align: right; 50 | } 51 | footer p { 52 | margin-bottom: 0; 53 | } 54 | 55 | img.icon { 56 | float: right; 57 | } 58 | 59 | /* Ensure in-page images don't run outside their container */ 60 | .contents img { 61 | max-width: 100%; 62 | height: auto; 63 | } 64 | 65 | /* Fix bug in bootstrap (only seen in firefox) */ 66 | summary { 67 | display: list-item; 68 | } 69 | 70 | /* Typographic tweaking ---------------------------------*/ 71 | 72 | .contents .page-header { 73 | margin-top: calc(-60px + 1em); 74 | } 75 | 76 | dd { 77 | margin-left: 3em; 78 | } 79 | 80 | /* Section anchors ---------------------------------*/ 81 | 82 | a.anchor { 83 | display: none; 84 | margin-left: 5px; 85 | width: 20px; 86 | height: 20px; 87 | 88 | background-image: url(./link.svg); 89 | background-repeat: no-repeat; 90 | background-size: 20px 20px; 91 | background-position: center center; 92 | } 93 | 94 | h1:hover .anchor, 95 | h2:hover .anchor, 96 | h3:hover .anchor, 97 | h4:hover .anchor, 98 | h5:hover .anchor, 99 | h6:hover .anchor { 100 | display: inline-block; 101 | } 102 | 103 | /* Fixes for fixed navbar --------------------------*/ 104 | 105 | .contents h1, .contents h2, .contents h3, .contents h4 { 106 | padding-top: 60px; 107 | margin-top: -40px; 108 | } 109 | 110 | /* Navbar submenu --------------------------*/ 111 | 112 | .dropdown-submenu { 113 | position: relative; 114 | } 115 | 116 | .dropdown-submenu>.dropdown-menu { 117 | top: 0; 118 | left: 100%; 119 | margin-top: -6px; 120 | margin-left: -1px; 121 | border-radius: 0 6px 6px 6px; 122 | } 123 | 124 | .dropdown-submenu:hover>.dropdown-menu { 125 | display: block; 126 | } 127 | 128 | .dropdown-submenu>a:after { 129 | display: block; 130 | content: " "; 131 | float: right; 132 | width: 0; 133 | height: 0; 134 | border-color: transparent; 135 | border-style: solid; 136 | border-width: 5px 0 5px 5px; 137 | border-left-color: #cccccc; 138 | margin-top: 5px; 139 | margin-right: -10px; 140 | } 141 | 142 | .dropdown-submenu:hover>a:after { 143 | border-left-color: #ffffff; 144 | } 145 | 146 | .dropdown-submenu.pull-left { 147 | float: none; 148 | } 149 | 150 | .dropdown-submenu.pull-left>.dropdown-menu { 151 | left: -100%; 152 | margin-left: 10px; 153 | border-radius: 6px 0 6px 6px; 154 | } 155 | 156 | /* Sidebar --------------------------*/ 157 | 158 | #pkgdown-sidebar { 159 | margin-top: 30px; 160 | position: -webkit-sticky; 161 | position: sticky; 162 | top: 70px; 163 | } 164 | 165 | #pkgdown-sidebar h2 { 166 | font-size: 1.5em; 167 | margin-top: 1em; 168 | } 169 | 170 | #pkgdown-sidebar h2:first-child { 171 | margin-top: 0; 172 | } 173 | 174 | #pkgdown-sidebar .list-unstyled li { 175 | margin-bottom: 0.5em; 176 | } 177 | 178 | /* bootstrap-toc tweaks ------------------------------------------------------*/ 179 | 180 | /* All levels of nav */ 181 | 182 | nav[data-toggle='toc'] .nav > li > a { 183 | padding: 4px 20px 4px 6px; 184 | font-size: 1.5rem; 185 | font-weight: 400; 186 | color: inherit; 187 | } 188 | 189 | nav[data-toggle='toc'] .nav > li > a:hover, 190 | nav[data-toggle='toc'] .nav > li > a:focus { 191 | padding-left: 5px; 192 | color: inherit; 193 | border-left: 1px solid #878787; 194 | } 195 | 196 | nav[data-toggle='toc'] .nav > .active > a, 197 | nav[data-toggle='toc'] .nav > .active:hover > a, 198 | nav[data-toggle='toc'] .nav > .active:focus > a { 199 | padding-left: 5px; 200 | font-size: 1.5rem; 201 | font-weight: 400; 202 | color: inherit; 203 | border-left: 2px solid #878787; 204 | } 205 | 206 | /* Nav: second level (shown on .active) */ 207 | 208 | nav[data-toggle='toc'] .nav .nav { 209 | display: none; /* Hide by default, but at >768px, show it */ 210 | padding-bottom: 10px; 211 | } 212 | 213 | nav[data-toggle='toc'] .nav .nav > li > a { 214 | padding-left: 16px; 215 | font-size: 1.35rem; 216 | } 217 | 218 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 219 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 220 | padding-left: 15px; 221 | } 222 | 223 | nav[data-toggle='toc'] .nav .nav > .active > a, 224 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 225 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 226 | padding-left: 15px; 227 | font-weight: 500; 228 | font-size: 1.35rem; 229 | } 230 | 231 | /* orcid ------------------------------------------------------------------- */ 232 | 233 | .orcid { 234 | font-size: 16px; 235 | color: #A6CE39; 236 | /* margins are required by official ORCID trademark and display guidelines */ 237 | margin-left:4px; 238 | margin-right:4px; 239 | vertical-align: middle; 240 | } 241 | 242 | /* Reference index & topics ----------------------------------------------- */ 243 | 244 | .ref-index th {font-weight: normal;} 245 | 246 | .ref-index td {vertical-align: top; min-width: 100px} 247 | .ref-index .icon {width: 40px;} 248 | .ref-index .alias {width: 40%;} 249 | .ref-index-icons .alias {width: calc(40% - 40px);} 250 | .ref-index .title {width: 60%;} 251 | 252 | .ref-arguments th {text-align: right; padding-right: 10px;} 253 | .ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} 254 | .ref-arguments .name {width: 20%;} 255 | .ref-arguments .desc {width: 80%;} 256 | 257 | /* Nice scrolling for wide elements --------------------------------------- */ 258 | 259 | table { 260 | display: block; 261 | overflow: auto; 262 | } 263 | 264 | /* Syntax highlighting ---------------------------------------------------- */ 265 | 266 | pre, code, pre code { 267 | background-color: #f8f8f8; 268 | color: #333; 269 | } 270 | pre, pre code { 271 | white-space: pre-wrap; 272 | word-break: break-all; 273 | overflow-wrap: break-word; 274 | } 275 | 276 | pre { 277 | border: 1px solid #eee; 278 | } 279 | 280 | pre .img, pre .r-plt { 281 | margin: 5px 0; 282 | } 283 | 284 | pre .img img, pre .r-plt img { 285 | background-color: #fff; 286 | } 287 | 288 | code a, pre a { 289 | color: #375f84; 290 | } 291 | 292 | a.sourceLine:hover { 293 | text-decoration: none; 294 | } 295 | 296 | .fl {color: #1514b5;} 297 | .fu {color: #000000;} /* function */ 298 | .ch,.st {color: #036a07;} /* string */ 299 | .kw {color: #264D66;} /* keyword */ 300 | .co {color: #888888;} /* comment */ 301 | 302 | .error {font-weight: bolder;} 303 | .warning {font-weight: bolder;} 304 | 305 | /* Clipboard --------------------------*/ 306 | 307 | .hasCopyButton { 308 | position: relative; 309 | } 310 | 311 | .btn-copy-ex { 312 | position: absolute; 313 | right: 0; 314 | top: 0; 315 | visibility: hidden; 316 | } 317 | 318 | .hasCopyButton:hover button.btn-copy-ex { 319 | visibility: visible; 320 | } 321 | 322 | /* headroom.js ------------------------ */ 323 | 324 | .headroom { 325 | will-change: transform; 326 | transition: transform 200ms linear; 327 | } 328 | .headroom--pinned { 329 | transform: translateY(0%); 330 | } 331 | .headroom--unpinned { 332 | transform: translateY(-100%); 333 | } 334 | 335 | /* mark.js ----------------------------*/ 336 | 337 | mark { 338 | background-color: rgba(255, 255, 51, 0.5); 339 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 340 | padding: 1px; 341 | } 342 | 343 | /* vertical spacing after htmlwidgets */ 344 | .html-widget { 345 | margin-bottom: 10px; 346 | } 347 | 348 | /* fontawesome ------------------------ */ 349 | 350 | .fab { 351 | font-family: "Font Awesome 5 Brands" !important; 352 | } 353 | 354 | /* don't display links in code chunks when printing */ 355 | /* source: https://stackoverflow.com/a/10781533 */ 356 | @media print { 357 | code a:link:after, code a:visited:after { 358 | content: ""; 359 | } 360 | } 361 | 362 | /* Section anchors --------------------------------- 363 | Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 364 | */ 365 | 366 | div.csl-bib-body { } 367 | div.csl-entry { 368 | clear: both; 369 | } 370 | .hanging-indent div.csl-entry { 371 | margin-left:2em; 372 | text-indent:-2em; 373 | } 374 | div.csl-left-margin { 375 | min-width:2em; 376 | float:left; 377 | } 378 | div.csl-right-inline { 379 | margin-left:2em; 380 | padding-left:1em; 381 | } 382 | div.csl-indent { 383 | margin-left: 2em; 384 | } 385 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('nav.navbar').headroom(); 6 | 7 | Toc.init({ 8 | $nav: $("#toc"), 9 | $scope: $("main h2, main h3, main h4, main h5, main h6") 10 | }); 11 | 12 | if ($('#toc').length) { 13 | $('body').scrollspy({ 14 | target: '#toc', 15 | offset: $("nav.navbar").outerHeight() + 1 16 | }); 17 | } 18 | 19 | // Activate popovers 20 | $('[data-bs-toggle="popover"]').popover({ 21 | container: 'body', 22 | html: true, 23 | trigger: 'focus', 24 | placement: "top", 25 | sanitize: false, 26 | }); 27 | 28 | $('[data-bs-toggle="tooltip"]').tooltip(); 29 | 30 | /* Clipboard --------------------------*/ 31 | 32 | function changeTooltipMessage(element, msg) { 33 | var tooltipOriginalTitle=element.getAttribute('data-bs-original-title'); 34 | element.setAttribute('data-bs-original-title', msg); 35 | $(element).tooltip('show'); 36 | element.setAttribute('data-bs-original-title', tooltipOriginalTitle); 37 | } 38 | 39 | if(ClipboardJS.isSupported()) { 40 | $(document).ready(function() { 41 | var copyButton = ""; 42 | 43 | $("div.sourceCode").addClass("hasCopyButton"); 44 | 45 | // Insert copy buttons: 46 | $(copyButton).prependTo(".hasCopyButton"); 47 | 48 | // Initialize tooltips: 49 | $('.btn-copy-ex').tooltip({container: 'body'}); 50 | 51 | // Initialize clipboard: 52 | var clipboard = new ClipboardJS('[data-clipboard-copy]', { 53 | text: function(trigger) { 54 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 55 | } 56 | }); 57 | 58 | clipboard.on('success', function(e) { 59 | changeTooltipMessage(e.trigger, 'Copied!'); 60 | e.clearSelection(); 61 | }); 62 | 63 | clipboard.on('error', function(e) { 64 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 65 | }); 66 | 67 | }); 68 | } 69 | 70 | /* Search marking --------------------------*/ 71 | var url = new URL(window.location.href); 72 | var toMark = url.searchParams.get("q"); 73 | var mark = new Mark("main#main"); 74 | if (toMark) { 75 | mark.mark(toMark, { 76 | accuracy: { 77 | value: "complementary", 78 | limiters: [",", ".", ":", "/"], 79 | } 80 | }); 81 | } 82 | 83 | /* Search --------------------------*/ 84 | /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ 85 | // Initialise search index on focus 86 | var fuse; 87 | $("#search-input").focus(async function(e) { 88 | if (fuse) { 89 | return; 90 | } 91 | 92 | $(e.target).addClass("loading"); 93 | var response = await fetch($("#search-input").data("search-index")); 94 | var data = await response.json(); 95 | 96 | var options = { 97 | keys: ["what", "text", "code"], 98 | ignoreLocation: true, 99 | threshold: 0.1, 100 | includeMatches: true, 101 | includeScore: true, 102 | }; 103 | fuse = new Fuse(data, options); 104 | 105 | $(e.target).removeClass("loading"); 106 | }); 107 | 108 | // Use algolia autocomplete 109 | var options = { 110 | autoselect: true, 111 | debug: true, 112 | hint: false, 113 | minLength: 2, 114 | }; 115 | var q; 116 | async function searchFuse(query, callback) { 117 | await fuse; 118 | 119 | var items; 120 | if (!fuse) { 121 | items = []; 122 | } else { 123 | q = query; 124 | var results = fuse.search(query, { limit: 20 }); 125 | items = results 126 | .filter((x) => x.score <= 0.75) 127 | .map((x) => x.item); 128 | if (items.length === 0) { 129 | items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; 130 | } 131 | } 132 | callback(items); 133 | } 134 | $("#search-input").autocomplete(options, [ 135 | { 136 | name: "content", 137 | source: searchFuse, 138 | templates: { 139 | suggestion: (s) => { 140 | if (s.title == s.what) { 141 | return `${s.dir} >
    ${s.title}
    `; 142 | } else if (s.previous_headings == "") { 143 | return `${s.dir} >
    ${s.title}
    > ${s.what}`; 144 | } else { 145 | return `${s.dir} >
    ${s.title}
    > ${s.previous_headings} > ${s.what}`; 146 | } 147 | }, 148 | }, 149 | }, 150 | ]).on('autocomplete:selected', function(event, s) { 151 | window.location.href = s.path + "?q=" + q + "#" + s.id; 152 | }); 153 | }); 154 | })(window.jQuery || window.$) 155 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.3 2 | pkgdown: 2.1.0 3 | pkgdown_sha: ~ 4 | articles: 5 | introduction: introduction.html 6 | last_built: 2024-07-08T12:34Z 7 | urls: 8 | reference: https://docs.ropensci.org/gitignore/reference 9 | article: https://docs.ropensci.org/gitignore/articles 10 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/figures/README-pressure-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/docs/reference/figures/README-pressure-1.png -------------------------------------------------------------------------------- /docs/reference/gi_write_gitignore.html: -------------------------------------------------------------------------------- 1 | 2 | Append or create a .gitignore file — gi_write_gitignore • gitignore 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    45 | 46 |
    47 |

    Use the returned template(s) to append the existing .gitignore file.

    48 |
    49 | 50 |
    51 |

    Usage

    52 |
    gi_write_gitignore(fetched_template, gitignore_file = here::here(".gitignore"))
    53 |
    54 | 55 |
    56 |

    Arguments

    57 | 58 | 59 |
    fetched_template
    60 |

    Template(s) returned by `gi_fetch_templates()`.

    61 | 62 | 63 |
    gitignore_file
    64 |

    Path of the .gitignore file to modify.

    65 | 66 |
    67 |
    68 |

    Value

    69 |

    TRUE if succeeds to write/append the .gitignore, FALSE otherwise.

    70 |
    71 | 72 |
    73 |

    Examples

    74 |
    if (FALSE) { # \dontrun{
     75 | f <- file.path(tempdir(), ".gitignore")
     76 | new_lines <- gi_fetch_templates("r")
     77 | gi_write_gitignore(new_lines, f)
     78 | 
     79 | unlink(f)
     80 | } # }
     81 | 
    82 |
    83 |
    85 | 86 | 87 |
    90 | 91 | 94 | 95 |
    96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /docs/reference/gitignore-package.html: -------------------------------------------------------------------------------- 1 | 2 | gitignore: Create Useful .gitignore Files for your Project — gitignore-package • gitignore 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    45 | 46 |
    47 |

    Simple interface to query gitignore.io to fetch gitignore templates that can be included in the .gitignore file. More than 450 templates are currently available.

    48 |
    49 | 50 | 51 | 58 |
    59 |

    Author

    60 |

    Maintainer: Philippe Massicotte pmassicotte@hotmail.com (ORCID)

    61 |

    Other contributors:

    64 | 65 |
    67 | 68 | 69 |
    72 | 73 | 76 | 77 |
    78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/reference/gitignore.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/index.html: -------------------------------------------------------------------------------- 1 | 2 | Package index • gitignore 3 | Skip to contents 4 | 5 | 6 |
    38 |
    39 |
    43 | 44 |
    45 |

    All functions

    46 | 47 | 48 | 49 | 50 |
    51 | 52 | 53 | 54 | 55 |
    56 | 57 | gi_available_templates() 58 | 59 |
    60 |
    Fetch available templates from gitignore.io
    61 |
    62 | 63 | gi_fetch_templates() 64 | 65 |
    66 |
    Fetch gitignore template(s) from gitignore.io
    67 |
    68 | 69 | gi_write_gitignore() 70 | 71 |
    72 |
    Append or create a .gitignore file
    73 |
    74 |
    75 | 76 | 77 |
    80 | 81 | 84 | 85 |
    86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | https://docs.ropensci.org/gitignore/404.html 3 | https://docs.ropensci.org/gitignore/CODE_OF_CONDUCT.html 4 | https://docs.ropensci.org/gitignore/CONTRIBUTING.html 5 | https://docs.ropensci.org/gitignore/LICENSE.html 6 | https://docs.ropensci.org/gitignore/articles/index.html 7 | https://docs.ropensci.org/gitignore/articles/introduction.html 8 | https://docs.ropensci.org/gitignore/authors.html 9 | https://docs.ropensci.org/gitignore/index.html 10 | https://docs.ropensci.org/gitignore/news/index.html 11 | https://docs.ropensci.org/gitignore/reference/gi_available_templates.html 12 | https://docs.ropensci.org/gitignore/reference/gi_fetch_templates.html 13 | https://docs.ropensci.org/gitignore/reference/gi_write_gitignore.html 14 | https://docs.ropensci.org/gitignore/reference/gitignore-package.html 15 | https://docs.ropensci.org/gitignore/reference/index.html 16 | 17 | 18 | -------------------------------------------------------------------------------- /gitignore.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | StripTrailingWhitespace: Yes 16 | 17 | BuildType: Package 18 | PackageUseDevtools: Yes 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | PackageRoxygenize: rd,collate,namespace,vignette 21 | -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | CMD 2 | Codecov 3 | DOI 4 | ORCID 5 | cli 6 | dev 7 | freecodecamp 8 | gi 9 | gitignore’ 10 | io 11 | programmatically 12 | rOpenSci 13 | ropensci 14 | testthat 15 | -------------------------------------------------------------------------------- /man/figures/README-pressure-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/gitignore/1f5250d562c48a08ab1cd975e83400037e0c288f/man/figures/README-pressure-1.png -------------------------------------------------------------------------------- /man/gi_available_templates.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gi_available_templates.R 3 | \name{gi_available_templates} 4 | \alias{gi_available_templates} 5 | \title{Fetch available templates from gitignore.io} 6 | \usage{ 7 | gi_available_templates() 8 | } 9 | \value{ 10 | A character with all templates supported by gitignore.io. 11 | } 12 | \description{ 13 | This return list of all templates supported by gitignore.io. 14 | } 15 | \details{ 16 | The returned list is returned as lower case characters. 17 | } 18 | \examples{ 19 | \dontshow{if (curl::has_internet()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} 20 | gi_available_templates() 21 | \dontshow{\}) # examplesIf} 22 | } 23 | -------------------------------------------------------------------------------- /man/gi_fetch_templates.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gi_fetch_templates.R 3 | \name{gi_fetch_templates} 4 | \alias{gi_fetch_templates} 5 | \title{Fetch gitignore template(s) from gitignore.io} 6 | \usage{ 7 | gi_fetch_templates( 8 | template_name, 9 | copy_to_clipboard = FALSE, 10 | append_gitignore = FALSE, 11 | gitignore_file = here::here(".gitignore") 12 | ) 13 | } 14 | \arguments{ 15 | \item{template_name}{A character vector with values included in 16 | \code{\link{gi_available_templates}}.} 17 | 18 | \item{copy_to_clipboard}{Logical. Should the returned template(s) be copied 19 | to the clipboard? Otherwise, it will be printed in the console. Default is FALSE.} 20 | 21 | \item{append_gitignore}{Logical. Should the .gitignore be modified to include 22 | the returned template(s)?} 23 | 24 | \item{gitignore_file}{The path of the .gitignore file to be modified. By 25 | default, it will try to find it in the current package/project using 26 | `here::here(".gitignore")`.} 27 | } 28 | \value{ 29 | A character containing gitignore template(s). 30 | } 31 | \description{ 32 | Fetch gitignore template(s) from gitignore.io 33 | } 34 | \examples{ 35 | \dontshow{if (curl::has_internet()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} 36 | # Fetch template for the R language 37 | gi_fetch_templates("R") 38 | 39 | # You can combine many templates at once 40 | gi_fetch_templates(c("R", "python", "java")) 41 | 42 | # The .gitignore file can be automatically modified with `append_gitignore = TRUE` 43 | gi_fetch_templates(c("R", "python", "java")) 44 | \dontshow{\}) # examplesIf} 45 | } 46 | -------------------------------------------------------------------------------- /man/gi_write_gitignore.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gi_write_gitignore.R 3 | \name{gi_write_gitignore} 4 | \alias{gi_write_gitignore} 5 | \title{Append or create a .gitignore file} 6 | \usage{ 7 | gi_write_gitignore(fetched_template, gitignore_file = here::here(".gitignore")) 8 | } 9 | \arguments{ 10 | \item{fetched_template}{Template(s) returned by `gi_fetch_templates()`.} 11 | 12 | \item{gitignore_file}{Path of the .gitignore file to modify.} 13 | } 14 | \value{ 15 | TRUE if succeeds to write/append the .gitignore, FALSE otherwise. 16 | } 17 | \description{ 18 | Use the returned template(s) to append the existing .gitignore file. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | f <- file.path(tempdir(), ".gitignore") 23 | new_lines <- gi_fetch_templates("r") 24 | gi_write_gitignore(new_lines, f) 25 | 26 | unlink(f) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /man/gitignore-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gitignore-package.R 3 | \docType{package} 4 | \name{gitignore-package} 5 | \alias{gitignore} 6 | \alias{gitignore-package} 7 | \title{gitignore: Create Useful .gitignore Files for your Project} 8 | \description{ 9 | Simple interface to query gitignore.io to fetch gitignore templates that can be included in the .gitignore file. More than 450 templates are currently available. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://docs.ropensci.org/gitignore/} 15 | \item \url{https://github.com/ropensci/gitignore} 16 | \item Report bugs at \url{https://github.com/ropensci/gitignore/issues} 17 | } 18 | 19 | } 20 | \author{ 21 | \strong{Maintainer}: Philippe Massicotte \email{pmassicotte@hotmail.com} (\href{https://orcid.org/0000-0002-5919-4116}{ORCID}) 22 | 23 | Other contributors: 24 | \itemize{ 25 | \item Amanda Dobbyn \email{amanda.e.dobbyn@gmail.com} [reviewer] 26 | \item Mauro Lepore \email{maurolepore@gmail.com} (\href{https://orcid.org/0000-0002-1986-7988}{ORCID}) [reviewer] 27 | } 28 | 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /tests/spelling.R: -------------------------------------------------------------------------------- 1 | if (requireNamespace("spelling", quietly = TRUE)) { 2 | spelling::spell_check_test( 3 | vignettes = TRUE, error = FALSE, 4 | skip_on_cran = TRUE 5 | ) 6 | } 7 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | # This file is part of the standard setup for testthat. 2 | # It is recommended that you do not modify it. 3 | # 4 | # Where should you do additional test configuration? 5 | # Learn more about the roles of various files in: 6 | # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview 7 | # * https://testthat.r-lib.org/articles/special-files.html 8 | 9 | library(testthat) 10 | library(gitignore) 11 | 12 | test_check("gitignore") 13 | -------------------------------------------------------------------------------- /tests/testthat/test-gi_available_templates.R: -------------------------------------------------------------------------------- 1 | test_that("gi_available_templates works", { 2 | templates <- gi_available_templates() 3 | 4 | expect_true(inherits(templates, "character")) 5 | expect_true(is.vector(templates)) 6 | expect_true("r" %in% templates) 7 | }) 8 | -------------------------------------------------------------------------------- /tests/testthat/test-gi_fetch_templates.R: -------------------------------------------------------------------------------- 1 | test_that("gi_fetch_templates inputs", { 2 | skip_on_cran() 3 | skip_if_offline() 4 | 5 | expect_error(gi_fetch_templates("a-non-valid-template")) 6 | expect_error(gi_fetch_templates("R", copy_to_clipboard = "A")) 7 | expect_error(gi_fetch_templates("R", copy_to_clipboard = 1)) 8 | expect_error(gi_fetch_templates("R", append_gitignore = "A")) 9 | expect_invisible(gi_fetch_templates("c")) 10 | }) 11 | 12 | test_that("gi_fetch_templates case do not matter", { 13 | skip_on_cran() 14 | skip_if_offline() 15 | 16 | expect_equal( 17 | gi_fetch_templates("r"), 18 | gi_fetch_templates("R") 19 | ) 20 | expect_equal( 21 | gi_fetch_templates("c"), 22 | gi_fetch_templates("C") 23 | ) 24 | expect_equal( 25 | gi_fetch_templates("c++"), 26 | gi_fetch_templates("C++") 27 | ) 28 | }) 29 | 30 | test_that("Template can be copied in the clipboard", { 31 | skip_on_cran() 32 | skip_if_offline() 33 | 34 | expect_invisible(gi_fetch_templates("c")) 35 | }) 36 | 37 | test_that("A non existing .gitignore file can be created", { 38 | skip_on_cran() 39 | skip_if_offline() 40 | 41 | f <- file.path(tempdir(), ".gitignore") 42 | unlist(f) 43 | file.create(f) 44 | 45 | expect_invisible( 46 | gi_fetch_templates( 47 | "R", 48 | copy_to_clipboard = FALSE, 49 | append_gitignore = TRUE, 50 | gitignore_file = f 51 | ) 52 | ) 53 | 54 | unlink(f) 55 | }) 56 | -------------------------------------------------------------------------------- /tests/testthat/test-gi_write_gitignore.R: -------------------------------------------------------------------------------- 1 | test_that("no change in the gitignore file", { 2 | skip_on_cran() 3 | skip_if_offline() 4 | 5 | f <- file.path(tempdir(), ".gitignore") 6 | file.create(f) 7 | 8 | new_lines <- gi_fetch_templates("r") 9 | 10 | # Write once 11 | gi_write_gitignore(new_lines, f) 12 | 13 | # The second time it should not write anything 14 | expect_false(gi_write_gitignore(new_lines, f)) 15 | 16 | unlink(f) 17 | }) 18 | 19 | test_that(".gitignore file can not be found", { 20 | skip_on_cran() 21 | skip_if_offline() 22 | 23 | f <- file.path(tempdir(), ".gitignore") 24 | unlink(f) 25 | 26 | new_lines <- gi_fetch_templates("r") 27 | 28 | expect_error(gi_write_gitignore(new_lines, f)) 29 | 30 | unlink(f) 31 | }) 32 | 33 | # That would be nice to test, but seems difficult with testthat because of: "menu() cannot be used non-interactively" error 34 | 35 | # test_that("A non existing .gitignore file can be created", { 36 | # 37 | # f <- tempfile(pattern = "", fileext = ".gitignore") 38 | # 39 | # template <- gi_fetch_templates("R", copy_to_clipboard = FALSE) 40 | # 41 | # expect_true(gi_write_gitignore(template, f)) 42 | # 43 | # unlink(f) 44 | # }) 45 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/introduction.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Introduction} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | 11 | 12 | 13 | ## Basic idea 14 | 15 | Based on the definition proposed by [freecodecamp](https://www.freecodecamp.org/news/gitignore-what-is-it-and-how-to-add-to-repo/): 16 | 17 | > The .gitignore file is a text file that tells Git which files or folders to ignore in a project. A local .gitignore file is usually placed in the root directory of a project. You can also create a global .gitignore file and any entries in that file will be ignored in all of your Git repositories. 18 | 19 | For any project, it is therefore important to have a `.gitignore` file that is complete and accurate. The package `gitignore` provides a simple R interface to the [gitignore.io](https://www.toptal.com/developers/gitignore) API. It can be used to fetch gitignore templates that can be included into the `.gitignore` file of you git repository. The `gitignore` R package can be used with R package, R Studio project or with any `.gitignore` file. Note that by default, the `usethis` package populates the `.gitignore` for the R language when you create a R project. However, it is common to use many different programming languages in a project such as `LaTeX`, `python`, `matlab`, `julia` and so on. This is where the `gitignore` package shines as it can be used to programmatically modify the `.gitignore` file of your project. 20 | 21 | `gitignore` is a simple R package that provide an interface to query [gitignore.io](https://www.toptal.com/developers/gitignore) to fetch gitignore templates that can be included in the .gitignore file. More than 450 templates are currently available. There are actually two functions in the package: 22 | 23 | - `gi_available_templates()`: to get a list of all templates available on [gitignore.io](https://www.toptal.com/developers/gitignore). 24 | - `gi_fetch_templates()`: to get one or more template(s). This function can copy the returned template(s) in the clipboard as well as happening the the `.gitignore` file in your project directory. 25 | 26 | ## Examples 27 | 28 | 29 | ```r 30 | library(gitignore) 31 | ``` 32 | 33 | Get the list of all available templates from [gitignore.io](https://www.toptal.com/developers/gitignore): 34 | 35 | 36 | ```r 37 | head(gi_available_templates(), 50) 38 | #> [1] "1c" "1c-bitrix" 39 | #> [3] "a-frame" "actionscript" 40 | #> [5] "ada" "adobe" 41 | #> [7] "advancedinstaller" "adventuregamestudio" 42 | #> [9] "agda" "al" 43 | #> [11] "alteraquartusii" "altium" 44 | #> [13] "amplify" "android" 45 | #> [15] "androidstudio" "angular" 46 | #> [17] "anjuta" "ansible" 47 | #> [19] "ansibletower" "apachecordova" 48 | #> [21] "apachehadoop" "appbuilder" 49 | #> [23] "appceleratortitanium" "appcode" 50 | #> [25] "appcode+all" "appcode+iml" 51 | #> [27] "appengine" "aptanastudio" 52 | #> [29] "arcanist" "archive" 53 | #> [31] "archives" "archlinuxpackages" 54 | #> [33] "asdf" "aspnetcore" 55 | #> [35] "assembler" "astro" 56 | #> [37] "ate" "atmelstudio" 57 | #> [39] "ats" "audio" 58 | #> [41] "autohotkey" "automationstudio" 59 | #> [43] "autotools" "autotools+strict" 60 | #> [45] "awr" "azurefunctions" 61 | #> [47] "azurite" "backup" 62 | #> [49] "ballerina" "basercms" 63 | ``` 64 | 65 | The function `gi_fetch_templates()` can be used to fetch particular template(s). For example, one could want to get the `java` and `c++` templates as follow: 66 | 67 | 68 | ```r 69 | gi_fetch_templates(c("java", "c++")) 70 | #> # Created by https://www.toptal.com/developers/gitignore/api/java,c++ 71 | #> # Edit at https://www.toptal.com/developers/gitignore?templates=java,c++ 72 | #> 73 | #> ### C++ ### 74 | #> # Prerequisites 75 | #> *.d 76 | #> 77 | #> # Compiled Object files 78 | #> *.slo 79 | #> *.lo 80 | #> *.o 81 | #> *.obj 82 | #> 83 | #> # Precompiled Headers 84 | #> *.gch 85 | #> *.pch 86 | #> 87 | #> # Compiled Dynamic libraries 88 | #> *.so 89 | #> *.dylib 90 | #> *.dll 91 | #> 92 | #> # Fortran module files 93 | #> *.mod 94 | #> *.smod 95 | #> 96 | #> # Compiled Static libraries 97 | #> *.lai 98 | #> *.la 99 | #> *.a 100 | #> *.lib 101 | #> 102 | #> # Executables 103 | #> *.exe 104 | #> *.out 105 | #> *.app 106 | #> 107 | #> ### Java ### 108 | #> # Compiled class file 109 | #> *.class 110 | #> 111 | #> # Log file 112 | #> *.log 113 | #> 114 | #> # BlueJ files 115 | #> *.ctxt 116 | #> 117 | #> # Mobile Tools for Java (J2ME) 118 | #> .mtj.tmp/ 119 | #> 120 | #> # Package Files # 121 | #> *.jar 122 | #> *.war 123 | #> *.nar 124 | #> *.ear 125 | #> *.zip 126 | #> *.tar.gz 127 | #> *.rar 128 | #> 129 | #> # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 130 | #> hs_err_pid* 131 | #> replay_pid* 132 | #> 133 | #> # End of https://www.toptal.com/developers/gitignore/api/java,c++ 134 | ``` 135 | 136 | By default, the template(s) are not copied into the clipboard, this can be changed by setting `copy_to_clipboard = TRUE`: 137 | 138 | 139 | ```r 140 | gi_fetch_templates(c("java", "c++"), copy_to_clipboard = TRUE) 141 | ``` 142 | 143 | Additionally, you can tell `gi_fetch_templates()` to append automatically the `.gitignore` file in your project by setting `append_gitignore = TRUE`: 144 | 145 | 146 | ```r 147 | gi_fetch_templates(c("R"), append_gitignore = TRUE) 148 | ``` 149 | 150 | It is also possible to specify the `.gitignore` file to be modified by specifying the `gitignore_file` argument. 151 | 152 | 153 | ```r 154 | f <- file.path(tempdir(), ".gitignore") 155 | 156 | file.create(f) 157 | #> [1] TRUE 158 | 159 | gi_fetch_templates("R", gitignore_file = f, append_gitignore = TRUE) 160 | #> # Created by https://www.toptal.com/developers/gitignore/api/r 161 | #> # Edit at https://www.toptal.com/developers/gitignore?templates=r 162 | #> 163 | #> ### R ### 164 | #> # History files 165 | #> .Rhistory 166 | #> .Rapp.history 167 | #> 168 | #> # Session Data files 169 | #> .RData 170 | #> .RDataTmp 171 | #> 172 | #> # User-specific files 173 | #> .Ruserdata 174 | #> 175 | #> # Example code in package build process 176 | #> *-Ex.R 177 | #> 178 | #> # Output files from R CMD build 179 | #> /*.tar.gz 180 | #> 181 | #> # Output files from R CMD check 182 | #> /*.Rcheck/ 183 | #> 184 | #> # RStudio files 185 | #> .Rproj.user/ 186 | #> 187 | #> # produced vignettes 188 | #> vignettes/*.html 189 | #> vignettes/*.pdf 190 | #> 191 | #> # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 192 | #> .httr-oauth 193 | #> 194 | #> # knitr and R markdown default cache directories 195 | #> *_cache/ 196 | #> /cache/ 197 | #> 198 | #> # Temporary files created by R markdown 199 | #> *.utf8.md 200 | #> *.knit.md 201 | #> 202 | #> # R Environment Variables 203 | #> .Renviron 204 | #> 205 | #> # pkgdown site 206 | #> docs/ 207 | #> 208 | #> # translation temp files 209 | #> po/*~ 210 | #> 211 | #> # RStudio Connect folder 212 | #> rsconnect/ 213 | #> 214 | #> ### R.Bookdown Stack ### 215 | #> # R package: bookdown caching files 216 | #> /*_files/ 217 | #> 218 | #> # End of https://www.toptal.com/developers/gitignore/api/r 219 | #> ● .gitignore file successfully modified. 220 | 221 | readLines(f) 222 | #> [1] "# Created by https://www.toptal.com/developers/gitignore/api/r" 223 | #> [2] "# Edit at https://www.toptal.com/developers/gitignore?templates=r" 224 | #> [3] "" 225 | #> [4] "### R ###" 226 | #> [5] "# History files" 227 | #> [6] ".Rhistory" 228 | #> [7] ".Rapp.history" 229 | #> [8] "# Session Data files" 230 | #> [9] ".RData" 231 | #> [10] ".RDataTmp" 232 | #> [11] "# User-specific files" 233 | #> [12] ".Ruserdata" 234 | #> [13] "# Example code in package build process" 235 | #> [14] "*-Ex.R" 236 | #> [15] "# Output files from R CMD build" 237 | #> [16] "/*.tar.gz" 238 | #> [17] "# Output files from R CMD check" 239 | #> [18] "/*.Rcheck/" 240 | #> [19] "# RStudio files" 241 | #> [20] ".Rproj.user/" 242 | #> [21] "# produced vignettes" 243 | #> [22] "vignettes/*.html" 244 | #> [23] "vignettes/*.pdf" 245 | #> [24] "# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3" 246 | #> [25] ".httr-oauth" 247 | #> [26] "# knitr and R markdown default cache directories" 248 | #> [27] "*_cache/" 249 | #> [28] "/cache/" 250 | #> [29] "# Temporary files created by R markdown" 251 | #> [30] "*.utf8.md" 252 | #> [31] "*.knit.md" 253 | #> [32] "# R Environment Variables" 254 | #> [33] ".Renviron" 255 | #> [34] "# pkgdown site" 256 | #> [35] "docs/" 257 | #> [36] "# translation temp files" 258 | #> [37] "po/*~" 259 | #> [38] "# RStudio Connect folder" 260 | #> [39] "rsconnect/" 261 | #> [40] "### R.Bookdown Stack ###" 262 | #> [41] "# R package: bookdown caching files" 263 | #> [42] "/*_files/" 264 | #> [43] "# End of https://www.toptal.com/developers/gitignore/api/r" 265 | ``` 266 | 267 | -------------------------------------------------------------------------------- /vignettes/introduction.Rmd.orig: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Introduction} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | collapse = TRUE, 13 | comment = "#>" 14 | ) 15 | 16 | ``` 17 | ```{r, eval=FALSE, echo=FALSE} 18 | 19 | # Use this to create the vignette to prevent CRAN checks from failing when 20 | # gitignore API is not available. 21 | 22 | # https://ropensci.org/blog/2019/12/08/precompute-vignettes/ 23 | knitr::knit("vignettes/introduction.Rmd.orig", "vignettes/introduction.Rmd") 24 | ``` 25 | 26 | ## Basic idea 27 | 28 | Based on the definition proposed by [freecodecamp](https://www.freecodecamp.org/news/gitignore-what-is-it-and-how-to-add-to-repo/): 29 | 30 | > The .gitignore file is a text file that tells Git which files or folders to ignore in a project. A local .gitignore file is usually placed in the root directory of a project. You can also create a global .gitignore file and any entries in that file will be ignored in all of your Git repositories. 31 | 32 | For any project, it is therefore important to have a `.gitignore` file that is complete and accurate. The package `gitignore` provides a simple R interface to the [gitignore.io](https://www.toptal.com/developers/gitignore) API. It can be used to fetch gitignore templates that can be included into the `.gitignore` file of you git repository. The `gitignore` R package can be used with R package, R Studio project or with any `.gitignore` file. Note that by default, the `usethis` package populates the `.gitignore` for the R language when you create a R project. However, it is common to use many different programming languages in a project such as `LaTeX`, `python`, `matlab`, `julia` and so on. This is where the `gitignore` package shines as it can be used to programmatically modify the `.gitignore` file of your project. 33 | 34 | `gitignore` is a simple R package that provide an interface to query [gitignore.io](https://www.toptal.com/developers/gitignore) to fetch gitignore templates that can be included in the .gitignore file. More than 450 templates are currently available. There are actually two functions in the package: 35 | 36 | - `gi_available_templates()`: to get a list of all templates available on [gitignore.io](https://www.toptal.com/developers/gitignore). 37 | - `gi_fetch_templates()`: to get one or more template(s). This function can copy the returned template(s) in the clipboard as well as happening the the `.gitignore` file in your project directory. 38 | 39 | ## Examples 40 | 41 | ```{r setup} 42 | library(gitignore) 43 | ``` 44 | 45 | Get the list of all available templates from [gitignore.io](https://www.toptal.com/developers/gitignore): 46 | 47 | ```{r} 48 | head(gi_available_templates(), 50) 49 | ``` 50 | 51 | The function `gi_fetch_templates()` can be used to fetch particular template(s). For example, one could want to get the `java` and `c++` templates as follow: 52 | 53 | ```{r} 54 | gi_fetch_templates(c("java", "c++")) 55 | ``` 56 | 57 | By default, the template(s) are not copied into the clipboard, this can be changed by setting `copy_to_clipboard = TRUE`: 58 | 59 | ```{r, eval=FALSE} 60 | gi_fetch_templates(c("java", "c++"), copy_to_clipboard = TRUE) 61 | ``` 62 | 63 | Additionally, you can tell `gi_fetch_templates()` to append automatically the `.gitignore` file in your project by setting `append_gitignore = TRUE`: 64 | 65 | ```{r, eval=FALSE} 66 | gi_fetch_templates(c("R"), append_gitignore = TRUE) 67 | ``` 68 | 69 | It is also possible to specify the `.gitignore` file to be modified by specifying the `gitignore_file` argument. 70 | 71 | ```{r, message=TRUE} 72 | f <- file.path(tempdir(), ".gitignore") 73 | 74 | file.create(f) 75 | 76 | gi_fetch_templates("R", gitignore_file = f, append_gitignore = TRUE) 77 | 78 | readLines(f) 79 | ``` 80 | 81 | --------------------------------------------------------------------------------