├── .Rbuildignore ├── .Rprofile ├── .github ├── .gitignore ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ └── issue_template.md └── workflows │ ├── R-CMD-check.yaml │ ├── document.yaml │ ├── pkgdown.yaml │ └── render-rmarkdown.yaml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── DESCRIPTION ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── aim.R ├── build.R ├── buildr-package.R ├── edit_makefile.R ├── edit_shortcuts.R ├── init.R ├── utils-pipe.R └── utils.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── buildr.Rproj ├── index.md ├── inst ├── WORDLIST └── rstudio │ └── addins.dcf ├── man ├── aim.Rd ├── build.Rd ├── buildr-package.Rd ├── edit_makefile.Rd ├── edit_shortcuts.Rd ├── figures │ ├── card.png │ └── logo.png ├── init.Rd └── pipe.Rd ├── pkgdown └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── renv.lock ├── renv ├── .gitignore ├── activate.R ├── settings.dcf └── settings.json ├── tests ├── spelling.R ├── testthat.R └── testthat │ ├── setup.R │ └── test-init.R └── vignettes ├── .gitignore ├── articles ├── addins_showcase.gif ├── aim_showcase.gif ├── build_showcase.gif ├── init_showcase.gif ├── know_your_buildr_gifs.Rmd └── shortcuts_showcase.gif └── know_your_buildr.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^renv$ 2 | ^renv\.lock$ 3 | ^.*\.Rproj$ 4 | ^\.Rproj\.user$ 5 | ^LICENSE\.md$ 6 | ^\.github$ 7 | ^cran-comments\.md$ 8 | ^CODE_OF_CONDUCT\.md$ 9 | ^pkgdown$ 10 | ^_pkgdown\.yml$ 11 | ^docs$ 12 | ^README\.Rmd$ 13 | ^index\.md$ 14 | ^vignettes/articles$ 15 | -------------------------------------------------------------------------------- /.Rprofile: -------------------------------------------------------------------------------- 1 | source("renv/activate.R") 2 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to buildr 2 | 3 | This outlines how to propose a change to buildr. 4 | For more detailed 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 | You can fix typos, spelling mistakes, or grammatical errors in the documentation directly using the GitHub web interface, as long as the changes are made in the _source_ file. 10 | This generally means you'll need to edit [roxygen2 comments](https://roxygen2.r-lib.org/articles/roxygen2.html) in an `.R`, not a `.Rd` file. 11 | You can find the `.R` file that generates the `.Rd` by reading the comment in the first line. 12 | 13 | ## Bigger changes 14 | 15 | If you want to make a bigger change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed. 16 | If you’ve found a bug, please file an issue that illustrates the bug with a minimal 17 | [reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed). 18 | 19 | ### Pull request process 20 | 21 | * Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("netique/buildr", fork = TRUE)`. 22 | 23 | * Install all development dependences with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`. 24 | If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing. 25 | * Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`. 26 | 27 | * Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser. 28 | The title of your PR should briefly describe the change. 29 | The body of your PR should contain `Fixes #issue-number`. 30 | 31 | * For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in . 32 | 33 | ### Code style 34 | 35 | * New code should follow the tidyverse [style guide](https://style.tidyverse.org). 36 | You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR. 37 | 38 | * We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation. 39 | 40 | * We use [testthat](https://cran.r-project.org/package=testthat) for unit tests. 41 | Contributions with test cases included are easier to accept. 42 | 43 | ## Code of Conduct 44 | 45 | Please note that the buildr project is released with a 46 | [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this 47 | project you agree to abide by its terms. 48 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/issue_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report or feature request 3 | about: Describe a bug you've seen or make a case for a new feature 4 | --- 5 | 6 | Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on or . 7 | 8 | Please include a minimal reproducible example (AKA a reprex). If you've never heard of a [reprex](http://reprex.tidyverse.org/) before, start by reading . 9 | 10 | Brief description of the problem 11 | 12 | ```r 13 | # insert reprex here 14 | ``` 15 | -------------------------------------------------------------------------------- /.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 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | - {os: windows-latest, r: 'release'} 23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 24 | - {os: ubuntu-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'oldrel-1'} 26 | 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | R_KEEP_PKG_SOURCE: yes 30 | 31 | steps: 32 | - uses: actions/checkout@v4 33 | 34 | - uses: r-lib/actions/setup-pandoc@v2 35 | 36 | - uses: r-lib/actions/setup-r@v2 37 | with: 38 | r-version: ${{ matrix.config.r }} 39 | http-user-agent: ${{ matrix.config.http-user-agent }} 40 | use-public-rspm: true 41 | 42 | - uses: r-lib/actions/setup-r-dependencies@v2 43 | with: 44 | extra-packages: any::rcmdcheck 45 | needs: check 46 | 47 | - uses: r-lib/actions/check-r-package@v2 48 | with: 49 | upload-snapshots: true 50 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 51 | -------------------------------------------------------------------------------- /.github/workflows/document.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 | paths: ["R/**"] 6 | pull_request: 7 | paths: ["R/**"] 8 | 9 | name: Document 10 | 11 | jobs: 12 | document: 13 | runs-on: ubuntu-latest 14 | env: 15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 16 | steps: 17 | - name: Checkout repo 18 | uses: actions/checkout@v2 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Setup R 23 | uses: r-lib/actions/setup-r@v2 24 | with: 25 | use-public-rspm: true 26 | 27 | - name: Install dependencies 28 | uses: r-lib/actions/setup-r-dependencies@v2 29 | with: 30 | extra-packages: any::roxygen2 31 | needs: roxygen2 32 | 33 | - name: Document 34 | run: roxygen2::roxygenise() 35 | shell: Rscript {0} 36 | 37 | - name: Commit and push changes 38 | run: | 39 | git config --local user.name "$GITHUB_ACTOR" 40 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 41 | git add man/\* NAMESPACE 42 | git commit -m "Update documentation" || echo "No changes to commit" 43 | git pull --ff-only 44 | git push origin 45 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.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 | release: 9 | types: [published] 10 | workflow_dispatch: 11 | 12 | name: pkgdown 13 | 14 | jobs: 15 | pkgdown: 16 | runs-on: ubuntu-latest 17 | # Only restrict concurrency for non-PR jobs 18 | concurrency: 19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 20 | env: 21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 22 | permissions: 23 | contents: write 24 | steps: 25 | - uses: actions/checkout@v4 26 | 27 | - uses: r-lib/actions/setup-pandoc@v2 28 | 29 | - uses: r-lib/actions/setup-r@v2 30 | with: 31 | use-public-rspm: true 32 | 33 | - uses: r-lib/actions/setup-r-dependencies@v2 34 | with: 35 | extra-packages: any::pkgdown, local::. 36 | needs: website 37 | 38 | - name: Build site 39 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 40 | shell: Rscript {0} 41 | 42 | - name: Deploy to GitHub pages 🚀 43 | if: github.event_name != 'pull_request' 44 | uses: JamesIves/github-pages-deploy-action@v4.5.0 45 | with: 46 | clean: false 47 | branch: gh-pages 48 | folder: docs 49 | -------------------------------------------------------------------------------- /.github/workflows/render-rmarkdown.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 | paths: ['**.Rmd'] 6 | 7 | name: render-rmarkdown 8 | 9 | jobs: 10 | render-rmarkdown: 11 | runs-on: ubuntu-latest 12 | env: 13 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 14 | steps: 15 | - name: Checkout repo 16 | uses: actions/checkout@v2 17 | with: 18 | fetch-depth: 0 19 | 20 | - name: Install system dependencies 21 | run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev 22 | 23 | - uses: r-lib/actions/setup-pandoc@v2 24 | 25 | - uses: r-lib/actions/setup-r@v2 26 | 27 | - uses: r-lib/actions/setup-renv@v2 28 | with: 29 | cache-version: 1 30 | 31 | - name: Render Rmarkdown files and Commit Results 32 | run: | 33 | RMD_PATH=($(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '[.]Rmd$')) 34 | Rscript -e 'for (f in commandArgs(TRUE)) if (file.exists(f)) rmarkdown::render(f)' ${RMD_PATH[*]} 35 | git config --local user.name "$GITHUB_ACTOR" 36 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 37 | git commit ${RMD_PATH[*]/.Rmd/.md} -m 'Re-build Rmarkdown files' || echo "No changes to commit" 38 | git push origin || echo "No changes to commit" 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | .RData 3 | .Rproj.user 4 | inst/doc 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards 42 | of acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies 54 | when an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail 56 | address, posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at [INSERT CONTACT 63 | METHOD]. All complaints will be reviewed and investigated promptly and fairly. 64 | 65 | All community leaders are obligated to respect the privacy and security of the 66 | reporter of any incident. 67 | 68 | ## Enforcement Guidelines 69 | 70 | Community leaders will follow these Community Impact Guidelines in determining 71 | the consequences for any action they deem in violation of this Code of Conduct: 72 | 73 | ### 1. Correction 74 | 75 | **Community Impact**: Use of inappropriate language or other behavior deemed 76 | unprofessional or unwelcome in the community. 77 | 78 | **Consequence**: A private, written warning from community leaders, providing 79 | clarity around the nature of the violation and an explanation of why the 80 | behavior was inappropriate. A public apology may be requested. 81 | 82 | ### 2. Warning 83 | 84 | **Community Impact**: A violation through a single incident or series of 85 | actions. 86 | 87 | **Consequence**: A warning with consequences for continued behavior. No 88 | interaction with the people involved, including unsolicited interaction with 89 | those enforcing the Code of Conduct, for a specified period of time. This 90 | includes avoiding interactions in community spaces as well as external channels 91 | like social media. Violating these terms may lead to a temporary or permanent 92 | ban. 93 | 94 | ### 3. Temporary Ban 95 | 96 | **Community Impact**: A serious violation of community standards, including 97 | sustained inappropriate behavior. 98 | 99 | **Consequence**: A temporary ban from any sort of interaction or public 100 | communication with the community for a specified period of time. No public or 101 | private interaction with the people involved, including unsolicited interaction 102 | with those enforcing the Code of Conduct, is allowed during this period. 103 | Violating these terms may lead to a permanent ban. 104 | 105 | ### 4. Permanent Ban 106 | 107 | **Community Impact**: Demonstrating a pattern of violation of community 108 | standards, including sustained inappropriate behavior, harassment of an 109 | individual, or aggression toward or disparagement of classes of individuals. 110 | 111 | **Consequence**: A permanent ban from any sort of public interaction within the 112 | community. 113 | 114 | ## Attribution 115 | 116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 117 | version 2.0, 118 | available at https://www.contributor-covenant.org/version/2/0/ 119 | code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at https:// 128 | www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: buildr 2 | Title: Organize & Run Build Scripts Comfortably 3 | Version: 0.1.1 4 | Authors@R: 5 | person(given = "Jan", 6 | family = "Netik", 7 | role = c("aut", "cre"), 8 | email = "netikja@gmail.com", 9 | comment = c(ORCID = "0000-0002-3888-3203")) 10 | Description: Working with reproducible reports or any other 11 | similar projects often require to run the script that builds the 12 | output file in a specified way. 'buildr' can help you organize, modify 13 | and comfortably run those scripts. The package provides a set of 14 | functions that interactively guides you through the process and that 15 | are available as 'RStudio' Addin, meaning you can set up the keyboard 16 | shortcuts, enabling you to choose and run the desired build script 17 | with one keystroke anywhere anytime. 18 | License: GPL (>= 3) 19 | URL: https://netique.github.io/buildr/ 20 | BugReports: https://github.com/netique/buildr/issues/ 21 | Imports: 22 | rstudioapi, 23 | usethis, 24 | readr, 25 | glue, 26 | stringr, 27 | magrittr, 28 | tibble, 29 | utils 30 | Encoding: UTF-8 31 | Roxygen: list(markdown = TRUE) 32 | RoxygenNote: 7.2.1 33 | Suggests: 34 | knitr, 35 | rmarkdown, 36 | roxygen2, 37 | testthat (>= 3.0.0), 38 | spelling, 39 | pkgdown, 40 | withr 41 | VignetteBuilder: 42 | knitr 43 | Config/testthat/edition: 3 44 | Language: en-US 45 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU General Public License 2 | ========================== 3 | 4 | _Version 3, 29 June 2007_ 5 | _Copyright © 2007 Free Software Foundation, Inc. <>_ 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license 8 | document, but changing it is not allowed. 9 | 10 | ## Preamble 11 | 12 | The GNU General Public License is a free, copyleft license for software and other 13 | kinds of works. 14 | 15 | The licenses for most software and other practical works are designed to take away 16 | your freedom to share and change the works. By contrast, the GNU General Public 17 | License is intended to guarantee your freedom to share and change all versions of a 18 | program--to make sure it remains free software for all its users. We, the Free 19 | Software Foundation, use the GNU General Public License for most of our software; it 20 | applies also to any other work released this way by its authors. You can apply it to 21 | your programs, too. 22 | 23 | When we speak of free software, we are referring to freedom, not price. Our General 24 | Public Licenses are designed to make sure that you have the freedom to distribute 25 | copies of free software (and charge for them if you wish), that you receive source 26 | code or can get it if you want it, that you can change the software or use pieces of 27 | it in new free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you these rights or 30 | asking you to surrender the rights. Therefore, you have certain responsibilities if 31 | you distribute copies of the software, or if you modify it: responsibilities to 32 | respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether gratis or for a fee, 35 | you must pass on to the recipients the same freedoms that you received. You must make 36 | sure that they, too, receive or can get the source code. And you must show them these 37 | terms so they know their rights. 38 | 39 | Developers that use the GNU GPL protect your rights with two steps: **(1)** assert 40 | copyright on the software, and **(2)** offer you this License giving you legal permission 41 | to copy, distribute and/or modify it. 42 | 43 | For the developers' and authors' protection, the GPL clearly explains that there is 44 | no warranty for this free software. For both users' and authors' sake, the GPL 45 | requires that modified versions be marked as changed, so that their problems will not 46 | be attributed erroneously to authors of previous versions. 47 | 48 | Some devices are designed to deny users access to install or run modified versions of 49 | the software inside them, although the manufacturer can do so. This is fundamentally 50 | incompatible with the aim of protecting users' freedom to change the software. The 51 | systematic pattern of such abuse occurs in the area of products for individuals to 52 | use, which is precisely where it is most unacceptable. Therefore, we have designed 53 | this version of the GPL to prohibit the practice for those products. If such problems 54 | arise substantially in other domains, we stand ready to extend this provision to 55 | those domains in future versions of the GPL, as needed to protect the freedom of 56 | users. 57 | 58 | Finally, every program is threatened constantly by software patents. States should 59 | not allow patents to restrict development and use of software on general-purpose 60 | computers, but in those that do, we wish to avoid the special danger that patents 61 | applied to a free program could make it effectively proprietary. To prevent this, the 62 | GPL assures that patents cannot be used to render the program non-free. 63 | 64 | The precise terms and conditions for copying, distribution and modification follow. 65 | 66 | ## TERMS AND CONDITIONS 67 | 68 | ### 0. Definitions 69 | 70 | “This License” refers to version 3 of the GNU General Public License. 71 | 72 | “Copyright” also means copyright-like laws that apply to other kinds of 73 | works, such as semiconductor masks. 74 | 75 | “The Program” refers to any copyrightable work licensed under this 76 | License. Each licensee is addressed as “you”. “Licensees” and 77 | “recipients” may be individuals or organizations. 78 | 79 | To “modify” a work means to copy from or adapt all or part of the work in 80 | a fashion requiring copyright permission, other than the making of an exact copy. The 81 | resulting work is called a “modified version” of the earlier work or a 82 | work “based on” the earlier work. 83 | 84 | A “covered work” means either the unmodified Program or a work based on 85 | the Program. 86 | 87 | To “propagate” a work means to do anything with it that, without 88 | permission, would make you directly or secondarily liable for infringement under 89 | applicable copyright law, except executing it on a computer or modifying a private 90 | copy. Propagation includes copying, distribution (with or without modification), 91 | making available to the public, and in some countries other activities as well. 92 | 93 | To “convey” a work means any kind of propagation that enables other 94 | parties to make or receive copies. Mere interaction with a user through a computer 95 | network, with no transfer of a copy, is not conveying. 96 | 97 | An interactive user interface displays “Appropriate Legal Notices” to the 98 | extent that it includes a convenient and prominently visible feature that **(1)** 99 | displays an appropriate copyright notice, and **(2)** tells the user that there is no 100 | warranty for the work (except to the extent that warranties are provided), that 101 | licensees may convey the work under this License, and how to view a copy of this 102 | License. If the interface presents a list of user commands or options, such as a 103 | menu, a prominent item in the list meets this criterion. 104 | 105 | ### 1. Source Code 106 | 107 | The “source code” for a work means the preferred form of the work for 108 | making modifications to it. “Object code” means any non-source form of a 109 | work. 110 | 111 | A “Standard Interface” means an interface that either is an official 112 | standard defined by a recognized standards body, or, in the case of interfaces 113 | specified for a particular programming language, one that is widely used among 114 | developers working in that language. 115 | 116 | The “System Libraries” of an executable work include anything, other than 117 | the work as a whole, that **(a)** is included in the normal form of packaging a Major 118 | Component, but which is not part of that Major Component, and **(b)** serves only to 119 | enable use of the work with that Major Component, or to implement a Standard 120 | Interface for which an implementation is available to the public in source code form. 121 | A “Major Component”, in this context, means a major essential component 122 | (kernel, window system, and so on) of the specific operating system (if any) on which 123 | the executable work runs, or a compiler used to produce the work, or an object code 124 | interpreter used to run it. 125 | 126 | The “Corresponding Source” for a work in object code form means all the 127 | source code needed to generate, install, and (for an executable work) run the object 128 | code and to modify the work, including scripts to control those activities. However, 129 | it does not include the work's System Libraries, or general-purpose tools or 130 | generally available free programs which are used unmodified in performing those 131 | activities but which are not part of the work. For example, Corresponding Source 132 | includes interface definition files associated with source files for the work, and 133 | the source code for shared libraries and dynamically linked subprograms that the work 134 | is specifically designed to require, such as by intimate data communication or 135 | control flow between those subprograms and other parts of the work. 136 | 137 | The Corresponding Source need not include anything that users can regenerate 138 | automatically from other parts of the Corresponding Source. 139 | 140 | The Corresponding Source for a work in source code form is that same work. 141 | 142 | ### 2. Basic Permissions 143 | 144 | All rights granted under this License are granted for the term of copyright on the 145 | Program, and are irrevocable provided the stated conditions are met. This License 146 | explicitly affirms your unlimited permission to run the unmodified Program. The 147 | output from running a covered work is covered by this License only if the output, 148 | given its content, constitutes a covered work. This License acknowledges your rights 149 | of fair use or other equivalent, as provided by copyright law. 150 | 151 | You may make, run and propagate covered works that you do not convey, without 152 | conditions so long as your license otherwise remains in force. You may convey covered 153 | works to others for the sole purpose of having them make modifications exclusively 154 | for you, or provide you with facilities for running those works, provided that you 155 | comply with the terms of this License in conveying all material for which you do not 156 | control copyright. Those thus making or running the covered works for you must do so 157 | exclusively on your behalf, under your direction and control, on terms that prohibit 158 | them from making any copies of your copyrighted material outside their relationship 159 | with you. 160 | 161 | Conveying under any other circumstances is permitted solely under the conditions 162 | stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 163 | 164 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law 165 | 166 | No covered work shall be deemed part of an effective technological measure under any 167 | applicable law fulfilling obligations under article 11 of the WIPO copyright treaty 168 | adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention 169 | of such measures. 170 | 171 | When you convey a covered work, you waive any legal power to forbid circumvention of 172 | technological measures to the extent such circumvention is effected by exercising 173 | rights under this License with respect to the covered work, and you disclaim any 174 | intention to limit operation or modification of the work as a means of enforcing, 175 | against the work's users, your or third parties' legal rights to forbid circumvention 176 | of technological measures. 177 | 178 | ### 4. Conveying Verbatim Copies 179 | 180 | You may convey verbatim copies of the Program's source code as you receive it, in any 181 | medium, provided that you conspicuously and appropriately publish on each copy an 182 | appropriate copyright notice; keep intact all notices stating that this License and 183 | any non-permissive terms added in accord with section 7 apply to the code; keep 184 | intact all notices of the absence of any warranty; and give all recipients a copy of 185 | this License along with the Program. 186 | 187 | You may charge any price or no price for each copy that you convey, and you may offer 188 | support or warranty protection for a fee. 189 | 190 | ### 5. Conveying Modified Source Versions 191 | 192 | You may convey a work based on the Program, or the modifications to produce it from 193 | the Program, in the form of source code under the terms of section 4, provided that 194 | you also meet all of these conditions: 195 | 196 | * **a)** The work must carry prominent notices stating that you modified it, and giving a 197 | relevant date. 198 | * **b)** The work must carry prominent notices stating that it is released under this 199 | License and any conditions added under section 7. This requirement modifies the 200 | requirement in section 4 to “keep intact all notices”. 201 | * **c)** You must license the entire work, as a whole, under this License to anyone who 202 | comes into possession of a copy. This License will therefore apply, along with any 203 | applicable section 7 additional terms, to the whole of the work, and all its parts, 204 | regardless of how they are packaged. This License gives no permission to license the 205 | work in any other way, but it does not invalidate such permission if you have 206 | separately received it. 207 | * **d)** If the work has interactive user interfaces, each must display Appropriate Legal 208 | Notices; however, if the Program has interactive interfaces that do not display 209 | Appropriate Legal Notices, your work need not make them do so. 210 | 211 | A compilation of a covered work with other separate and independent works, which are 212 | not by their nature extensions of the covered work, and which are not combined with 213 | it such as to form a larger program, in or on a volume of a storage or distribution 214 | medium, is called an “aggregate” if the compilation and its resulting 215 | copyright are not used to limit the access or legal rights of the compilation's users 216 | beyond what the individual works permit. Inclusion of a covered work in an aggregate 217 | does not cause this License to apply to the other parts of the aggregate. 218 | 219 | ### 6. Conveying Non-Source Forms 220 | 221 | You may convey a covered work in object code form under the terms of sections 4 and 222 | 5, provided that you also convey the machine-readable Corresponding Source under the 223 | terms of this License, in one of these ways: 224 | 225 | * **a)** Convey the object code in, or embodied in, a physical product (including a 226 | physical distribution medium), accompanied by the Corresponding Source fixed on a 227 | durable physical medium customarily used for software interchange. 228 | * **b)** Convey the object code in, or embodied in, a physical product (including a 229 | physical distribution medium), accompanied by a written offer, valid for at least 230 | three years and valid for as long as you offer spare parts or customer support for 231 | that product model, to give anyone who possesses the object code either **(1)** a copy of 232 | the Corresponding Source for all the software in the product that is covered by this 233 | License, on a durable physical medium customarily used for software interchange, for 234 | a price no more than your reasonable cost of physically performing this conveying of 235 | source, or **(2)** access to copy the Corresponding Source from a network server at no 236 | charge. 237 | * **c)** Convey individual copies of the object code with a copy of the written offer to 238 | provide the Corresponding Source. This alternative is allowed only occasionally and 239 | noncommercially, and only if you received the object code with such an offer, in 240 | accord with subsection 6b. 241 | * **d)** Convey the object code by offering access from a designated place (gratis or for 242 | a charge), and offer equivalent access to the Corresponding Source in the same way 243 | through the same place at no further charge. You need not require recipients to copy 244 | the Corresponding Source along with the object code. If the place to copy the object 245 | code is a network server, the Corresponding Source may be on a different server 246 | (operated by you or a third party) that supports equivalent copying facilities, 247 | provided you maintain clear directions next to the object code saying where to find 248 | the Corresponding Source. Regardless of what server hosts the Corresponding Source, 249 | you remain obligated to ensure that it is available for as long as needed to satisfy 250 | these requirements. 251 | * **e)** Convey the object code using peer-to-peer transmission, provided you inform 252 | other peers where the object code and Corresponding Source of the work are being 253 | offered to the general public at no charge under subsection 6d. 254 | 255 | A separable portion of the object code, whose source code is excluded from the 256 | Corresponding Source as a System Library, need not be included in conveying the 257 | object code work. 258 | 259 | A “User Product” is either **(1)** a “consumer product”, which 260 | means any tangible personal property which is normally used for personal, family, or 261 | household purposes, or **(2)** anything designed or sold for incorporation into a 262 | dwelling. In determining whether a product is a consumer product, doubtful cases 263 | shall be resolved in favor of coverage. For a particular product received by a 264 | particular user, “normally used” refers to a typical or common use of 265 | that class of product, regardless of the status of the particular user or of the way 266 | in which the particular user actually uses, or expects or is expected to use, the 267 | product. A product is a consumer product regardless of whether the product has 268 | substantial commercial, industrial or non-consumer uses, unless such uses represent 269 | the only significant mode of use of the product. 270 | 271 | “Installation Information” for a User Product means any methods, 272 | procedures, authorization keys, or other information required to install and execute 273 | modified versions of a covered work in that User Product from a modified version of 274 | its Corresponding Source. The information must suffice to ensure that the continued 275 | functioning of the modified object code is in no case prevented or interfered with 276 | solely because modification has been made. 277 | 278 | If you convey an object code work under this section in, or with, or specifically for 279 | use in, a User Product, and the conveying occurs as part of a transaction in which 280 | the right of possession and use of the User Product is transferred to the recipient 281 | in perpetuity or for a fixed term (regardless of how the transaction is 282 | characterized), the Corresponding Source conveyed under this section must be 283 | accompanied by the Installation Information. But this requirement does not apply if 284 | neither you nor any third party retains the ability to install modified object code 285 | on the User Product (for example, the work has been installed in ROM). 286 | 287 | The requirement to provide Installation Information does not include a requirement to 288 | continue to provide support service, warranty, or updates for a work that has been 289 | modified or installed by the recipient, or for the User Product in which it has been 290 | modified or installed. Access to a network may be denied when the modification itself 291 | materially and adversely affects the operation of the network or violates the rules 292 | and protocols for communication across the network. 293 | 294 | Corresponding Source conveyed, and Installation Information provided, in accord with 295 | this section must be in a format that is publicly documented (and with an 296 | implementation available to the public in source code form), and must require no 297 | special password or key for unpacking, reading or copying. 298 | 299 | ### 7. Additional Terms 300 | 301 | “Additional permissions” are terms that supplement the terms of this 302 | License by making exceptions from one or more of its conditions. Additional 303 | permissions that are applicable to the entire Program shall be treated as though they 304 | were included in this License, to the extent that they are valid under applicable 305 | law. If additional permissions apply only to part of the Program, that part may be 306 | used separately under those permissions, but the entire Program remains governed by 307 | this License without regard to the additional permissions. 308 | 309 | When you convey a copy of a covered work, you may at your option remove any 310 | additional permissions from that copy, or from any part of it. (Additional 311 | permissions may be written to require their own removal in certain cases when you 312 | modify the work.) You may place additional permissions on material, added by you to a 313 | covered work, for which you have or can give appropriate copyright permission. 314 | 315 | Notwithstanding any other provision of this License, for material you add to a 316 | covered work, you may (if authorized by the copyright holders of that material) 317 | supplement the terms of this License with terms: 318 | 319 | * **a)** Disclaiming warranty or limiting liability differently from the terms of 320 | sections 15 and 16 of this License; or 321 | * **b)** Requiring preservation of specified reasonable legal notices or author 322 | attributions in that material or in the Appropriate Legal Notices displayed by works 323 | containing it; or 324 | * **c)** Prohibiting misrepresentation of the origin of that material, or requiring that 325 | modified versions of such material be marked in reasonable ways as different from the 326 | original version; or 327 | * **d)** Limiting the use for publicity purposes of names of licensors or authors of the 328 | material; or 329 | * **e)** Declining to grant rights under trademark law for use of some trade names, 330 | trademarks, or service marks; or 331 | * **f)** Requiring indemnification of licensors and authors of that material by anyone 332 | who conveys the material (or modified versions of it) with contractual assumptions of 333 | liability to the recipient, for any liability that these contractual assumptions 334 | directly impose on those licensors and authors. 335 | 336 | All other non-permissive additional terms are considered “further 337 | restrictions” within the meaning of section 10. If the Program as you received 338 | it, or any part of it, contains a notice stating that it is governed by this License 339 | along with a term that is a further restriction, you may remove that term. If a 340 | license document contains a further restriction but permits relicensing or conveying 341 | under this License, you may add to a covered work material governed by the terms of 342 | that license document, provided that the further restriction does not survive such 343 | relicensing or conveying. 344 | 345 | If you add terms to a covered work in accord with this section, you must place, in 346 | the relevant source files, a statement of the additional terms that apply to those 347 | files, or a notice indicating where to find the applicable terms. 348 | 349 | Additional terms, permissive or non-permissive, may be stated in the form of a 350 | separately written license, or stated as exceptions; the above requirements apply 351 | either way. 352 | 353 | ### 8. Termination 354 | 355 | You may not propagate or modify a covered work except as expressly provided under 356 | this License. Any attempt otherwise to propagate or modify it is void, and will 357 | automatically terminate your rights under this License (including any patent licenses 358 | granted under the third paragraph of section 11). 359 | 360 | However, if you cease all violation of this License, then your license from a 361 | particular copyright holder is reinstated **(a)** provisionally, unless and until the 362 | copyright holder explicitly and finally terminates your license, and **(b)** permanently, 363 | if the copyright holder fails to notify you of the violation by some reasonable means 364 | prior to 60 days after the cessation. 365 | 366 | Moreover, your license from a particular copyright holder is reinstated permanently 367 | if the copyright holder notifies you of the violation by some reasonable means, this 368 | is the first time you have received notice of violation of this License (for any 369 | work) from that copyright holder, and you cure the violation prior to 30 days after 370 | your receipt of the notice. 371 | 372 | Termination of your rights under this section does not terminate the licenses of 373 | parties who have received copies or rights from you under this License. If your 374 | rights have been terminated and not permanently reinstated, you do not qualify to 375 | receive new licenses for the same material under section 10. 376 | 377 | ### 9. Acceptance Not Required for Having Copies 378 | 379 | You are not required to accept this License in order to receive or run a copy of the 380 | Program. Ancillary propagation of a covered work occurring solely as a consequence of 381 | using peer-to-peer transmission to receive a copy likewise does not require 382 | acceptance. However, nothing other than this License grants you permission to 383 | propagate or modify any covered work. These actions infringe copyright if you do not 384 | accept this License. Therefore, by modifying or propagating a covered work, you 385 | indicate your acceptance of this License to do so. 386 | 387 | ### 10. Automatic Licensing of Downstream Recipients 388 | 389 | Each time you convey a covered work, the recipient automatically receives a license 390 | from the original licensors, to run, modify and propagate that work, subject to this 391 | License. You are not responsible for enforcing compliance by third parties with this 392 | License. 393 | 394 | An “entity transaction” is a transaction transferring control of an 395 | organization, or substantially all assets of one, or subdividing an organization, or 396 | merging organizations. If propagation of a covered work results from an entity 397 | transaction, each party to that transaction who receives a copy of the work also 398 | receives whatever licenses to the work the party's predecessor in interest had or 399 | could give under the previous paragraph, plus a right to possession of the 400 | Corresponding Source of the work from the predecessor in interest, if the predecessor 401 | has it or can get it with reasonable efforts. 402 | 403 | You may not impose any further restrictions on the exercise of the rights granted or 404 | affirmed under this License. For example, you may not impose a license fee, royalty, 405 | or other charge for exercise of rights granted under this License, and you may not 406 | initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging 407 | that any patent claim is infringed by making, using, selling, offering for sale, or 408 | importing the Program or any portion of it. 409 | 410 | ### 11. Patents 411 | 412 | A “contributor” is a copyright holder who authorizes use under this 413 | License of the Program or a work on which the Program is based. The work thus 414 | licensed is called the contributor's “contributor version”. 415 | 416 | A contributor's “essential patent claims” are all patent claims owned or 417 | controlled by the contributor, whether already acquired or hereafter acquired, that 418 | would be infringed by some manner, permitted by this License, of making, using, or 419 | selling its contributor version, but do not include claims that would be infringed 420 | only as a consequence of further modification of the contributor version. For 421 | purposes of this definition, “control” includes the right to grant patent 422 | sublicenses in a manner consistent with the requirements of this License. 423 | 424 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license 425 | under the contributor's essential patent claims, to make, use, sell, offer for sale, 426 | import and otherwise run, modify and propagate the contents of its contributor 427 | version. 428 | 429 | In the following three paragraphs, a “patent license” is any express 430 | agreement or commitment, however denominated, not to enforce a patent (such as an 431 | express permission to practice a patent or covenant not to sue for patent 432 | infringement). To “grant” such a patent license to a party means to make 433 | such an agreement or commitment not to enforce a patent against the party. 434 | 435 | If you convey a covered work, knowingly relying on a patent license, and the 436 | Corresponding Source of the work is not available for anyone to copy, free of charge 437 | and under the terms of this License, through a publicly available network server or 438 | other readily accessible means, then you must either **(1)** cause the Corresponding 439 | Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the 440 | patent license for this particular work, or **(3)** arrange, in a manner consistent with 441 | the requirements of this License, to extend the patent license to downstream 442 | recipients. “Knowingly relying” means you have actual knowledge that, but 443 | for the patent license, your conveying the covered work in a country, or your 444 | recipient's use of the covered work in a country, would infringe one or more 445 | identifiable patents in that country that you have reason to believe are valid. 446 | 447 | If, pursuant to or in connection with a single transaction or arrangement, you 448 | convey, or propagate by procuring conveyance of, a covered work, and grant a patent 449 | license to some of the parties receiving the covered work authorizing them to use, 450 | propagate, modify or convey a specific copy of the covered work, then the patent 451 | license you grant is automatically extended to all recipients of the covered work and 452 | works based on it. 453 | 454 | A patent license is “discriminatory” if it does not include within the 455 | scope of its coverage, prohibits the exercise of, or is conditioned on the 456 | non-exercise of one or more of the rights that are specifically granted under this 457 | License. You may not convey a covered work if you are a party to an arrangement with 458 | a third party that is in the business of distributing software, under which you make 459 | payment to the third party based on the extent of your activity of conveying the 460 | work, and under which the third party grants, to any of the parties who would receive 461 | the covered work from you, a discriminatory patent license **(a)** in connection with 462 | copies of the covered work conveyed by you (or copies made from those copies), or **(b)** 463 | primarily for and in connection with specific products or compilations that contain 464 | the covered work, unless you entered into that arrangement, or that patent license 465 | was granted, prior to 28 March 2007. 466 | 467 | Nothing in this License shall be construed as excluding or limiting any implied 468 | license or other defenses to infringement that may otherwise be available to you 469 | under applicable patent law. 470 | 471 | ### 12. No Surrender of Others' Freedom 472 | 473 | If conditions are imposed on you (whether by court order, agreement or otherwise) 474 | that contradict the conditions of this License, they do not excuse you from the 475 | conditions of this License. If you cannot convey a covered work so as to satisfy 476 | simultaneously your obligations under this License and any other pertinent 477 | obligations, then as a consequence you may not convey it at all. For example, if you 478 | agree to terms that obligate you to collect a royalty for further conveying from 479 | those to whom you convey the Program, the only way you could satisfy both those terms 480 | and this License would be to refrain entirely from conveying the Program. 481 | 482 | ### 13. Use with the GNU Affero General Public License 483 | 484 | Notwithstanding any other provision of this License, you have permission to link or 485 | combine any covered work with a work licensed under version 3 of the GNU Affero 486 | General Public License into a single combined work, and to convey the resulting work. 487 | The terms of this License will continue to apply to the part which is the covered 488 | work, but the special requirements of the GNU Affero General Public License, section 489 | 13, concerning interaction through a network will apply to the combination as such. 490 | 491 | ### 14. Revised Versions of this License 492 | 493 | The Free Software Foundation may publish revised and/or new versions of the GNU 494 | General Public License from time to time. Such new versions will be similar in spirit 495 | to the present version, but may differ in detail to address new problems or concerns. 496 | 497 | Each version is given a distinguishing version number. If the Program specifies that 498 | a certain numbered version of the GNU General Public License “or any later 499 | version” applies to it, you have the option of following the terms and 500 | conditions either of that numbered version or of any later version published by the 501 | Free Software Foundation. If the Program does not specify a version number of the GNU 502 | General Public License, you may choose any version ever published by the Free 503 | Software Foundation. 504 | 505 | If the Program specifies that a proxy can decide which future versions of the GNU 506 | General Public License can be used, that proxy's public statement of acceptance of a 507 | version permanently authorizes you to choose that version for the Program. 508 | 509 | Later license versions may give you additional or different permissions. However, no 510 | additional obligations are imposed on any author or copyright holder as a result of 511 | your choosing to follow a later version. 512 | 513 | ### 15. Disclaimer of Warranty 514 | 515 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 516 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 517 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER 518 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 519 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 520 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 521 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 522 | 523 | ### 16. Limitation of Liability 524 | 525 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 526 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 527 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 528 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 529 | PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE 530 | OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE 531 | WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 532 | POSSIBILITY OF SUCH DAMAGES. 533 | 534 | ### 17. Interpretation of Sections 15 and 16 535 | 536 | If the disclaimer of warranty and limitation of liability provided above cannot be 537 | given local legal effect according to their terms, reviewing courts shall apply local 538 | law that most closely approximates an absolute waiver of all civil liability in 539 | connection with the Program, unless a warranty or assumption of liability accompanies 540 | a copy of the Program in return for a fee. 541 | 542 | _END OF TERMS AND CONDITIONS_ 543 | 544 | ## How to Apply These Terms to Your New Programs 545 | 546 | If you develop a new program, and you want it to be of the greatest possible use to 547 | the public, the best way to achieve this is to make it free software which everyone 548 | can redistribute and change under these terms. 549 | 550 | To do so, attach the following notices to the program. It is safest to attach them 551 | to the start of each source file to most effectively state the exclusion of warranty; 552 | and each file should have at least the “copyright” line and a pointer to 553 | where the full notice is found. 554 | 555 | 556 | Copyright (C) 557 | 558 | This program is free software: you can redistribute it and/or modify 559 | it under the terms of the GNU General Public License as published by 560 | the Free Software Foundation, either version 3 of the License, or 561 | (at your option) any later version. 562 | 563 | This program is distributed in the hope that it will be useful, 564 | but WITHOUT ANY WARRANTY; without even the implied warranty of 565 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 566 | GNU General Public License for more details. 567 | 568 | You should have received a copy of the GNU General Public License 569 | along with this program. If not, see . 570 | 571 | Also add information on how to contact you by electronic and paper mail. 572 | 573 | If the program does terminal interaction, make it output a short notice like this 574 | when it starts in an interactive mode: 575 | 576 | Copyright (C) 577 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 578 | This is free software, and you are welcome to redistribute it 579 | under certain conditions; type 'show c' for details. 580 | 581 | The hypothetical commands `show w` and `show c` should show the appropriate parts of 582 | the General Public License. Of course, your program's commands might be different; 583 | for a GUI interface, you would use an “about box”. 584 | 585 | You should also get your employer (if you work as a programmer) or school, if any, to 586 | sign a “copyright disclaimer” for the program, if necessary. For more 587 | information on this, and how to apply and follow the GNU GPL, see 588 | <>. 589 | 590 | The GNU General Public License does not permit incorporating your program into 591 | proprietary programs. If your program is a subroutine library, you may consider it 592 | more useful to permit linking proprietary applications with the library. If this is 593 | what you want to do, use the GNU Lesser General Public License instead of this 594 | License. But first, please read 595 | <>. 596 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export("%>%") 4 | export(aim) 5 | export(build) 6 | export(edit_makefile) 7 | export(edit_shortcuts) 8 | export(init) 9 | importFrom(glue,glue) 10 | importFrom(glue,glue_data) 11 | importFrom(magrittr,"%>%") 12 | importFrom(readr,read_file) 13 | importFrom(readr,read_lines) 14 | importFrom(readr,write_lines) 15 | importFrom(rstudioapi,executeCommand) 16 | importFrom(rstudioapi,hasFun) 17 | importFrom(rstudioapi,isAvailable) 18 | importFrom(rstudioapi,navigateToFile) 19 | importFrom(rstudioapi,sendToConsole) 20 | importFrom(stringr,str_detect) 21 | importFrom(stringr,str_extract) 22 | importFrom(stringr,str_remove) 23 | importFrom(stringr,str_subset) 24 | importFrom(stringr,str_trim) 25 | importFrom(tibble,tibble) 26 | importFrom(usethis,ui_code) 27 | importFrom(usethis,ui_done) 28 | importFrom(usethis,ui_field) 29 | importFrom(usethis,ui_info) 30 | importFrom(usethis,ui_oops) 31 | importFrom(usethis,ui_path) 32 | importFrom(usethis,ui_stop) 33 | importFrom(usethis,ui_todo) 34 | importFrom(usethis,ui_value) 35 | importFrom(usethis,ui_yeah) 36 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # buildr 0.1.1 2 | 3 | - fix documentation to be HTML5 compliant 4 | 5 | # buildr 0.1.0 6 | 7 | - **complete reboot**, a whole new philosophy *built* around automatically generated, fully editable `Makefile` and prioritization of its "rules" 8 | 9 | - "trinity" of essential functions introduced: 10 | 11 | - `init()` initializes a `Makefile` in project root with automatically discovered build scripts 12 | - `aim()` sets one of the `Makefile` targets to be recognized by RStudio's *Build* pane (prioritization) 13 | - `build()` builds the first `Makefile` entry (set by user or via `aim()`) 14 | 15 | ## Technicals 16 | 17 | - `pkgdown` is used to build package website, so you can read the news, vignettes and full documentation in a more pleasant, responsive way even outside `R` 18 | 19 | - partly covered with `testthat` tests 20 | 21 | ------------------------------------------------------------------------ 22 | 23 | # buildr 0.0.4 24 | 25 | - first CRAN release 26 | - package offers basic functionality 27 | -------------------------------------------------------------------------------- /R/aim.R: -------------------------------------------------------------------------------- 1 | #' Set Makefile Target 2 | #' 3 | #' `aim()` looks for an existing `Makefile`, reads its content, and offers a 4 | #' list of discovered `Makefile` targets (denoting build scripts, in our case), 5 | #' all in an interactive way. When the session is not interactive, or you know 6 | #' the name of the desired target, you can declare it directly in the `target` 7 | #' argument. 8 | #' 9 | #' 10 | #' @param target *Character*. The name of the Makefile target to set. 11 | #' 12 | #' @family functions from buildr trinity 13 | #' @keywords file utilities misc 14 | #' 15 | #' @return No return value. Called for side effects. 16 | #' 17 | #' @author Jan Netik 18 | #' 19 | #' @importFrom rstudioapi executeCommand 20 | #' @importFrom stringr str_trim str_subset str_remove 21 | #' @importFrom magrittr %>% 22 | #' @importFrom readr read_lines write_lines 23 | #' @importFrom usethis ui_done ui_field ui_code ui_value ui_stop ui_oops 24 | #' 25 | #' @examples 26 | #' \dontrun{ 27 | #' # We have several build scripts in our project root 28 | #' # and we want to select script called "build_all.R": 29 | #' 30 | #' aim(target = "all") # note that "build_" is stripped out by default 31 | #' } 32 | #' @export 33 | aim <- function(target = NULL) { 34 | if (!interactive() & is.null(target)) { 35 | ui_stop(c( 36 | "{ui_field('aim()')} cannot run in noninteractive session and argument {ui_value('target')} is not specified.", 37 | "Please call {ui_code('aim(target = \"your_target_script\")')}, or use interactive session." 38 | )) 39 | } 40 | 41 | check_makefile() 42 | 43 | lines <- read_lines("Makefile", skip_empty_rows = TRUE) 44 | 45 | 46 | if (length(lines) %% 2) { 47 | ui_oops(c( 48 | "It seems that your {ui_path('Makefile')} contains odd number of lines.", 49 | "This should not be possible and probably will cause trouble.", 50 | "Please check the {ui_path('Makefile')} with {ui_code('edit_makefile()')}." 51 | )) 52 | } 53 | 54 | targets <- targets_from_lines(lines) 55 | 56 | 57 | rules_split <- split(lines, f = targets %>% rep(each = 2)) 58 | 59 | if (is.null(target)) { 60 | switch_to <- utils::menu(targets, 61 | title = ui_todo("Select the build script that will be used from now on.") 62 | ) 63 | 64 | switch_to <- targets[switch_to] 65 | 66 | if (switch_to == 0) { 67 | return( 68 | ui_oops(c( 69 | "You have not chosen any of the scripts.", 70 | "There will be no changes." 71 | )) 72 | ) 73 | } 74 | } else { 75 | switch_to_trimmed <- target %>% str_remove("\\.[r|R]") 76 | 77 | if (switch_to_trimmed %in% targets) { 78 | switch_to <- switch_to_trimmed 79 | } else { 80 | ui_stop(c( 81 | "{ui_value({switch_to_trimmed})} is not a valid target in {ui_path('Makefile')}.", 82 | "Pick from {ui_value({targets})}." 83 | )) 84 | } 85 | } 86 | 87 | 88 | new_order <- c(switch_to, setdiff(targets, switch_to)) 89 | 90 | rules_split[new_order] %>% 91 | unlist() %>% 92 | write_lines("Makefile") 93 | 94 | ui_done("Set! Use {ui_code('build()')} to build {ui_value({switch_to})}.") 95 | } 96 | -------------------------------------------------------------------------------- /R/build.R: -------------------------------------------------------------------------------- 1 | #' Run Selected Build Script 2 | #' 3 | #' `build()` is the final function in the workflow, as it instructs 'RStudio' 4 | #' Build pane to take the first rule in the `Makefile` (set previously with 5 | #' `aim()`) and runs the respective recipe. 6 | #' 7 | #' The 'RStudio' Build pane is not always visible and set to take `Makefiles`. 8 | #' However, the `build()` ensures that everything is set properly and if not, it 9 | #' offers you to automatically edit necessary settings automatically for you. 10 | #' Note that this action forces 'RStudio' user interface (UI) to reload and you 11 | #' have to call `build()` again afterwards. 12 | #' 13 | #' @family functions from buildr trinity 14 | #' @keywords file utilities misc 15 | #' 16 | #' @return No return value. Called for side effects. 17 | #' 18 | #' @author Jan Netik 19 | #' 20 | #' @importFrom rstudioapi executeCommand 21 | #' @importFrom stringr str_extract 22 | #' @importFrom readr read_lines 23 | #' @importFrom magrittr %>% 24 | #' @importFrom readr read_file read_lines 25 | #' @importFrom usethis ui_done ui_field ui_code ui_value ui_stop 26 | #' 27 | #' @examples 28 | #' \dontrun{ 29 | #' build() 30 | #' } 31 | #' @export 32 | build <- function() { 33 | check_makefile() 34 | 35 | target <- read_lines("Makefile")[1] %>% str_extract(".*(?=:)") 36 | 37 | ui_done("Building {ui_value({target})} in RStudio's {ui_field('Build')} pane...") 38 | 39 | if (check_build_pane() == "success") { 40 | invisible(executeCommand("buildAll")) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /R/buildr-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/edit_makefile.R: -------------------------------------------------------------------------------- 1 | #' Edit Makefile 2 | #' 3 | #' Opens `Makefile`, if present in the project root. 4 | #' 5 | #' @return No return value. Called for side effect. 6 | #' 7 | #' @seealso The [documentation for GNU 8 | #' Make](https://www.gnu.org/software/make/manual/html_node/). 9 | #' 10 | #' @importFrom rstudioapi executeCommand navigateToFile hasFun isAvailable 11 | #' @importFrom usethis ui_info ui_oops ui_todo 12 | #' 13 | #' @export 14 | edit_makefile <- function() { 15 | if (!file.exists("Makefile")) { 16 | ui_oops("{ui_value('Makefile')} does not exist in project root.") 17 | return(ui_todo("Call {ui_code('buildr::init()')} to create it.")) 18 | } 19 | 20 | ui_info("{ui_path('Makefile')} opened.") 21 | 22 | if (isAvailable() && hasFun("navigateToFile")) { 23 | navigateToFile("Makefile") 24 | } 25 | else { 26 | utils::file.edit("Makefile") 27 | } 28 | 29 | invisible("Makefile") 30 | } 31 | -------------------------------------------------------------------------------- /R/edit_shortcuts.R: -------------------------------------------------------------------------------- 1 | #' Show RStudio Keyboard Shortcuts Popup 2 | #' 3 | #' Shows popup window with RStudio keyboard shortcuts. Uses `rstudioapi`. 4 | #' Applicable only in RStudio and in interactive session. 5 | #' 6 | #' You can quickly reach out solicited addin function by typing it in the 7 | #' `Filter...` box in the very top of the popup window. Then double click at the 8 | #' blank space just next to the addin function name and press down desired key 9 | #' or key combination. Apply the changes and from now on, just call the function 10 | #' with one keystroke. 11 | #' 12 | #' @return No return value. Called for side effect. 13 | #' 14 | #' @importFrom rstudioapi executeCommand isAvailable 15 | #' @examples 16 | #' \dontrun{ 17 | #' edit_schortcuts() 18 | #' } 19 | #' @export 20 | edit_shortcuts <- function() { 21 | if (isAvailable()) { 22 | invisible(executeCommand("modifyKeyboardShortcuts")) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /R/init.R: -------------------------------------------------------------------------------- 1 | #' Discover Build Scripts & Create Makefile 2 | #' 3 | #' \code{init()} looks for \code{.R} scripts in a project root (current working 4 | #' directory) that contain a specified prefix and separator. Then, it creates a 5 | #' \code{Makefile} with rules describing how to run discovered scripts. 6 | #' 7 | #' The build script names should all follow a common pattern that is both human 8 | #' and machine readable. Filename should incorporate a prefix ("build" by 9 | #' default) and the "body" describing what the given script builds. Those two 10 | #' essential parts are separated by underscore (i.e. "_") by default as it 11 | #' helps with the readability. Both parts are configurable (see below), but we 12 | #' encourage you not to make any changes. Do not forget that build scripts are 13 | #' matched for a prefix and separator concatenated together, so the script named 14 | #' "build.R" won't be recognized, as it doesn't begin with "build_". Follow the 15 | #' example below on how to include "build.R". 16 | #' 17 | #' @param prefix \emph{Character}. Prefix that solicited build scripts have in 18 | #' common. It is trimmed and stripped in the list of \code{Makefile} targets 19 | #' because of redundancy. Default to "build". 20 | #' @param sep \emph{Character}. Separator between \code{prefix} and "body" of a 21 | #' build script filename. It is also stripped in the list of \code{Makefile} 22 | #' targets because of redundancy. Default to underscore (i.e. "_"). 23 | #' @param path \emph{Character}. Path being searched. Default to the project 24 | #' root (i.e. ".", the current working directory, call \code{getwd()} to print 25 | #' it). See \code{\link{list.files}} for more details on the topic. 26 | #' @param ignore_case \emph{Logical}. Should the search be case-sensitive? 27 | #' Default to FALSE. 28 | #' @param command_args \emph{Single character}. Command argument(s) to include 29 | #' after the recipe call. Command argument can be picked up by your script 30 | #' with \code{\link{commandArgs}}. See 31 | #' \code{vignette("know_your_buildr")} for more details. Empty string by 32 | #' default (not in use). 33 | #' 34 | #' @family functions from buildr trinity 35 | #' @keywords file utilities misc 36 | #' @noMd 37 | #' 38 | #' @return No return value. Called for side effects. 39 | #' 40 | #' @author Jan Netik 41 | #' 42 | #' @importFrom rstudioapi executeCommand 43 | #' @importFrom readr write_lines 44 | #' @importFrom stringr str_extract str_trim 45 | #' @importFrom tibble tibble 46 | #' @importFrom magrittr %>% 47 | #' @importFrom glue glue glue_data 48 | #' @importFrom usethis ui_done ui_field ui_code ui_value ui_stop ui_path 49 | #' 50 | #' @examples 51 | #' \dontrun{ 52 | #' # if you stick with the defaults, run: 53 | #' init() 54 | #' 55 | #' # if you want to include "build.R", 56 | #' # you have to tell {buildr} to 57 | #' # use an empty separator, like: 58 | #' init(sep = "") 59 | #' } 60 | #' @export 61 | init <- function(prefix = "build", sep = "_", path = ".", ignore_case = TRUE, command_args = "") { 62 | pattern <- paste0("^", prefix, sep, ".*\\.R$") 63 | 64 | files <- list.files(path, pattern, ignore.case = ignore_case) 65 | 66 | if (length(files) == 0) { 67 | ui_stop(c( 68 | "{ui_field('{buildr}')} has not discovered any build scripts. Have you created them yet?", 69 | "If so, try to call {ui_code('init()')} again with different {ui_field('prefix')} and/or {ui_field('sep')} arguments." 70 | )) 71 | } 72 | 73 | rules <- tibble( 74 | rule = file_to_target(files, prefix, sep), 75 | recipe = glue("@Rscript -e 'source(\"{recipe_core}\")'", 76 | recipe_core = files 77 | ), 78 | command_args = ifelse(nzchar(command_args), 79 | paste0(" ", command_args), 80 | command_args 81 | ) 82 | ) 83 | 84 | rules %>% 85 | glue_data("{rule}:\n\t{recipe}{command_args}", .trim = FALSE) %>% 86 | write_lines("Makefile") 87 | 88 | ui_done(c( 89 | "{ui_field('{buildr}')} has discovered following build script(s):", 90 | "{ui_value({rules$rule})}. Proceed with {ui_code('aim()')}." 91 | )) 92 | } 93 | -------------------------------------------------------------------------------- /R/utils-pipe.R: -------------------------------------------------------------------------------- 1 | #' Pipe operator 2 | #' 3 | #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 4 | #' 5 | #' @name %>% 6 | #' @rdname pipe 7 | #' @keywords internal 8 | #' @export 9 | #' @importFrom magrittr %>% 10 | #' @usage lhs \%>\% rhs 11 | NULL 12 | -------------------------------------------------------------------------------- /R/utils.R: -------------------------------------------------------------------------------- 1 | #' Read Targets from Makefile 2 | #' 3 | #' @noRd 4 | #' @keywords internal 5 | #' @importFrom usethis ui_stop ui_path ui_code ui_field ui_oops ui_value 6 | #' @importFrom stringr str_subset str_remove str_trim 7 | #' 8 | targets_from_lines <- function(lines) { 9 | targets <- lines %>% 10 | str_subset(":$") %>% 11 | str_remove(":$") %>% 12 | str_trim() 13 | 14 | if (length(targets) == 0) { 15 | ui_stop(c( 16 | "{ui_field('{buildr}')} has not discovered any build scripts in {ui_path('Makefile')}.", 17 | "Try to call {ui_code('init()')} again with different {ui_field('prefix')} argument." 18 | )) 19 | } 20 | 21 | if (length(targets) == 1) { 22 | ui_stop(c( 23 | "{ui_field('{buildr}')} has discovered only one build script {ui_value({targets})}.", 24 | "You can run it directly with {ui_code('build()')}, there is no need to call {ui_code('aim()')}.", 25 | "If you think you have more build scripts in your project,", 26 | "try to call {ui_code('init()')} again with different {ui_value('prefix')} argument." 27 | )) 28 | } 29 | 30 | return(targets) 31 | } 32 | 33 | 34 | #' Check Makefile for problems 35 | #' 36 | #' @noRd 37 | #' @keywords internal 38 | #' @importFrom usethis ui_stop ui_path ui_code ui_field 39 | #' 40 | check_makefile <- function() { 41 | if (!file.exists("Makefile") || file.info("Makefile")$size == 0) { 42 | ui_stop(c( 43 | "{ui_field('{buildr}')} seems uninitialized, {ui_path('Makefile')} does not exist in your project root or is empty.", 44 | "Please, call {ui_code('init()')} first." 45 | )) 46 | } 47 | 48 | tryCatch( 49 | { 50 | invisible(read.dcf("Makefile")) 51 | }, 52 | error = function(e) { 53 | ui_stop(c( 54 | "{ui_path('Makefile')} seems corrupted.", 55 | "Call {ui_code('init()')} again or inspect your {ui_path('Makefile')} with {ui_code('edit_makefile()')}" 56 | )) 57 | } 58 | ) 59 | } 60 | 61 | 62 | #' Check if build pane is set-up 63 | #' 64 | #' @keywords internal 65 | #' @noRd 66 | #' @importFrom stringr str_detect 67 | #' @importFrom rstudioapi executeCommand sendToConsole 68 | #' @importFrom readr read_lines write_lines 69 | #' @importFrom usethis ui_oops ui_field ui_path ui_yeah ui_stop 70 | check_build_pane <- function() { 71 | rproj_file <- list.files(".", pattern = "\\.Rproj$") 72 | rproj_config <- read_lines(rproj_file) 73 | 74 | if (!"BuildType: Makefile" %in% rproj_config) { 75 | ui_oops("{ui_field('{buildr}')} discovered that your RStudio Build pane is not set to build from {ui_path('Makefile')}.") 76 | granted <- ui_yeah(c( 77 | "Do you want to set everything up and reload RStudio UI?", 78 | "After the reload, you'll have to call {ui_code('build()')} again.", 79 | "The action {ui_field('will not')} restart your session." 80 | )) 81 | 82 | if (granted) { 83 | if (!any(str_detect(rproj_config, "BuildType"))) { 84 | rproj_config <- c(rproj_config, "BuildType: Makefile") 85 | } else { 86 | rproj_config[str_detect(rproj_config, "BuildType")] <- "BuildType: Makefile" 87 | } 88 | 89 | write_lines(rproj_config, rproj_file) 90 | 91 | executeCommand("reloadUi") 92 | return("reloaded") 93 | } else { 94 | ui_oops("RStudio Build pane was not set. Build terminated.") 95 | return("fail") 96 | } 97 | } 98 | 99 | return("success") 100 | } 101 | 102 | #' Aim Addin wrapper 103 | #' 104 | #' wrapping inside try defuses RStudio warnings about code execution 105 | #' 106 | #' @noRd 107 | #' @keywords internal 108 | aim_addin <- function() { 109 | try({ 110 | aim() 111 | }) 112 | } 113 | 114 | #' Build Addin wrapper 115 | #' 116 | #' wrapping inside try defuses RStudio warnings about code execution 117 | #' 118 | #' @noRd 119 | #' @keywords internal 120 | build_addin <- function() { 121 | try({ 122 | build() 123 | }) 124 | } 125 | 126 | 127 | #' Init Addin wrapper 128 | #' 129 | #' wrapping inside try defuses RStudio warnings about code execution 130 | #' 131 | #' @noRd 132 | #' @keywords internal 133 | init_addin <- function() { 134 | try({ 135 | init() 136 | }) 137 | } 138 | 139 | 140 | #' Create Makefile target from list of files 141 | #' 142 | #' @noRd 143 | #' 144 | #' @keywords internal 145 | #' 146 | #' @importFrom stringr str_extract str_trim 147 | #' @importFrom magrittr %>% 148 | #' @importFrom usethis ui_path ui_info 149 | #' 150 | file_to_target <- function(file, prefix, sep, noname = "noname") { 151 | pattern <- paste0("(?<=", prefix, sep, ").*(?=\\.[R|r]$)") 152 | 153 | target_core <- str_extract(file, pattern) %>% str_trim() 154 | 155 | if (any(is.na(target_core)) | any(!nzchar(target_core))) { 156 | ui_info(c( 157 | "At least one {ui_path('Makefile')} target has unusable name.", 158 | "Names were automatically repaired, check them carefully." 159 | )) 160 | 161 | target_core[is.na(target_core) | !nzchar(target_core)] <- noname 162 | } 163 | 164 | if (any(duplicated(target_core))) { 165 | ui_info(c( 166 | "There are duplicates among {ui_path('Makefile')} targets.", 167 | "Names were automatically repaired, check them carefully." 168 | )) 169 | 170 | target_core <- make.unique(target_core, sep = "_") 171 | } 172 | 173 | return(target_core) 174 | } 175 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r setup, echo = FALSE} 8 | knitr::opts_chunk$set( 9 | echo = TRUE, eval = FALSE, 10 | collapse = TRUE, 11 | comment = "#>", 12 | fig.path = "man/figures/README-", 13 | out.width = "100%" 14 | ) 15 | ``` 16 | 17 | # buildr 18 | 19 | 20 | 21 | [![CRAN](https://img.shields.io/cran/v/buildr?label=CRAN)](https://CRAN.R-project.org/package=buildr) 22 | [![buildr status badge](https://netique.r-universe.dev/badges/buildr)](https://netique.r-universe.dev) 23 | [![DESCRIPTION version)](https://img.shields.io/github/r-package/v/netique/buildr?label=devel)](https://github.com/netique/buildr) 24 | [![R CMD Check](https://github.com/netique/buildr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/netique/buildr/actions/workflows/R-CMD-check.yaml) 25 | [![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/buildr)](https://cranlogs.r-pkg.org/) 26 | [![Lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing/) 27 | 28 | 29 | 30 | > Organize & Run Build Scripts Comfortably 31 | 32 | Working with reproducible reports or any other similar projects often requires to run the script that "builds" the output file in a specified way. `{buildr}` can help you organize, modify and comfortably run those scripts. The package provides a set of functions that **interactively guides you through the process** and that are available as [RStudio Addin](https://rstudio.github.io/rstudioaddins/), meaning you can set up the **keyboard shortcuts**, enabling you to choose and run the desired build script with **one keystroke anywhere anytime.** 33 | 34 | ## Installation 35 | 36 | You can install the stable version of `{buildr}` ([![CRAN](https://img.shields.io/cran/v/buildr?label=CRAN)](https://CRAN.R-project.org/package=buildr)) from [CRAN](https://CRAN.R-project.org/package=buildr) with: 37 | 38 | ```{r} 39 | install.packages("buildr") 40 | ``` 41 | 42 | And the development version ([![DESCRIPTION version)](https://img.shields.io/github/r-package/v/netique/buildr?label=devel)](https://github.com/netique/buildr)) from [GitHub](https://github.com/netique/buildr) with: 43 | 44 | ```{r} 45 | if (!require(remotes)) {install.packages("remotes")} 46 | remotes::install_github("netique/buildr") 47 | ``` 48 | 49 | ## Load the package 50 | 51 | First, load the package with: 52 | 53 | ```{r init} 54 | library(buildr) 55 | ``` 56 | 57 | You can skip the step above and prepend `buildr::` to every function call. That could be handy if you use `{buildr}` functions only occasionally. 58 | 59 | ## Use `{buildr}` in three steps 60 | 61 | 1. First, call `init()`, which initializes a special `Makefile` in project root with automatically discovered build scripts that share a common prefix and separator ("build" and "_", by default). `Makefile` is a standard "recipe book" which tells the software how it should be compiled. It's so general it can serve perfectly for our purposes. See the [documentation for GNU Make](https://www.gnu.org/software/make/manual/html_node/) or read `vignette("know_your_buildr")` vignette of `{buildr}`. 62 | 63 | 64 | 2. If you have only one build script, you may just proceed by calling `build()`. However, **the strength of `{buildr}` lies in the ease with which you can choose the desired script and run it when your project is populated with many of them**. To do so, call `aim()` and choose among the scripts `{buildr}` discovered for you. `aim()` will set one of the `Makefile` targets to be recognized by RStudio Build pane. 65 | 66 | 3. The last step that you'll need and use most of the time is the actual "building". Simply call `build()` to run the first `Makefile` entry that you have previously set with `aim()`. 67 | 68 | That's it! To learn more about `{buildr}`, `Makefile`s or other relevant stuff, please refer yourself to the `vignette("know_your_buildr")` vignette, which describes how to use `{buildr}` as an Addin, **how to define your keyboard shortcut** and much more. 69 | 70 | Happy building! 71 | 72 | ## License 73 | 74 | This program is free software and you can redistribute it and or modify it under the terms of the [GNU GPL 3](https://www.gnu.org/licenses/gpl-3.0.en.html). 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # buildr 5 | 6 | 7 | 8 | [![CRAN](https://img.shields.io/cran/v/buildr?label=CRAN)](https://CRAN.R-project.org/package=buildr) 9 | [![buildr status 10 | badge](https://netique.r-universe.dev/badges/buildr)](https://netique.r-universe.dev) 11 | [![DESCRIPTION 12 | version)](https://img.shields.io/github/r-package/v/netique/buildr?label=devel)](https://github.com/netique/buildr) 13 | [![R CMD 14 | Check](https://github.com/netique/buildr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/netique/buildr/actions/workflows/R-CMD-check.yaml) 15 | [![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/buildr)](https://cranlogs.r-pkg.org/) 16 | [![Lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing/) 17 | 18 | 19 | 20 | > Organize & Run Build Scripts Comfortably 21 | 22 | Working with reproducible reports or any other similar projects often 23 | requires to run the script that “builds” the output file in a specified 24 | way. `{buildr}` can help you organize, modify and comfortably run those 25 | scripts. The package provides a set of functions that **interactively 26 | guides you through the process** and that are available as [RStudio 27 | Addin](https://rstudio.github.io/rstudioaddins/), meaning you can set up 28 | the **keyboard shortcuts**, enabling you to choose and run the desired 29 | build script with **one keystroke anywhere anytime.** 30 | 31 | ## Installation 32 | 33 | You can install the stable version of `{buildr}` 34 | ([![CRAN](https://img.shields.io/cran/v/buildr?label=CRAN)](https://CRAN.R-project.org/package=buildr)) 35 | from [CRAN](https://CRAN.R-project.org/package=buildr) with: 36 | 37 | ``` r 38 | install.packages("buildr") 39 | ``` 40 | 41 | And the development version ([![DESCRIPTION 42 | version)](https://img.shields.io/github/r-package/v/netique/buildr?label=devel)](https://github.com/netique/buildr)) 43 | from [GitHub](https://github.com/netique/buildr) with: 44 | 45 | ``` r 46 | if (!require(remotes)) {install.packages("remotes")} 47 | remotes::install_github("netique/buildr") 48 | ``` 49 | 50 | ## Load the package 51 | 52 | First, load the package with: 53 | 54 | ``` r 55 | library(buildr) 56 | ``` 57 | 58 | You can skip the step above and prepend `buildr::` to every function 59 | call. That could be handy if you use `{buildr}` functions only 60 | occasionally. 61 | 62 | ## Use `{buildr}` in three steps 63 | 64 | 1. First, call `init()`, which initializes a special `Makefile` in 65 | project root with automatically discovered build scripts that share 66 | a common prefix and separator (“build” and “\_“, by default). 67 | `Makefile` is a standard”recipe book” which tells the software how 68 | it should be compiled. It’s so general it can serve perfectly for 69 | our purposes. See the [documentation for GNU 70 | Make](https://www.gnu.org/software/make/manual/html_node/) or read 71 | `vignette("know_your_buildr")` vignette of `{buildr}`. 72 | 73 | 2. If you have only one build script, you may just proceed by calling 74 | `build()`. However, **the strength of `{buildr}` lies in the ease 75 | with which you can choose the desired script and run it when your 76 | project is populated with many of them**. To do so, call `aim()` and 77 | choose among the scripts `{buildr}` discovered for you. `aim()` will 78 | set one of the `Makefile` targets to be recognized by RStudio Build 79 | pane. 80 | 81 | 3. The last step that you’ll need and use most of the time is the 82 | actual “building”. Simply call `build()` to run the first `Makefile` 83 | entry that you have previously set with `aim()`. 84 | 85 | That’s it! To learn more about `{buildr}`, `Makefile`s or other relevant 86 | stuff, please refer yourself to the `vignette("know_your_buildr")` 87 | vignette, which describes how to use `{buildr}` as an Addin, **how to 88 | define your keyboard shortcut** and much more. 89 | 90 | Happy building! 91 | 92 | ## License 93 | 94 | This program is free software and you can redistribute it and or modify 95 | it under the terms of the [GNU GPL 96 | 3](https://www.gnu.org/licenses/gpl-3.0.en.html). 97 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://netique.github.io/buildr 2 | 3 | home: 4 | title: "buildr: Organize & Run Build Scripts Comfortably" 5 | sidebar: 6 | structure: [dev, links, authors, license, community] 7 | 8 | authors: 9 | Jan Netik: 10 | href: https://jan.netik.cz 11 | 12 | 13 | articles: 14 | - title: 15 | navbar: ~ 16 | contents: 17 | - articles/know_your_buildr_gifs 18 | - title: internal 19 | contents: 20 | - know_your_buildr 21 | 22 | reference: 23 | - title: The trinity 24 | desc: The core functions of the package 25 | contents: 26 | - init 27 | - aim 28 | - build 29 | - title: Others 30 | contents: 31 | - edit_makefile 32 | - edit_shortcuts 33 | 34 | 35 | redirects: 36 | - ["articles/know_your_buildr.html", "articles/know_your_buildr_gifs.html"] 37 | 38 | template: 39 | bootstrap: 5 40 | opengraph: 41 | image: 42 | src: man/figures/card.png 43 | alt: "buildr: Organize & Run Build Scripts Comfortably" 44 | twitter: 45 | creator: "@netikja" 46 | card: summary_large_image 47 | params: 48 | ganalytics: G-B8CQ89BFM4 49 | docsearch: 50 | api_key: e458fb64769df53ec0272e7b819ed428 51 | index_name: buildr 52 | -------------------------------------------------------------------------------- /buildr.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: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageCheckArgs: --as-cran 22 | PackageRoxygenize: rd,collate,namespace,vignette 23 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [![CRAN](https://img.shields.io/cran/v/buildr?label=CRAN)](https://CRAN.R-project.org/package=buildr) 5 | [![DESCRIPTION 6 | version)](https://img.shields.io/github/r-package/v/netique/buildr?label=devel)](https://github.com/netique/buildr) 7 | [![R CMD 8 | Check](https://img.shields.io/github/workflow/status/netique/buildr/R-CMD-check)](https://github.com/netique/buildr/actions?query=workflow%3AR-CMD-check) 9 | [![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/buildr)](https://cranlogs.r-pkg.org/) 10 | [![Lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) 11 | 12 | 13 | 14 | 15 | 16 | 17 | > Organize & Run Build Scripts Comfortably 18 | 19 | 20 | 21 | 22 | Working with reproducible reports or any other similar projects often 23 | requires to run the script that “builds” the output file in a specified 24 | way. `{buildr}` can help you organize, modify and comfortably run those 25 | scripts. The package provides a set of functions that **interactively 26 | guides you through the process** and that are available as [RStudio 27 | Addin](https://rstudio.github.io/rstudioaddins/), meaning you can set up 28 | the **keyboard shortcuts**, enabling you to choose and run the desired 29 | build script with **one keystroke anywhere anytime.** 30 | 31 | ## Installation 32 | 33 | You can install the stable version of `{buildr}` 34 | ([![CRAN](https://img.shields.io/cran/v/buildr?label=CRAN)](https://CRAN.R-project.org/package=buildr)) 35 | from [CRAN](https://CRAN.R-project.org/package=buildr) with: 36 | 37 | ``` r 38 | install.packages("buildr") 39 | ``` 40 | 41 | And the development version ([![DESCRIPTION 42 | version)](https://img.shields.io/github/r-package/v/netique/buildr?label=devel)](https://github.com/netique/buildr)) 43 | from [GitHub](https://github.com/netique/buildr) with: 44 | 45 | ``` r 46 | if (!require(remotes)) {install.packages("remotes")} 47 | remotes::install_github("netique/buildr") 48 | ``` 49 | 50 | ## Load the package 51 | 52 | First, load the package with: 53 | 54 | ``` r 55 | library(buildr) 56 | ``` 57 | 58 | You can skip the step above and prepend `buildr::` to every function 59 | call. That could be handy if you use `{buildr}` functions only 60 | occasionally. 61 | 62 | ## Use `{buildr}` in three steps 63 | 64 | 1. First, call `init()`, which initializes a special `Makefile` in 65 | project root with automatically discovered build scripts that share 66 | a common prefix and separator (“build” and "\_“, by default). 67 | `Makefile` is a standard”recipe book" which tells the software how 68 | it should be compiled. It’s so general it can serve perfectly for 69 | our purposes. See the [documentation for GNU 70 | Make](https://www.gnu.org/software/make/manual/html_node/) or read 71 | `vignette("know_your_buildr")` vignette of `{buildr}`. 72 | 73 | 2. If you have only one build script, you may just proceed by calling 74 | `build()`. However, **the strength of `{buildr}` lies in the ease 75 | with which you can choose the desired script and run it when your 76 | project is populated with many of them**. To do so, call `aim()` and 77 | choose among the scripts `{buildr}` discovered for you. `aim()` will 78 | set one of the `Makefile` targets to be recognized by RStudio Build 79 | pane. 80 | 81 | 3. The last step that you’ll need and use most of the time is the 82 | actual “building”. Simply call `build()` to run the first `Makefile` 83 | entry that you have previously set with `aim()`. 84 | 85 | That’s it! To learn more about `{buildr}`, `Makefile`s or other relevant 86 | stuff, please refer yourself to the `vignette("know_your_buildr")` 87 | vignette, which describes how to use `{buildr}` as an Addin, **how to 88 | define your keyboard shortcut** and much more. 89 | 90 | Happy building! 91 | 92 | ## License 93 | 94 | This program is free software and you can redistribute it and or modify 95 | it under the terms of the [GNU GPL 96 | 3](https://www.gnu.org/licenses/gpl-3.0.en.html). 97 | -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | GHversion 2 | Lifecycle 3 | Makefile 4 | ORCID 5 | RStudio 6 | RStudio's 7 | RStudio’s 8 | Sbalbalbaab 9 | Shorcuts 10 | Technicals 11 | addin 12 | addins 13 | cranlogs 14 | shorcut 15 | -------------------------------------------------------------------------------- /inst/rstudio/addins.dcf: -------------------------------------------------------------------------------- 1 | Name: Init 2 | Description: Initializes a Makefile in project root with automatically discovered build scripts. 3 | Binding: init_addin 4 | Interactive: false 5 | 6 | Name: Aim 7 | Description: Sets one of the Makefile targets to be recognized by RStudio's Build pane. Run init() first. 8 | Binding: aim_addin 9 | Interactive: false 10 | 11 | Name: Build 12 | Description: Builds the first Makefile entry (set by aim()). 13 | Binding: build_addin 14 | Interactive: false 15 | 16 | -------------------------------------------------------------------------------- /man/aim.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aim.R 3 | \name{aim} 4 | \alias{aim} 5 | \title{Set Makefile Target} 6 | \usage{ 7 | aim(target = NULL) 8 | } 9 | \arguments{ 10 | \item{target}{\emph{Character}. The name of the Makefile target to set.} 11 | } 12 | \value{ 13 | No return value. Called for side effects. 14 | } 15 | \description{ 16 | \code{aim()} looks for an existing \code{Makefile}, reads its content, and offers a 17 | list of discovered \code{Makefile} targets (denoting build scripts, in our case), 18 | all in an interactive way. When the session is not interactive, or you know 19 | the name of the desired target, you can declare it directly in the \code{target} 20 | argument. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | # We have several build scripts in our project root 25 | # and we want to select script called "build_all.R": 26 | 27 | aim(target = "all") # note that "build_" is stripped out by default 28 | } 29 | } 30 | \seealso{ 31 | Other functions from buildr trinity: 32 | \code{\link{build}()}, 33 | \code{\link{init}()} 34 | } 35 | \author{ 36 | Jan Netik 37 | } 38 | \concept{functions from buildr trinity} 39 | \keyword{file} 40 | \keyword{misc} 41 | \keyword{utilities} 42 | -------------------------------------------------------------------------------- /man/build.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/build.R 3 | \name{build} 4 | \alias{build} 5 | \title{Run Selected Build Script} 6 | \usage{ 7 | build() 8 | } 9 | \value{ 10 | No return value. Called for side effects. 11 | } 12 | \description{ 13 | \code{build()} is the final function in the workflow, as it instructs 'RStudio' 14 | Build pane to take the first rule in the \code{Makefile} (set previously with 15 | \code{aim()}) and runs the respective recipe. 16 | } 17 | \details{ 18 | The 'RStudio' Build pane is not always visible and set to take \code{Makefiles}. 19 | However, the \code{build()} ensures that everything is set properly and if not, it 20 | offers you to automatically edit necessary settings automatically for you. 21 | Note that this action forces 'RStudio' user interface (UI) to reload and you 22 | have to call \code{build()} again afterwards. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | build() 27 | } 28 | } 29 | \seealso{ 30 | Other functions from buildr trinity: 31 | \code{\link{aim}()}, 32 | \code{\link{init}()} 33 | } 34 | \author{ 35 | Jan Netik 36 | } 37 | \concept{functions from buildr trinity} 38 | \keyword{file} 39 | \keyword{misc} 40 | \keyword{utilities} 41 | -------------------------------------------------------------------------------- /man/buildr-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/buildr-package.R 3 | \docType{package} 4 | \name{buildr-package} 5 | \alias{buildr} 6 | \alias{buildr-package} 7 | \title{buildr: Organize & Run Build Scripts Comfortably} 8 | \description{ 9 | \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} 10 | 11 | Working with reproducible reports or any other similar projects often require to run the script that builds the output file in a specified way. 'buildr' can help you organize, modify and comfortably run those scripts. The package provides a set of functions that interactively guides you through the process and that are available as 'RStudio' Addin, meaning you can set up the keyboard shortcuts, enabling you to choose and run the desired build script with one keystroke anywhere anytime. 12 | } 13 | \seealso{ 14 | Useful links: 15 | \itemize{ 16 | \item \url{https://netique.github.io/buildr/} 17 | \item Report bugs at \url{https://github.com/netique/buildr/issues/} 18 | } 19 | 20 | } 21 | \author{ 22 | \strong{Maintainer}: Jan Netik \email{netikja@gmail.com} (\href{https://orcid.org/0000-0002-3888-3203}{ORCID}) 23 | 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/edit_makefile.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/edit_makefile.R 3 | \name{edit_makefile} 4 | \alias{edit_makefile} 5 | \title{Edit Makefile} 6 | \usage{ 7 | edit_makefile() 8 | } 9 | \value{ 10 | No return value. Called for side effect. 11 | } 12 | \description{ 13 | Opens \code{Makefile}, if present in the project root. 14 | } 15 | \seealso{ 16 | The \href{https://www.gnu.org/software/make/manual/html_node/}{documentation for GNU Make}. 17 | } 18 | -------------------------------------------------------------------------------- /man/edit_shortcuts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/edit_shortcuts.R 3 | \name{edit_shortcuts} 4 | \alias{edit_shortcuts} 5 | \title{Show RStudio Keyboard Shortcuts Popup} 6 | \usage{ 7 | edit_shortcuts() 8 | } 9 | \value{ 10 | No return value. Called for side effect. 11 | } 12 | \description{ 13 | Shows popup window with RStudio keyboard shortcuts. Uses \code{rstudioapi}. 14 | Applicable only in RStudio and in interactive session. 15 | } 16 | \details{ 17 | You can quickly reach out solicited addin function by typing it in the 18 | \code{Filter...} box in the very top of the popup window. Then double click at the 19 | blank space just next to the addin function name and press down desired key 20 | or key combination. Apply the changes and from now on, just call the function 21 | with one keystroke. 22 | } 23 | \examples{ 24 | \dontrun{ 25 | edit_schortcuts() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /man/figures/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/man/figures/card.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/man/figures/logo.png -------------------------------------------------------------------------------- /man/init.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{init} 4 | \alias{init} 5 | \title{Discover Build Scripts & Create Makefile} 6 | \usage{ 7 | init( 8 | prefix = "build", 9 | sep = "_", 10 | path = ".", 11 | ignore_case = TRUE, 12 | command_args = "" 13 | ) 14 | } 15 | \arguments{ 16 | \item{prefix}{\emph{Character}. Prefix that solicited build scripts have in 17 | common. It is trimmed and stripped in the list of \code{Makefile} targets 18 | because of redundancy. Default to "build".} 19 | 20 | \item{sep}{\emph{Character}. Separator between \code{prefix} and "body" of a 21 | build script filename. It is also stripped in the list of \code{Makefile} 22 | targets because of redundancy. Default to underscore (i.e. "_").} 23 | 24 | \item{path}{\emph{Character}. Path being searched. Default to the project 25 | root (i.e. ".", the current working directory, call \code{getwd()} to print 26 | it). See \code{\link{list.files}} for more details on the topic.} 27 | 28 | \item{ignore_case}{\emph{Logical}. Should the search be case-sensitive? 29 | Default to FALSE.} 30 | 31 | \item{command_args}{\emph{Single character}. Command argument(s) to include 32 | after the recipe call. Command argument can be picked up by your script 33 | with \code{\link{commandArgs}}. See 34 | \code{vignette("know_your_buildr")} for more details. Empty string by 35 | default (not in use).} 36 | } 37 | \value{ 38 | No return value. Called for side effects. 39 | } 40 | \description{ 41 | \code{init()} looks for \code{.R} scripts in a project root (current working 42 | directory) that contain a specified prefix and separator. Then, it creates a 43 | \code{Makefile} with rules describing how to run discovered scripts. 44 | } 45 | \details{ 46 | The build script names should all follow a common pattern that is both human 47 | and machine readable. Filename should incorporate a prefix ("build" by 48 | default) and the "body" describing what the given script builds. Those two 49 | essential parts are separated by underscore (i.e. "_") by default as it 50 | helps with the readability. Both parts are configurable (see below), but we 51 | encourage you not to make any changes. Do not forget that build scripts are 52 | matched for a prefix and separator concatenated together, so the script named 53 | "build.R" won't be recognized, as it doesn't begin with "build_". Follow the 54 | example below on how to include "build.R". 55 | } 56 | \examples{ 57 | \dontrun{ 58 | # if you stick with the defaults, run: 59 | init() 60 | 61 | # if you want to include "build.R", 62 | # you have to tell {buildr} to 63 | # use an empty separator, like: 64 | init(sep = "") 65 | } 66 | } 67 | \seealso{ 68 | Other functions from buildr trinity: 69 | \code{\link{aim}()}, 70 | \code{\link{build}()} 71 | } 72 | \author{ 73 | Jan Netik 74 | } 75 | \concept{functions from buildr trinity} 76 | \keyword{file} 77 | \keyword{misc} 78 | \keyword{utilities} 79 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils-pipe.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \description{ 10 | See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /renv.lock: -------------------------------------------------------------------------------- 1 | { 2 | "R": { 3 | "Version": "4.3.3", 4 | "Repositories": [ 5 | { 6 | "Name": "CRAN", 7 | "URL": "https://cloud.r-project.org" 8 | } 9 | ] 10 | }, 11 | "Packages": { 12 | "R6": { 13 | "Package": "R6", 14 | "Version": "2.5.1", 15 | "Source": "Repository", 16 | "Repository": "CRAN", 17 | "Requirements": [ 18 | "R" 19 | ], 20 | "Hash": "470851b6d5d0ac559e9d01bb352b4021" 21 | }, 22 | "Rcpp": { 23 | "Package": "Rcpp", 24 | "Version": "1.0.12", 25 | "Source": "Repository", 26 | "Repository": "CRAN", 27 | "Requirements": [ 28 | "methods", 29 | "utils" 30 | ], 31 | "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" 32 | }, 33 | "askpass": { 34 | "Package": "askpass", 35 | "Version": "1.2.0", 36 | "Source": "Repository", 37 | "Repository": "RSPM", 38 | "Requirements": [ 39 | "sys" 40 | ], 41 | "Hash": "cad6cf7f1d5f6e906700b9d3e718c796" 42 | }, 43 | "base64enc": { 44 | "Package": "base64enc", 45 | "Version": "0.1-3", 46 | "Source": "Repository", 47 | "Repository": "CRAN", 48 | "Requirements": [ 49 | "R" 50 | ], 51 | "Hash": "543776ae6848fde2f48ff3816d0628bc" 52 | }, 53 | "bit": { 54 | "Package": "bit", 55 | "Version": "4.0.5", 56 | "Source": "Repository", 57 | "Repository": "CRAN", 58 | "Requirements": [ 59 | "R" 60 | ], 61 | "Hash": "d242abec29412ce988848d0294b208fd" 62 | }, 63 | "bit64": { 64 | "Package": "bit64", 65 | "Version": "4.0.5", 66 | "Source": "Repository", 67 | "Repository": "CRAN", 68 | "Requirements": [ 69 | "R", 70 | "bit", 71 | "methods", 72 | "stats", 73 | "utils" 74 | ], 75 | "Hash": "9fe98599ca456d6552421db0d6772d8f" 76 | }, 77 | "brio": { 78 | "Package": "brio", 79 | "Version": "1.1.4", 80 | "Source": "Repository", 81 | "Repository": "CRAN", 82 | "Requirements": [ 83 | "R" 84 | ], 85 | "Hash": "68bd2b066e1fe780bbf62fc8bcc36de3" 86 | }, 87 | "bslib": { 88 | "Package": "bslib", 89 | "Version": "0.7.0", 90 | "Source": "Repository", 91 | "Repository": "CRAN", 92 | "Requirements": [ 93 | "R", 94 | "base64enc", 95 | "cachem", 96 | "fastmap", 97 | "grDevices", 98 | "htmltools", 99 | "jquerylib", 100 | "jsonlite", 101 | "lifecycle", 102 | "memoise", 103 | "mime", 104 | "rlang", 105 | "sass" 106 | ], 107 | "Hash": "8644cc53f43828f19133548195d7e59e" 108 | }, 109 | "cachem": { 110 | "Package": "cachem", 111 | "Version": "1.0.8", 112 | "Source": "Repository", 113 | "Repository": "CRAN", 114 | "Requirements": [ 115 | "fastmap", 116 | "rlang" 117 | ], 118 | "Hash": "c35768291560ce302c0a6589f92e837d" 119 | }, 120 | "callr": { 121 | "Package": "callr", 122 | "Version": "3.7.6", 123 | "Source": "Repository", 124 | "Repository": "CRAN", 125 | "Requirements": [ 126 | "R", 127 | "R6", 128 | "processx", 129 | "utils" 130 | ], 131 | "Hash": "d7e13f49c19103ece9e58ad2d83a7354" 132 | }, 133 | "cli": { 134 | "Package": "cli", 135 | "Version": "3.6.2", 136 | "Source": "Repository", 137 | "Repository": "CRAN", 138 | "Requirements": [ 139 | "R", 140 | "utils" 141 | ], 142 | "Hash": "1216ac65ac55ec0058a6f75d7ca0fd52" 143 | }, 144 | "clipr": { 145 | "Package": "clipr", 146 | "Version": "0.8.0", 147 | "Source": "Repository", 148 | "Repository": "CRAN", 149 | "Requirements": [ 150 | "utils" 151 | ], 152 | "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" 153 | }, 154 | "commonmark": { 155 | "Package": "commonmark", 156 | "Version": "1.9.1", 157 | "Source": "Repository", 158 | "Repository": "CRAN", 159 | "Hash": "5d8225445acb167abf7797de48b2ee3c" 160 | }, 161 | "cpp11": { 162 | "Package": "cpp11", 163 | "Version": "0.4.7", 164 | "Source": "Repository", 165 | "Repository": "RSPM", 166 | "Requirements": [ 167 | "R" 168 | ], 169 | "Hash": "5a295d7d963cc5035284dcdbaf334f4e" 170 | }, 171 | "crayon": { 172 | "Package": "crayon", 173 | "Version": "1.5.2", 174 | "Source": "Repository", 175 | "Repository": "CRAN", 176 | "Requirements": [ 177 | "grDevices", 178 | "methods", 179 | "utils" 180 | ], 181 | "Hash": "e8a1e41acf02548751f45c718d55aa6a" 182 | }, 183 | "credentials": { 184 | "Package": "credentials", 185 | "Version": "2.0.1", 186 | "Source": "Repository", 187 | "Repository": "CRAN", 188 | "Requirements": [ 189 | "askpass", 190 | "curl", 191 | "jsonlite", 192 | "openssl", 193 | "sys" 194 | ], 195 | "Hash": "c7844b32098dcbd1c59cbd8dddb4ecc6" 196 | }, 197 | "curl": { 198 | "Package": "curl", 199 | "Version": "5.2.1", 200 | "Source": "Repository", 201 | "Repository": "CRAN", 202 | "Requirements": [ 203 | "R" 204 | ], 205 | "Hash": "411ca2c03b1ce5f548345d2fc2685f7a" 206 | }, 207 | "desc": { 208 | "Package": "desc", 209 | "Version": "1.4.3", 210 | "Source": "Repository", 211 | "Repository": "CRAN", 212 | "Requirements": [ 213 | "R", 214 | "R6", 215 | "cli", 216 | "utils" 217 | ], 218 | "Hash": "99b79fcbd6c4d1ce087f5c5c758b384f" 219 | }, 220 | "diffobj": { 221 | "Package": "diffobj", 222 | "Version": "0.3.5", 223 | "Source": "Repository", 224 | "Repository": "CRAN", 225 | "Requirements": [ 226 | "R", 227 | "crayon", 228 | "methods", 229 | "stats", 230 | "tools", 231 | "utils" 232 | ], 233 | "Hash": "bcaa8b95f8d7d01a5dedfd959ce88ab8" 234 | }, 235 | "digest": { 236 | "Package": "digest", 237 | "Version": "0.6.35", 238 | "Source": "Repository", 239 | "Repository": "CRAN", 240 | "Requirements": [ 241 | "R", 242 | "utils" 243 | ], 244 | "Hash": "698ece7ba5a4fa4559e3d537e7ec3d31" 245 | }, 246 | "downlit": { 247 | "Package": "downlit", 248 | "Version": "0.4.3", 249 | "Source": "Repository", 250 | "Repository": "CRAN", 251 | "Requirements": [ 252 | "R", 253 | "brio", 254 | "desc", 255 | "digest", 256 | "evaluate", 257 | "fansi", 258 | "memoise", 259 | "rlang", 260 | "vctrs", 261 | "withr", 262 | "yaml" 263 | ], 264 | "Hash": "14fa1f248b60ed67e1f5418391a17b14" 265 | }, 266 | "evaluate": { 267 | "Package": "evaluate", 268 | "Version": "0.23", 269 | "Source": "Repository", 270 | "Repository": "CRAN", 271 | "Requirements": [ 272 | "R", 273 | "methods" 274 | ], 275 | "Hash": "daf4a1246be12c1fa8c7705a0935c1a0" 276 | }, 277 | "fansi": { 278 | "Package": "fansi", 279 | "Version": "1.0.6", 280 | "Source": "Repository", 281 | "Repository": "CRAN", 282 | "Requirements": [ 283 | "R", 284 | "grDevices", 285 | "utils" 286 | ], 287 | "Hash": "962174cf2aeb5b9eea581522286a911f" 288 | }, 289 | "fastmap": { 290 | "Package": "fastmap", 291 | "Version": "1.1.1", 292 | "Source": "Repository", 293 | "Repository": "CRAN", 294 | "Hash": "f7736a18de97dea803bde0a2daaafb27" 295 | }, 296 | "fontawesome": { 297 | "Package": "fontawesome", 298 | "Version": "0.5.2", 299 | "Source": "Repository", 300 | "Repository": "RSPM", 301 | "Requirements": [ 302 | "R", 303 | "htmltools", 304 | "rlang" 305 | ], 306 | "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" 307 | }, 308 | "fs": { 309 | "Package": "fs", 310 | "Version": "1.6.3", 311 | "Source": "Repository", 312 | "Repository": "CRAN", 313 | "Requirements": [ 314 | "R", 315 | "methods" 316 | ], 317 | "Hash": "47b5f30c720c23999b913a1a635cf0bb" 318 | }, 319 | "gert": { 320 | "Package": "gert", 321 | "Version": "2.0.1", 322 | "Source": "Repository", 323 | "Repository": "CRAN", 324 | "Requirements": [ 325 | "askpass", 326 | "credentials", 327 | "openssl", 328 | "rstudioapi", 329 | "sys", 330 | "zip" 331 | ], 332 | "Hash": "f70d3fe2d9e7654213a946963d1591eb" 333 | }, 334 | "gh": { 335 | "Package": "gh", 336 | "Version": "1.4.1", 337 | "Source": "Repository", 338 | "Repository": "CRAN", 339 | "Requirements": [ 340 | "R", 341 | "cli", 342 | "gitcreds", 343 | "glue", 344 | "httr2", 345 | "ini", 346 | "jsonlite", 347 | "lifecycle", 348 | "rlang" 349 | ], 350 | "Hash": "fbbbc48eba7a6626a08bb365e44b563b" 351 | }, 352 | "gitcreds": { 353 | "Package": "gitcreds", 354 | "Version": "0.1.2", 355 | "Source": "Repository", 356 | "Repository": "CRAN", 357 | "Requirements": [ 358 | "R" 359 | ], 360 | "Hash": "ab08ac61f3e1be454ae21911eb8bc2fe" 361 | }, 362 | "glue": { 363 | "Package": "glue", 364 | "Version": "1.7.0", 365 | "Source": "Repository", 366 | "Repository": "CRAN", 367 | "Requirements": [ 368 | "R", 369 | "methods" 370 | ], 371 | "Hash": "e0b3a53876554bd45879e596cdb10a52" 372 | }, 373 | "highr": { 374 | "Package": "highr", 375 | "Version": "0.10", 376 | "Source": "Repository", 377 | "Repository": "CRAN", 378 | "Requirements": [ 379 | "R", 380 | "xfun" 381 | ], 382 | "Hash": "06230136b2d2b9ba5805e1963fa6e890" 383 | }, 384 | "hms": { 385 | "Package": "hms", 386 | "Version": "1.1.3", 387 | "Source": "Repository", 388 | "Repository": "CRAN", 389 | "Requirements": [ 390 | "lifecycle", 391 | "methods", 392 | "pkgconfig", 393 | "rlang", 394 | "vctrs" 395 | ], 396 | "Hash": "b59377caa7ed00fa41808342002138f9" 397 | }, 398 | "htmltools": { 399 | "Package": "htmltools", 400 | "Version": "0.5.8.1", 401 | "Source": "Repository", 402 | "Repository": "CRAN", 403 | "Requirements": [ 404 | "R", 405 | "base64enc", 406 | "digest", 407 | "fastmap", 408 | "grDevices", 409 | "rlang", 410 | "utils" 411 | ], 412 | "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" 413 | }, 414 | "httr": { 415 | "Package": "httr", 416 | "Version": "1.4.7", 417 | "Source": "Repository", 418 | "Repository": "CRAN", 419 | "Requirements": [ 420 | "R", 421 | "R6", 422 | "curl", 423 | "jsonlite", 424 | "mime", 425 | "openssl" 426 | ], 427 | "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" 428 | }, 429 | "httr2": { 430 | "Package": "httr2", 431 | "Version": "1.0.1", 432 | "Source": "Repository", 433 | "Repository": "CRAN", 434 | "Requirements": [ 435 | "R", 436 | "R6", 437 | "cli", 438 | "curl", 439 | "glue", 440 | "lifecycle", 441 | "magrittr", 442 | "openssl", 443 | "rappdirs", 444 | "rlang", 445 | "vctrs", 446 | "withr" 447 | ], 448 | "Hash": "03d741c92fda96d98c3a3f22494e3b4a" 449 | }, 450 | "hunspell": { 451 | "Package": "hunspell", 452 | "Version": "3.0.3", 453 | "Source": "Repository", 454 | "Repository": "CRAN", 455 | "Requirements": [ 456 | "R", 457 | "Rcpp", 458 | "digest" 459 | ], 460 | "Hash": "e957e989ea17f937964f0d46b0f0bca0" 461 | }, 462 | "ini": { 463 | "Package": "ini", 464 | "Version": "0.3.1", 465 | "Source": "Repository", 466 | "Repository": "CRAN", 467 | "Hash": "6154ec2223172bce8162d4153cda21f7" 468 | }, 469 | "jquerylib": { 470 | "Package": "jquerylib", 471 | "Version": "0.1.4", 472 | "Source": "Repository", 473 | "Repository": "CRAN", 474 | "Requirements": [ 475 | "htmltools" 476 | ], 477 | "Hash": "5aab57a3bd297eee1c1d862735972182" 478 | }, 479 | "jsonlite": { 480 | "Package": "jsonlite", 481 | "Version": "1.8.8", 482 | "Source": "Repository", 483 | "Repository": "CRAN", 484 | "Requirements": [ 485 | "methods" 486 | ], 487 | "Hash": "e1b9c55281c5adc4dd113652d9e26768" 488 | }, 489 | "knitr": { 490 | "Package": "knitr", 491 | "Version": "1.46", 492 | "Source": "Repository", 493 | "Repository": "CRAN", 494 | "Requirements": [ 495 | "R", 496 | "evaluate", 497 | "highr", 498 | "methods", 499 | "tools", 500 | "xfun", 501 | "yaml" 502 | ], 503 | "Hash": "6e008ab1d696a5283c79765fa7b56b47" 504 | }, 505 | "lifecycle": { 506 | "Package": "lifecycle", 507 | "Version": "1.0.4", 508 | "Source": "Repository", 509 | "Repository": "CRAN", 510 | "Requirements": [ 511 | "R", 512 | "cli", 513 | "glue", 514 | "rlang" 515 | ], 516 | "Hash": "b8552d117e1b808b09a832f589b79035" 517 | }, 518 | "magrittr": { 519 | "Package": "magrittr", 520 | "Version": "2.0.3", 521 | "Source": "Repository", 522 | "Repository": "CRAN", 523 | "Requirements": [ 524 | "R" 525 | ], 526 | "Hash": "7ce2733a9826b3aeb1775d56fd305472" 527 | }, 528 | "memoise": { 529 | "Package": "memoise", 530 | "Version": "2.0.1", 531 | "Source": "Repository", 532 | "Repository": "CRAN", 533 | "Requirements": [ 534 | "cachem", 535 | "rlang" 536 | ], 537 | "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" 538 | }, 539 | "mime": { 540 | "Package": "mime", 541 | "Version": "0.12", 542 | "Source": "Repository", 543 | "Repository": "CRAN", 544 | "Requirements": [ 545 | "tools" 546 | ], 547 | "Hash": "18e9c28c1d3ca1560ce30658b22ce104" 548 | }, 549 | "openssl": { 550 | "Package": "openssl", 551 | "Version": "2.1.1", 552 | "Source": "Repository", 553 | "Repository": "RSPM", 554 | "Requirements": [ 555 | "askpass" 556 | ], 557 | "Hash": "2a0dc8c6adfb6f032e4d4af82d258ab5" 558 | }, 559 | "pillar": { 560 | "Package": "pillar", 561 | "Version": "1.9.0", 562 | "Source": "Repository", 563 | "Repository": "CRAN", 564 | "Requirements": [ 565 | "cli", 566 | "fansi", 567 | "glue", 568 | "lifecycle", 569 | "rlang", 570 | "utf8", 571 | "utils", 572 | "vctrs" 573 | ], 574 | "Hash": "15da5a8412f317beeee6175fbc76f4bb" 575 | }, 576 | "pkgbuild": { 577 | "Package": "pkgbuild", 578 | "Version": "1.4.4", 579 | "Source": "Repository", 580 | "Repository": "CRAN", 581 | "Requirements": [ 582 | "R", 583 | "R6", 584 | "callr", 585 | "cli", 586 | "desc", 587 | "processx" 588 | ], 589 | "Hash": "a29e8e134a460a01e0ca67a4763c595b" 590 | }, 591 | "pkgconfig": { 592 | "Package": "pkgconfig", 593 | "Version": "2.0.3", 594 | "Source": "Repository", 595 | "Repository": "CRAN", 596 | "Requirements": [ 597 | "utils" 598 | ], 599 | "Hash": "01f28d4278f15c76cddbea05899c5d6f" 600 | }, 601 | "pkgdown": { 602 | "Package": "pkgdown", 603 | "Version": "2.0.9", 604 | "Source": "Repository", 605 | "Repository": "CRAN", 606 | "Requirements": [ 607 | "R", 608 | "bslib", 609 | "callr", 610 | "cli", 611 | "desc", 612 | "digest", 613 | "downlit", 614 | "fs", 615 | "httr", 616 | "jsonlite", 617 | "magrittr", 618 | "memoise", 619 | "purrr", 620 | "ragg", 621 | "rlang", 622 | "rmarkdown", 623 | "tibble", 624 | "whisker", 625 | "withr", 626 | "xml2", 627 | "yaml" 628 | ], 629 | "Hash": "8bf1151ed1a48328d71b937e651117a6" 630 | }, 631 | "pkgload": { 632 | "Package": "pkgload", 633 | "Version": "1.3.4", 634 | "Source": "Repository", 635 | "Repository": "CRAN", 636 | "Requirements": [ 637 | "R", 638 | "cli", 639 | "crayon", 640 | "desc", 641 | "fs", 642 | "glue", 643 | "methods", 644 | "pkgbuild", 645 | "rlang", 646 | "rprojroot", 647 | "utils", 648 | "withr" 649 | ], 650 | "Hash": "876c618df5ae610be84356d5d7a5d124" 651 | }, 652 | "praise": { 653 | "Package": "praise", 654 | "Version": "1.0.0", 655 | "Source": "Repository", 656 | "Repository": "CRAN", 657 | "Hash": "a555924add98c99d2f411e37e7d25e9f" 658 | }, 659 | "prettyunits": { 660 | "Package": "prettyunits", 661 | "Version": "1.2.0", 662 | "Source": "Repository", 663 | "Repository": "RSPM", 664 | "Requirements": [ 665 | "R" 666 | ], 667 | "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" 668 | }, 669 | "processx": { 670 | "Package": "processx", 671 | "Version": "3.8.4", 672 | "Source": "Repository", 673 | "Repository": "CRAN", 674 | "Requirements": [ 675 | "R", 676 | "R6", 677 | "ps", 678 | "utils" 679 | ], 680 | "Hash": "0c90a7d71988856bad2a2a45dd871bb9" 681 | }, 682 | "progress": { 683 | "Package": "progress", 684 | "Version": "1.2.3", 685 | "Source": "Repository", 686 | "Repository": "CRAN", 687 | "Requirements": [ 688 | "R", 689 | "R6", 690 | "crayon", 691 | "hms", 692 | "prettyunits" 693 | ], 694 | "Hash": "f4625e061cb2865f111b47ff163a5ca6" 695 | }, 696 | "ps": { 697 | "Package": "ps", 698 | "Version": "1.7.6", 699 | "Source": "Repository", 700 | "Repository": "CRAN", 701 | "Requirements": [ 702 | "R", 703 | "utils" 704 | ], 705 | "Hash": "dd2b9319ee0656c8acf45c7f40c59de7" 706 | }, 707 | "purrr": { 708 | "Package": "purrr", 709 | "Version": "1.0.2", 710 | "Source": "Repository", 711 | "Repository": "CRAN", 712 | "Requirements": [ 713 | "R", 714 | "cli", 715 | "lifecycle", 716 | "magrittr", 717 | "rlang", 718 | "vctrs" 719 | ], 720 | "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" 721 | }, 722 | "ragg": { 723 | "Package": "ragg", 724 | "Version": "1.3.0", 725 | "Source": "Repository", 726 | "Repository": "CRAN", 727 | "Requirements": [ 728 | "systemfonts", 729 | "textshaping" 730 | ], 731 | "Hash": "082e1a198e3329d571f4448ef0ede4bc" 732 | }, 733 | "rappdirs": { 734 | "Package": "rappdirs", 735 | "Version": "0.3.3", 736 | "Source": "Repository", 737 | "Repository": "CRAN", 738 | "Requirements": [ 739 | "R" 740 | ], 741 | "Hash": "5e3c5dc0b071b21fa128676560dbe94d" 742 | }, 743 | "readr": { 744 | "Package": "readr", 745 | "Version": "2.1.5", 746 | "Source": "Repository", 747 | "Repository": "CRAN", 748 | "Requirements": [ 749 | "R", 750 | "R6", 751 | "cli", 752 | "clipr", 753 | "cpp11", 754 | "crayon", 755 | "hms", 756 | "lifecycle", 757 | "methods", 758 | "rlang", 759 | "tibble", 760 | "tzdb", 761 | "utils", 762 | "vroom" 763 | ], 764 | "Hash": "9de96463d2117f6ac49980577939dfb3" 765 | }, 766 | "rematch2": { 767 | "Package": "rematch2", 768 | "Version": "2.1.2", 769 | "Source": "Repository", 770 | "Repository": "CRAN", 771 | "Requirements": [ 772 | "tibble" 773 | ], 774 | "Hash": "76c9e04c712a05848ae7a23d2f170a40" 775 | }, 776 | "remotes": { 777 | "Package": "remotes", 778 | "Version": "2.5.0", 779 | "Source": "Repository", 780 | "Repository": "CRAN", 781 | "Requirements": [ 782 | "R", 783 | "methods", 784 | "stats", 785 | "tools", 786 | "utils" 787 | ], 788 | "Hash": "3ee025083e66f18db6cf27b56e23e141" 789 | }, 790 | "renv": { 791 | "Package": "renv", 792 | "Version": "1.0.7", 793 | "Source": "Repository", 794 | "Repository": "CRAN", 795 | "Requirements": [ 796 | "utils" 797 | ], 798 | "Hash": "397b7b2a265bc5a7a06852524dabae20" 799 | }, 800 | "rlang": { 801 | "Package": "rlang", 802 | "Version": "1.1.3", 803 | "Source": "Repository", 804 | "Repository": "CRAN", 805 | "Requirements": [ 806 | "R", 807 | "utils" 808 | ], 809 | "Hash": "42548638fae05fd9a9b5f3f437fbbbe2" 810 | }, 811 | "rmarkdown": { 812 | "Package": "rmarkdown", 813 | "Version": "2.26", 814 | "Source": "Repository", 815 | "Repository": "CRAN", 816 | "Requirements": [ 817 | "R", 818 | "bslib", 819 | "evaluate", 820 | "fontawesome", 821 | "htmltools", 822 | "jquerylib", 823 | "jsonlite", 824 | "knitr", 825 | "methods", 826 | "tinytex", 827 | "tools", 828 | "utils", 829 | "xfun", 830 | "yaml" 831 | ], 832 | "Hash": "9b148e7f95d33aac01f31282d49e4f44" 833 | }, 834 | "rprojroot": { 835 | "Package": "rprojroot", 836 | "Version": "2.0.4", 837 | "Source": "Repository", 838 | "Repository": "CRAN", 839 | "Requirements": [ 840 | "R" 841 | ], 842 | "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" 843 | }, 844 | "rstudioapi": { 845 | "Package": "rstudioapi", 846 | "Version": "0.16.0", 847 | "Source": "Repository", 848 | "Repository": "CRAN", 849 | "Hash": "96710351d642b70e8f02ddeb237c46a7" 850 | }, 851 | "sass": { 852 | "Package": "sass", 853 | "Version": "0.4.9", 854 | "Source": "Repository", 855 | "Repository": "CRAN", 856 | "Requirements": [ 857 | "R6", 858 | "fs", 859 | "htmltools", 860 | "rappdirs", 861 | "rlang" 862 | ], 863 | "Hash": "d53dbfddf695303ea4ad66f86e99b95d" 864 | }, 865 | "spelling": { 866 | "Package": "spelling", 867 | "Version": "2.3.0", 868 | "Source": "Repository", 869 | "Repository": "CRAN", 870 | "Requirements": [ 871 | "commonmark", 872 | "hunspell", 873 | "knitr", 874 | "xml2" 875 | ], 876 | "Hash": "632e9e83d3dc774d361b9415b15642bb" 877 | }, 878 | "stringi": { 879 | "Package": "stringi", 880 | "Version": "1.8.3", 881 | "Source": "Repository", 882 | "Repository": "CRAN", 883 | "Requirements": [ 884 | "R", 885 | "stats", 886 | "tools", 887 | "utils" 888 | ], 889 | "Hash": "058aebddea264f4c99401515182e656a" 890 | }, 891 | "stringr": { 892 | "Package": "stringr", 893 | "Version": "1.5.1", 894 | "Source": "Repository", 895 | "Repository": "CRAN", 896 | "Requirements": [ 897 | "R", 898 | "cli", 899 | "glue", 900 | "lifecycle", 901 | "magrittr", 902 | "rlang", 903 | "stringi", 904 | "vctrs" 905 | ], 906 | "Hash": "960e2ae9e09656611e0b8214ad543207" 907 | }, 908 | "sys": { 909 | "Package": "sys", 910 | "Version": "3.4.2", 911 | "Source": "Repository", 912 | "Repository": "CRAN", 913 | "Hash": "3a1be13d68d47a8cd0bfd74739ca1555" 914 | }, 915 | "systemfonts": { 916 | "Package": "systemfonts", 917 | "Version": "1.0.6", 918 | "Source": "Repository", 919 | "Repository": "CRAN", 920 | "Requirements": [ 921 | "R", 922 | "cpp11" 923 | ], 924 | "Hash": "6d538cff441f0f1f36db2209ac7495ac" 925 | }, 926 | "testthat": { 927 | "Package": "testthat", 928 | "Version": "3.2.1.1", 929 | "Source": "Repository", 930 | "Repository": "CRAN", 931 | "Requirements": [ 932 | "R", 933 | "R6", 934 | "brio", 935 | "callr", 936 | "cli", 937 | "desc", 938 | "digest", 939 | "evaluate", 940 | "jsonlite", 941 | "lifecycle", 942 | "magrittr", 943 | "methods", 944 | "pkgload", 945 | "praise", 946 | "processx", 947 | "ps", 948 | "rlang", 949 | "utils", 950 | "waldo", 951 | "withr" 952 | ], 953 | "Hash": "3f6e7e5e2220856ff865e4834766bf2b" 954 | }, 955 | "textshaping": { 956 | "Package": "textshaping", 957 | "Version": "0.3.7", 958 | "Source": "Repository", 959 | "Repository": "RSPM", 960 | "Requirements": [ 961 | "R", 962 | "cpp11", 963 | "systemfonts" 964 | ], 965 | "Hash": "997aac9ad649e0ef3b97f96cddd5622b" 966 | }, 967 | "tibble": { 968 | "Package": "tibble", 969 | "Version": "3.2.1", 970 | "Source": "Repository", 971 | "Repository": "CRAN", 972 | "Requirements": [ 973 | "R", 974 | "fansi", 975 | "lifecycle", 976 | "magrittr", 977 | "methods", 978 | "pillar", 979 | "pkgconfig", 980 | "rlang", 981 | "utils", 982 | "vctrs" 983 | ], 984 | "Hash": "a84e2cc86d07289b3b6f5069df7a004c" 985 | }, 986 | "tidyselect": { 987 | "Package": "tidyselect", 988 | "Version": "1.2.1", 989 | "Source": "Repository", 990 | "Repository": "CRAN", 991 | "Requirements": [ 992 | "R", 993 | "cli", 994 | "glue", 995 | "lifecycle", 996 | "rlang", 997 | "vctrs", 998 | "withr" 999 | ], 1000 | "Hash": "829f27b9c4919c16b593794a6344d6c0" 1001 | }, 1002 | "tinytex": { 1003 | "Package": "tinytex", 1004 | "Version": "0.50", 1005 | "Source": "Repository", 1006 | "Repository": "CRAN", 1007 | "Requirements": [ 1008 | "xfun" 1009 | ], 1010 | "Hash": "be7a76845222ad20adb761f462eed3ea" 1011 | }, 1012 | "tzdb": { 1013 | "Package": "tzdb", 1014 | "Version": "0.4.0", 1015 | "Source": "Repository", 1016 | "Repository": "CRAN", 1017 | "Requirements": [ 1018 | "R", 1019 | "cpp11" 1020 | ], 1021 | "Hash": "f561504ec2897f4d46f0c7657e488ae1" 1022 | }, 1023 | "usethis": { 1024 | "Package": "usethis", 1025 | "Version": "2.2.3", 1026 | "Source": "Repository", 1027 | "Repository": "CRAN", 1028 | "Requirements": [ 1029 | "R", 1030 | "cli", 1031 | "clipr", 1032 | "crayon", 1033 | "curl", 1034 | "desc", 1035 | "fs", 1036 | "gert", 1037 | "gh", 1038 | "glue", 1039 | "jsonlite", 1040 | "lifecycle", 1041 | "purrr", 1042 | "rappdirs", 1043 | "rlang", 1044 | "rprojroot", 1045 | "rstudioapi", 1046 | "stats", 1047 | "utils", 1048 | "whisker", 1049 | "withr", 1050 | "yaml" 1051 | ], 1052 | "Hash": "d524fd42c517035027f866064417d7e6" 1053 | }, 1054 | "utf8": { 1055 | "Package": "utf8", 1056 | "Version": "1.2.4", 1057 | "Source": "Repository", 1058 | "Repository": "CRAN", 1059 | "Requirements": [ 1060 | "R" 1061 | ], 1062 | "Hash": "62b65c52671e6665f803ff02954446e9" 1063 | }, 1064 | "vctrs": { 1065 | "Package": "vctrs", 1066 | "Version": "0.6.5", 1067 | "Source": "Repository", 1068 | "Repository": "RSPM", 1069 | "Requirements": [ 1070 | "R", 1071 | "cli", 1072 | "glue", 1073 | "lifecycle", 1074 | "rlang" 1075 | ], 1076 | "Hash": "c03fa420630029418f7e6da3667aac4a" 1077 | }, 1078 | "vroom": { 1079 | "Package": "vroom", 1080 | "Version": "1.6.5", 1081 | "Source": "Repository", 1082 | "Repository": "CRAN", 1083 | "Requirements": [ 1084 | "R", 1085 | "bit64", 1086 | "cli", 1087 | "cpp11", 1088 | "crayon", 1089 | "glue", 1090 | "hms", 1091 | "lifecycle", 1092 | "methods", 1093 | "progress", 1094 | "rlang", 1095 | "stats", 1096 | "tibble", 1097 | "tidyselect", 1098 | "tzdb", 1099 | "vctrs", 1100 | "withr" 1101 | ], 1102 | "Hash": "390f9315bc0025be03012054103d227c" 1103 | }, 1104 | "waldo": { 1105 | "Package": "waldo", 1106 | "Version": "0.5.2", 1107 | "Source": "Repository", 1108 | "Repository": "CRAN", 1109 | "Requirements": [ 1110 | "R", 1111 | "cli", 1112 | "diffobj", 1113 | "fansi", 1114 | "glue", 1115 | "methods", 1116 | "rematch2", 1117 | "rlang", 1118 | "tibble" 1119 | ], 1120 | "Hash": "c7d3fd6d29ab077cbac8f0e2751449e6" 1121 | }, 1122 | "whisker": { 1123 | "Package": "whisker", 1124 | "Version": "0.4.1", 1125 | "Source": "Repository", 1126 | "Repository": "CRAN", 1127 | "Hash": "c6abfa47a46d281a7d5159d0a8891e88" 1128 | }, 1129 | "withr": { 1130 | "Package": "withr", 1131 | "Version": "3.0.0", 1132 | "Source": "Repository", 1133 | "Repository": "CRAN", 1134 | "Requirements": [ 1135 | "R", 1136 | "grDevices", 1137 | "graphics" 1138 | ], 1139 | "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" 1140 | }, 1141 | "xfun": { 1142 | "Package": "xfun", 1143 | "Version": "0.43", 1144 | "Source": "Repository", 1145 | "Repository": "CRAN", 1146 | "Requirements": [ 1147 | "grDevices", 1148 | "stats", 1149 | "tools" 1150 | ], 1151 | "Hash": "ab6371d8653ce5f2f9290f4ec7b42a8e" 1152 | }, 1153 | "xml2": { 1154 | "Package": "xml2", 1155 | "Version": "1.3.6", 1156 | "Source": "Repository", 1157 | "Repository": "CRAN", 1158 | "Requirements": [ 1159 | "R", 1160 | "cli", 1161 | "methods", 1162 | "rlang" 1163 | ], 1164 | "Hash": "1d0336142f4cd25d8d23cd3ba7a8fb61" 1165 | }, 1166 | "yaml": { 1167 | "Package": "yaml", 1168 | "Version": "2.3.8", 1169 | "Source": "Repository", 1170 | "Repository": "CRAN", 1171 | "Hash": "29240487a071f535f5e5d5a323b7afbd" 1172 | }, 1173 | "zip": { 1174 | "Package": "zip", 1175 | "Version": "2.3.1", 1176 | "Source": "Repository", 1177 | "Repository": "CRAN", 1178 | "Hash": "fcc4bd8e6da2d2011eb64a5e5cc685ab" 1179 | } 1180 | } 1181 | } 1182 | -------------------------------------------------------------------------------- /renv/.gitignore: -------------------------------------------------------------------------------- 1 | library/ 2 | local/ 3 | cellar/ 4 | lock/ 5 | python/ 6 | sandbox/ 7 | staging/ 8 | -------------------------------------------------------------------------------- /renv/activate.R: -------------------------------------------------------------------------------- 1 | 2 | local({ 3 | 4 | # the requested version of renv 5 | version <- "1.0.7" 6 | attr(version, "sha") <- NULL 7 | 8 | # the project directory 9 | project <- Sys.getenv("RENV_PROJECT") 10 | if (!nzchar(project)) 11 | project <- getwd() 12 | 13 | # use start-up diagnostics if enabled 14 | diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") 15 | if (diagnostics) { 16 | start <- Sys.time() 17 | profile <- tempfile("renv-startup-", fileext = ".Rprof") 18 | utils::Rprof(profile) 19 | on.exit({ 20 | utils::Rprof(NULL) 21 | elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) 22 | writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) 23 | writeLines(sprintf("- Profile: %s", profile)) 24 | print(utils::summaryRprof(profile)) 25 | }, add = TRUE) 26 | } 27 | 28 | # figure out whether the autoloader is enabled 29 | enabled <- local({ 30 | 31 | # first, check config option 32 | override <- getOption("renv.config.autoloader.enabled") 33 | if (!is.null(override)) 34 | return(override) 35 | 36 | # if we're being run in a context where R_LIBS is already set, 37 | # don't load -- presumably we're being run as a sub-process and 38 | # the parent process has already set up library paths for us 39 | rcmd <- Sys.getenv("R_CMD", unset = NA) 40 | rlibs <- Sys.getenv("R_LIBS", unset = NA) 41 | if (!is.na(rlibs) && !is.na(rcmd)) 42 | return(FALSE) 43 | 44 | # next, check environment variables 45 | # TODO: prefer using the configuration one in the future 46 | envvars <- c( 47 | "RENV_CONFIG_AUTOLOADER_ENABLED", 48 | "RENV_AUTOLOADER_ENABLED", 49 | "RENV_ACTIVATE_PROJECT" 50 | ) 51 | 52 | for (envvar in envvars) { 53 | envval <- Sys.getenv(envvar, unset = NA) 54 | if (!is.na(envval)) 55 | return(tolower(envval) %in% c("true", "t", "1")) 56 | } 57 | 58 | # enable by default 59 | TRUE 60 | 61 | }) 62 | 63 | # bail if we're not enabled 64 | if (!enabled) { 65 | 66 | # if we're not enabled, we might still need to manually load 67 | # the user profile here 68 | profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") 69 | if (file.exists(profile)) { 70 | cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") 71 | if (tolower(cfg) %in% c("true", "t", "1")) 72 | sys.source(profile, envir = globalenv()) 73 | } 74 | 75 | return(FALSE) 76 | 77 | } 78 | 79 | # avoid recursion 80 | if (identical(getOption("renv.autoloader.running"), TRUE)) { 81 | warning("ignoring recursive attempt to run renv autoloader") 82 | return(invisible(TRUE)) 83 | } 84 | 85 | # signal that we're loading renv during R startup 86 | options(renv.autoloader.running = TRUE) 87 | on.exit(options(renv.autoloader.running = NULL), add = TRUE) 88 | 89 | # signal that we've consented to use renv 90 | options(renv.consent = TRUE) 91 | 92 | # load the 'utils' package eagerly -- this ensures that renv shims, which 93 | # mask 'utils' packages, will come first on the search path 94 | library(utils, lib.loc = .Library) 95 | 96 | # unload renv if it's already been loaded 97 | if ("renv" %in% loadedNamespaces()) 98 | unloadNamespace("renv") 99 | 100 | # load bootstrap tools 101 | `%||%` <- function(x, y) { 102 | if (is.null(x)) y else x 103 | } 104 | 105 | catf <- function(fmt, ..., appendLF = TRUE) { 106 | 107 | quiet <- getOption("renv.bootstrap.quiet", default = FALSE) 108 | if (quiet) 109 | return(invisible()) 110 | 111 | msg <- sprintf(fmt, ...) 112 | cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") 113 | 114 | invisible(msg) 115 | 116 | } 117 | 118 | header <- function(label, 119 | ..., 120 | prefix = "#", 121 | suffix = "-", 122 | n = min(getOption("width"), 78)) 123 | { 124 | label <- sprintf(label, ...) 125 | n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) 126 | if (n <= 0) 127 | return(paste(prefix, label)) 128 | 129 | tail <- paste(rep.int(suffix, n), collapse = "") 130 | paste0(prefix, " ", label, " ", tail) 131 | 132 | } 133 | 134 | heredoc <- function(text, leave = 0) { 135 | 136 | # remove leading, trailing whitespace 137 | trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) 138 | 139 | # split into lines 140 | lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] 141 | 142 | # compute common indent 143 | indent <- regexpr("[^[:space:]]", lines) 144 | common <- min(setdiff(indent, -1L)) - leave 145 | paste(substring(lines, common), collapse = "\n") 146 | 147 | } 148 | 149 | startswith <- function(string, prefix) { 150 | substring(string, 1, nchar(prefix)) == prefix 151 | } 152 | 153 | bootstrap <- function(version, library) { 154 | 155 | friendly <- renv_bootstrap_version_friendly(version) 156 | section <- header(sprintf("Bootstrapping renv %s", friendly)) 157 | catf(section) 158 | 159 | # attempt to download renv 160 | catf("- Downloading renv ... ", appendLF = FALSE) 161 | withCallingHandlers( 162 | tarball <- renv_bootstrap_download(version), 163 | error = function(err) { 164 | catf("FAILED") 165 | stop("failed to download:\n", conditionMessage(err)) 166 | } 167 | ) 168 | catf("OK") 169 | on.exit(unlink(tarball), add = TRUE) 170 | 171 | # now attempt to install 172 | catf("- Installing renv ... ", appendLF = FALSE) 173 | withCallingHandlers( 174 | status <- renv_bootstrap_install(version, tarball, library), 175 | error = function(err) { 176 | catf("FAILED") 177 | stop("failed to install:\n", conditionMessage(err)) 178 | } 179 | ) 180 | catf("OK") 181 | 182 | # add empty line to break up bootstrapping from normal output 183 | catf("") 184 | 185 | return(invisible()) 186 | } 187 | 188 | renv_bootstrap_tests_running <- function() { 189 | getOption("renv.tests.running", default = FALSE) 190 | } 191 | 192 | renv_bootstrap_repos <- function() { 193 | 194 | # get CRAN repository 195 | cran <- getOption("renv.repos.cran", "https://cloud.r-project.org") 196 | 197 | # check for repos override 198 | repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) 199 | if (!is.na(repos)) { 200 | 201 | # check for RSPM; if set, use a fallback repository for renv 202 | rspm <- Sys.getenv("RSPM", unset = NA) 203 | if (identical(rspm, repos)) 204 | repos <- c(RSPM = rspm, CRAN = cran) 205 | 206 | return(repos) 207 | 208 | } 209 | 210 | # check for lockfile repositories 211 | repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) 212 | if (!inherits(repos, "error") && length(repos)) 213 | return(repos) 214 | 215 | # retrieve current repos 216 | repos <- getOption("repos") 217 | 218 | # ensure @CRAN@ entries are resolved 219 | repos[repos == "@CRAN@"] <- cran 220 | 221 | # add in renv.bootstrap.repos if set 222 | default <- c(FALLBACK = "https://cloud.r-project.org") 223 | extra <- getOption("renv.bootstrap.repos", default = default) 224 | repos <- c(repos, extra) 225 | 226 | # remove duplicates that might've snuck in 227 | dupes <- duplicated(repos) | duplicated(names(repos)) 228 | repos[!dupes] 229 | 230 | } 231 | 232 | renv_bootstrap_repos_lockfile <- function() { 233 | 234 | lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") 235 | if (!file.exists(lockpath)) 236 | return(NULL) 237 | 238 | lockfile <- tryCatch(renv_json_read(lockpath), error = identity) 239 | if (inherits(lockfile, "error")) { 240 | warning(lockfile) 241 | return(NULL) 242 | } 243 | 244 | repos <- lockfile$R$Repositories 245 | if (length(repos) == 0) 246 | return(NULL) 247 | 248 | keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) 249 | vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) 250 | names(vals) <- keys 251 | 252 | return(vals) 253 | 254 | } 255 | 256 | renv_bootstrap_download <- function(version) { 257 | 258 | sha <- attr(version, "sha", exact = TRUE) 259 | 260 | methods <- if (!is.null(sha)) { 261 | 262 | # attempting to bootstrap a development version of renv 263 | c( 264 | function() renv_bootstrap_download_tarball(sha), 265 | function() renv_bootstrap_download_github(sha) 266 | ) 267 | 268 | } else { 269 | 270 | # attempting to bootstrap a release version of renv 271 | c( 272 | function() renv_bootstrap_download_tarball(version), 273 | function() renv_bootstrap_download_cran_latest(version), 274 | function() renv_bootstrap_download_cran_archive(version) 275 | ) 276 | 277 | } 278 | 279 | for (method in methods) { 280 | path <- tryCatch(method(), error = identity) 281 | if (is.character(path) && file.exists(path)) 282 | return(path) 283 | } 284 | 285 | stop("All download methods failed") 286 | 287 | } 288 | 289 | renv_bootstrap_download_impl <- function(url, destfile) { 290 | 291 | mode <- "wb" 292 | 293 | # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 294 | fixup <- 295 | Sys.info()[["sysname"]] == "Windows" && 296 | substring(url, 1L, 5L) == "file:" 297 | 298 | if (fixup) 299 | mode <- "w+b" 300 | 301 | args <- list( 302 | url = url, 303 | destfile = destfile, 304 | mode = mode, 305 | quiet = TRUE 306 | ) 307 | 308 | if ("headers" %in% names(formals(utils::download.file))) 309 | args$headers <- renv_bootstrap_download_custom_headers(url) 310 | 311 | do.call(utils::download.file, args) 312 | 313 | } 314 | 315 | renv_bootstrap_download_custom_headers <- function(url) { 316 | 317 | headers <- getOption("renv.download.headers") 318 | if (is.null(headers)) 319 | return(character()) 320 | 321 | if (!is.function(headers)) 322 | stopf("'renv.download.headers' is not a function") 323 | 324 | headers <- headers(url) 325 | if (length(headers) == 0L) 326 | return(character()) 327 | 328 | if (is.list(headers)) 329 | headers <- unlist(headers, recursive = FALSE, use.names = TRUE) 330 | 331 | ok <- 332 | is.character(headers) && 333 | is.character(names(headers)) && 334 | all(nzchar(names(headers))) 335 | 336 | if (!ok) 337 | stop("invocation of 'renv.download.headers' did not return a named character vector") 338 | 339 | headers 340 | 341 | } 342 | 343 | renv_bootstrap_download_cran_latest <- function(version) { 344 | 345 | spec <- renv_bootstrap_download_cran_latest_find(version) 346 | type <- spec$type 347 | repos <- spec$repos 348 | 349 | baseurl <- utils::contrib.url(repos = repos, type = type) 350 | ext <- if (identical(type, "source")) 351 | ".tar.gz" 352 | else if (Sys.info()[["sysname"]] == "Windows") 353 | ".zip" 354 | else 355 | ".tgz" 356 | name <- sprintf("renv_%s%s", version, ext) 357 | url <- paste(baseurl, name, sep = "/") 358 | 359 | destfile <- file.path(tempdir(), name) 360 | status <- tryCatch( 361 | renv_bootstrap_download_impl(url, destfile), 362 | condition = identity 363 | ) 364 | 365 | if (inherits(status, "condition")) 366 | return(FALSE) 367 | 368 | # report success and return 369 | destfile 370 | 371 | } 372 | 373 | renv_bootstrap_download_cran_latest_find <- function(version) { 374 | 375 | # check whether binaries are supported on this system 376 | binary <- 377 | getOption("renv.bootstrap.binary", default = TRUE) && 378 | !identical(.Platform$pkgType, "source") && 379 | !identical(getOption("pkgType"), "source") && 380 | Sys.info()[["sysname"]] %in% c("Darwin", "Windows") 381 | 382 | types <- c(if (binary) "binary", "source") 383 | 384 | # iterate over types + repositories 385 | for (type in types) { 386 | for (repos in renv_bootstrap_repos()) { 387 | 388 | # retrieve package database 389 | db <- tryCatch( 390 | as.data.frame( 391 | utils::available.packages(type = type, repos = repos), 392 | stringsAsFactors = FALSE 393 | ), 394 | error = identity 395 | ) 396 | 397 | if (inherits(db, "error")) 398 | next 399 | 400 | # check for compatible entry 401 | entry <- db[db$Package %in% "renv" & db$Version %in% version, ] 402 | if (nrow(entry) == 0) 403 | next 404 | 405 | # found it; return spec to caller 406 | spec <- list(entry = entry, type = type, repos = repos) 407 | return(spec) 408 | 409 | } 410 | } 411 | 412 | # if we got here, we failed to find renv 413 | fmt <- "renv %s is not available from your declared package repositories" 414 | stop(sprintf(fmt, version)) 415 | 416 | } 417 | 418 | renv_bootstrap_download_cran_archive <- function(version) { 419 | 420 | name <- sprintf("renv_%s.tar.gz", version) 421 | repos <- renv_bootstrap_repos() 422 | urls <- file.path(repos, "src/contrib/Archive/renv", name) 423 | destfile <- file.path(tempdir(), name) 424 | 425 | for (url in urls) { 426 | 427 | status <- tryCatch( 428 | renv_bootstrap_download_impl(url, destfile), 429 | condition = identity 430 | ) 431 | 432 | if (identical(status, 0L)) 433 | return(destfile) 434 | 435 | } 436 | 437 | return(FALSE) 438 | 439 | } 440 | 441 | renv_bootstrap_download_tarball <- function(version) { 442 | 443 | # if the user has provided the path to a tarball via 444 | # an environment variable, then use it 445 | tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) 446 | if (is.na(tarball)) 447 | return() 448 | 449 | # allow directories 450 | if (dir.exists(tarball)) { 451 | name <- sprintf("renv_%s.tar.gz", version) 452 | tarball <- file.path(tarball, name) 453 | } 454 | 455 | # bail if it doesn't exist 456 | if (!file.exists(tarball)) { 457 | 458 | # let the user know we weren't able to honour their request 459 | fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." 460 | msg <- sprintf(fmt, tarball) 461 | warning(msg) 462 | 463 | # bail 464 | return() 465 | 466 | } 467 | 468 | catf("- Using local tarball '%s'.", tarball) 469 | tarball 470 | 471 | } 472 | 473 | renv_bootstrap_download_github <- function(version) { 474 | 475 | enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") 476 | if (!identical(enabled, "TRUE")) 477 | return(FALSE) 478 | 479 | # prepare download options 480 | pat <- Sys.getenv("GITHUB_PAT") 481 | if (nzchar(Sys.which("curl")) && nzchar(pat)) { 482 | fmt <- "--location --fail --header \"Authorization: token %s\"" 483 | extra <- sprintf(fmt, pat) 484 | saved <- options("download.file.method", "download.file.extra") 485 | options(download.file.method = "curl", download.file.extra = extra) 486 | on.exit(do.call(base::options, saved), add = TRUE) 487 | } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { 488 | fmt <- "--header=\"Authorization: token %s\"" 489 | extra <- sprintf(fmt, pat) 490 | saved <- options("download.file.method", "download.file.extra") 491 | options(download.file.method = "wget", download.file.extra = extra) 492 | on.exit(do.call(base::options, saved), add = TRUE) 493 | } 494 | 495 | url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) 496 | name <- sprintf("renv_%s.tar.gz", version) 497 | destfile <- file.path(tempdir(), name) 498 | 499 | status <- tryCatch( 500 | renv_bootstrap_download_impl(url, destfile), 501 | condition = identity 502 | ) 503 | 504 | if (!identical(status, 0L)) 505 | return(FALSE) 506 | 507 | renv_bootstrap_download_augment(destfile) 508 | 509 | return(destfile) 510 | 511 | } 512 | 513 | # Add Sha to DESCRIPTION. This is stop gap until #890, after which we 514 | # can use renv::install() to fully capture metadata. 515 | renv_bootstrap_download_augment <- function(destfile) { 516 | sha <- renv_bootstrap_git_extract_sha1_tar(destfile) 517 | if (is.null(sha)) { 518 | return() 519 | } 520 | 521 | # Untar 522 | tempdir <- tempfile("renv-github-") 523 | on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) 524 | untar(destfile, exdir = tempdir) 525 | pkgdir <- dir(tempdir, full.names = TRUE)[[1]] 526 | 527 | # Modify description 528 | desc_path <- file.path(pkgdir, "DESCRIPTION") 529 | desc_lines <- readLines(desc_path) 530 | remotes_fields <- c( 531 | "RemoteType: github", 532 | "RemoteHost: api.github.com", 533 | "RemoteRepo: renv", 534 | "RemoteUsername: rstudio", 535 | "RemotePkgRef: rstudio/renv", 536 | paste("RemoteRef: ", sha), 537 | paste("RemoteSha: ", sha) 538 | ) 539 | writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) 540 | 541 | # Re-tar 542 | local({ 543 | old <- setwd(tempdir) 544 | on.exit(setwd(old), add = TRUE) 545 | 546 | tar(destfile, compression = "gzip") 547 | }) 548 | invisible() 549 | } 550 | 551 | # Extract the commit hash from a git archive. Git archives include the SHA1 552 | # hash as the comment field of the tarball pax extended header 553 | # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) 554 | # For GitHub archives this should be the first header after the default one 555 | # (512 byte) header. 556 | renv_bootstrap_git_extract_sha1_tar <- function(bundle) { 557 | 558 | # open the bundle for reading 559 | # We use gzcon for everything because (from ?gzcon) 560 | # > Reading from a connection which does not supply a 'gzip' magic 561 | # > header is equivalent to reading from the original connection 562 | conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) 563 | on.exit(close(conn)) 564 | 565 | # The default pax header is 512 bytes long and the first pax extended header 566 | # with the comment should be 51 bytes long 567 | # `52 comment=` (11 chars) + 40 byte SHA1 hash 568 | len <- 0x200 + 0x33 569 | res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) 570 | 571 | if (grepl("^52 comment=", res)) { 572 | sub("52 comment=", "", res) 573 | } else { 574 | NULL 575 | } 576 | } 577 | 578 | renv_bootstrap_install <- function(version, tarball, library) { 579 | 580 | # attempt to install it into project library 581 | dir.create(library, showWarnings = FALSE, recursive = TRUE) 582 | output <- renv_bootstrap_install_impl(library, tarball) 583 | 584 | # check for successful install 585 | status <- attr(output, "status") 586 | if (is.null(status) || identical(status, 0L)) 587 | return(status) 588 | 589 | # an error occurred; report it 590 | header <- "installation of renv failed" 591 | lines <- paste(rep.int("=", nchar(header)), collapse = "") 592 | text <- paste(c(header, lines, output), collapse = "\n") 593 | stop(text) 594 | 595 | } 596 | 597 | renv_bootstrap_install_impl <- function(library, tarball) { 598 | 599 | # invoke using system2 so we can capture and report output 600 | bin <- R.home("bin") 601 | exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" 602 | R <- file.path(bin, exe) 603 | 604 | args <- c( 605 | "--vanilla", "CMD", "INSTALL", "--no-multiarch", 606 | "-l", shQuote(path.expand(library)), 607 | shQuote(path.expand(tarball)) 608 | ) 609 | 610 | system2(R, args, stdout = TRUE, stderr = TRUE) 611 | 612 | } 613 | 614 | renv_bootstrap_platform_prefix <- function() { 615 | 616 | # construct version prefix 617 | version <- paste(R.version$major, R.version$minor, sep = ".") 618 | prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") 619 | 620 | # include SVN revision for development versions of R 621 | # (to avoid sharing platform-specific artefacts with released versions of R) 622 | devel <- 623 | identical(R.version[["status"]], "Under development (unstable)") || 624 | identical(R.version[["nickname"]], "Unsuffered Consequences") 625 | 626 | if (devel) 627 | prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") 628 | 629 | # build list of path components 630 | components <- c(prefix, R.version$platform) 631 | 632 | # include prefix if provided by user 633 | prefix <- renv_bootstrap_platform_prefix_impl() 634 | if (!is.na(prefix) && nzchar(prefix)) 635 | components <- c(prefix, components) 636 | 637 | # build prefix 638 | paste(components, collapse = "/") 639 | 640 | } 641 | 642 | renv_bootstrap_platform_prefix_impl <- function() { 643 | 644 | # if an explicit prefix has been supplied, use it 645 | prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) 646 | if (!is.na(prefix)) 647 | return(prefix) 648 | 649 | # if the user has requested an automatic prefix, generate it 650 | auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) 651 | if (is.na(auto) && getRversion() >= "4.4.0") 652 | auto <- "TRUE" 653 | 654 | if (auto %in% c("TRUE", "True", "true", "1")) 655 | return(renv_bootstrap_platform_prefix_auto()) 656 | 657 | # empty string on failure 658 | "" 659 | 660 | } 661 | 662 | renv_bootstrap_platform_prefix_auto <- function() { 663 | 664 | prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) 665 | if (inherits(prefix, "error") || prefix %in% "unknown") { 666 | 667 | msg <- paste( 668 | "failed to infer current operating system", 669 | "please file a bug report at https://github.com/rstudio/renv/issues", 670 | sep = "; " 671 | ) 672 | 673 | warning(msg) 674 | 675 | } 676 | 677 | prefix 678 | 679 | } 680 | 681 | renv_bootstrap_platform_os <- function() { 682 | 683 | sysinfo <- Sys.info() 684 | sysname <- sysinfo[["sysname"]] 685 | 686 | # handle Windows + macOS up front 687 | if (sysname == "Windows") 688 | return("windows") 689 | else if (sysname == "Darwin") 690 | return("macos") 691 | 692 | # check for os-release files 693 | for (file in c("/etc/os-release", "/usr/lib/os-release")) 694 | if (file.exists(file)) 695 | return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) 696 | 697 | # check for redhat-release files 698 | if (file.exists("/etc/redhat-release")) 699 | return(renv_bootstrap_platform_os_via_redhat_release()) 700 | 701 | "unknown" 702 | 703 | } 704 | 705 | renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { 706 | 707 | # read /etc/os-release 708 | release <- utils::read.table( 709 | file = file, 710 | sep = "=", 711 | quote = c("\"", "'"), 712 | col.names = c("Key", "Value"), 713 | comment.char = "#", 714 | stringsAsFactors = FALSE 715 | ) 716 | 717 | vars <- as.list(release$Value) 718 | names(vars) <- release$Key 719 | 720 | # get os name 721 | os <- tolower(sysinfo[["sysname"]]) 722 | 723 | # read id 724 | id <- "unknown" 725 | for (field in c("ID", "ID_LIKE")) { 726 | if (field %in% names(vars) && nzchar(vars[[field]])) { 727 | id <- vars[[field]] 728 | break 729 | } 730 | } 731 | 732 | # read version 733 | version <- "unknown" 734 | for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { 735 | if (field %in% names(vars) && nzchar(vars[[field]])) { 736 | version <- vars[[field]] 737 | break 738 | } 739 | } 740 | 741 | # join together 742 | paste(c(os, id, version), collapse = "-") 743 | 744 | } 745 | 746 | renv_bootstrap_platform_os_via_redhat_release <- function() { 747 | 748 | # read /etc/redhat-release 749 | contents <- readLines("/etc/redhat-release", warn = FALSE) 750 | 751 | # infer id 752 | id <- if (grepl("centos", contents, ignore.case = TRUE)) 753 | "centos" 754 | else if (grepl("redhat", contents, ignore.case = TRUE)) 755 | "redhat" 756 | else 757 | "unknown" 758 | 759 | # try to find a version component (very hacky) 760 | version <- "unknown" 761 | 762 | parts <- strsplit(contents, "[[:space:]]")[[1L]] 763 | for (part in parts) { 764 | 765 | nv <- tryCatch(numeric_version(part), error = identity) 766 | if (inherits(nv, "error")) 767 | next 768 | 769 | version <- nv[1, 1] 770 | break 771 | 772 | } 773 | 774 | paste(c("linux", id, version), collapse = "-") 775 | 776 | } 777 | 778 | renv_bootstrap_library_root_name <- function(project) { 779 | 780 | # use project name as-is if requested 781 | asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") 782 | if (asis) 783 | return(basename(project)) 784 | 785 | # otherwise, disambiguate based on project's path 786 | id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) 787 | paste(basename(project), id, sep = "-") 788 | 789 | } 790 | 791 | renv_bootstrap_library_root <- function(project) { 792 | 793 | prefix <- renv_bootstrap_profile_prefix() 794 | 795 | path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) 796 | if (!is.na(path)) 797 | return(paste(c(path, prefix), collapse = "/")) 798 | 799 | path <- renv_bootstrap_library_root_impl(project) 800 | if (!is.null(path)) { 801 | name <- renv_bootstrap_library_root_name(project) 802 | return(paste(c(path, prefix, name), collapse = "/")) 803 | } 804 | 805 | renv_bootstrap_paths_renv("library", project = project) 806 | 807 | } 808 | 809 | renv_bootstrap_library_root_impl <- function(project) { 810 | 811 | root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) 812 | if (!is.na(root)) 813 | return(root) 814 | 815 | type <- renv_bootstrap_project_type(project) 816 | if (identical(type, "package")) { 817 | userdir <- renv_bootstrap_user_dir() 818 | return(file.path(userdir, "library")) 819 | } 820 | 821 | } 822 | 823 | renv_bootstrap_validate_version <- function(version, description = NULL) { 824 | 825 | # resolve description file 826 | # 827 | # avoid passing lib.loc to `packageDescription()` below, since R will 828 | # use the loaded version of the package by default anyhow. note that 829 | # this function should only be called after 'renv' is loaded 830 | # https://github.com/rstudio/renv/issues/1625 831 | description <- description %||% packageDescription("renv") 832 | 833 | # check whether requested version 'version' matches loaded version of renv 834 | sha <- attr(version, "sha", exact = TRUE) 835 | valid <- if (!is.null(sha)) 836 | renv_bootstrap_validate_version_dev(sha, description) 837 | else 838 | renv_bootstrap_validate_version_release(version, description) 839 | 840 | if (valid) 841 | return(TRUE) 842 | 843 | # the loaded version of renv doesn't match the requested version; 844 | # give the user instructions on how to proceed 845 | dev <- identical(description[["RemoteType"]], "github") 846 | remote <- if (dev) 847 | paste("rstudio/renv", description[["RemoteSha"]], sep = "@") 848 | else 849 | paste("renv", description[["Version"]], sep = "@") 850 | 851 | # display both loaded version + sha if available 852 | friendly <- renv_bootstrap_version_friendly( 853 | version = description[["Version"]], 854 | sha = if (dev) description[["RemoteSha"]] 855 | ) 856 | 857 | fmt <- heredoc(" 858 | renv %1$s was loaded from project library, but this project is configured to use renv %2$s. 859 | - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. 860 | - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. 861 | ") 862 | catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) 863 | 864 | FALSE 865 | 866 | } 867 | 868 | renv_bootstrap_validate_version_dev <- function(version, description) { 869 | expected <- description[["RemoteSha"]] 870 | is.character(expected) && startswith(expected, version) 871 | } 872 | 873 | renv_bootstrap_validate_version_release <- function(version, description) { 874 | expected <- description[["Version"]] 875 | is.character(expected) && identical(expected, version) 876 | } 877 | 878 | renv_bootstrap_hash_text <- function(text) { 879 | 880 | hashfile <- tempfile("renv-hash-") 881 | on.exit(unlink(hashfile), add = TRUE) 882 | 883 | writeLines(text, con = hashfile) 884 | tools::md5sum(hashfile) 885 | 886 | } 887 | 888 | renv_bootstrap_load <- function(project, libpath, version) { 889 | 890 | # try to load renv from the project library 891 | if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) 892 | return(FALSE) 893 | 894 | # warn if the version of renv loaded does not match 895 | renv_bootstrap_validate_version(version) 896 | 897 | # execute renv load hooks, if any 898 | hooks <- getHook("renv::autoload") 899 | for (hook in hooks) 900 | if (is.function(hook)) 901 | tryCatch(hook(), error = warnify) 902 | 903 | # load the project 904 | renv::load(project) 905 | 906 | TRUE 907 | 908 | } 909 | 910 | renv_bootstrap_profile_load <- function(project) { 911 | 912 | # if RENV_PROFILE is already set, just use that 913 | profile <- Sys.getenv("RENV_PROFILE", unset = NA) 914 | if (!is.na(profile) && nzchar(profile)) 915 | return(profile) 916 | 917 | # check for a profile file (nothing to do if it doesn't exist) 918 | path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) 919 | if (!file.exists(path)) 920 | return(NULL) 921 | 922 | # read the profile, and set it if it exists 923 | contents <- readLines(path, warn = FALSE) 924 | if (length(contents) == 0L) 925 | return(NULL) 926 | 927 | # set RENV_PROFILE 928 | profile <- contents[[1L]] 929 | if (!profile %in% c("", "default")) 930 | Sys.setenv(RENV_PROFILE = profile) 931 | 932 | profile 933 | 934 | } 935 | 936 | renv_bootstrap_profile_prefix <- function() { 937 | profile <- renv_bootstrap_profile_get() 938 | if (!is.null(profile)) 939 | return(file.path("profiles", profile, "renv")) 940 | } 941 | 942 | renv_bootstrap_profile_get <- function() { 943 | profile <- Sys.getenv("RENV_PROFILE", unset = "") 944 | renv_bootstrap_profile_normalize(profile) 945 | } 946 | 947 | renv_bootstrap_profile_set <- function(profile) { 948 | profile <- renv_bootstrap_profile_normalize(profile) 949 | if (is.null(profile)) 950 | Sys.unsetenv("RENV_PROFILE") 951 | else 952 | Sys.setenv(RENV_PROFILE = profile) 953 | } 954 | 955 | renv_bootstrap_profile_normalize <- function(profile) { 956 | 957 | if (is.null(profile) || profile %in% c("", "default")) 958 | return(NULL) 959 | 960 | profile 961 | 962 | } 963 | 964 | renv_bootstrap_path_absolute <- function(path) { 965 | 966 | substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( 967 | substr(path, 1L, 1L) %in% c(letters, LETTERS) && 968 | substr(path, 2L, 3L) %in% c(":/", ":\\") 969 | ) 970 | 971 | } 972 | 973 | renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { 974 | renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") 975 | root <- if (renv_bootstrap_path_absolute(renv)) NULL else project 976 | prefix <- if (profile) renv_bootstrap_profile_prefix() 977 | components <- c(root, renv, prefix, ...) 978 | paste(components, collapse = "/") 979 | } 980 | 981 | renv_bootstrap_project_type <- function(path) { 982 | 983 | descpath <- file.path(path, "DESCRIPTION") 984 | if (!file.exists(descpath)) 985 | return("unknown") 986 | 987 | desc <- tryCatch( 988 | read.dcf(descpath, all = TRUE), 989 | error = identity 990 | ) 991 | 992 | if (inherits(desc, "error")) 993 | return("unknown") 994 | 995 | type <- desc$Type 996 | if (!is.null(type)) 997 | return(tolower(type)) 998 | 999 | package <- desc$Package 1000 | if (!is.null(package)) 1001 | return("package") 1002 | 1003 | "unknown" 1004 | 1005 | } 1006 | 1007 | renv_bootstrap_user_dir <- function() { 1008 | dir <- renv_bootstrap_user_dir_impl() 1009 | path.expand(chartr("\\", "/", dir)) 1010 | } 1011 | 1012 | renv_bootstrap_user_dir_impl <- function() { 1013 | 1014 | # use local override if set 1015 | override <- getOption("renv.userdir.override") 1016 | if (!is.null(override)) 1017 | return(override) 1018 | 1019 | # use R_user_dir if available 1020 | tools <- asNamespace("tools") 1021 | if (is.function(tools$R_user_dir)) 1022 | return(tools$R_user_dir("renv", "cache")) 1023 | 1024 | # try using our own backfill for older versions of R 1025 | envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") 1026 | for (envvar in envvars) { 1027 | root <- Sys.getenv(envvar, unset = NA) 1028 | if (!is.na(root)) 1029 | return(file.path(root, "R/renv")) 1030 | } 1031 | 1032 | # use platform-specific default fallbacks 1033 | if (Sys.info()[["sysname"]] == "Windows") 1034 | file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") 1035 | else if (Sys.info()[["sysname"]] == "Darwin") 1036 | "~/Library/Caches/org.R-project.R/R/renv" 1037 | else 1038 | "~/.cache/R/renv" 1039 | 1040 | } 1041 | 1042 | renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { 1043 | sha <- sha %||% attr(version, "sha", exact = TRUE) 1044 | parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) 1045 | paste(parts, collapse = "") 1046 | } 1047 | 1048 | renv_bootstrap_exec <- function(project, libpath, version) { 1049 | if (!renv_bootstrap_load(project, libpath, version)) 1050 | renv_bootstrap_run(version, libpath) 1051 | } 1052 | 1053 | renv_bootstrap_run <- function(version, libpath) { 1054 | 1055 | # perform bootstrap 1056 | bootstrap(version, libpath) 1057 | 1058 | # exit early if we're just testing bootstrap 1059 | if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) 1060 | return(TRUE) 1061 | 1062 | # try again to load 1063 | if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { 1064 | return(renv::load(project = getwd())) 1065 | } 1066 | 1067 | # failed to download or load renv; warn the user 1068 | msg <- c( 1069 | "Failed to find an renv installation: the project will not be loaded.", 1070 | "Use `renv::activate()` to re-initialize the project." 1071 | ) 1072 | 1073 | warning(paste(msg, collapse = "\n"), call. = FALSE) 1074 | 1075 | } 1076 | 1077 | renv_json_read <- function(file = NULL, text = NULL) { 1078 | 1079 | jlerr <- NULL 1080 | 1081 | # if jsonlite is loaded, use that instead 1082 | if ("jsonlite" %in% loadedNamespaces()) { 1083 | 1084 | json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) 1085 | if (!inherits(json, "error")) 1086 | return(json) 1087 | 1088 | jlerr <- json 1089 | 1090 | } 1091 | 1092 | # otherwise, fall back to the default JSON reader 1093 | json <- tryCatch(renv_json_read_default(file, text), error = identity) 1094 | if (!inherits(json, "error")) 1095 | return(json) 1096 | 1097 | # report an error 1098 | if (!is.null(jlerr)) 1099 | stop(jlerr) 1100 | else 1101 | stop(json) 1102 | 1103 | } 1104 | 1105 | renv_json_read_jsonlite <- function(file = NULL, text = NULL) { 1106 | text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") 1107 | jsonlite::fromJSON(txt = text, simplifyVector = FALSE) 1108 | } 1109 | 1110 | renv_json_read_default <- function(file = NULL, text = NULL) { 1111 | 1112 | # find strings in the JSON 1113 | text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") 1114 | pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' 1115 | locs <- gregexpr(pattern, text, perl = TRUE)[[1]] 1116 | 1117 | # if any are found, replace them with placeholders 1118 | replaced <- text 1119 | strings <- character() 1120 | replacements <- character() 1121 | 1122 | if (!identical(c(locs), -1L)) { 1123 | 1124 | # get the string values 1125 | starts <- locs 1126 | ends <- locs + attr(locs, "match.length") - 1L 1127 | strings <- substring(text, starts, ends) 1128 | 1129 | # only keep those requiring escaping 1130 | strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE) 1131 | 1132 | # compute replacements 1133 | replacements <- sprintf('"\032%i\032"', seq_along(strings)) 1134 | 1135 | # replace the strings 1136 | mapply(function(string, replacement) { 1137 | replaced <<- sub(string, replacement, replaced, fixed = TRUE) 1138 | }, strings, replacements) 1139 | 1140 | } 1141 | 1142 | # transform the JSON into something the R parser understands 1143 | transformed <- replaced 1144 | transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE) 1145 | transformed <- gsub("[[{]", "list(", transformed, perl = TRUE) 1146 | transformed <- gsub("[]}]", ")", transformed, perl = TRUE) 1147 | transformed <- gsub(":", "=", transformed, fixed = TRUE) 1148 | text <- paste(transformed, collapse = "\n") 1149 | 1150 | # parse it 1151 | json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]] 1152 | 1153 | # construct map between source strings, replaced strings 1154 | map <- as.character(parse(text = strings)) 1155 | names(map) <- as.character(parse(text = replacements)) 1156 | 1157 | # convert to list 1158 | map <- as.list(map) 1159 | 1160 | # remap strings in object 1161 | remapped <- renv_json_read_remap(json, map) 1162 | 1163 | # evaluate 1164 | eval(remapped, envir = baseenv()) 1165 | 1166 | } 1167 | 1168 | renv_json_read_remap <- function(json, map) { 1169 | 1170 | # fix names 1171 | if (!is.null(names(json))) { 1172 | lhs <- match(names(json), names(map), nomatch = 0L) 1173 | rhs <- match(names(map), names(json), nomatch = 0L) 1174 | names(json)[rhs] <- map[lhs] 1175 | } 1176 | 1177 | # fix values 1178 | if (is.character(json)) 1179 | return(map[[json]] %||% json) 1180 | 1181 | # handle true, false, null 1182 | if (is.name(json)) { 1183 | text <- as.character(json) 1184 | if (text == "true") 1185 | return(TRUE) 1186 | else if (text == "false") 1187 | return(FALSE) 1188 | else if (text == "null") 1189 | return(NULL) 1190 | } 1191 | 1192 | # recurse 1193 | if (is.recursive(json)) { 1194 | for (i in seq_along(json)) { 1195 | json[i] <- list(renv_json_read_remap(json[[i]], map)) 1196 | } 1197 | } 1198 | 1199 | json 1200 | 1201 | } 1202 | 1203 | # load the renv profile, if any 1204 | renv_bootstrap_profile_load(project) 1205 | 1206 | # construct path to library root 1207 | root <- renv_bootstrap_library_root(project) 1208 | 1209 | # construct library prefix for platform 1210 | prefix <- renv_bootstrap_platform_prefix() 1211 | 1212 | # construct full libpath 1213 | libpath <- file.path(root, prefix) 1214 | 1215 | # run bootstrap code 1216 | renv_bootstrap_exec(project, libpath, version) 1217 | 1218 | invisible() 1219 | 1220 | }) 1221 | -------------------------------------------------------------------------------- /renv/settings.dcf: -------------------------------------------------------------------------------- 1 | bioconductor.version: 2 | external.libraries: 3 | ignored.packages: 4 | package.dependency.fields: Imports, Depends, LinkingTo 5 | r.version: 6 | snapshot.type: implicit 7 | use.cache: TRUE 8 | vcs.ignore.cellar: TRUE 9 | vcs.ignore.library: TRUE 10 | vcs.ignore.local: TRUE 11 | -------------------------------------------------------------------------------- /renv/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "bioconductor.version": [], 3 | "external.libraries": [], 4 | "ignored.packages": [], 5 | "package.dependency.fields": [ 6 | "Imports", 7 | "Depends", 8 | "LinkingTo" 9 | ], 10 | "ppm.enabled": null, 11 | "ppm.ignored.urls": [], 12 | "r.version": [], 13 | "snapshot.type": "implicit", 14 | "use.cache": true, 15 | "vcs.ignore.cellar": true, 16 | "vcs.ignore.library": true, 17 | "vcs.ignore.local": true, 18 | "vcs.manage.ignores": true 19 | } 20 | -------------------------------------------------------------------------------- /tests/spelling.R: -------------------------------------------------------------------------------- 1 | if(requireNamespace('spelling', quietly = TRUE)) 2 | spelling::spell_check_test(vignettes = TRUE, error = FALSE, 3 | skip_on_cran = TRUE) 4 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(buildr) 3 | 4 | test_check("buildr") 5 | -------------------------------------------------------------------------------- /tests/testthat/setup.R: -------------------------------------------------------------------------------- 1 | # create bunch of test files 2 | writeLines("print('build.R')", con = "build.R") 3 | writeLines("print('build_.R')", con = "build_.R") 4 | writeLines("print('build_.R')", con = "build_.R") 5 | writeLines("print('build with spaces.R')", con = "build with spaces.R") 6 | writeLines("print('build_correct-script.R')", con = "build_correct-script.R") 7 | writeLines("print('build_2.R')", con = "build_2.R") 8 | writeLines("print('build_this.R')", con = "build_this.R") 9 | writeLines("print('build_that.r')", con = "build_that.r") 10 | writeLines("print('build_foo.R')", con = "build_foo.R") 11 | writeLines("print('build_bar.r')", con = "build_bar.r") 12 | writeLines("print('bui.R')", con = "bui.R") 13 | writeLines("print('builder.R')", con = "builder.R") 14 | 15 | # clean after all tests 16 | withr::defer( 17 | unlink( 18 | c( 19 | "bui.R", "build with spaces.R", "build_.R", 20 | "build_2.R", "build_bar.r", "build_correct-script.R", 21 | "build_foo.R", "build_that.r", "build_this.R", 22 | "build.R", "builder.R", "Makefile" 23 | ) 24 | ), 25 | teardown_env() 26 | ) 27 | -------------------------------------------------------------------------------- /tests/testthat/test-init.R: -------------------------------------------------------------------------------- 1 | test_that("init recognizes all build scripts with 'build_' prefix", { 2 | buildr::init() 3 | 4 | expect_true(file.exists("Makefile")) 5 | content <- readr::read_lines("Makefile", skip_empty_rows = TRUE) 6 | 7 | n_lines <- length(content) 8 | 9 | expect_equal(n_lines %% 2, 0) 10 | }) 11 | 12 | test_that("aim throws error if not interactive and target is NULL", { 13 | expect_error(buildr::aim(), "cannot run in noninteractive session and argument") 14 | }) 15 | 16 | test_that("aim does'n throw error if not interactive and target is set", { 17 | expect_message(buildr::aim(target = "foo"), "Set!") 18 | }) 19 | 20 | test_that("aim throw error if not interactive and target is set wrong", { 21 | expect_error(buildr::aim(target = "builddsfvgsfg"), "is not a valid target") 22 | }) 23 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/articles/addins_showcase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/vignettes/articles/addins_showcase.gif -------------------------------------------------------------------------------- /vignettes/articles/aim_showcase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/vignettes/articles/aim_showcase.gif -------------------------------------------------------------------------------- /vignettes/articles/build_showcase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/vignettes/articles/build_showcase.gif -------------------------------------------------------------------------------- /vignettes/articles/init_showcase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/vignettes/articles/init_showcase.gif -------------------------------------------------------------------------------- /vignettes/articles/know_your_buildr_gifs.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Know your {buildr}" 3 | --- 4 | 5 | ```{r, include = FALSE} 6 | knitr::opts_chunk$set( 7 | echo = FALSE, 8 | collapse = TRUE, 9 | comment = "#>", 10 | out.width = "100%" 11 | ) 12 | ``` 13 | 14 | This article extends what `README` or `{buildr}` homepage already briefly described. It's identical to the vignette, but it includes a bunch of animated examples. After reading it, you'll be familiar with: 15 | 16 | * how to work with `{buildr}` using your own keyboard shortcuts 17 | * how `{buildr}` works under the hood 18 | * what is a `Makefile` and how `{buildr}` uses it 19 | * tips for some advanced usage 20 | 21 | ## `{buildr}` + RStudio = ❤️ 22 | 23 | It's easy to work with `{buildr}` by printing function calls in your `R` console. However, much more feasible is to use `{buildr}` as RStudio Addin, which plays nicely with keyboard shortcuts, adding to the comfort. `{buildr}` addin commands are available below your toolbar in RStudio just upon the installation: 24 | 25 | ```{r addinsShowcase} 26 | knitr::include_graphics("addins_showcase.gif") 27 | ``` 28 | 29 | > Well, that's pretty neat, but my time is precious and I don't mean to spend it by clicking around that tiny toolbar. 30 | 31 | Likewise! Here come the keyboard shortcuts. The quickest way how to set them up is to use `buildr::edit_shortcuts()` as shown here (for `build()` addin command): 32 | 33 | ```{r shortcutsShowcase} 34 | knitr::include_graphics("shortcuts_showcase.gif") 35 | ``` 36 | 37 | Note that all three functions are supported as addin commands. If you stick with recommended defaults, there is no need to use anything else. The only function that may need a richer user input is `init()`. Let's describe it in more detail. 38 | 39 | ## Let's see what you got there 40 | 41 | The `init()` function should be called first (and only occasionally afterwards). It searches your project root (the directory where your `.Rproj` file resides) and looks for `.R` scripts that shares a common prefix separated from the rest of a file name by a separator ("build" and "_" by default, respectively). Although it is possible to use different prefix and separator, we recommend that you stick with the default. For more details, please see the reference (documentation) for the `init()` function. 42 | 43 | Those "build scripts" can do really anything, that's up to you. Commonly, they share the following: 44 | 45 | 1. loading of libraries 46 | 2. sourcing some `.R` scripts, e.g., `source("run_this.R", encoding = "UTF-8", local = TRUE)`, which can do a bunch of things, like: 47 | * downloading any remote data 48 | * cleaning them 49 | * estimating some "heavier" models, saving their output 50 | 3. finally, you'd typically include some `{rmarkdown}` call, say `rmarkdown::render("my_report.Rmd")` 51 | 52 | Here is `init()` in action: 53 | 54 | ```{r} 55 | knitr::include_graphics("init_showcase.gif") 56 | ``` 57 | 58 | ## Line up your bricks 59 | 60 | Once the `{buildr}` discovered your build scripts, it automatically creates a `Makefile` in your project root for you and populates it with rules describing how to run your build scripts. Let's make a little detour and talk more about `Makefile`s more (**you can skip this section if you just want to use the package and do your stuff**). 61 | 62 | 63 | ``` 64 | target: 65 | recipe 66 | ``` 67 | 68 | A target is usually a file name, but in our case, it is an arbitrary string uniquely identifying given `Makefile` rule. A recipe consists of a command describing what to do. In our case, we want to source a `.R` script, say `build_all.R`, so our rule would look like this: 69 | 70 | ``` 71 | all: 72 | @Rscript -e 'source("build_all.R")' 73 | ``` 74 | 75 | The target of our rule is "all" and the recipe instructs the computer to quietly (hence the `@`) start `R` and source the script "build_all.R", which resides in your project root. Note that `Makefile`s are whitespace sensitive. A tab must always precede the beginning of the recipe. **Again, you don't have to bother with any of this, as the `{buildr}` does everything for you.** 76 | 77 | Now you may wonder why this section is called "Line up your bricks"? That's simple. The purpose of `aim()` is to line up the `Makefile` rules in a particular order because the RStudio Build pane always takes the first rule available (in fact, you can specify the target manually, but it is buried deep inside the GUI). The goal of `aim()` is to list your `Makefile` rules and show them so that you can pick the one you are interested in (i.e. to prioritize it). Your choice then projects in the actual `Makefile` -- the desired rule is in the first place. That's what `aim()` does. In case you already know the target of a given rule, you can just supply it directly in the call like this: `aim(target = "all")` or even simpler `aim("all")`. 78 | 79 | Here is `aim()` in action: 80 | 81 | ```{r} 82 | knitr::include_graphics("aim_showcase.gif") 83 | ``` 84 | 85 | ## Build 86 | 87 | Now that everything is set-up, your only task is to call `build()`. Under the hood, `{buildr}` makes sure that RStudio is set appropriately to handle the `Makefile`. RStudio Build pane may be set for building packages or websites, so it is crucial to ensure your script is run nice and clean. In case something is wrong, `{buildr}` automatically offers you a remedy. 88 | 89 | Here is `build()` in action: 90 | 91 | ```{r} 92 | knitr::include_graphics("build_showcase.gif") 93 | ``` 94 | 95 | ## What's next? 96 | 97 | If you've already dived into the documentation of the package, you might still wonder what is the purpose of `command_args` argument of `init()`. When the build script is processed in RStudio Build pane, the recipe may be accompanied by so-called "command argument". This argument can be picked up by `R` and used in your build script to further specify how it should be run. In order to use it, state your command argument when you initialize the `Makefile` using `init(command_arg = "my_argument")` or manually. Note that the command argument will be placed after *each* rule's recipe. In future updates, this may accommodate a vector of command arguments, but there are many things to solve yet. Then, include the following line to your script: 98 | 99 | ``` 100 | command_args <- commandArgs(trailingOnly = TRUE) 101 | 102 | ``` 103 | 104 | The object `command_args` that you've created by the assignment will comprise the command argument stated in `Makefile` when it is run, and you can further use it inside your script. E.g., you can query whether specific command argument was passed by `if ("my_arg" %in% command_args) {print("Yes")} else {print("No")}`. 105 | 106 | ## I want more complexity! 107 | 108 | The `{buildr}` was made with simplicity in mind. It helps you bind a given script with a single keystroke using only a handful of functions. The content of such script is completely up to you. What you code is what you get. 109 | 110 | However, if you don't mind delving a bit into new and slightly complicated things, I warmly recommend you to take a look at [drake](https://docs.ropensci.org/drake/) package or at its successor, [targets](https://github.com/ropensci/targets/). 111 | 112 | And as always, happy building! 113 | -------------------------------------------------------------------------------- /vignettes/articles/shortcuts_showcase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netique/buildr/625a71f5a80aa50122ef54b69efd6aab99509c42/vignettes/articles/shortcuts_showcase.gif -------------------------------------------------------------------------------- /vignettes/know_your_buildr.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Know your {buildr}" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Know your {buildr}} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | echo = FALSE, 13 | collapse = TRUE, 14 | comment = "#>", 15 | out.width = "100%" 16 | ) 17 | ``` 18 | 19 | This vignette extends what `README` or `{buildr}` homepage already briefly described. There is also [version with **animated examples**](https://netique.github.io/buildr/articles/know_your_buildr.html). After reading it, you'll be familiar with: 20 | 21 | * how to work with `{buildr}` using your own keyboard shortcuts 22 | * how `{buildr}` works under the hood 23 | * what is a `Makefile` and how `{buildr}` uses it 24 | * tips for some advanced usage 25 | 26 | ## `{buildr}` + RStudio = ❤️ 27 | 28 | It's easy to work with `{buildr}` by printing function calls in your `R` console. However, much more feasible is to use `{buildr}` as RStudio Addin, which plays nicely with keyboard shortcuts, adding to the comfort. `{buildr}` addin commands are available below your toolbar in RStudio just upon the installation. 29 | 30 | > Well, that's pretty neat, but my time is precious and I don't mean to spend it by clicking around that tiny toolbar. 31 | 32 | Likewise! Here come the keyboard shortcuts. The quickest way how to set them up is to use `buildr::edit_shortcuts()`. 33 | 34 | Note that all three functions are supported as addin commands. If you stick with recommended defaults, there is no need to use anything else. The only function that may need a richer user input is `init()`. Let's describe it in more detail. 35 | 36 | ## Let's see what you got there 37 | 38 | The `init()` function should be called first (and only occasionally afterwards). It searches your project root (the directory where your `.Rproj` file resides) and looks for `.R` scripts that shares a common prefix separated from the rest of a file name by a separator ("build" and "_" by default, respectively). Although it is possible to use different prefix and separator, we recommend that you stick with the default. For more details, please see the reference (documentation) for the `init()` function. 39 | 40 | Those "build scripts" can do really anything, that's up to you. Commonly, they share the following: 41 | 42 | 1. loading of libraries 43 | 2. sourcing some `.R` scripts, e.g., `source("run_this.R", encoding = "UTF-8", local = TRUE)`, which can do a bunch of things, like: 44 | * downloading any remote data 45 | * cleaning them 46 | * estimating some "heavier" models, saving their output 47 | 3. finally, you'd typically include some `{rmarkdown}` call, say `rmarkdown::render("my_report.Rmd")` 48 | 49 | ## Line up your bricks 50 | 51 | Once the `{buildr}` discovered your build scripts, it automatically creates a `Makefile` in your project root for you and populates it with rules describing how to run your build scripts. Let's make a little detour and talk more about `Makefile`s more (**you can skip this section if you just want to use the package and do your stuff**). 52 | 53 | 54 | ``` 55 | target: 56 | recipe 57 | ``` 58 | 59 | A target is usually a file name, but in our case, it is an arbitrary string uniquely identifying given `Makefile` rule. A recipe consists of a command describing what to do. In our case, we want to source a `.R` script, say `build_all.R`, so our rule would look like this: 60 | 61 | ``` 62 | all: 63 | @Rscript -e 'source("build_all.R")' 64 | ``` 65 | 66 | The target of our rule is "all" and the recipe instructs the computer to quietly (hence the `@`) start `R` and source the script "build_all.R", which resides in your project root. Note that `Makefile`s are whitespace sensitive. A tab must always precede the beginning of the recipe. **Again, you don't have to bother with any of this, as the `{buildr}` does everything for you.** 67 | 68 | Now you may wonder why this section is called "Line up your bricks"? That's simple. The purpose of `aim()` is to line up the `Makefile` rules in a particular order because the RStudio Build pane always takes the first rule available (in fact, you can specify the target manually, but it is buried deep inside the GUI). The goal of `aim()` is to list your `Makefile` rules and show them so that you can pick the one you are interested in (i.e. to prioritize it). Your choice then projects in the actual `Makefile` -- the desired rule is in the first place. That's what `aim()` does. In case you already know the target of a given rule, you can just supply it directly in the call like this: `aim(target = "all")` or even simpler `aim("all")`. 69 | 70 | ## Build 71 | 72 | Now that everything is set-up, your only task is to call `build()`. Under the hood, `{buildr}` makes sure that RStudio is set appropriately to handle the `Makefile`. RStudio Build pane may be set for building packages or websites, so it is crucial to ensure your script is run nice and clean. In case something is wrong, `{buildr}` automatically offers you a remedy. 73 | 74 | ## What's next? 75 | 76 | If you've already dived into the documentation of the package, you might still wonder what is the purpose of `command_args` argument of `init()`. When the build script is processed in RStudio Build pane, the recipe may be accompanied by so-called "command argument". This argument can be picked up by `R` and used in your build script to further specify how it should be run. In order to use it, state your command argument when you initialize the `Makefile` using `init(command_arg = "my_argument")` or manually. Note that the command argument will be placed after *each* rule's recipe. In future updates, this may accommodate a vector of command arguments, but there are many things to solve yet. Then, include the following line to your script: 77 | 78 | ``` 79 | command_args <- commandArgs(trailingOnly = TRUE) 80 | 81 | ``` 82 | 83 | The object `command_args` that you've created by the assignment will comprise the command argument stated in `Makefile` when it is run, and you can further use it inside your script. E.g., you can query whether specific command argument was passed by `if ("my_arg" %in% command_args) {print("Yes")} else {print("No")}`. 84 | 85 | ## I want more complexity! 86 | 87 | The `{buildr}` was made with simplicity in mind. It helps you bind a given script with a single keystroke using only a handful of functions. The content of such script is completely up to you. What you code is what you get. 88 | 89 | However, if you don't mind delving a bit into new and slightly complicated things, I warmly recommend you to take a look at [drake](https://docs.ropensci.org/drake/) package or at its successor, [targets](https://github.com/ropensci/targets/). 90 | 91 | And as always, happy building! 92 | --------------------------------------------------------------------------------