├── .Rbuildignore
├── .gitattributes
├── .github
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE
│ ├── config.yml
│ └── feature_request.md
├── lock.yml
├── move.yml
└── workflows
│ ├── R-CMD-check.yaml
│ ├── lint.yaml
│ ├── pkgdown.yaml
│ ├── pr-commands.yaml
│ └── test-coverage.yaml
├── .gitignore
├── .lintr.R
├── DESCRIPTION
├── LICENSE
├── LICENSE.md
├── MAINTENANCE.md
├── NAMESPACE
├── NEWS.md
├── R
├── R.R
├── active.R
├── bash.R
├── build-manual.R
├── build-readme.R
├── build-site.R
├── check-devtools.R
├── check-doc.R
├── check-git.R
├── check-mac.R
├── check-win.R
├── check.R
├── create.R
├── dev-mode.R
├── devtools-package.R
├── document.R
├── git.R
├── has-tests.R
├── install.R
├── lint.R
├── missing-s3.R
├── package-deps.R
├── package.R
├── pkgbuild.R
├── pkgload.R
├── r-hub.R
├── release.R
├── reload.R
├── remotes.R
├── revdep.R
├── run-examples.R
├── run-source.R
├── save-all.R
├── session-info.R
├── show-news.R
├── sitrep.R
├── spell-check.R
├── test.R
├── uninstall.R
├── usethis.R
├── utils.R
├── vignette-r.R
├── vignettes.R
├── wd.R
└── zzz.R
├── README.md
├── _pkgdown.yml
├── codecov.yml
├── cran-comments.md
├── devtools.Rproj
├── inst
├── WORDLIST
└── rstudio
│ └── addins.dcf
├── man-roxygen
└── devtools.R
├── man
├── as.package.Rd
├── bash.Rd
├── build.Rd
├── build_manual.Rd
├── build_rmd.Rd
├── build_site.Rd
├── build_vignettes.Rd
├── check.Rd
├── check_mac_release.Rd
├── check_man.Rd
├── check_rhub.Rd
├── check_win.Rd
├── clean_vignettes.Rd
├── create.Rd
├── dev_mode.Rd
├── dev_packages.Rd
├── dev_sitrep.Rd
├── devtools-deprecated.Rd
├── devtools-package.Rd
├── document.Rd
├── figures
│ ├── lifecycle-archived.svg
│ ├── lifecycle-defunct.svg
│ ├── lifecycle-deprecated.svg
│ ├── lifecycle-experimental.svg
│ ├── lifecycle-maturing.svg
│ ├── lifecycle-questioning.svg
│ ├── lifecycle-stable.svg
│ ├── lifecycle-superseded.svg
│ └── logo.png
├── git_checks.Rd
├── has_tests.Rd
├── install.Rd
├── install_deps.Rd
├── is.package.Rd
├── lint.Rd
├── load_all.Rd
├── loaded_packages.Rd
├── missing_s3.Rd
├── package_file.Rd
├── r_env_vars.Rd
├── reexports.Rd
├── release.Rd
├── release_checks.Rd
├── reload.Rd
├── remote-reexports.Rd
├── revdep.Rd
├── run_examples.Rd
├── save_all.Rd
├── show_news.Rd
├── source_gist.Rd
├── source_url.Rd
├── spell_check.Rd
├── submit_cran.Rd
├── test.Rd
├── uninstall.Rd
├── uses_testthat.Rd
└── wd.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
├── revdep
├── .gitignore
├── README.md
├── check.R
├── cran.md
├── email.yml
├── failures.md
└── problems.md
├── tests
├── spelling.R
├── testthat.R
└── testthat
│ ├── _snaps
│ ├── active.md
│ ├── build-readme.md
│ ├── check-win.md
│ ├── package.md
│ ├── run-source.md
│ └── sitrep.md
│ ├── archive.rds
│ ├── check-results-note.log
│ ├── helper.R
│ ├── shallowRepo
│ ├── HEAD
│ ├── config
│ ├── description
│ ├── info
│ │ └── exclude
│ ├── objects
│ │ └── pack
│ │ │ ├── pack-c4e0f1d1d68408f260cbbf0a533ad5f6bfd5524e.idx
│ │ │ └── pack-c4e0f1d1d68408f260cbbf0a533ad5f6bfd5524e.pack
│ ├── packed-refs
│ ├── refs
│ │ └── tags
│ │ │ └── v1.10.0
│ └── shallow
│ ├── test-active.R
│ ├── test-build-readme.R
│ ├── test-build-site.R
│ ├── test-check-doc.R
│ ├── test-check-win.R
│ ├── test-check.R
│ ├── test-install.R
│ ├── test-package.R
│ ├── test-reload.R
│ ├── test-run-examples.R
│ ├── test-run-source.R
│ ├── test-sitrep.R
│ ├── test-test.R
│ ├── test-uninstall.R
│ ├── test-utils.R
│ ├── test-vignettes.R
│ ├── testCheckExtrafile
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ ├── R
│ │ └── a.R
│ ├── an_extra_file
│ └── man
│ │ └── a.Rd
│ ├── testError
│ ├── DESCRIPTION
│ └── R
│ │ └── error.R
│ ├── testHelp
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ ├── R
│ │ └── foofoo.R
│ └── man
│ │ └── foofoo.Rd
│ ├── testMarkdownVignettes
│ ├── .Rbuildignore
│ ├── DESCRIPTION
│ └── vignettes
│ │ └── test.Rmd
│ ├── testMissingNsObject
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ └── R
│ │ └── a.R
│ ├── testPkgdown
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ ├── R
│ │ └── pkgdown-test-test.R
│ ├── _pkgdown.yml
│ ├── man
│ │ └── pkgdown_test_test.Rd
│ └── vignettes
│ │ └── test.Rmd
│ ├── testTest
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ ├── R
│ │ └── dummy.R
│ └── tests
│ │ ├── testthat.R
│ │ └── testthat
│ │ ├── test-dummy.R
│ │ └── test-envvar.R
│ ├── testTestWithDepends
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ └── tests
│ │ ├── testthat.R
│ │ └── testthat
│ │ └── test-dummy.R
│ ├── testTestWithFailure
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ ├── R
│ │ └── dummy.R
│ └── tests
│ │ ├── testthat.R
│ │ └── testthat
│ │ ├── test-fail.R
│ │ └── test-warn.R
│ ├── testUseData
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ └── R
│ │ └── a.R
│ ├── testVignetteExtras
│ ├── .Rbuildignore
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ └── vignettes
│ │ ├── a.R
│ │ └── new.Rnw
│ ├── testVignettes
│ ├── .Rbuildignore
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ └── vignettes
│ │ └── new.Rnw
│ └── testVignettesBuilt
│ ├── DESCRIPTION
│ ├── NAMESPACE
│ ├── R
│ └── code.R
│ └── vignettes
│ └── new.Rnw
└── vignettes
└── dependencies.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^CRAN-RELEASE$
2 | ^Meta$
3 | ^doc$
4 | ^\.github$
5 | ^devtools\.Rproj$
6 | ^\.Rproj\.user$
7 | ^\.travis\.yml$
8 | ^cran-comments\.md$
9 | ^revdep$
10 | ^appveyor\.yml$
11 | ^\.httr-oauth$
12 | ^codecov\.yml$
13 | ^_pkgdown\.yml$
14 | ^docs$
15 | ^tests/testthat/test.*/\.Rbuildignore
16 | ^script\.R$
17 | ^pkgdown$
18 | ^man-roxygen$
19 | ^LICENSE\.md$
20 | ^MAINTENANCE\.md$
21 | ^\.lintr\.R$
22 | ^notes$
23 | ^CRAN-SUBMISSION$
24 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | /NEWS.md merge=union
2 |
--------------------------------------------------------------------------------
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: RStudio Community Support
4 | url: https://community.rstudio.com/
5 | about: Please ask questions for general R configuration issues and failures here.
6 | - name: Remotes 📦
7 | url: https://github.com/r-lib/remotes/issues
8 | about: Please open issues related to package installation here.
9 | - name: Usethis 📦
10 | url: https://github.com/r-lib/usethis/issues
11 | about: Please open issues related to package infrastructure setup here.
12 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for devtools
4 | title: ''
5 | assignees: ''
6 |
7 | ---
8 |
9 | **Is your feature request related to a problem? Please describe.**
10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11 |
12 | **Describe the solution you'd like**
13 | A clear and concise description of what you want to happen.
14 |
15 | **Describe alternatives you've considered**
16 | A clear and concise description of any alternative solutions or features you've considered.
17 |
18 | **Additional context**
19 | Add any other context or about the feature request here.
20 |
--------------------------------------------------------------------------------
/.github/lock.yml:
--------------------------------------------------------------------------------
1 | # Configuration for lock-threads - https://github.com/dessant/lock-threads
2 |
3 | # Number of days of inactivity before a closed issue or pull request is locked
4 | daysUntilLock: 180
5 |
6 | # Issues and pull requests with these labels will not be locked. Set to `[]` to disable
7 | exemptLabels: []
8 |
9 | # Label to add before locking, such as `outdated`. Set to `false` to disable
10 | lockLabel: false
11 |
12 | # Stop lockbot from closing as "resolved"
13 | setLockReason: false
14 |
15 | # Comment to post before locking. Set to `false` to disable
16 | lockComment: >
17 | This old issue has been automatically locked. If you believe you
18 | have found a related problem, please file a new issue (with reprex)
19 | and link to this issue.
20 |
21 | # Limit to only `issues` or `pulls`
22 | only: issues
23 |
24 | # Optionally, specify configuration settings just for `issues` or `pulls`
25 | # issues:
26 | # exemptLabels:
27 | # - help-wanted
28 | # lockLabel: outdated
29 |
30 | # pulls:
31 | # daysUntilLock: 30
32 |
--------------------------------------------------------------------------------
/.github/move.yml:
--------------------------------------------------------------------------------
1 | # Configuration for move-issues bot - https://github.com/dessant/move-issues
2 |
3 | # Delete the command comment when it contains no other content
4 | deleteCommand: true
5 |
6 | # Close the source issue after moving
7 | closeSourceIssue: true
8 |
9 | # Lock the source issue after moving
10 | lockSourceIssue: false
11 |
12 | # Mention issue and comment authors
13 | mentionAuthors: true
14 |
15 | # Preserve mentions in the issue content
16 | keepContentMentions: true
17 |
18 | # Set custom aliases for targets
19 | # aliases:
20 | # r: repo
21 | # or: owner/repo
22 |
--------------------------------------------------------------------------------
/.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 | #
4 | # NOTE: This workflow is overkill for most R packages and
5 | # check-standard.yaml is likely a better choice.
6 | # usethis::use_github_action("check-standard") will install it.
7 | on:
8 | push:
9 | branches: [main, master]
10 | pull_request:
11 | branches: [main, master]
12 |
13 | name: R-CMD-check
14 |
15 | permissions: read-all
16 |
17 | jobs:
18 | R-CMD-check:
19 | runs-on: ${{ matrix.config.os }}
20 |
21 | name: ${{ matrix.config.os }} (${{ matrix.config.r }})
22 |
23 | strategy:
24 | fail-fast: false
25 | matrix:
26 | config:
27 | - {os: macos-latest, r: 'release'}
28 |
29 | - {os: windows-latest, r: 'release'}
30 | # use 4.1 to check with rtools40's older compiler
31 | - {os: windows-latest, r: '4.1'}
32 |
33 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34 | - {os: ubuntu-latest, r: 'release'}
35 | - {os: ubuntu-latest, r: 'oldrel-1'}
36 | - {os: ubuntu-latest, r: 'oldrel-2'}
37 | - {os: ubuntu-latest, r: 'oldrel-3'}
38 | - {os: ubuntu-latest, r: 'oldrel-4'}
39 |
40 | env:
41 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
42 | R_KEEP_PKG_SOURCE: yes
43 |
44 | steps:
45 | - uses: actions/checkout@v4
46 |
47 | - uses: r-lib/actions/setup-pandoc@v2
48 |
49 | - uses: r-lib/actions/setup-r@v2
50 | with:
51 | r-version: ${{ matrix.config.r }}
52 | http-user-agent: ${{ matrix.config.http-user-agent }}
53 | use-public-rspm: true
54 |
55 | - uses: r-lib/actions/setup-r-dependencies@v2
56 | with:
57 | extra-packages: any::rcmdcheck
58 | needs: check
59 |
60 | - uses: r-lib/actions/check-r-package@v2
61 | with:
62 | upload-snapshots: true
63 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
64 |
--------------------------------------------------------------------------------
/.github/workflows/lint.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: lint
10 |
11 | jobs:
12 | lint:
13 | runs-on: ubuntu-latest
14 | env:
15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16 | steps:
17 | - uses: actions/checkout@v2
18 |
19 | - uses: r-lib/actions/setup-r@v2
20 | with:
21 | use-public-rspm: true
22 |
23 | - uses: r-lib/actions/setup-r-dependencies@v2
24 | with:
25 | packages: r-lib/lintr
26 |
27 | - name: Lint
28 | run: |
29 | out <- lintr::lint_package()
30 | print(out)
31 | if (length(out)) stop("lints found")
32 | shell: Rscript {0}
33 |
--------------------------------------------------------------------------------
/.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 | permissions: read-all
15 |
16 | jobs:
17 | pkgdown:
18 | runs-on: ubuntu-latest
19 | # Only restrict concurrency for non-PR jobs
20 | concurrency:
21 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
22 | env:
23 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24 | permissions:
25 | contents: write
26 | steps:
27 | - uses: actions/checkout@v4
28 |
29 | - uses: r-lib/actions/setup-pandoc@v2
30 |
31 | - uses: r-lib/actions/setup-r@v2
32 | with:
33 | use-public-rspm: true
34 |
35 | - uses: r-lib/actions/setup-r-dependencies@v2
36 | with:
37 | extra-packages: any::pkgdown, local::.
38 | needs: website
39 |
40 | - name: Build site
41 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
42 | shell: Rscript {0}
43 |
44 | - name: Deploy to GitHub pages 🚀
45 | if: github.event_name != 'pull_request'
46 | uses: JamesIves/github-pages-deploy-action@v4.5.0
47 | with:
48 | clean: false
49 | branch: gh-pages
50 | folder: docs
51 |
--------------------------------------------------------------------------------
/.github/workflows/pr-commands.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 | issue_comment:
5 | types: [created]
6 |
7 | name: Commands
8 |
9 | permissions: read-all
10 |
11 | jobs:
12 | document:
13 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
14 | name: document
15 | runs-on: ubuntu-latest
16 | env:
17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18 | steps:
19 | - uses: actions/checkout@v4
20 |
21 | - uses: r-lib/actions/pr-fetch@v2
22 | with:
23 | repo-token: ${{ secrets.GITHUB_TOKEN }}
24 |
25 | - uses: r-lib/actions/setup-r@v2
26 | with:
27 | use-public-rspm: true
28 |
29 | - uses: r-lib/actions/setup-r-dependencies@v2
30 | with:
31 | extra-packages: any::roxygen2
32 | needs: pr-document
33 |
34 | - name: Document
35 | run: roxygen2::roxygenise()
36 | shell: Rscript {0}
37 |
38 | - name: commit
39 | run: |
40 | git config --local user.name "$GITHUB_ACTOR"
41 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
42 | git add man/\* NAMESPACE
43 | git commit -m 'Document'
44 |
45 | - uses: r-lib/actions/pr-push@v2
46 | with:
47 | repo-token: ${{ secrets.GITHUB_TOKEN }}
48 |
49 | style:
50 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
51 | name: style
52 | runs-on: ubuntu-latest
53 | env:
54 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
55 | steps:
56 | - uses: actions/checkout@v4
57 |
58 | - uses: r-lib/actions/pr-fetch@v2
59 | with:
60 | repo-token: ${{ secrets.GITHUB_TOKEN }}
61 |
62 | - uses: r-lib/actions/setup-r@v2
63 |
64 | - name: Install dependencies
65 | run: install.packages("styler")
66 | shell: Rscript {0}
67 |
68 | - name: Style
69 | run: styler::style_pkg()
70 | shell: Rscript {0}
71 |
72 | - name: commit
73 | run: |
74 | git config --local user.name "$GITHUB_ACTOR"
75 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
76 | git add \*.R
77 | git commit -m 'Style'
78 |
79 | - uses: r-lib/actions/pr-push@v2
80 | with:
81 | repo-token: ${{ secrets.GITHUB_TOKEN }}
82 |
--------------------------------------------------------------------------------
/.github/workflows/test-coverage.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: test-coverage
10 |
11 | permissions: read-all
12 |
13 | jobs:
14 | test-coverage:
15 | runs-on: ubuntu-latest
16 | env:
17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18 |
19 | steps:
20 | - uses: actions/checkout@v4
21 |
22 | - uses: r-lib/actions/setup-r@v2
23 | with:
24 | use-public-rspm: true
25 |
26 | - uses: r-lib/actions/setup-r-dependencies@v2
27 | with:
28 | extra-packages: any::covr, any::xml2
29 | needs: coverage
30 |
31 | - name: Test coverage
32 | run: |
33 | cov <- covr::package_coverage(
34 | quiet = FALSE,
35 | clean = FALSE,
36 | install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
37 | )
38 | covr::to_cobertura(cov)
39 | shell: Rscript {0}
40 |
41 | - uses: codecov/codecov-action@v4
42 | with:
43 | fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
44 | file: ./cobertura.xml
45 | plugin: noop
46 | disable_search: true
47 | token: ${{ secrets.CODECOV_TOKEN }}
48 |
49 | - name: Show testthat output
50 | if: always()
51 | run: |
52 | ## --------------------------------------------------------------------
53 | find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
54 | shell: bash
55 |
56 | - name: Upload test results
57 | if: failure()
58 | uses: actions/upload-artifact@v4
59 | with:
60 | name: coverage-test-failures
61 | path: ${{ runner.temp }}/package
62 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.so
2 | *.o
3 | *.dll
4 | .Rproj.user
5 | .Rhistory
6 | .project
7 | .settings/
8 | inst/doc
9 | .httr-oauth
10 | tests/testthat/infrastructure/
11 | script.R
12 | /doc/
13 | /Meta/
14 | tests/*/*/.gitignore
15 | docs/
16 | *.key
17 |
--------------------------------------------------------------------------------
/.lintr.R:
--------------------------------------------------------------------------------
1 | linters <- list(lintr::undesirable_function_linter(
2 | fun = c(
3 | # Base messaging
4 | "message" = "use cli::cli_inform()",
5 | "warning" = "use cli::cli_warn()",
6 | "stop" = "use cli::cli_abort()",
7 | # rlang messaging
8 | "inform" = "use cli::cli_inform()",
9 | "warn" = "use cli::cli_warn()",
10 | "abort" = "use cli::cli_abort()",
11 | # older cli
12 | "cli_alert_danger" = "use cli::cli_inform()",
13 | "cli_alert_info" = "use cli::cli_inform()",
14 | "cli_alert_success" = "use cli::cli_inform()",
15 | "cli_alert_warning" = "use cli::cli_inform()"
16 | ),
17 | symbol_is_undesirable = FALSE
18 | ))
19 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: devtools
2 | Title: Tools to Make Developing R Packages Easier
3 | Version: 2.4.5.9000
4 | Authors@R: c(
5 | person("Hadley", "Wickham", role = "aut"),
6 | person("Jim", "Hester", role = "aut"),
7 | person("Winston", "Chang", role = "aut"),
8 | person("Jennifer", "Bryan", , "jenny@posit.co", role = c("aut", "cre"),
9 | comment = c(ORCID = "0000-0002-6983-2759")),
10 | person("Posit Software, PBC", role = c("cph", "fnd"))
11 | )
12 | Description: Collection of package development tools.
13 | License: MIT + file LICENSE
14 | URL: https://devtools.r-lib.org/, https://github.com/r-lib/devtools
15 | BugReports: https://github.com/r-lib/devtools/issues
16 | Depends:
17 | R (>= 3.6),
18 | usethis (>= 2.1.6)
19 | Imports:
20 | cli (>= 3.3.0),
21 | desc (>= 1.4.1),
22 | ellipsis (>= 0.3.2),
23 | fs (>= 1.5.2),
24 | lifecycle (>= 1.0.1),
25 | memoise (>= 2.0.1),
26 | miniUI (>= 0.1.1.1),
27 | pkgbuild (>= 1.3.1),
28 | pkgdown (>= 2.0.6),
29 | pkgload (>= 1.3.0),
30 | profvis (>= 0.3.7),
31 | rcmdcheck (>= 1.4.0),
32 | remotes (>= 2.4.2),
33 | rlang (>= 1.0.4),
34 | roxygen2 (>= 7.2.1),
35 | rversions (>= 2.1.1),
36 | sessioninfo (>= 1.2.2),
37 | stats,
38 | testthat (>= 3.2.0),
39 | tools,
40 | urlchecker (>= 1.0.1),
41 | utils,
42 | withr (>= 2.5.0)
43 | Suggests:
44 | BiocManager (>= 1.30.18),
45 | callr (>= 3.7.1),
46 | covr (>= 3.5.1),
47 | curl (>= 4.3.2),
48 | digest (>= 0.6.29),
49 | DT (>= 0.23),
50 | foghorn (>= 1.4.2),
51 | gh (>= 1.3.0),
52 | gmailr (>= 1.0.1),
53 | httr (>= 1.4.3),
54 | knitr (>= 1.39),
55 | lintr (>= 3.0.0),
56 | MASS,
57 | mockery (>= 0.4.3),
58 | pingr (>= 2.0.1),
59 | rhub (>= 1.1.1),
60 | rmarkdown (>= 2.14),
61 | rstudioapi (>= 0.13),
62 | spelling (>= 2.2)
63 | VignetteBuilder:
64 | knitr
65 | Remotes:
66 | r-lib/testthat
67 | Config/Needs/website: tidyverse/tidytemplate
68 | Config/testthat/edition: 3
69 | Encoding: UTF-8
70 | Language: en-US
71 | Roxygen: list(markdown = TRUE)
72 | RoxygenNote: 7.3.2
73 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2023
2 | COPYRIGHT HOLDER: devtools authors
3 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # MIT License
2 |
3 | Copyright (c) 2023 devtools authors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MAINTENANCE.md:
--------------------------------------------------------------------------------
1 | ## Current state
2 |
3 | Devtools is generally stable, most of the active development has moved to sub-packages like remotes and usethis, and relatively little code lives in devtools itself.
4 |
5 | ## Known outstanding issues
6 |
7 | I don't know of any major outstanding issues in devtools itself.
8 |
9 | ## Future directions
10 |
11 | The package development cheatsheet likely needs a major overhaul to account for much more functionality in usethis and the current state of devtools. https://github.com/r-lib/devtools/issues/2107
12 |
13 | Should devtools be converted to use pak for installation, or should the installation commands be deprecated in devtools and users suggested to use pak directly?
14 |
15 | ## R CMD check notes
16 |
17 | devtools has some vintage tests around `.Rnw` vignettes.
18 | It's not clear if it makes sense to keep these, but I (jennybc) am not rushing to remove these tests.
19 | Since I inherited the maintainership of devtools, I have not pursued why 2 of these tests fail locally (they are skipped on GHA).
20 | However, today, I did sort it out and want to record what I did.
21 | In case it comes up in the future, this caused the necessary LaTeX package to be installed:
22 |
23 | ``` r
24 | tinytex::parse_install(
25 | text = "! LaTeX Error: File `grfext.sty' not found."
26 | )
27 | ```
28 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | S3method(print,dev_sitrep)
4 | S3method(print,maintainers)
5 | export(as.package)
6 | export(bash)
7 | export(build)
8 | export(build_manual)
9 | export(build_readme)
10 | export(build_rmd)
11 | export(build_site)
12 | export(build_vignettes)
13 | export(check)
14 | export(check_built)
15 | export(check_dep_version)
16 | export(check_mac_release)
17 | export(check_man)
18 | export(check_rhub)
19 | export(check_win_devel)
20 | export(check_win_oldrelease)
21 | export(check_win_release)
22 | export(clean_dll)
23 | export(clean_vignettes)
24 | export(create)
25 | export(dev_mode)
26 | export(dev_package_deps)
27 | export(dev_packages)
28 | export(dev_sitrep)
29 | export(document)
30 | export(find_rtools)
31 | export(github_pull)
32 | export(github_release)
33 | export(has_devel)
34 | export(has_tests)
35 | export(install)
36 | export(install_bioc)
37 | export(install_bitbucket)
38 | export(install_cran)
39 | export(install_deps)
40 | export(install_dev)
41 | export(install_dev_deps)
42 | export(install_git)
43 | export(install_github)
44 | export(install_gitlab)
45 | export(install_local)
46 | export(install_svn)
47 | export(install_url)
48 | export(install_version)
49 | export(is.package)
50 | export(lint)
51 | export(load_all)
52 | export(loaded_packages)
53 | export(missing_s3)
54 | export(package_file)
55 | export(package_info)
56 | export(parse_deps)
57 | export(r_env_vars)
58 | export(release)
59 | export(release_checks)
60 | export(reload)
61 | export(revdep)
62 | export(revdep_maintainers)
63 | export(run_examples)
64 | export(session_info)
65 | export(show_news)
66 | export(source_gist)
67 | export(source_url)
68 | export(spell_check)
69 | export(submit_cran)
70 | export(test)
71 | export(test_active_file)
72 | export(test_coverage)
73 | export(test_coverage_active_file)
74 | export(test_coverage_file)
75 | export(test_file)
76 | export(uninstall)
77 | export(unload)
78 | export(update_packages)
79 | export(uses_testthat)
80 | export(wd)
81 | export(with_debug)
82 | import(fs)
83 | importFrom(cli,cat_bullet)
84 | importFrom(cli,cat_rule)
85 | importFrom(ellipsis,check_dots_used)
86 | importFrom(lifecycle,deprecated)
87 | importFrom(memoise,memoise)
88 | importFrom(pkgbuild,clean_dll)
89 | importFrom(pkgbuild,find_rtools)
90 | importFrom(pkgbuild,has_devel)
91 | importFrom(pkgbuild,with_debug)
92 | importFrom(pkgload,check_dep_version)
93 | importFrom(pkgload,parse_deps)
94 | importFrom(pkgload,unload)
95 | importFrom(remotes,dev_package_deps)
96 | importFrom(remotes,github_pull)
97 | importFrom(remotes,github_release)
98 | importFrom(remotes,install_bioc)
99 | importFrom(remotes,install_bitbucket)
100 | importFrom(remotes,install_cran)
101 | importFrom(remotes,install_dev)
102 | importFrom(remotes,install_git)
103 | importFrom(remotes,install_github)
104 | importFrom(remotes,install_gitlab)
105 | importFrom(remotes,install_local)
106 | importFrom(remotes,install_svn)
107 | importFrom(remotes,install_url)
108 | importFrom(remotes,install_version)
109 | importFrom(remotes,update_packages)
110 | importFrom(sessioninfo,package_info)
111 | importFrom(sessioninfo,session_info)
112 | importFrom(stats,update)
113 | importFrom(usethis,ui_code)
114 | importFrom(usethis,ui_done)
115 | importFrom(usethis,ui_field)
116 | importFrom(usethis,ui_path)
117 | importFrom(usethis,ui_todo)
118 | importFrom(usethis,ui_value)
119 | importFrom(usethis,use_test)
120 | importFrom(utils,available.packages)
121 | importFrom(utils,contrib.url)
122 | importFrom(utils,install.packages)
123 | importFrom(utils,installed.packages)
124 | importFrom(utils,modifyList)
125 | importFrom(utils,packageDescription)
126 | importFrom(utils,packageVersion)
127 | importFrom(utils,remove.packages)
128 |
--------------------------------------------------------------------------------
/R/R.R:
--------------------------------------------------------------------------------
1 | #' Environment variables to set when calling R
2 | #'
3 | #' Devtools sets a number of environmental variables to ensure consistent
4 | #' between the current R session and the new session, and to ensure that
5 | #' everything behaves the same across systems. It also suppresses a common
6 | #' warning on windows, and sets `NOT_CRAN` so you can tell that your
7 | #' code is not running on CRAN. If `NOT_CRAN` has been set externally, it
8 | #' is not overwritten.
9 | #'
10 | #' @keywords internal
11 | #' @return a named character vector
12 | #' @export
13 | r_env_vars <- function() {
14 | vars <- c(
15 | "R_LIBS" = paste(.libPaths(), collapse = .Platform$path.sep),
16 | "CYGWIN" = "nodosfilewarning",
17 | # When R CMD check runs tests, it sets R_TESTS. When the tests
18 | # themselves run R CMD xxxx, as is the case with the tests in
19 | # devtools, having R_TESTS set causes errors because it confuses
20 | # the R subprocesses. Un-setting it here avoids those problems.
21 | "R_TESTS" = "",
22 | "R_BROWSER" = "false",
23 | "R_PDFVIEWER" = "false"
24 | )
25 |
26 | if (is.na(Sys.getenv("NOT_CRAN", unset = NA))) {
27 | vars[["NOT_CRAN"]] <- "true"
28 | }
29 |
30 | vars
31 | }
32 |
--------------------------------------------------------------------------------
/R/active.R:
--------------------------------------------------------------------------------
1 | find_active_file <- function(arg = "file", call = parent.frame()) {
2 | if (!is_rstudio_running()) {
3 | cli::cli_abort("Argument {.arg {arg}} is missing, with no default", call = call)
4 | }
5 | normalizePath(rstudioapi::getSourceEditorContext()$path)
6 | }
7 |
8 | find_test_file <- function(path, call = parent.frame()) {
9 | type <- test_file_type(path)
10 | if (any(is.na(type))) {
11 | file <- path_file(path[is.na(type)])
12 | cli::cli_abort(
13 | "Don't know how to find tests associated with the active file {.file {file}}",
14 | call = call
15 | )
16 | }
17 |
18 | pkg <- as.package(dirname(path))
19 |
20 | is_test <- type == "test"
21 | path[!is_test] <- paste0(pkg$path, "/tests/testthat/test-", name_source(path[!is_test]), ".R")
22 | path <- unique(path[file_exists(path)])
23 |
24 | if (length(path) == 0) {
25 | cli::cli_abort("No test files found", call = call)
26 | }
27 | path
28 | }
29 |
30 | test_file_type <- function(path) {
31 | dir <- path_file(path_dir(path))
32 | name <- path_file(path)
33 | ext <- tolower(path_ext(path))
34 |
35 | src_ext <- c("c", "cc", "cpp", "cxx", "h", "hpp", "hxx")
36 |
37 | type <- rep(NA_character_, length(path))
38 | type[dir == "R" & ext == "r"] <- "R"
39 | type[dir == "testthat" & ext == "r" & grepl("^test", name)] <- "test"
40 | type[dir == "src" & ext %in% src_ext] <- "src"
41 | type
42 | }
43 |
44 | # Figure out "name" of a test or source file
45 | name_test <- function(path) {
46 | gsub("^test[-_]", "", name_source(path))
47 | }
48 | name_source <- function(path) {
49 | path_ext_remove(path_file(path))
50 | }
51 |
--------------------------------------------------------------------------------
/R/bash.R:
--------------------------------------------------------------------------------
1 | #' Open bash shell in package directory.
2 | #'
3 | #' @template devtools
4 | #' @export
5 | bash <- function(pkg = ".") {
6 | pkg <- as.package(pkg)
7 |
8 | withr::with_dir(pkg$path, system("bash"))
9 | }
10 |
--------------------------------------------------------------------------------
/R/build-manual.R:
--------------------------------------------------------------------------------
1 | #' Create package pdf manual
2 | #'
3 | #' @template devtools
4 | #' @param path path in which to produce package manual.
5 | #' If `NULL`, defaults to the parent directory of the package.
6 | #'
7 | #' @seealso [Rd2pdf()]
8 | #' @export
9 | build_manual <- function(pkg = ".", path = NULL) {
10 | pkg <- as.package(pkg)
11 | path <- path %||% path_dir(pkg$path)
12 | name <- paste0(pkg$package, "_", pkg$version, ".pdf", collapse = " ")
13 | tryCatch(msg <- callr::rcmd("Rd2pdf", cmdargs = c(
14 | "--force",
15 | paste0("--output=", path, "/", name),
16 | pkg$path
17 | ), fail_on_status = TRUE, stderr = "2>&1", spinner = FALSE),
18 | error = function(e) {
19 | cat(e$stdout)
20 | cli::cli_abort("Failed to build manual")
21 | })
22 |
23 | cat(msg$stdout)
24 | invisible(msg)
25 | }
26 |
--------------------------------------------------------------------------------
/R/build-readme.R:
--------------------------------------------------------------------------------
1 | #' Build a Rmarkdown files package
2 | #'
3 | #' `build_rmd()` is a wrapper around [rmarkdown::render()] that first installs
4 | #' a temporary copy of the package, and then renders each `.Rmd` in a clean R
5 | #' session. `build_readme()` locates your `README.Rmd` and builds it into a
6 | #' `README.md`
7 | #'
8 | #' @param files The Rmarkdown files to be rendered.
9 | #' @param path path to the package to build the readme.
10 | #' @param ... additional arguments passed to [rmarkdown::render()]
11 | #' @inheritParams install
12 | #' @inheritParams rmarkdown::render
13 | #' @export
14 | build_rmd <- function(files, path = ".", output_options = list(), ..., quiet = TRUE) {
15 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
16 |
17 | pkg <- as.package(path)
18 |
19 | rlang::check_installed("rmarkdown")
20 | save_all()
21 |
22 | paths <- files
23 | abs_files <- is_absolute_path(files)
24 | paths[!abs_files] <- path(pkg$path, files[!abs_files])
25 |
26 | ok <- file_exists(paths)
27 | if (any(!ok)) {
28 | cli::cli_abort("Can't find file{?s}: {.path {files[!ok]}}.")
29 | }
30 |
31 | local_install(pkg, quiet = TRUE)
32 |
33 | # Ensure rendering github_document() doesn't generate HTML file
34 | output_options$html_preview <- FALSE
35 |
36 |
37 | for (path in paths) {
38 | cli::cli_inform(c(i = "Building {.path {path}}"))
39 | callr::r_safe(
40 | function(...) rmarkdown::render(...),
41 | args = list(input = path, ..., output_options = output_options, quiet = quiet),
42 | show = TRUE,
43 | spinner = FALSE,
44 | stderr = "2>&1"
45 | )
46 | }
47 |
48 | invisible(TRUE)
49 | }
50 |
51 | #' @rdname build_rmd
52 | #' @export
53 | build_readme <- function(path = ".", quiet = TRUE, ...) {
54 | pkg <- as.package(path)
55 |
56 | regexp <- paste0(path_file(pkg$path), "/(inst/)?readme[.]rmd")
57 | readme_path <- path_abs(dir_ls(pkg$path, ignore.case = TRUE, regexp = regexp, recurse = 1, type = "file"))
58 |
59 | if (length(readme_path) == 0) {
60 | cli::cli_abort("Can't find {.file README.Rmd} or {.file inst/README.Rmd}.")
61 | }
62 | if (length(readme_path) > 1) {
63 | cli::cli_abort("Can't have both {.file README.Rmd} and {.file inst/README.Rmd}.")
64 | }
65 |
66 | build_rmd(readme_path, path = path, quiet = quiet, ...)
67 | }
68 |
--------------------------------------------------------------------------------
/R/build-site.R:
--------------------------------------------------------------------------------
1 | #' Execute \pkg{pkgdown} build_site in a package
2 | #'
3 | #' `build_site()` is a shortcut for [pkgdown::build_site()], it generates the
4 | #' static HTML documentation.
5 | #'
6 | #' @param path path to the package to build the static HTML.
7 | #' @param ... additional arguments passed to [pkgdown::build_site()]
8 | #' @inheritParams install
9 | #'
10 | #' @return NULL
11 | #' @export
12 | build_site <- function(path = ".", quiet = TRUE, ...) {
13 | rlang::check_installed("pkgdown")
14 |
15 | save_all()
16 |
17 | pkg <- as.package(path)
18 |
19 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
20 |
21 | withr::with_temp_libpaths(action = "prefix", code = {
22 | install(pkg = pkg$path, upgrade = "never", reload = FALSE, quiet = quiet)
23 | if (isTRUE(quiet)) {
24 | withr::with_output_sink(
25 | file_temp(),
26 | pkgdown::build_site(pkg = pkg$path, ...)
27 | )
28 | } else {
29 | pkgdown::build_site(pkg = pkg$path, ...)
30 | }
31 | })
32 | }
33 |
--------------------------------------------------------------------------------
/R/check-devtools.R:
--------------------------------------------------------------------------------
1 | #' Custom devtools release checks.
2 | #'
3 | #' This function performs additional checks prior to release. It is called
4 | #' automatically by [release()].
5 | #'
6 | #' @template devtools
7 | #' @keywords internal
8 | #' @export
9 | release_checks <- function(pkg = ".", built_path = NULL) {
10 | pkg <- as.package(pkg)
11 | cat_rule(paste0("Running additional devtools checks for ", pkg$package))
12 |
13 | check_version(pkg)
14 | check_dev_versions(pkg)
15 | check_vignette_titles(pkg)
16 | check_news_md(pkg)
17 | check_remotes(pkg)
18 |
19 | cat_rule()
20 | }
21 |
22 | check_dev_versions <- function(pkg = ".") {
23 | pkg <- as.package(pkg)
24 |
25 | dep_list <- pkg[tolower(remotes::standardise_dep(TRUE))]
26 | deps <- do.call("rbind", unname(compact(lapply(dep_list, parse_deps))))
27 | deps <- deps[!is.na(deps$version), , drop = FALSE]
28 |
29 | parsed <- lapply(deps$version, function(x) unlist(numeric_version(x)))
30 |
31 | lengths <- vapply(parsed, length, integer(1))
32 | last_ver <- vapply(parsed, function(x) x[[length(x)]], integer(1))
33 |
34 | is_dev <- lengths == 4 & last_ver >= 9000
35 |
36 | check_status(
37 | !any(is_dev),
38 | "dependencies don't rely on dev versions",
39 | paste(
40 | "depends on devel versions of: ",
41 | paste0(deps$name[is_dev], collapse = ", ")
42 | )
43 | )
44 |
45 | return(invisible(FALSE))
46 | }
47 |
48 | check_version <- function(pkg = ".") {
49 | pkg <- as.package(pkg)
50 | ver <- unlist(numeric_version(pkg$version))
51 |
52 | check_status(
53 | length(ver) == 3,
54 | "version number has three components",
55 | paste0("version (", pkg$version, ") should have exactly three components")
56 | )
57 | }
58 |
59 | check_vignette_titles <- function(pkg = ".") {
60 | pkg <- as.package(pkg)
61 | vigns <- tools::pkgVignettes(dir = pkg$path)
62 | if (length(vigns$docs) == 0) return()
63 |
64 | has_vignette_title <- function(v, n) {
65 | h <- readLines(v, n = n)
66 | any(grepl("Vignette Title", h))
67 | }
68 | v <- stats::setNames(vigns$docs, path_file(vigns$docs))
69 | has_vt <- vapply(v, has_vignette_title, logical(1), n = 30)
70 |
71 | check_status(
72 | !any(has_vt),
73 | "vignette titles are not placeholders",
74 | paste0(
75 | "placeholder 'Vignette Title' detected in 'title' field and/or ",
76 | "'VignetteIndexEntry' for: ",
77 | paste(names(has_vt)[has_vt], collapse = ",")
78 | )
79 | )
80 | }
81 |
82 | check_news_md <- function(pkg) {
83 | pkg <- as.package(pkg)
84 |
85 | news_path <- path(pkg$path, "NEWS.md")
86 | if (!file_exists(news_path)) {
87 | return()
88 | }
89 |
90 | ignore_path <- path(pkg$path, ".Rbuildignore")
91 | if (!file_exists(ignore_path)) {
92 | ignore_lines <- character()
93 | } else {
94 | ignore_lines <- readLines(ignore_path)
95 | }
96 |
97 | has_news <- grepl("NEWS\\.md", ignore_lines, fixed = TRUE) |
98 | grepl("NEWS.md", ignore_lines, fixed = TRUE)
99 |
100 | check_status(
101 | !any(has_news),
102 | "NEWS.md is not ignored",
103 | "NEWS.md now supported by CRAN and doesn't need to be ignored."
104 | )
105 |
106 | news_rd_path <- path(pkg$path, "inst/NEWS.Rd")
107 | check_status(
108 | !file_exists(news_rd_path),
109 | "NEWS.Rd does not exist",
110 | "NEWS.md now supported by CRAN, NEWS.Rd can be removed."
111 | )
112 | }
113 |
114 | check_remotes <- function(pkg) {
115 | check_status(
116 | !has_dev_remotes(pkg),
117 | "DESCRIPTION doesn't have Remotes field",
118 | "Remotes field should be removed before CRAN submission."
119 | )
120 | }
121 |
122 | has_dev_remotes <- function(pkg) {
123 | !is.null(pkg[["remotes"]])
124 | }
125 |
126 | check_status <- function(status, name, warning) {
127 | cat("Checking ", name, "...", sep = "")
128 |
129 | status <- tryCatch(
130 | if (status) {
131 | cat(" OK\n")
132 | } else {
133 | cat("\n")
134 | cli::cli_inform(c(x = "WARNING: {warning}"))
135 | },
136 | error = function(e) {
137 | cat("\n")
138 | cli::cli_inform(c(x = "ERROR: {conditionMessage(e)}"))
139 | FALSE
140 | }
141 | )
142 |
143 | invisible(status)
144 | }
145 |
--------------------------------------------------------------------------------
/R/check-doc.R:
--------------------------------------------------------------------------------
1 | #' Check documentation, as `R CMD check` does.
2 | #'
3 | #' This function attempts to run the documentation related checks in the
4 | #' same way that `R CMD check` does. Unfortunately it can't run them
5 | #' all because some tests require the package to be loaded, and the way
6 | #' they attempt to load the code conflicts with how devtools does it.
7 | #'
8 | #' @template devtools
9 | #' @return Nothing. This function is called purely for it's side effects: if
10 | #' no errors there will be no output.
11 | #' @export
12 | #' @examples
13 | #' \dontrun{
14 | #' check_man("mypkg")
15 | #' }
16 | check_man <- function(pkg = ".") {
17 | pkg <- as.package(pkg)
18 | document(pkg)
19 |
20 | old <- options(warn = -1)
21 | on.exit(options(old))
22 |
23 | cli::cli_inform(c(i = "Checking documentation..."))
24 |
25 | check_Rd_contents <- if (getRversion() < "4.1") {
26 | asNamespace("tools")$.check_Rd_contents
27 | } else {
28 | asNamespace("tools")$checkRdContents
29 | }
30 |
31 | ok <-
32 | all(
33 | man_message(("tools" %:::% ".check_package_parseRd")(dir = pkg$path)),
34 | man_message(("tools" %:::% ".check_Rd_metadata")(dir = pkg$path)),
35 | man_message(("tools" %:::% ".check_Rd_xrefs")(dir = pkg$path)),
36 | man_message(check_Rd_contents(dir = pkg$path)),
37 | man_message(tools::checkDocFiles(dir = pkg$path)),
38 | man_message(tools::checkDocStyle(dir = pkg$path)),
39 | man_message(tools::checkReplaceFuns(dir = pkg$path)),
40 | man_message(tools::checkS3methods(dir = pkg$path)),
41 | man_message(tools::undoc(dir = pkg$path))
42 | )
43 |
44 | if (ok) {
45 | cli::cli_inform(c(v = "No issues detected"))
46 | }
47 |
48 | invisible()
49 | }
50 |
51 | man_message <- function(x) {
52 | if (inherits(x, "undoc") && length(x$code) == 0) {
53 | # Returned by tools::undoc()
54 | TRUE
55 | } else if ("bad" %in% names(x) && length(x$bad) == 0) {
56 | # Returned by check_Rd_xrefs()
57 | TRUE
58 | } else if (length(x) == 0) {
59 | TRUE
60 | } else {
61 | print(x)
62 | FALSE
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/R/check-git.R:
--------------------------------------------------------------------------------
1 | #' Git checks.
2 | #'
3 | #' This function performs Git checks checks prior to release. It is called
4 | #' automatically by [release()].
5 | #'
6 | #' @template devtools
7 | #' @keywords internal
8 | git_checks <- function(pkg = ".") {
9 | pkg <- as.package(pkg)
10 | cat_rule(paste0("Running Git checks for ", pkg$package))
11 |
12 | git_report_branch(pkg)
13 | git_check_uncommitted(pkg)
14 | cat_rule()
15 | }
16 |
17 | git_report_branch <- function(pkg) {
18 | cat("Current branch:", git_branch(pkg$path), "\n")
19 | }
20 |
21 | git_check_uncommitted <- function(pkg) {
22 | check_status(
23 | !git_uncommitted(pkg$path),
24 | "uncommitted files",
25 | "All files should be tracked and committed before release. Please add and commit."
26 | )
27 | }
28 |
--------------------------------------------------------------------------------
/R/check-mac.R:
--------------------------------------------------------------------------------
1 | #' Check a package on macOS
2 | #'
3 | #' This function first bundles a source package, then uploads it to
4 | #' . This function returns a
5 | #' link to the page where the check results will appear.
6 | #'
7 | #' @template devtools
8 | #' @inheritParams check_win
9 | #' @param dep_pkgs Additional custom dependencies to install prior to checking
10 | #' the package.
11 | #' @family build functions
12 | #' @return The url with the check results (invisibly)
13 | #' @export
14 | check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
15 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
16 |
17 | pkg <- as.package(pkg)
18 |
19 | if (!quiet) {
20 | cli::cli_inform(c(
21 | "Building macOS version of {.pkg {pkg$package}} ({pkg$version})",
22 | i = "Using https://mac.r-project.org/macbuilder/submit.html."
23 | ))
24 | }
25 |
26 | built_path <- pkgbuild::build(pkg$path, tempdir(),
27 | args = args,
28 | manual = manual, quiet = quiet, ...
29 | )
30 |
31 | dep_built_paths <- character()
32 | for (i in seq_along(dep_pkgs)) {
33 | dep_pkg <- as.package(dep_pkgs[[i]])$path
34 | dep_built_paths[[i]] <- pkgbuild::build(dep_pkg, tempdir(),
35 | args = args,
36 | manual = manual, quiet = quiet, ...
37 | )
38 | }
39 | on.exit(file_delete(c(built_path, dep_built_paths)), add = TRUE)
40 |
41 | url <- "https://mac.r-project.org/macbuilder/v1/submit"
42 |
43 | rlang::check_installed("httr")
44 | body <- list(pkgfile = httr::upload_file(built_path))
45 |
46 | if (length(dep_built_paths) > 0) {
47 | uploads <- lapply(dep_built_paths, httr::upload_file)
48 | names(uploads) <- rep("depfiles", length(uploads))
49 | body <- append(body, uploads)
50 | }
51 |
52 | res <- httr::POST(url,
53 | body = body,
54 | headers = list(
55 | "Content-Type" = "multipart/form-data"
56 | ),
57 | encode = "multipart"
58 | )
59 |
60 | httr::stop_for_status(res, task = "Uploading package")
61 |
62 | response_url <- httr::content(res)$url
63 |
64 | if (!quiet) {
65 | time <- strftime(Sys.time() + 10 * 60, "%I:%M %p")
66 |
67 | cli::cat_rule(col = "cyan")
68 | cli::cli_inform(c(
69 | i = "Check {.url {response_url}} for the results in 5-10 mins (~{time})."
70 | ))
71 | }
72 |
73 | invisible(response_url)
74 | }
75 |
--------------------------------------------------------------------------------
/R/create.R:
--------------------------------------------------------------------------------
1 | #' Create a package
2 | #'
3 | #' @param path A path. If it exists, it is used. If it does not exist, it is
4 | #' created, provided that the parent path exists.
5 | #' @param ... Additional arguments passed to [usethis::create_package()]
6 | #' @inheritParams usethis::create_package
7 | #' @return The path to the created package, invisibly.
8 | #' @export
9 | create <- function(path, ..., open = FALSE) {
10 | usethis::create_package(path, ..., open = open)
11 | }
12 |
--------------------------------------------------------------------------------
/R/dev-mode.R:
--------------------------------------------------------------------------------
1 | #' Activate and deactivate development mode
2 | #'
3 | #' @description
4 | #' `r lifecycle::badge("deprecated")`
5 | #'
6 |
7 | #' We no longer recommend `dev_mode()` and it will be removed in a future
8 | #' release of devtools. Instead, we now rely on [load_all()] to test drive an
9 | #' in-development package. If you really like the idea of corralling
10 | #' experimental packages in a special library, you might enjoy
11 | #' `withr::local_libpaths()`. If you are concerned about different projects
12 | #' interfering with each other through the use of a shared library, consider
13 | #' using the [renv package](https://rstudio.github.io/renv/).
14 | #'
15 | #' Original description: When activated, `dev_mode` creates a new library for
16 | #' storing installed packages. This new library is automatically created when
17 | #' `dev_mode` is activated if it does not already exist. This allows you to test
18 | #' development packages in a sandbox, without interfering with the other
19 | #' packages you have installed.
20 | #'
21 | #' @param on turn dev mode on (`TRUE`) or off (`FALSE`). If omitted will guess
22 | #' based on whether or not `path` is in [.libPaths()]
23 | #' @param path directory to library.
24 | #' @export
25 | #' @keywords internal
26 | #' @examples
27 | #' \dontrun{
28 | #' dev_mode()
29 | #' dev_mode()
30 | #' }
31 | dev_mode <- local({
32 | .prompt <- NULL
33 |
34 | function(on = NULL, path = getOption("devtools.path")) {
35 | lifecycle::deprecate_warn("2.4.5", "dev_mode()")
36 | lib_paths <- .libPaths()
37 |
38 | path <- path_real(path)
39 | if (is.null(on)) {
40 | on <- !(path %in% lib_paths)
41 | }
42 |
43 | if (on) {
44 | if (!file_exists(path)) {
45 | dir_create(path)
46 | }
47 | if (!file_exists(path)) {
48 | cli::cli_abort("Failed to create {.path {path}}")
49 | }
50 |
51 | if (!is_library(path)) {
52 | cli::cli_warn(c(
53 | "{.path {path}} does not appear to be a library.",
54 | "Are sure you specified the correct directory?"
55 | ))
56 | }
57 |
58 | cli::cli_inform(c(v = "Dev mode: ON"))
59 | options(dev_path = path)
60 |
61 | if (is.null(.prompt)) .prompt <<- getOption("prompt")
62 | options(prompt = paste("d> "))
63 |
64 | .libPaths(c(path, lib_paths))
65 | } else {
66 | cli::cli_inform(c(v = "Dev mode: OFF"))
67 | options(dev_path = NULL)
68 |
69 | if (!is.null(.prompt)) options(prompt = .prompt)
70 | .prompt <<- NULL
71 |
72 | .libPaths(setdiff(lib_paths, path))
73 | }
74 | }
75 | })
76 |
77 | is_library <- function(path) {
78 | # empty directories can be libraries
79 | if (length(dir_ls(path)) == 0) return(TRUE)
80 |
81 | # otherwise check that the directories are compiled R directories -
82 | # i.e. that they contain a Meta directory
83 | dirs <- dir_ls(path, type = "directory")
84 |
85 | has_pkg_dir <- function(path) length(dir_ls(path, regexp = "Meta")) > 0
86 | help_dirs <- vapply(dirs, has_pkg_dir, logical(1))
87 |
88 | all(help_dirs)
89 | }
90 |
--------------------------------------------------------------------------------
/R/devtools-package.R:
--------------------------------------------------------------------------------
1 | #' @section Package options:
2 | #'
3 | #' Devtools uses the following [options()] to configure behaviour:
4 | #' * `devtools.install.args`: a string giving extra arguments passed to
5 | #' `R CMD install` by [install()].
6 | #' * `devtools.path`: Deprecated. Path used by the now-deprecated [dev_mode()]
7 | #' function.
8 | #' @docType package
9 | #' @keywords internal
10 | "_PACKAGE"
11 |
12 | ## usethis namespace: start
13 | #' @importFrom lifecycle deprecated
14 | ## usethis namespace: end
15 | NULL
16 |
17 | # https://r-pkgs.org/dependencies-in-practice.html#how-to-not-use-a-package-in-imports
18 | ignore_unused_imports <- function() {
19 | miniUI::miniPage
20 | profvis::profvis
21 | urlchecker::url_check
22 | }
23 |
--------------------------------------------------------------------------------
/R/document.R:
--------------------------------------------------------------------------------
1 | #' Use roxygen to document a package.
2 | #'
3 | #' This function is a wrapper for the [roxygen2::roxygenize()]
4 | #' function from the roxygen2 package. See the documentation and vignettes of
5 | #' that package to learn how to use roxygen.
6 | #'
7 | #' @template devtools
8 | #' @inheritParams roxygen2::roxygenise
9 | #' @param quiet if `TRUE` suppresses output from this function.
10 | #' @seealso [roxygen2::roxygenize()],
11 | #' `browseVignettes("roxygen2")`
12 | #' @export
13 | document <- function(pkg = ".", roclets = NULL, quiet = FALSE) {
14 | pkg <- as.package(pkg)
15 | if (!isTRUE(quiet)) {
16 | cli::cli_inform(c(i = "Updating {.pkg {pkg$package}} documentation"))
17 | }
18 |
19 | save_all()
20 | if (pkg$package == "roxygen2") {
21 | # roxygen2 crashes if it reloads itself
22 | load_all(pkg$path, quiet = quiet)
23 | }
24 |
25 | if (quiet) {
26 | output <- file_temp()
27 | withr::defer(file_delete(output))
28 | withr::local_output_sink(output)
29 | }
30 | withr::local_envvar(r_env_vars())
31 |
32 | roxygen2::roxygenise(pkg$path, roclets)
33 | pkgload::dev_topic_index_reset(pkg$package)
34 | invisible()
35 | }
36 |
--------------------------------------------------------------------------------
/R/git.R:
--------------------------------------------------------------------------------
1 | uses_git <- function(path = ".") {
2 | dir_exists(path(path, ".git"))
3 | }
4 |
5 | git_branch <- function(path = ".") {
6 | withr::local_dir(path)
7 |
8 | system2("git", c("rev-parse", "--abbrev-ref", "HEAD"), stdout = TRUE)
9 | }
10 |
11 | git_uncommitted <- function(path = ".") {
12 | withr::local_dir(path)
13 |
14 | out <- system2("git", c("status", "--porcelain=v1"), stdout = TRUE)
15 | length(out) > 0
16 | }
17 |
--------------------------------------------------------------------------------
/R/has-tests.R:
--------------------------------------------------------------------------------
1 | #' Was devtools installed with tests?
2 | #'
3 | #' @keywords internal
4 | #' @export
5 | has_tests <- function() {
6 | test_path <- tryCatch(
7 | path_package("devtools", "tests"),
8 | error = function(e) NULL
9 | )
10 |
11 | !is.null(test_path)
12 | }
13 |
--------------------------------------------------------------------------------
/R/lint.R:
--------------------------------------------------------------------------------
1 | #' Lint all source files in a package
2 | #'
3 | #' The default linters correspond to the style guide at
4 | #' , however it is possible to override any or all
5 | #' of them using the `linters` parameter.
6 | #'
7 | #' @template devtools
8 | #' @param cache Store the lint results so repeated lints of the same content use
9 | #' the previous results. Consult the lintr package to learn more about its
10 | #' caching behaviour.
11 | #' @param ... Additional arguments passed to [lintr::lint_package()].
12 | #' @seealso [lintr::lint_package()], [lintr::lint()]
13 | #' @export
14 | lint <- function(pkg = ".", cache = TRUE, ...) {
15 | rlang::check_installed("lintr")
16 | pkg <- as.package(pkg)
17 |
18 | cli::cli_inform(c(i = "Linting {.pkg {pkg$package}}"))
19 |
20 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
21 |
22 | lintr::lint_package(pkg$path, cache = cache, ...)
23 | }
24 |
--------------------------------------------------------------------------------
/R/missing-s3.R:
--------------------------------------------------------------------------------
1 | #' Find missing s3 exports.
2 | #'
3 | #' The method is heuristic - looking for objs with a period in their name.
4 | #'
5 | #' @template devtools
6 | #' @export
7 | missing_s3 <- function(pkg = ".") {
8 | pkg <- as.package(pkg)
9 | loaded <- load_all(pkg$path)
10 |
11 | # Find all S3 methods in package
12 | objs <- ls(envir = loaded$env)
13 | is_s3 <- function(x) roxygen2::is_s3_method(x, env = loaded$env)
14 | s3_objs <- Filter(is_s3, objs)
15 |
16 | # Find all S3 methods in NAMESPACE
17 | ns <- pkgload::parse_ns_file(pkg$path)
18 | exports <- paste(ns$S3methods[, 1], ns$S3methods[, 2], sep = ".")
19 |
20 | setdiff(s3_objs, exports)
21 | }
22 |
--------------------------------------------------------------------------------
/R/package-deps.R:
--------------------------------------------------------------------------------
1 | #' @importFrom pkgload parse_deps
2 | #' @export
3 | pkgload::parse_deps
4 |
5 | #' @importFrom pkgload check_dep_version
6 | #' @export
7 | pkgload::check_dep_version
8 |
--------------------------------------------------------------------------------
/R/package.R:
--------------------------------------------------------------------------------
1 | #' Coerce input to a package.
2 | #'
3 | #' Possible specifications of package:
4 | #' \itemize{
5 | #' \item path
6 | #' \item package object
7 | #' }
8 | #' @param x object to coerce to a package
9 | #' @param create `r lifecycle::badge("deprecated")` Hasn't worked for some time.
10 | #' @export
11 | #' @keywords internal
12 | as.package <- function(x = NULL, create = deprecated()) {
13 | if (is.package(x)) return(x)
14 | if (lifecycle::is_present(create)) {
15 | lifecycle::deprecate_warn("2.5.0", "as.package(create = )")
16 | }
17 |
18 | x <- package_file(path = x)
19 | load_pkg_description(x)
20 | }
21 |
22 | #' Find file in a package.
23 | #'
24 | #' It always starts by walking up the path until it finds the root directory,
25 | #' i.e. a directory containing `DESCRIPTION`. If it cannot find the root
26 | #' directory, or it can't find the specified path, it will throw an error.
27 | #'
28 | #' @param ... Components of the path.
29 | #' @param path Place to start search for package directory.
30 | #' @keywords internal
31 | #' @export
32 | #' @examples
33 | #' \dontrun{
34 | #' package_file("figures", "figure_1")
35 | #' }
36 | package_file <- function(..., path = ".") {
37 | if (!is.character(path) || length(path) != 1) {
38 | cli::cli_abort("{.arg path} must be a string.")
39 | }
40 | if (!dir_exists(path)) {
41 | cli::cli_abort("{.path {path}} is not a directory.")
42 | }
43 |
44 | base_path <- path
45 | path <- strip_slashes(path_real(path))
46 |
47 | # Walk up to root directory
48 | while (!has_description(path)) {
49 | path <- path_dir(path)
50 |
51 | if (is_root(path)) {
52 | cli::cli_abort(c(
53 | "Could not find package root.",
54 | i = "Is {.path {base_path}} inside a package?"
55 | ))
56 | }
57 | }
58 |
59 | path(path, ...)
60 | }
61 |
62 | has_description <- function(path) {
63 | file_exists(path(path, "DESCRIPTION"))
64 | }
65 |
66 | is_root <- function(path) {
67 | identical(path, path_dir(path))
68 | }
69 |
70 | strip_slashes <- function(x) {
71 | x <- sub("/*$", "", x)
72 | x
73 | }
74 |
75 | # Load package DESCRIPTION into convenient form.
76 | load_pkg_description <- function(path) {
77 | path_desc <- path(path, "DESCRIPTION")
78 |
79 | info <- read.dcf(path_desc)[1, ]
80 | Encoding(info) <- 'UTF-8'
81 | desc <- as.list(info)
82 | names(desc) <- tolower(names(desc))
83 | desc$path <- path
84 |
85 | structure(desc, class = "package")
86 | }
87 |
88 | #' Is the object a package?
89 | #'
90 | #' @keywords internal
91 | #' @export
92 | is.package <- function(x) inherits(x, "package")
93 |
94 | # Mockable variant of interactive
95 | interactive <- function() .Primitive("interactive")()
96 |
--------------------------------------------------------------------------------
/R/pkgbuild.R:
--------------------------------------------------------------------------------
1 | #' @template devtools
2 | #' @param path Path in which to produce package. If `NULL`, defaults to
3 | #' the parent directory of the package.
4 | #' @inherit pkgbuild::build
5 | #' @note The default `manual = FALSE` is not suitable for a CRAN
6 | #' submission, which may require `manual = TRUE`. Even better, use
7 | #' [submit_cran()] or [release()].
8 | #' @param ... Additional arguments passed to [pkgbuild::build].
9 | #' @export
10 | build <- function(pkg = ".", path = NULL, binary = FALSE, vignettes = TRUE,
11 | manual = FALSE, args = NULL, quiet = FALSE, ...) {
12 | save_all()
13 |
14 | if (!file_exists(pkg)) {
15 | cli::cli_abort("{.arg pkg} must exist")
16 | }
17 |
18 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
19 |
20 | pkgbuild::build(
21 | path = pkg, dest_path = path, binary = binary,
22 | vignettes = vignettes, manual = manual, args = args, quiet = quiet, ...
23 | )
24 | }
25 |
26 | #' @importFrom pkgbuild with_debug
27 | #' @export
28 | pkgbuild::with_debug
29 |
30 | #' @importFrom pkgbuild clean_dll
31 | #' @export
32 | pkgbuild::clean_dll
33 |
34 | #' @importFrom pkgbuild has_devel
35 | #' @export
36 | pkgbuild::has_devel
37 |
38 | #' @importFrom pkgbuild find_rtools
39 | #' @export
40 | pkgbuild::find_rtools
41 |
--------------------------------------------------------------------------------
/R/pkgload.R:
--------------------------------------------------------------------------------
1 | #' @inherit pkgload::load_all
2 | #' @param ... Additional arguments passed to [pkgload::load_all()].
3 | #' @export
4 | load_all <- function(path = ".", reset = TRUE, recompile = FALSE,
5 | export_all = TRUE, helpers = TRUE, quiet = FALSE, ...) {
6 | if (inherits(path, "package")) {
7 | path <- path$path
8 | }
9 |
10 | save_all()
11 |
12 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
13 |
14 | pkgload::load_all(
15 | path = path, reset = reset, recompile = recompile,
16 | export_all = export_all, helpers = helpers, quiet = quiet, ...
17 | )
18 | }
19 |
20 | #' @importFrom pkgload unload
21 | #' @export
22 | pkgload::unload
23 |
--------------------------------------------------------------------------------
/R/r-hub.R:
--------------------------------------------------------------------------------
1 |
2 | #' Run CRAN checks for package on R-hub
3 | #'
4 | #' It runs [build()] on the package, with the arguments specified
5 | #' in `args`, and then submits it to the R-hub builder at
6 | #' . The `interactive` option controls
7 | #' whether the function waits for the check output. Regardless, after the
8 | #' check is complete, R-hub sends an email with the results to the package
9 | #' maintainer.
10 | #'
11 | #' @section About email validation on r-hub:
12 | #' To build and check R packages on R-hub, you need to validate your
13 | #' email address. This is because R-hub sends out emails about build
14 | #' results. See more at [rhub::validate_email()].
15 | #'
16 | #' @param platforms R-hub platforms to run the check on. If `NULL`
17 | #' uses default list of CRAN checkers (one for each major platform, and
18 | #' one with extra checks if you have compiled code). You can also specify
19 | #' your own, see [rhub::platforms()] for a complete list.
20 | #' @param email email address to notify, defaults to the maintainer
21 | #' address in the package.
22 | #' @param interactive whether to show the status of the build
23 | #' interactively. R-hub will send an email to the package maintainer's
24 | #' email address, regardless of whether the check is interactive or not.
25 | #' @param build_args Arguments passed to `R CMD build`
26 | #' @param ... extra arguments, passed to [rhub::check_for_cran()].
27 | #' @inheritParams check
28 | #' @family build functions
29 | #' @return a `rhub_check` object.
30 | #'
31 | #' @export
32 |
33 | check_rhub <- function(pkg = ".",
34 | platforms = NULL,
35 | email = NULL,
36 | interactive = TRUE,
37 | build_args = NULL,
38 | ...) {
39 | rlang::check_installed("rhub")
40 | pkg <- as.package(pkg)
41 |
42 | built_path <- build(pkg$path, tempdir(), quiet = !interactive,
43 | args = build_args)
44 | on.exit(file_delete(built_path), add = TRUE)
45 |
46 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
47 |
48 | status <- rhub::check_for_cran(
49 | path = built_path,
50 | email = email,
51 | platforms = platforms,
52 | show_status = interactive,
53 | ...
54 | )
55 |
56 | if (!interactive) {
57 | cli::cli_inform(c(v = "R-hub check for package {.pkg {pkg$package}} submitted."))
58 | status
59 | } else {
60 | status
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/R/reload.R:
--------------------------------------------------------------------------------
1 | #' Unload and reload package.
2 | #'
3 | #' This attempts to unload and reload an _installed_ package. If the package is
4 | #' not loaded already, it does nothing. It's not always possible to cleanly
5 | #' unload a package: see the caveats in [unload()] for some of the potential
6 | #' failure points. If in doubt, restart R and reload the package with
7 | #' [library()].
8 | #'
9 | #' @template devtools
10 | #' @param quiet if `TRUE` suppresses output from this function.
11 | #' @seealso [load_all()] to load a package for interactive development.
12 | #' @examples
13 | #' \dontrun{
14 | #' # Reload package that is in current directory
15 | #' reload(".")
16 | #'
17 | #' # Reload package that is in ./ggplot2/
18 | #' reload("ggplot2/")
19 | #'
20 | #' # Can use inst() to find the package path
21 | #' # This will reload the installed ggplot2 package
22 | #' reload(pkgload::inst("ggplot2"))
23 | #' }
24 | #' @export
25 | reload <- function(pkg = ".", quiet = FALSE) {
26 | pkg <- as.package(pkg)
27 |
28 | if (is_attached(pkg)) {
29 | if (!quiet) cli::cli_inform(c(i = "Reloading attached {.pkg {pkg$package}}"))
30 | pkgload::unload(pkg$package)
31 | require(pkg$package, character.only = TRUE, quietly = TRUE)
32 | } else if (is_loaded(pkg)) {
33 | if (!quiet) cli::cli_inform(c(i = "Reloading loaded {.pkg {pkg$package}}"))
34 | pkgload::unload(pkg$package)
35 | requireNamespace(pkg$package, quietly = TRUE)
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/R/remotes.R:
--------------------------------------------------------------------------------
1 | #' @importFrom ellipsis check_dots_used
2 | with_ellipsis <- function(fun) {
3 | b <- body(fun)
4 |
5 | f <- function(...) {
6 | ellipsis::check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
7 |
8 | !! b
9 | }
10 | f <- rlang::expr_interp(f)
11 |
12 | body(fun) <- body(f)
13 | fun
14 | }
15 |
16 | with_pkgbuild_build_tools <- function(fun) {
17 | b <- body(fun)
18 | pkgbuild_call <- as.call(c(call("::", as.symbol("pkgbuild"), as.symbol("with_build_tools")), b, list(required = FALSE)))
19 |
20 | body(fun) <- pkgbuild_call
21 | fun
22 | }
23 |
24 | #' Functions re-exported from the remotes package
25 | #'
26 |
27 | #' These functions are re-exported from the remotes package. They differ only
28 | #' that the ones in devtools use the [ellipsis] package to ensure all dotted
29 | #' arguments are used.
30 | #'
31 | #' Follow the links below to see the documentation.
32 | #' [remotes::install_bioc()], [remotes::install_bitbucket()], [remotes::install_cran()], [remotes::install_dev()],
33 | #' [remotes::install_git()], [remotes::install_github()], [remotes::install_gitlab()], [remotes::install_local()],
34 | #' [remotes::install_svn()], [remotes::install_url()], [remotes::install_version()], [remotes::update_packages()],
35 | #' [remotes::dev_package_deps()].
36 | #'
37 | #' @importFrom remotes install_bioc
38 | #' @name remote-reexports
39 | #' @keywords internal
40 | #' @export
41 | install_bioc <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_bioc))
42 |
43 | #' @importFrom remotes install_bitbucket
44 | #' @rdname remote-reexports
45 | #' @export
46 | install_bitbucket <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_bitbucket))
47 |
48 | #' @importFrom remotes install_cran
49 | #' @rdname remote-reexports
50 | #' @export
51 | install_cran <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_cran))
52 |
53 | #' @importFrom remotes install_dev
54 | #' @rdname remote-reexports
55 | #' @export
56 | install_dev <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_dev))
57 |
58 | #' @importFrom remotes install_git
59 | #' @rdname remote-reexports
60 | #' @export
61 | install_git <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_git))
62 |
63 | #' @importFrom remotes install_github
64 | #' @rdname remote-reexports
65 | #' @export
66 | install_github <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_github))
67 |
68 | #' @importFrom remotes github_pull
69 | #' @rdname reexports
70 | #' @export
71 | remotes::github_pull
72 |
73 | #' @importFrom remotes github_release
74 | #' @rdname reexports
75 | #' @export
76 | remotes::github_release
77 |
78 | #' @importFrom remotes install_gitlab
79 | #' @rdname remote-reexports
80 | #' @export
81 | install_gitlab <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_gitlab))
82 |
83 | #' @importFrom remotes install_local
84 | #' @rdname remote-reexports
85 | #' @export
86 | install_local <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_local))
87 |
88 | #' @importFrom remotes install_svn
89 | #' @rdname remote-reexports
90 | #' @export
91 | install_svn <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_svn))
92 |
93 | #' @importFrom remotes install_url
94 | #' @rdname remote-reexports
95 | #' @export
96 | install_url <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_url))
97 |
98 | #' @importFrom remotes install_version
99 | #' @rdname remote-reexports
100 | #' @export
101 | install_version <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_version))
102 |
103 | #' @importFrom remotes update_packages
104 | #' @rdname remote-reexports
105 | #' @export
106 | update_packages <- with_pkgbuild_build_tools(with_ellipsis(remotes::update_packages))
107 |
108 | #' @importFrom remotes dev_package_deps
109 | #' @rdname remote-reexports
110 | #' @export
111 | dev_package_deps <- with_pkgbuild_build_tools(remotes::dev_package_deps)
112 |
--------------------------------------------------------------------------------
/R/revdep.R:
--------------------------------------------------------------------------------
1 | #' Reverse dependency tools.
2 | #'
3 | #' Tools to check and notify maintainers of all CRAN and Bioconductor
4 | #' packages that depend on the specified package.
5 | #'
6 | #' The first run in a session will be time-consuming because it must download
7 | #' all package metadata from CRAN and Bioconductor. Subsequent runs will
8 | #' be faster.
9 | #'
10 | #' @param pkg Package name. This is unlike most devtools packages which
11 | #' take a path because you might want to determine dependencies for a package
12 | #' that you don't have installed. If omitted, defaults to the name of the
13 | #' current package.
14 | #' @param ignore A character vector of package names to ignore. These packages
15 | #' will not appear in returned vector.
16 | #' @param dependencies A character vector listing the types of dependencies
17 | #' to follow.
18 | #' @param bioconductor If `TRUE` also look for dependencies amongst
19 | #' Bioconductor packages.
20 | #' @param recursive If `TRUE` look for full set of recursive dependencies.
21 | #' @seealso The [revdepcheck](https://github.com/r-lib/revdepcheck) package can
22 | #' be used to run R CMD check on all reverse dependencies.
23 | #' @export
24 | #' @keywords internal
25 | #' @examples
26 | #' \dontrun{
27 | #' revdep("ggplot2")
28 | #'
29 | #' revdep("ggplot2", ignore = c("xkcd", "zoo"))
30 | #' }
31 | revdep <- function(pkg,
32 | dependencies = c("Depends", "Imports", "Suggests", "LinkingTo"),
33 | recursive = FALSE, ignore = NULL,
34 | bioconductor = FALSE) {
35 | if (missing(pkg)) pkg <- as.package(".")$package
36 |
37 | all <- if (bioconductor) packages() else cran_packages()
38 |
39 | deps <- tools::dependsOnPkgs(pkg, dependencies, recursive, installed = all)
40 | deps <- setdiff(deps, ignore)
41 | sort_ci(deps)
42 | }
43 |
44 | #' @rdname revdep
45 | #' @export
46 | revdep_maintainers <- function(pkg = ".") {
47 | if (missing(pkg)) pkg <- as.package(".")$package
48 |
49 | maintainers <- unique(packages()[revdep(pkg), "Maintainer"])
50 | class(maintainers) <- "maintainers"
51 |
52 | maintainers
53 | }
54 |
55 | #' @export
56 | print.maintainers <- function(x, ...) {
57 | x <- gsub("\n", " ", x)
58 | cat(x, sep = ",\n")
59 | cat("\n")
60 | }
61 |
62 | # Package caches ----------------------------------------------------------
63 |
64 | cran_packages <- memoise::memoise(
65 | function() {
66 | local <- path_temp("packages.rds")
67 | utils::download.file("https://cran.R-project.org/web/packages/packages.rds", local,
68 | mode = "wb", quiet = TRUE
69 | )
70 | on.exit(file_delete(local))
71 | cp <- readRDS(local)
72 | rownames(cp) <- unname(cp[, 1])
73 | cp
74 | },
75 | ~memoise::timeout(30 * 60)
76 | )
77 |
78 | bioc_packages <- memoise::memoise(
79 | function(views = paste(BiocManager::repositories()[["BioCsoft"]], "VIEWS", sep = "/")) {
80 | con <- url(views)
81 | on.exit(close(con))
82 | bioc <- read.dcf(con)
83 | rownames(bioc) <- bioc[, 1]
84 | bioc
85 | },
86 | ~memoise::timeout(30 * 60)
87 | )
88 |
89 | packages <- function() {
90 | bioc <- bioc_packages()
91 | cran <- cran_packages()
92 | cols <- intersect(colnames(cran), colnames(bioc))
93 | rbind(cran[, cols], bioc[, cols])
94 | }
95 |
--------------------------------------------------------------------------------
/R/run-examples.R:
--------------------------------------------------------------------------------
1 | #' Run all examples in a package.
2 | #'
3 | #' One of the most frustrating parts of `R CMD check` is getting all of your
4 | #' examples to pass - whenever one fails you need to fix the problem and then
5 | #' restart the whole process. This function makes it a little easier by
6 | #' making it possible to run all examples from an R function.
7 | #'
8 | #' @template devtools
9 | #' @inheritParams pkgload::run_example
10 | #' @param start Where to start running the examples: this can either be the
11 | #' name of `Rd` file to start with (with or without extensions), or
12 | #' a topic name. If omitted, will start with the (lexicographically) first
13 | #' file. This is useful if you have a lot of examples and don't want to
14 | #' rerun them every time you fix a problem.
15 | #' @family example functions
16 | #' @param show DEPRECATED.
17 | #' @param fresh if `TRUE`, will be run in a fresh R session. This has
18 | #' the advantage that there's no way the examples can depend on anything in
19 | #' the current session, but interactive code (like [browser()])
20 | #' won't work.
21 | #' @param document if `TRUE`, [document()] will be run to ensure
22 | #' examples are updated before running them.
23 | #' @keywords programming
24 | #' @export
25 | run_examples <- function(pkg = ".", start = NULL, show = deprecated(), run_donttest = FALSE,
26 | run_dontrun = FALSE, fresh = FALSE, document = TRUE,
27 | run = deprecated(), test = deprecated()) {
28 |
29 | if (!missing(run)) {
30 | lifecycle::deprecate_warn("2.3.1", "run_examples(run)", 'run_example(run_dontrun)')
31 | run_dontrun <- run
32 | }
33 | if (!missing(test)) {
34 | lifecycle::deprecate_warn("2.3.1", "run_examples(test)", 'run_example(run_donttest)')
35 | run_donttest <- test
36 | }
37 | if (!missing(show)) {
38 | lifecycle::deprecate_warn("2.3.1", "run_examples(show)")
39 | }
40 |
41 | pkg <- as.package(pkg)
42 |
43 | if (fresh) {
44 | to_run <-
45 | function(path, start, run_donttest, run_dontrun) devtools::run_examples(pkg = path, start = start, run_donttest = run_donttest, run_dontrun = run_dontrun, document = FALSE)
46 |
47 | callr::r(to_run, args = list(path = pkg$path, start = start, run_donttest = run_donttest, run_dontrun = run_dontrun), show = TRUE, spinner = FALSE, stderr = "2>&1")
48 | return(invisible())
49 | }
50 |
51 | if (document) {
52 | document(pkg)
53 | }
54 |
55 | files <- rd_files(pkg$path, start = start)
56 | if (length(files) == 0) {
57 | return()
58 | }
59 |
60 | cat_rule(
61 | left = paste0("Running ", length(files), " example files"),
62 | right = pkg$package
63 | )
64 |
65 | load_all(pkg$path, reset = TRUE, export_all = FALSE, helpers = FALSE)
66 | on.exit(load_all(pkg$path, reset = TRUE))
67 |
68 | lapply(files, pkgload::run_example, run_donttest = run_donttest, run_dontrun = run_dontrun)
69 |
70 | invisible()
71 | }
72 | # If an error occurs, should print out the suspect line of code, and offer
73 | # the following options:
74 | # * skip to the next example
75 | # * quit
76 | # * browser
77 | # * rerun example and rerun
78 | # * reload code and rerun
79 |
80 |
81 | rd_files <- function(pkg = ".", start = NULL) {
82 | pkg <- as.package(pkg)
83 |
84 | path_man <- path(pkg$path, "man")
85 | files <- dir_ls(path_man, regexp = "\\.[Rr]d$")
86 | names(files) <- path_file(files)
87 | files <- sort_ci(files)
88 |
89 | if (!is.null(start)) {
90 | topic <- pkgload::dev_help(start, dev_packages = pkg$package)
91 | start_path <- path_file(topic$path)
92 |
93 | start_pos <- which(names(files) == start_path)
94 | if (length(start_pos) == 1) {
95 | files <- files[-seq(1, start_pos - 1)]
96 | }
97 | }
98 |
99 | files
100 | }
101 |
--------------------------------------------------------------------------------
/R/save-all.R:
--------------------------------------------------------------------------------
1 | #' Save all documents in an active IDE session.
2 | #'
3 | #' Helper function wrapping IDE-specific calls to save all documents in the
4 | #' active session. In this form, callers of `save_all()` don't need to
5 | #' execute any IDE-specific code. This function can be extended to include
6 | #' other IDE implementations of their equivalent
7 | #' `rstudioapi::documentSaveAll()` methods.
8 | #' @return NULL
9 | save_all <- function() {
10 | if (rstudioapi::hasFun("documentSaveAll")) {
11 | rstudioapi::documentSaveAll()
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/R/session-info.R:
--------------------------------------------------------------------------------
1 | #' Return a vector of names of attached packages
2 | #' @export
3 | #' @keywords internal
4 | #' @return A data frame with columns package and path, giving the name of
5 | #' each package and the path it was loaded from.
6 | loaded_packages <- function() {
7 | attached <- data.frame(
8 | package = search(),
9 | path = searchpaths(),
10 | stringsAsFactors = FALSE
11 | )
12 | packages <- attached[grepl("^package:", attached$package), , drop = FALSE]
13 | rownames(packages) <- NULL
14 |
15 | packages$package <- sub("^package:", "", packages$package)
16 | packages
17 | }
18 |
19 | #' Return a vector of names of packages loaded by devtools
20 | #' @export
21 | #' @keywords internal
22 | dev_packages <- function() {
23 | packages <- vapply(
24 | loadedNamespaces(),
25 | function(x) !is.null(pkgload::dev_meta(x)), logical(1)
26 | )
27 |
28 | names(packages)[packages]
29 | }
30 |
31 | #' @export
32 | #' @importFrom sessioninfo session_info
33 | sessioninfo::session_info
34 |
35 | #' @export
36 | #' @importFrom sessioninfo package_info
37 | sessioninfo::package_info
38 |
--------------------------------------------------------------------------------
/R/show-news.R:
--------------------------------------------------------------------------------
1 | #' Show package news
2 | #'
3 | #' @template devtools
4 | #' @param latest if `TRUE`, only show the news for the most recent
5 | #' version.
6 | #' @param ... other arguments passed on to `news`
7 | #' @export
8 | show_news <- function(pkg = ".", latest = TRUE, ...) {
9 | pkg <- as.package(pkg)
10 | news_path <- path(pkg$path, "NEWS")
11 |
12 | if (!file_exists(news_path)) {
13 | cli::cli_abort("No NEWS found")
14 | }
15 |
16 | check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
17 |
18 | out <- utils::news(..., db = ("tools" %:::% ".news_reader_default")(news_path))
19 | if (latest) {
20 | ver <- numeric_version(out$Version)
21 | recent <- ver == max(ver)
22 | structure(out[recent, ],
23 | class = class(out),
24 | bad = attr(out, "bad")[recent]
25 | )
26 | } else {
27 | out
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/R/spell-check.R:
--------------------------------------------------------------------------------
1 | #' Spell checking
2 | #'
3 | #' Runs a spell check on text fields in the package description file, manual
4 | #' pages, and optionally vignettes. Wraps the \link[spelling:spell_check_package]{spelling}
5 | #' package.
6 | #'
7 | #' @export
8 | #' @rdname spell_check
9 | #' @template devtools
10 | #' @param vignettes also check all `rmd` and `rnw` files in the pkg `vignettes` folder
11 | #' @param use_wordlist ignore words in the package [WORDLIST][spelling::get_wordlist] file
12 | spell_check <- function(pkg = ".", vignettes = TRUE, use_wordlist = TRUE) {
13 | rlang::check_installed("spelling")
14 | pkg <- as.package(pkg)
15 | spelling::spell_check_package(pkg = pkg, vignettes = vignettes, use_wordlist = use_wordlist)
16 | }
17 |
--------------------------------------------------------------------------------
/R/uninstall.R:
--------------------------------------------------------------------------------
1 | #' Uninstall a local development package
2 | #'
3 | #' Uses `remove.packages()` to uninstall the package. To uninstall a package
4 | #' from a non-default library, use in combination with [withr::with_libpaths()].
5 | #'
6 | #' @inheritParams install
7 | #' @param unload if `TRUE` (the default), ensures the package is unloaded, prior
8 | #' to uninstalling.
9 | #' @inheritParams utils::remove.packages
10 | #' @export
11 | #' @family package installation
12 | #' @seealso [with_debug()] to install packages with debugging flags set.
13 | uninstall <- function(pkg = ".", unload = TRUE, quiet = FALSE, lib = .libPaths()[[1]]) {
14 | pkg <- as.package(pkg)
15 |
16 | if (unload && pkg$package %in% loaded_packages()$package) {
17 | pkgload::unload(pkg$package)
18 | }
19 |
20 | if (!quiet) {
21 | cli::cli_inform(c(i = "Uninstalling {.pkg {pkg$package}}"))
22 | }
23 |
24 | remove.packages(pkg$package, .libPaths()[[1]])
25 |
26 | invisible(TRUE)
27 | }
28 |
--------------------------------------------------------------------------------
/R/usethis.R:
--------------------------------------------------------------------------------
1 | # Some helpers around usethis functions
2 |
3 | # we need to import some usethis function so the namespace is loaded when
4 | # devtools is loaded, but not attached.
5 | #' @importFrom usethis use_test
6 | NULL
7 |
8 | usethis_use_testthat <- function(pkg) {
9 | usethis::local_project(pkg$path, quiet = FALSE)
10 | usethis::use_testthat()
11 | }
12 |
13 | usethis_use_directory <- function(pkg, path, ignore = FALSE) {
14 | usethis::local_project(pkg$path, quiet = TRUE)
15 | usethis::use_directory(path, ignore)
16 | }
17 |
18 | usethis_use_git_ignore <- function(pkg, ignores, ignore = FALSE) {
19 | usethis::local_project(pkg$path, quiet = TRUE)
20 | usethis::use_git_ignore(ignores)
21 | }
22 |
--------------------------------------------------------------------------------
/R/utils.R:
--------------------------------------------------------------------------------
1 | compact <- function(x) {
2 | is_empty <- vapply(x, function(x) length(x) == 0, logical(1))
3 | x[!is_empty]
4 | }
5 |
6 | "%||%" <- function(a, b) if (!is.null(a)) a else b
7 |
8 | "%:::%" <- function(p, f) {
9 | get(f, envir = asNamespace(p))
10 | }
11 |
12 | is_windows <- isTRUE(.Platform$OS.type == "windows")
13 | is_macos <- isTRUE(tolower(Sys.info()[["sysname"]]) == "darwin")
14 |
15 | sort_ci <- function(x) {
16 | withr::with_collate("C", x[order(tolower(x), x)])
17 | }
18 |
19 | is_loaded <- function(pkg = ".") {
20 | pkg <- as.package(pkg)
21 | pkg$package %in% loadedNamespaces()
22 | }
23 |
24 | is_attached <- function(pkg = ".") {
25 | pkg <- as.package(pkg)
26 |
27 | !is.null(pkgload::pkg_env(pkg$package))
28 | }
29 |
30 | vcapply <- function(x, FUN, ...) {
31 | vapply(x, FUN, FUN.VALUE = character(1), ...)
32 | }
33 |
34 | release_bullets <- function() {
35 | c(
36 | '`usethis::use_latest_dependencies(TRUE, "CRAN")`',
37 | NULL
38 | )
39 | }
40 |
41 | is_testing <- function() {
42 | identical(Sys.getenv("TESTTHAT"), "true")
43 | }
44 |
45 | is_rstudio_running <- function() {
46 | !is_testing() && rstudioapi::isAvailable()
47 | }
48 |
--------------------------------------------------------------------------------
/R/vignette-r.R:
--------------------------------------------------------------------------------
1 | copy_vignettes <- function(pkg, keep_md) {
2 | pkg <- as.package(pkg)
3 |
4 | usethis_use_directory(pkg, "doc", ignore = TRUE)
5 | usethis_use_git_ignore(pkg, "/doc/")
6 |
7 | doc_dir <- path(pkg$path, "doc")
8 |
9 | vignettes <- tools::pkgVignettes(dir = pkg$path, output = TRUE, source = TRUE)
10 | if (length(vignettes$docs) == 0) {
11 | return(invisible())
12 | }
13 |
14 | md_outputs <- character()
15 | if (isTRUE(keep_md)) {
16 | md_outputs <- dir_ls(path = vignettes$dir, regexp = "[.]md$")
17 | }
18 |
19 | out_mv <- unique(c(
20 | md_outputs,
21 | vignettes$outputs,
22 | unlist(vignettes$sources, use.names = FALSE)
23 | ))
24 | out_cp <- vignettes$docs
25 |
26 | cli::cli_inform(c(i = "Moving {.file {path_file(out_mv)}} to {.path doc/}"))
27 | file_copy(out_mv, doc_dir, overwrite = TRUE)
28 | file_delete(out_mv)
29 |
30 | cli::cli_inform(c(i = "Copying {.file {path_file(out_cp)}} to {.path doc/}"))
31 | file_copy(out_cp, doc_dir, overwrite = TRUE)
32 |
33 | # Copy extra files, if needed
34 | extra_files <- find_vignette_extras(pkg)
35 | if (length(extra_files) == 0) {
36 | return(invisible())
37 | }
38 |
39 | cli::cli_inform(c(i = "Copying extra files {.file {path_file(extra_files)}} to {.path doc/}"))
40 | file_copy(extra_files, doc_dir)
41 |
42 | invisible()
43 | }
44 |
45 | find_vignette_extras <- function(pkg = ".") {
46 | pkg <- as.package(pkg)
47 |
48 | vig_path <- path(pkg$path, "vignettes")
49 | extras_file <- path(vig_path, ".install_extras")
50 | if (!file_exists(extras_file)) {
51 | return(character())
52 | }
53 |
54 | extras <- readLines(extras_file, warn = FALSE)
55 |
56 | if (length(extras) == 0) {
57 | return(character())
58 | }
59 |
60 | all_files <- path_rel(dir_ls(vig_path, all = TRUE), vig_path)
61 |
62 | re <- paste0(extras, collapse = "|")
63 | files <- grep(re, all_files, perl = TRUE, ignore.case = TRUE, value = TRUE)
64 |
65 | path_real(path(vig_path, files))
66 | }
67 |
--------------------------------------------------------------------------------
/R/vignettes.R:
--------------------------------------------------------------------------------
1 | #' Build package vignettes.
2 | #'
3 | #' Builds package vignettes using the same algorithm that `R CMD build`
4 | #' does. This means including non-Sweave vignettes, using makefiles (if
5 | #' present), and copying over extra files. The files are copied in the 'doc'
6 | #' directory and an vignette index is created in 'Meta/vignette.rds', as they
7 | #' would be in a built package. 'doc' and 'Meta' are added to
8 | #' `.Rbuildignore`, so will not be included in the built package. These
9 | #' files can be checked into version control, so they can be viewed with
10 | #' `browseVignettes()` and `vignette()` if the package has been
11 | #' loaded with `load_all()` without needing to re-build them locally.
12 | #'
13 | #' @template devtools
14 | #' @param quiet If `TRUE`, suppresses most output. Set to `FALSE`
15 | #' if you need to debug.
16 | #' @param install If `TRUE`, install the package before building
17 | #' vignettes.
18 | #' @param keep_md If `TRUE`, move md intermediates as well as rendered
19 | #' outputs. Most useful when using the `keep_md` YAML option for Rmarkdown
20 | #' outputs. See
21 | #' .
22 | #' @inheritParams tools::buildVignettes
23 | #' @inheritParams remotes::install_deps
24 | #' @importFrom stats update
25 | #' @keywords programming
26 | #' @seealso [clean_vignettes()] to remove the pdfs in
27 | #' \file{doc} created from vignettes
28 | #' @export
29 | #' @seealso [clean_vignettes()] to remove build tex/pdf files.
30 | build_vignettes <- function(pkg = ".",
31 | dependencies = "VignetteBuilder",
32 | clean = TRUE,
33 | upgrade = "never",
34 | quiet = FALSE,
35 | install = TRUE,
36 | keep_md = TRUE) {
37 | pkg <- as.package(pkg)
38 | save_all()
39 |
40 | vigns <- tools::pkgVignettes(dir = pkg$path)
41 | if (length(vigns$docs) == 0) return()
42 |
43 | deps <- remotes::dev_package_deps(pkg$path, dependencies)
44 | update(deps, upgrade = upgrade)
45 |
46 | if (isTRUE(install)) {
47 | local_install(pkg, quiet = TRUE)
48 | }
49 |
50 | cli::cli_inform(c(i = "Building vignettes for {.pkg {pkg$package}}"))
51 | callr::r(
52 | function(...) tools::buildVignettes(...),
53 | args = list(
54 | dir = pkg$path,
55 | clean = clean,
56 | tangle = TRUE,
57 | quiet = quiet
58 | ),
59 | show = !quiet,
60 | spinner = FALSE
61 | )
62 |
63 | # We need to re-run pkgVignettes now that they are built to get the output
64 | # files as well
65 | cli::cli_inform(c(i = "Copying vignettes"))
66 | vigns <- tools::pkgVignettes(dir = pkg$path, source = TRUE, output = TRUE)
67 | copy_vignettes(pkg, keep_md)
68 | create_vignette_index(pkg, vigns)
69 |
70 | invisible(TRUE)
71 | }
72 |
73 | create_vignette_index <- function(pkg, vigns) {
74 | cli::cli_inform(c(i = "Building vignette index"))
75 |
76 | usethis_use_directory(pkg, "Meta", ignore = TRUE)
77 | usethis_use_git_ignore(pkg, "/Meta/")
78 |
79 | vignette_index <- ("tools" %:::% ".build_vignette_index")(vigns)
80 | vignette_index_path <- path(pkg$path, "Meta", "vignette.rds")
81 |
82 | saveRDS(vignette_index, vignette_index_path, version = 2L)
83 | }
84 |
85 | #' Clean built vignettes.
86 | #'
87 | #' This uses a fairly rudimentary algorithm where any files in \file{doc}
88 | #' with a name that exists in \file{vignettes} are removed.
89 | #'
90 | #' @template devtools
91 | #' @export
92 | clean_vignettes <- function(pkg = ".") {
93 | pkg <- as.package(pkg)
94 | vigns <- tools::pkgVignettes(dir = pkg$path)
95 | if (path_file(vigns$dir) != "vignettes") return()
96 |
97 | cli::cli_inform(c(i = "Cleaning built vignettes and index from {.pkg {pkg$package}}"))
98 |
99 | doc_path <- path(pkg$path, "doc")
100 |
101 | vig_candidates <- if (dir_exists(doc_path)) dir_ls(doc_path) else character()
102 | vig_rm <- vig_candidates[file_name(vig_candidates) %in% file_name(vigns$docs)]
103 |
104 | extra_candidates <- path(doc_path, path_file(find_vignette_extras(pkg)))
105 | extra_rm <- extra_candidates[file_exists(extra_candidates)]
106 |
107 | meta_path <- path(pkg$path, "Meta")
108 | vig_index_path <- path(meta_path, "vignette.rds")
109 | vig_index_rm <- if (file_exists(vig_index_path)) vig_index_path
110 |
111 | to_remove <- c(vig_rm, extra_rm, vig_index_rm)
112 | if (length(to_remove) > 0) {
113 | cli::cli_inform(c(x = "Removing {.file {path_file(to_remove)}}"))
114 | file_delete(to_remove)
115 | }
116 |
117 | lapply(c(doc_path, meta_path), dir_delete_if_empty)
118 |
119 | invisible(TRUE)
120 | }
121 |
122 | dir_delete_if_empty <- function(x) {
123 | if (dir_exists(x) && rlang::is_empty(dir_ls(x))) {
124 | dir_delete(x)
125 | cli::cli_inform(c(x = "Removing {.file {path_file(x)}}"))
126 | }
127 | }
128 |
129 | file_name <- function(x) {
130 | if (length(x) == 0) return(NULL)
131 | path_ext_remove(path_file(x))
132 | }
133 |
--------------------------------------------------------------------------------
/R/wd.R:
--------------------------------------------------------------------------------
1 | #' Set working directory.
2 | #'
3 | #' @template devtools
4 | #' @param path path within package. Leave empty to change working directory
5 | #' to package directory.
6 | #' @export
7 | wd <- function(pkg = ".", path = "") {
8 | pkg <- as.package(pkg)
9 | path <- path(pkg$path, path)
10 |
11 | if (!file_exists(path)) {
12 | cli::cli_abort("{.path {path} does not exist")
13 | }
14 |
15 | cli::cli_inform(c(i = "Changing working directory to {.path {path}}"))
16 | setwd(path)
17 | }
18 |
--------------------------------------------------------------------------------
/R/zzz.R:
--------------------------------------------------------------------------------
1 | #' @importFrom utils available.packages contrib.url install.packages
2 | #' installed.packages modifyList packageDescription
3 | #' packageVersion remove.packages
4 | #' @importFrom cli cat_rule cat_bullet
5 | #' @import fs
6 | NULL
7 |
8 | #' Deprecated Functions
9 | #'
10 | #' These functions are Deprecated in this release of devtools, they will be
11 | #' marked as Defunct and removed in a future version.
12 | #' @name devtools-deprecated
13 | #' @keywords internal
14 | NULL
15 |
16 | devtools_default_options <- list(
17 | devtools.path = "~/R-dev",
18 | devtools.install.args = "",
19 | devtools.ellipsis_action = rlang::warn
20 | )
21 |
22 | .onLoad <- function(libname, pkgname) {
23 | op <- options()
24 | toset <- !(names(devtools_default_options) %in% names(op))
25 | if (any(toset)) options(devtools_default_options[toset])
26 |
27 | invisible()
28 | }
29 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: https://devtools.r-lib.org/
2 |
3 | template:
4 | package: tidytemplate
5 | bootstrap: 5
6 |
7 | includes:
8 | in_header: |
9 |
10 | params:
11 | ganalytics: UA-115082821-1
12 |
13 | development:
14 | mode: auto
15 |
16 | reference:
17 | - title: Package Development
18 | desc: Primary commands used when developing a package.
19 | contents:
20 | - build
21 | - starts_with("build_")
22 | - starts_with("check_")
23 | - check
24 | - create
25 | - document
26 | - load_all
27 | - reload
28 | - release
29 | - spell_check
30 | - test
31 | - title: Package Installation
32 | contents:
33 | - starts_with("install")
34 | - uninstall
35 | - title: Utilities
36 | contents:
37 | - bash
38 | - clean_vignettes
39 | - dev_sitrep
40 | - github_pull
41 | - lint
42 | - missing_s3
43 | - run_examples
44 | - session_info
45 | - show_news
46 | - starts_with("source_")
47 | - update_packages
48 | - wd
49 | - save_all
50 |
51 | news:
52 | releases:
53 | - text: "Version 2.2.1"
54 | href: https://www.tidyverse.org/articles/2019/09/devtools-2-2-1/
55 | - text: "Version 2.0.0"
56 | href: https://www.tidyverse.org/articles/2018/10/devtools-2-0-0/
57 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | comment: false
2 |
3 | coverage:
4 | status:
5 | project:
6 | default:
7 | target: auto
8 | threshold: 1%
9 | informational: true
10 | patch:
11 | default:
12 | target: auto
13 | threshold: 1%
14 | informational: true
15 |
--------------------------------------------------------------------------------
/cran-comments.md:
--------------------------------------------------------------------------------
1 | ## revdepcheck results
2 |
3 | We checked 369 reverse dependencies (367 from CRAN + 2 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.
4 |
5 | * We saw 0 new problems
6 | * We failed to check 2 packages
7 |
8 | Issues with CRAN packages are summarised below.
9 |
10 | ### Failed to check
11 |
12 | * ctsem (NA)
13 | * nlmixr2 (NA)
14 |
--------------------------------------------------------------------------------
/devtools.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 | PackageRoxygenize: rd,collate,namespace
22 |
--------------------------------------------------------------------------------
/inst/WORDLIST:
--------------------------------------------------------------------------------
1 | Allaire
2 | AppVeyor
3 | BiocInstaller
4 | Bitbucket
5 | BugReports
6 | Bugfix
7 | CMD
8 | CYGWIN
9 | Cheatsheet
10 | Chun
11 | Coallier
12 | Codecov
13 | Config
14 | DT
15 | ERRORs
16 | Fong
17 | GitLab
18 | Github
19 | HKCU
20 | HKLM
21 | HTTPS
22 | JJ
23 | JSON
24 | Jefferis
25 | Kirill
26 | Kohske
27 | Kornelius
28 | Laake
29 | LinkingTo
30 | Lovell
31 | Maintainer's
32 | Makevars
33 | Maëlle
34 | Müller
35 | NOTEs
36 | ORCID
37 | README
38 | RTools
39 | Rbuildignore
40 | Rcpp
41 | Redd
42 | Revdep
43 | Rmarkdown
44 | Rmd
45 | Rohmeyer
46 | Roxygen
47 | Rprofile
48 | Rstudio
49 | Rtools
50 | SHA
51 | Studer
52 | Takahashi
53 | Titov
54 | UNC
55 | VignetteBuilder
56 | WARNINGs
57 | Westlake
58 | Xie
59 | YAML
60 | Yihui
61 | addin
62 | addins
63 | al
64 | amongst
65 | args
66 | artefacts
67 | behaviour
68 | bioc
69 | bitbucket
70 | callr
71 | cleandoc
72 | cli
73 | codecov
74 | codemeta
75 | compileAttributes
76 | config
77 | covr
78 | cran
79 | dev
80 | devmode
81 | dplyr
82 | env
83 | envvar
84 | et
85 | fieldnames
86 | focussed
87 | forkable
88 | foreseeable
89 | fs
90 | funder
91 | gcc
92 | gists
93 | github
94 | gitorious
95 | gz
96 | hadley
97 | http
98 | https
99 | hunspell
100 | importFrom
101 | initialising
102 | installable
103 | io
104 | json
105 | knitr
106 | landroni
107 | lexicographically
108 | libcurl
109 | libpaths
110 | linters
111 | lintr
112 | linux
113 | macOS
114 | maintainer's
115 | makefiles
116 | md
117 | miniUI
118 | mnel
119 | nchar
120 | objs
121 | onLoad
122 | pandoc
123 | param
124 | params
125 | passthrough
126 | pkgbuild
127 | pkgdown
128 | pkgload
129 | pkgs
130 | pre
131 | processx
132 | profvis
133 | pryr
134 | rOpenSci
135 | randomises
136 | rcmdcheck
137 | rds
138 | readme
139 | realisation
140 | reinstalls
141 | repo
142 | repos
143 | revdep
144 | revdepcheck
145 | rgl
146 | rlang
147 | roclet
148 | roxygen
149 | rstudio
150 | rstudioapi
151 | rtools
152 | sessioninfo
153 | sha
154 | snuck
155 | src
156 | srcreferences
157 | srcrefs
158 | subdir
159 | submodules
160 | summarised
161 | summarises
162 | svg
163 | synchronise
164 | testthat
165 | tex
166 | tgz
167 | toolchain
168 | travis
169 | trimws
170 | un
171 | uncommited
172 | urlchecker
173 | usethis
174 | vectorised
175 | withr
176 | wordlists
177 | xxxx
178 | yml
179 |
--------------------------------------------------------------------------------
/inst/rstudio/addins.dcf:
--------------------------------------------------------------------------------
1 | Name: Run a test file
2 | Description: Run the current test file, using `devtools::test_active_file()`.
3 | Binding: test_active_file
4 | Interactive: true
5 |
6 | Name: Report test coverage for a file
7 | Description: Calculate and report test coverage for the current test file, using `devtools::test_coverage_active_file()`.
8 | Binding: test_coverage_active_file
9 | Interactive: true
10 |
11 | Name: Report test coverage for a package
12 | Description: Calculate and report the test coverage for the current package, using `devtools::test_coverage()`.
13 | Binding: test_coverage
14 | Interactive: true
15 |
16 | Name: Document a package
17 | Description: A wrapper for `roxygen`'s `roxygen2::roxygenize()`
18 | Binding: document
19 | Interactive: true
20 |
21 | Name: Run examples
22 | Description: Runs R code in examples using `devtools::run_examples()`
23 | Binding: run_examples
24 | Interactive: true
25 |
--------------------------------------------------------------------------------
/man-roxygen/devtools.R:
--------------------------------------------------------------------------------
1 | #' @param pkg The package to use, can be a file path to the package or a
2 | #' package object. See [as.package()] for more information.
3 |
--------------------------------------------------------------------------------
/man/as.package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/package.R
3 | \name{as.package}
4 | \alias{as.package}
5 | \title{Coerce input to a package.}
6 | \usage{
7 | as.package(x = NULL, create = deprecated())
8 | }
9 | \arguments{
10 | \item{x}{object to coerce to a package}
11 |
12 | \item{create}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Hasn't worked for some time.}
13 | }
14 | \description{
15 | Possible specifications of package:
16 | \itemize{
17 | \item path
18 | \item package object
19 | }
20 | }
21 | \keyword{internal}
22 |
--------------------------------------------------------------------------------
/man/bash.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/bash.R
3 | \name{bash}
4 | \alias{bash}
5 | \title{Open bash shell in package directory.}
6 | \usage{
7 | bash(pkg = ".")
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 | }
13 | \description{
14 | Open bash shell in package directory.
15 | }
16 |
--------------------------------------------------------------------------------
/man/build.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pkgbuild.R
3 | \name{build}
4 | \alias{build}
5 | \title{Build package}
6 | \usage{
7 | build(
8 | pkg = ".",
9 | path = NULL,
10 | binary = FALSE,
11 | vignettes = TRUE,
12 | manual = FALSE,
13 | args = NULL,
14 | quiet = FALSE,
15 | ...
16 | )
17 | }
18 | \arguments{
19 | \item{pkg}{The package to use, can be a file path to the package or a
20 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
21 |
22 | \item{path}{Path in which to produce package. If \code{NULL}, defaults to
23 | the parent directory of the package.}
24 |
25 | \item{binary}{Produce a binary (\code{--binary}) or source (
26 | \code{--no-manual --no-resave-data}) version of the package.}
27 |
28 | \item{vignettes, manual}{For source packages: if \code{FALSE}, don't build PDF
29 | vignettes (\code{--no-build-vignettes}) or manual (\code{--no-manual}).}
30 |
31 | \item{args}{An optional character vector of additional command
32 | line arguments to be passed to \verb{R CMD build} if \code{binary = FALSE},
33 | or \verb{R CMD install} if \code{binary = TRUE}.}
34 |
35 | \item{quiet}{if \code{TRUE} suppresses output from this function.}
36 |
37 | \item{...}{Additional arguments passed to \link[pkgbuild:build]{pkgbuild::build}.}
38 | }
39 | \value{
40 | a string giving the location (including file name) of the built
41 | package
42 | }
43 | \description{
44 | Building converts a package source directory into a single bundled file.
45 | If \code{binary = FALSE} this creates a \code{tar.gz} package that can
46 | be installed on any platform, provided they have a full development
47 | environment (although packages without source code can typically be
48 | installed out of the box). If \code{binary = TRUE}, the package will have
49 | a platform specific extension (e.g. \code{.zip} for windows), and will
50 | only be installable on the current platform, but no development
51 | environment is needed.
52 | }
53 | \details{
54 | \subsection{Configuration}{
55 | \subsection{\code{DESCRIPTION} entries}{
56 | \itemize{
57 | \item \code{Config/build/clean-inst-doc} can be set to \code{FALSE} to avoid cleaning up
58 | \code{inst/doc} when building a source package. Set it to \code{TRUE} to force a
59 | cleanup. See the \code{clean_doc} argument.
60 | \item \code{Config/build/copy-method} can be used to avoid copying large
61 | directories in \verb{R CMD build}. It works by copying (or linking) the
62 | files of the package to a temporary directory, leaving out the
63 | (possibly large) files that are not part of the package. Possible
64 | values:
65 | \itemize{
66 | \item \code{none}: pkgbuild does not copy the package tree. This is the default.
67 | \item \code{copy}: the package files are copied to a temporary directory before
68 | \verb{ R CMD build}.
69 | \item \code{link}: the package files are symbolic linked to a temporary
70 | directory before \verb{R CMD build}. Windows does not have symbolic
71 | links, so on Windows this is equivalent to \code{copy}.
72 | }
73 |
74 | You can also use the \code{pkg.build_copy_method} option or the
75 | \code{PKG_BUILD_COPY_METHOD} environment variable to set the copy method.
76 | The option is consulted first, then the \code{DESCRIPTION} entry, then the
77 | environment variable.
78 | \item \code{Config/build/extra-sources} can be used to define extra source files
79 | for pkgbuild to decide whether a package DLL needs to be recompiled in
80 | \code{needs_compile()}. The syntax is a comma separated list of file names,
81 | or globs. (See \code{\link[utils:glob2rx]{utils::glob2rx()}}.) E.g. \verb{src/rust/src/*.rs} or
82 | \verb{configure*}.
83 | \item \code{Config/build/bootstrap} can be set to \code{TRUE} to run
84 | \verb{Rscript bootstrap.R} in the source directory prior to running subsequent
85 | build steps.
86 | }
87 | }
88 |
89 | \subsection{Options}{
90 | \itemize{
91 | \item \code{pkg.build_copy_method}: use this option to avoid copying large
92 | directories when building a package. See possible values above, at the
93 | \code{Config/build/copy-method} \code{DESCRIPTION} entry.
94 | \item \code{pkg.build_stop_for_warnings}: if it is set to \code{TRUE}, then pkgbuild
95 | will stop for \verb{R CMD build} errors. It takes precedence over the
96 | \code{PKG_BUILD_STOP_FOR_WARNINGS} environment variable.
97 | }
98 | }
99 |
100 | \subsection{Environment variables}{
101 | \itemize{
102 | \item \code{PKG_BUILD_COLOR_DIAGNOSTICS}: set it to \code{false} to opt out of colored
103 | compiler diagnostics. Set it to \code{true} to force colored compiler
104 | diagnostics.
105 | \item \code{PKG_BUILD_COPY_METHOD}: use this environment variable to avoid copying
106 | large directories when building a package. See possible values above,
107 | at the \code{Config/build/copy-method} \code{DESCRIPTION} entry.
108 | }
109 |
110 | will stop for \verb{R CMD build} errors. The \code{pkg.build_stop_for_warnings}
111 | option takes precedence over this environment variable.
112 | }
113 |
114 | }
115 | }
116 | \note{
117 | The default \code{manual = FALSE} is not suitable for a CRAN
118 | submission, which may require \code{manual = TRUE}. Even better, use
119 | \code{\link[=submit_cran]{submit_cran()}} or \code{\link[=release]{release()}}.
120 | }
121 |
--------------------------------------------------------------------------------
/man/build_manual.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/build-manual.R
3 | \name{build_manual}
4 | \alias{build_manual}
5 | \title{Create package pdf manual}
6 | \usage{
7 | build_manual(pkg = ".", path = NULL)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{path}{path in which to produce package manual.
14 | If \code{NULL}, defaults to the parent directory of the package.}
15 | }
16 | \description{
17 | Create package pdf manual
18 | }
19 | \seealso{
20 | \code{\link[=Rd2pdf]{Rd2pdf()}}
21 | }
22 |
--------------------------------------------------------------------------------
/man/build_rmd.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/build-readme.R
3 | \name{build_rmd}
4 | \alias{build_rmd}
5 | \alias{build_readme}
6 | \title{Build a Rmarkdown files package}
7 | \usage{
8 | build_rmd(files, path = ".", output_options = list(), ..., quiet = TRUE)
9 |
10 | build_readme(path = ".", quiet = TRUE, ...)
11 | }
12 | \arguments{
13 | \item{files}{The Rmarkdown files to be rendered.}
14 |
15 | \item{path}{path to the package to build the readme.}
16 |
17 | \item{output_options}{List of output options that can override the options
18 | specified in metadata (e.g. could be used to force \code{self_contained} or
19 | \code{mathjax = "local"}). Note that this is only valid when the output
20 | format is read from metadata (i.e. not a custom format object passed to
21 | \code{output_format}).}
22 |
23 | \item{...}{additional arguments passed to \code{\link[rmarkdown:render]{rmarkdown::render()}}}
24 |
25 | \item{quiet}{If \code{TRUE}, suppress output.}
26 | }
27 | \description{
28 | \code{build_rmd()} is a wrapper around \code{\link[rmarkdown:render]{rmarkdown::render()}} that first installs
29 | a temporary copy of the package, and then renders each \code{.Rmd} in a clean R
30 | session. \code{build_readme()} locates your \code{README.Rmd} and builds it into a
31 | \code{README.md}
32 | }
33 |
--------------------------------------------------------------------------------
/man/build_site.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/build-site.R
3 | \name{build_site}
4 | \alias{build_site}
5 | \title{Execute \pkg{pkgdown} build_site in a package}
6 | \usage{
7 | build_site(path = ".", quiet = TRUE, ...)
8 | }
9 | \arguments{
10 | \item{path}{path to the package to build the static HTML.}
11 |
12 | \item{quiet}{If \code{TRUE}, suppress output.}
13 |
14 | \item{...}{additional arguments passed to \code{\link[pkgdown:build_site]{pkgdown::build_site()}}}
15 | }
16 | \description{
17 | \code{build_site()} is a shortcut for \code{\link[pkgdown:build_site]{pkgdown::build_site()}}, it generates the
18 | static HTML documentation.
19 | }
20 |
--------------------------------------------------------------------------------
/man/build_vignettes.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vignettes.R
3 | \name{build_vignettes}
4 | \alias{build_vignettes}
5 | \title{Build package vignettes.}
6 | \usage{
7 | build_vignettes(
8 | pkg = ".",
9 | dependencies = "VignetteBuilder",
10 | clean = TRUE,
11 | upgrade = "never",
12 | quiet = FALSE,
13 | install = TRUE,
14 | keep_md = TRUE
15 | )
16 | }
17 | \arguments{
18 | \item{pkg}{The package to use, can be a file path to the package or a
19 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
20 |
21 | \item{dependencies}{Which dependencies do you want to check?
22 | Can be a character vector (selecting from "Depends", "Imports",
23 | "LinkingTo", "Suggests", or "Enhances"), or a logical vector.
24 |
25 | \code{TRUE} is shorthand for "Depends", "Imports", "LinkingTo" and
26 | "Suggests". \code{NA} is shorthand for "Depends", "Imports" and "LinkingTo"
27 | and is the default. \code{FALSE} is shorthand for no dependencies (i.e.
28 | just check this package, not its dependencies).
29 |
30 | The value "soft" means the same as \code{TRUE}, "hard" means the same as \code{NA}.
31 |
32 | You can also specify dependencies from one or more additional fields,
33 | common ones include:
34 | \itemize{
35 | \item Config/Needs/website - for dependencies used in building the pkgdown site.
36 | \item Config/Needs/coverage for dependencies used in calculating test coverage.
37 | }}
38 |
39 | \item{clean}{Remove all files generated by the build, even if there
40 | were copies there before.}
41 |
42 | \item{upgrade}{Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default"
43 | respects the value of the \code{R_REMOTES_UPGRADE} environment variable if set,
44 | and falls back to "ask" if unset. "ask" prompts the user for which out of
45 | date packages to upgrade. For non-interactive sessions "ask" is equivalent
46 | to "always". \code{TRUE} and \code{FALSE} are also accepted and correspond to
47 | "always" and "never" respectively.}
48 |
49 | \item{quiet}{If \code{TRUE}, suppresses most output. Set to \code{FALSE}
50 | if you need to debug.}
51 |
52 | \item{install}{If \code{TRUE}, install the package before building
53 | vignettes.}
54 |
55 | \item{keep_md}{If \code{TRUE}, move md intermediates as well as rendered
56 | outputs. Most useful when using the \code{keep_md} YAML option for Rmarkdown
57 | outputs. See
58 | \url{https://bookdown.org/yihui/rmarkdown/html-document.html#keeping-markdown}.}
59 | }
60 | \description{
61 | Builds package vignettes using the same algorithm that \verb{R CMD build}
62 | does. This means including non-Sweave vignettes, using makefiles (if
63 | present), and copying over extra files. The files are copied in the 'doc'
64 | directory and an vignette index is created in 'Meta/vignette.rds', as they
65 | would be in a built package. 'doc' and 'Meta' are added to
66 | \code{.Rbuildignore}, so will not be included in the built package. These
67 | files can be checked into version control, so they can be viewed with
68 | \code{browseVignettes()} and \code{vignette()} if the package has been
69 | loaded with \code{load_all()} without needing to re-build them locally.
70 | }
71 | \seealso{
72 | \code{\link[=clean_vignettes]{clean_vignettes()}} to remove the pdfs in
73 | \file{doc} created from vignettes
74 |
75 | \code{\link[=clean_vignettes]{clean_vignettes()}} to remove build tex/pdf files.
76 | }
77 | \keyword{programming}
78 |
--------------------------------------------------------------------------------
/man/check_mac_release.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/check-mac.R
3 | \name{check_mac_release}
4 | \alias{check_mac_release}
5 | \title{Check a package on macOS}
6 | \usage{
7 | check_mac_release(
8 | pkg = ".",
9 | dep_pkgs = character(),
10 | args = NULL,
11 | manual = TRUE,
12 | quiet = FALSE,
13 | ...
14 | )
15 | }
16 | \arguments{
17 | \item{pkg}{The package to use, can be a file path to the package or a
18 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
19 |
20 | \item{dep_pkgs}{Additional custom dependencies to install prior to checking
21 | the package.}
22 |
23 | \item{args}{An optional character vector of additional command
24 | line arguments to be passed to \verb{R CMD build} if \code{binary = FALSE},
25 | or \verb{R CMD install} if \code{binary = TRUE}.}
26 |
27 | \item{manual}{Should the manual be built?}
28 |
29 | \item{quiet}{If \code{TRUE}, suppresses output.}
30 |
31 | \item{...}{Additional arguments passed to \code{\link[pkgbuild:build]{pkgbuild::build()}}.}
32 | }
33 | \value{
34 | The url with the check results (invisibly)
35 | }
36 | \description{
37 | This function first bundles a source package, then uploads it to
38 | \url{https://mac.r-project.org/macbuilder/submit.html}. This function returns a
39 | link to the page where the check results will appear.
40 | }
41 | \seealso{
42 | Other build functions:
43 | \code{\link{check_rhub}()},
44 | \code{\link{check_win}()}
45 | }
46 | \concept{build functions}
47 |
--------------------------------------------------------------------------------
/man/check_man.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/check-doc.R
3 | \name{check_man}
4 | \alias{check_man}
5 | \title{Check documentation, as \verb{R CMD check} does.}
6 | \usage{
7 | check_man(pkg = ".")
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 | }
13 | \value{
14 | Nothing. This function is called purely for it's side effects: if
15 | no errors there will be no output.
16 | }
17 | \description{
18 | This function attempts to run the documentation related checks in the
19 | same way that \verb{R CMD check} does. Unfortunately it can't run them
20 | all because some tests require the package to be loaded, and the way
21 | they attempt to load the code conflicts with how devtools does it.
22 | }
23 | \examples{
24 | \dontrun{
25 | check_man("mypkg")
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/man/check_rhub.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/r-hub.R
3 | \name{check_rhub}
4 | \alias{check_rhub}
5 | \title{Run CRAN checks for package on R-hub}
6 | \usage{
7 | check_rhub(
8 | pkg = ".",
9 | platforms = NULL,
10 | email = NULL,
11 | interactive = TRUE,
12 | build_args = NULL,
13 | ...
14 | )
15 | }
16 | \arguments{
17 | \item{pkg}{The package to use, can be a file path to the package or a
18 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
19 |
20 | \item{platforms}{R-hub platforms to run the check on. If \code{NULL}
21 | uses default list of CRAN checkers (one for each major platform, and
22 | one with extra checks if you have compiled code). You can also specify
23 | your own, see \code{\link[rhub:platforms]{rhub::platforms()}} for a complete list.}
24 |
25 | \item{email}{email address to notify, defaults to the maintainer
26 | address in the package.}
27 |
28 | \item{interactive}{whether to show the status of the build
29 | interactively. R-hub will send an email to the package maintainer's
30 | email address, regardless of whether the check is interactive or not.}
31 |
32 | \item{build_args}{Arguments passed to \verb{R CMD build}}
33 |
34 | \item{...}{extra arguments, passed to \code{\link[rhub:check_for_cran]{rhub::check_for_cran()}}.}
35 | }
36 | \value{
37 | a \code{rhub_check} object.
38 | }
39 | \description{
40 | It runs \code{\link[=build]{build()}} on the package, with the arguments specified
41 | in \code{args}, and then submits it to the R-hub builder at
42 | \url{https://builder.r-hub.io}. The \code{interactive} option controls
43 | whether the function waits for the check output. Regardless, after the
44 | check is complete, R-hub sends an email with the results to the package
45 | maintainer.
46 | }
47 | \section{About email validation on r-hub}{
48 |
49 | To build and check R packages on R-hub, you need to validate your
50 | email address. This is because R-hub sends out emails about build
51 | results. See more at \code{\link[rhub:validate_email]{rhub::validate_email()}}.
52 | }
53 |
54 | \seealso{
55 | Other build functions:
56 | \code{\link{check_mac_release}()},
57 | \code{\link{check_win}()}
58 | }
59 | \concept{build functions}
60 |
--------------------------------------------------------------------------------
/man/check_win.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/check-win.R
3 | \name{check_win}
4 | \alias{check_win}
5 | \alias{check_win_devel}
6 | \alias{check_win_release}
7 | \alias{check_win_oldrelease}
8 | \title{Check a package on Windows}
9 | \usage{
10 | check_win_devel(
11 | pkg = ".",
12 | args = NULL,
13 | manual = TRUE,
14 | email = NULL,
15 | quiet = FALSE,
16 | ...
17 | )
18 |
19 | check_win_release(
20 | pkg = ".",
21 | args = NULL,
22 | manual = TRUE,
23 | email = NULL,
24 | quiet = FALSE,
25 | ...
26 | )
27 |
28 | check_win_oldrelease(
29 | pkg = ".",
30 | args = NULL,
31 | manual = TRUE,
32 | email = NULL,
33 | quiet = FALSE,
34 | ...
35 | )
36 | }
37 | \arguments{
38 | \item{pkg}{The package to use, can be a file path to the package or a
39 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
40 |
41 | \item{args}{An optional character vector of additional command
42 | line arguments to be passed to \verb{R CMD build} if \code{binary = FALSE},
43 | or \verb{R CMD install} if \code{binary = TRUE}.}
44 |
45 | \item{manual}{Should the manual be built?}
46 |
47 | \item{email}{An alternative email address to use. If \code{NULL}, the default is
48 | to use the package maintainer's email.}
49 |
50 | \item{quiet}{If \code{TRUE}, suppresses output.}
51 |
52 | \item{...}{Additional arguments passed to \code{\link[pkgbuild:build]{pkgbuild::build()}}.}
53 | }
54 | \description{
55 | This function first bundles a source package, then uploads it to
56 | \url{https://win-builder.r-project.org/}. Once the service has built and checked
57 | the package, an email is sent to address of the maintainer listed in
58 | \code{DESCRIPTION}. This usually takes around 30 minutes. The email contains a
59 | link to a directory with the package binary and check logs, which will be
60 | deleted after a couple of days.
61 | }
62 | \section{Functions}{
63 | \itemize{
64 | \item \code{check_win_devel()}: Check package on the development version of R.
65 |
66 | \item \code{check_win_release()}: Check package on the released version of R.
67 |
68 | \item \code{check_win_oldrelease()}: Check package on the previous major release version of R.
69 |
70 | }}
71 | \seealso{
72 | Other build functions:
73 | \code{\link{check_mac_release}()},
74 | \code{\link{check_rhub}()}
75 | }
76 | \concept{build functions}
77 |
--------------------------------------------------------------------------------
/man/clean_vignettes.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/vignettes.R
3 | \name{clean_vignettes}
4 | \alias{clean_vignettes}
5 | \title{Clean built vignettes.}
6 | \usage{
7 | clean_vignettes(pkg = ".")
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 | }
13 | \description{
14 | This uses a fairly rudimentary algorithm where any files in \file{doc}
15 | with a name that exists in \file{vignettes} are removed.
16 | }
17 |
--------------------------------------------------------------------------------
/man/create.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/create.R
3 | \name{create}
4 | \alias{create}
5 | \title{Create a package}
6 | \usage{
7 | create(path, ..., open = FALSE)
8 | }
9 | \arguments{
10 | \item{path}{A path. If it exists, it is used. If it does not exist, it is
11 | created, provided that the parent path exists.}
12 |
13 | \item{...}{Additional arguments passed to \code{\link[usethis:create_package]{usethis::create_package()}}}
14 |
15 | \item{open}{If \code{TRUE}, \link[usethis:proj_activate]{activates} the new project:
16 | \itemize{
17 | \item If using RStudio desktop, the package is opened in a new session.
18 | \item If on RStudio server, the current RStudio project is activated.
19 | \item Otherwise, the working directory and active project is changed.
20 | }}
21 | }
22 | \value{
23 | The path to the created package, invisibly.
24 | }
25 | \description{
26 | Create a package
27 | }
28 |
--------------------------------------------------------------------------------
/man/dev_mode.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/dev-mode.R
3 | \name{dev_mode}
4 | \alias{dev_mode}
5 | \title{Activate and deactivate development mode}
6 | \usage{
7 | dev_mode(on = NULL, path = getOption("devtools.path"))
8 | }
9 | \arguments{
10 | \item{on}{turn dev mode on (\code{TRUE}) or off (\code{FALSE}). If omitted will guess
11 | based on whether or not \code{path} is in \code{\link[=.libPaths]{.libPaths()}}}
12 |
13 | \item{path}{directory to library.}
14 | }
15 | \description{
16 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}
17 |
18 | We no longer recommend \code{dev_mode()} and it will be removed in a future
19 | release of devtools. Instead, we now rely on \code{\link[=load_all]{load_all()}} to test drive an
20 | in-development package. If you really like the idea of corralling
21 | experimental packages in a special library, you might enjoy
22 | \code{withr::local_libpaths()}. If you are concerned about different projects
23 | interfering with each other through the use of a shared library, consider
24 | using the \href{https://rstudio.github.io/renv/}{renv package}.
25 |
26 | Original description: When activated, \code{dev_mode} creates a new library for
27 | storing installed packages. This new library is automatically created when
28 | \code{dev_mode} is activated if it does not already exist. This allows you to test
29 | development packages in a sandbox, without interfering with the other
30 | packages you have installed.
31 | }
32 | \examples{
33 | \dontrun{
34 | dev_mode()
35 | dev_mode()
36 | }
37 | }
38 | \keyword{internal}
39 |
--------------------------------------------------------------------------------
/man/dev_packages.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/session-info.R
3 | \name{dev_packages}
4 | \alias{dev_packages}
5 | \title{Return a vector of names of packages loaded by devtools}
6 | \usage{
7 | dev_packages()
8 | }
9 | \description{
10 | Return a vector of names of packages loaded by devtools
11 | }
12 | \keyword{internal}
13 |
--------------------------------------------------------------------------------
/man/dev_sitrep.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sitrep.R
3 | \name{dev_sitrep}
4 | \alias{dev_sitrep}
5 | \title{Report package development situation}
6 | \usage{
7 | dev_sitrep(pkg = ".", debug = FALSE)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{debug}{If \code{TRUE}, will print out extra information useful for
14 | debugging. If \code{FALSE}, it will use result cached from a previous run.}
15 | }
16 | \value{
17 | A named list, with S3 class \code{dev_sitrep} (for printing purposes).
18 | }
19 | \description{
20 | \code{dev_sitrep()} reports
21 | \itemize{
22 | \item If R is up to date
23 | \item If RStudio is up to date
24 | \item If compiler build tools are installed and available for use
25 | \item If devtools and its dependencies are up to date
26 | \item If the package's dependencies are up to date
27 | }
28 |
29 | Call this function if things seem weird and you're not sure
30 | what's wrong or how to fix it. If this function returns no output
31 | everything should be ready for package development.
32 | }
33 | \examples{
34 | \dontrun{
35 | dev_sitrep()
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/man/devtools-deprecated.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/test.R, R/zzz.R
3 | \name{test_file}
4 | \alias{test_file}
5 | \alias{test_coverage_file}
6 | \alias{devtools-deprecated}
7 | \title{Deprecated Functions}
8 | \usage{
9 | test_file(file = find_active_file(), ...)
10 |
11 | test_coverage_file(file = find_active_file(), ...)
12 | }
13 | \description{
14 | These functions are Deprecated in this release of devtools, they will be
15 | marked as Defunct and removed in a future version.
16 | }
17 | \keyword{internal}
18 |
--------------------------------------------------------------------------------
/man/devtools-package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/devtools-package.R
3 | \docType{package}
4 | \name{devtools-package}
5 | \alias{devtools}
6 | \alias{devtools-package}
7 | \title{devtools: Tools to Make Developing R Packages Easier}
8 | \description{
9 | \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}}
10 |
11 | Collection of package development tools.
12 | }
13 | \section{Package options}{
14 |
15 |
16 | Devtools uses the following \code{\link[=options]{options()}} to configure behaviour:
17 | \itemize{
18 | \item \code{devtools.install.args}: a string giving extra arguments passed to
19 | \verb{R CMD install} by \code{\link[=install]{install()}}.
20 | \item \code{devtools.path}: Deprecated. Path used by the now-deprecated \code{\link[=dev_mode]{dev_mode()}}
21 | function.
22 | }
23 | }
24 |
25 | \seealso{
26 | Useful links:
27 | \itemize{
28 | \item \url{https://devtools.r-lib.org/}
29 | \item \url{https://github.com/r-lib/devtools}
30 | \item Report bugs at \url{https://github.com/r-lib/devtools/issues}
31 | }
32 |
33 | }
34 | \author{
35 | \strong{Maintainer}: Jennifer Bryan \email{jenny@posit.co} (\href{https://orcid.org/0000-0002-6983-2759}{ORCID})
36 |
37 | Authors:
38 | \itemize{
39 | \item Hadley Wickham
40 | \item Jim Hester
41 | \item Winston Chang
42 | }
43 |
44 | Other contributors:
45 | \itemize{
46 | \item Posit Software, PBC [copyright holder, funder]
47 | }
48 |
49 | }
50 | \keyword{internal}
51 |
--------------------------------------------------------------------------------
/man/document.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/document.R
3 | \name{document}
4 | \alias{document}
5 | \title{Use roxygen to document a package.}
6 | \usage{
7 | document(pkg = ".", roclets = NULL, quiet = FALSE)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{roclets}{Character vector of roclet names to use with package.
14 | The default, \code{NULL}, uses the roxygen \code{roclets} option,
15 | which defaults to \code{c("collate", "namespace", "rd")}.}
16 |
17 | \item{quiet}{if \code{TRUE} suppresses output from this function.}
18 | }
19 | \description{
20 | This function is a wrapper for the \code{\link[roxygen2:roxygenize]{roxygen2::roxygenize()}}
21 | function from the roxygen2 package. See the documentation and vignettes of
22 | that package to learn how to use roxygen.
23 | }
24 | \seealso{
25 | \code{\link[roxygen2:roxygenize]{roxygen2::roxygenize()}},
26 | \code{browseVignettes("roxygen2")}
27 | }
28 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-archived.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-defunct.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-deprecated.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-experimental.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-maturing.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-questioning.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-stable.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/lifecycle-superseded.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/man/figures/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/man/figures/logo.png
--------------------------------------------------------------------------------
/man/git_checks.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/check-git.R
3 | \name{git_checks}
4 | \alias{git_checks}
5 | \title{Git checks.}
6 | \usage{
7 | git_checks(pkg = ".")
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 | }
13 | \description{
14 | This function performs Git checks checks prior to release. It is called
15 | automatically by \code{\link[=release]{release()}}.
16 | }
17 | \keyword{internal}
18 |
--------------------------------------------------------------------------------
/man/has_tests.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/has-tests.R
3 | \name{has_tests}
4 | \alias{has_tests}
5 | \title{Was devtools installed with tests?}
6 | \usage{
7 | has_tests()
8 | }
9 | \description{
10 | Was devtools installed with tests?
11 | }
12 | \keyword{internal}
13 |
--------------------------------------------------------------------------------
/man/install.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/install.R
3 | \name{install}
4 | \alias{install}
5 | \title{Install a local development package.}
6 | \usage{
7 | install(
8 | pkg = ".",
9 | reload = TRUE,
10 | quick = FALSE,
11 | build = !quick,
12 | args = getOption("devtools.install.args"),
13 | quiet = FALSE,
14 | dependencies = NA,
15 | upgrade = "default",
16 | build_vignettes = FALSE,
17 | keep_source = getOption("keep.source.pkgs"),
18 | force = FALSE,
19 | ...
20 | )
21 | }
22 | \arguments{
23 | \item{pkg}{The package to use, can be a file path to the package or a
24 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
25 |
26 | \item{reload}{if \code{TRUE} (the default), will automatically reload the
27 | package after installing.}
28 |
29 | \item{quick}{if \code{TRUE} skips docs, multiple-architectures,
30 | demos, and vignettes, to make installation as fast as possible.}
31 |
32 | \item{build}{if \code{TRUE} \code{\link[pkgbuild:build]{pkgbuild::build()}}s the package first:
33 | this ensures that the installation is completely clean, and prevents any
34 | binary artefacts (like \file{.o}, \code{.so}) from appearing in your local
35 | package directory, but is considerably slower, because every compile has
36 | to start from scratch.
37 |
38 | One downside of installing from a built tarball is that the package is
39 | installed from a temporary location. This means that any source references,
40 | at R level or C/C++ level, will point to dangling locations. The debuggers
41 | will not be able to find the sources for step-debugging. If you're
42 | installing the package for development, consider setting \code{build} to
43 | \code{FALSE}.}
44 |
45 | \item{args}{An optional character vector of additional command line
46 | arguments to be passed to \verb{R CMD INSTALL}. This defaults to the
47 | value of the option \code{"devtools.install.args"}.}
48 |
49 | \item{quiet}{If \code{TRUE}, suppress output.}
50 |
51 | \item{dependencies}{Which dependencies do you want to check?
52 | Can be a character vector (selecting from "Depends", "Imports",
53 | "LinkingTo", "Suggests", or "Enhances"), or a logical vector.
54 |
55 | \code{TRUE} is shorthand for "Depends", "Imports", "LinkingTo" and
56 | "Suggests". \code{NA} is shorthand for "Depends", "Imports" and "LinkingTo"
57 | and is the default. \code{FALSE} is shorthand for no dependencies (i.e.
58 | just check this package, not its dependencies).
59 |
60 | The value "soft" means the same as \code{TRUE}, "hard" means the same as \code{NA}.
61 |
62 | You can also specify dependencies from one or more additional fields,
63 | common ones include:
64 | \itemize{
65 | \item Config/Needs/website - for dependencies used in building the pkgdown site.
66 | \item Config/Needs/coverage for dependencies used in calculating test coverage.
67 | }}
68 |
69 | \item{upgrade}{Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default"
70 | respects the value of the \code{R_REMOTES_UPGRADE} environment variable if set,
71 | and falls back to "ask" if unset. "ask" prompts the user for which out of
72 | date packages to upgrade. For non-interactive sessions "ask" is equivalent
73 | to "always". \code{TRUE} and \code{FALSE} are also accepted and correspond to
74 | "always" and "never" respectively.}
75 |
76 | \item{build_vignettes}{if \code{TRUE}, will build vignettes. Normally it is
77 | \code{build} that's responsible for creating vignettes; this argument makes
78 | sure vignettes are built even if a build never happens (i.e. because
79 | \code{build = FALSE}).}
80 |
81 | \item{keep_source}{If \code{TRUE} will keep the srcrefs from an installed
82 | package. This is useful for debugging (especially inside of RStudio).
83 | It defaults to the option \code{"keep.source.pkgs"}.}
84 |
85 | \item{force}{Force installation, even if the remote state has not changed
86 | since the previous install.}
87 |
88 | \item{...}{additional arguments passed to \code{\link[remotes:install_deps]{remotes::install_deps()}}
89 | when installing dependencies.}
90 | }
91 | \description{
92 | Uses \verb{R CMD INSTALL} to install the package. Will also try to install
93 | dependencies of the package from CRAN, if they're not already installed.
94 | }
95 | \details{
96 | If \code{quick = TRUE}, installation takes place using the current package
97 | directory. If you have compiled code, this means that artefacts of
98 | compilation will be created in the \verb{src/} directory. If you want to avoid
99 | this, you can use \code{build = TRUE} to first build a package bundle and then
100 | install it from a temporary directory. This is slower, but keeps the source
101 | directory pristine.
102 |
103 | If the package is loaded, it will be reloaded after installation. This is
104 | not always completely possible, see \code{\link[=reload]{reload()}} for caveats.
105 |
106 | To install a package in a non-default library, use \code{\link[withr:with_libpaths]{withr::with_libpaths()}}.
107 | }
108 | \seealso{
109 | \code{\link[=update_packages]{update_packages()}} to update installed packages from the
110 | source location and \code{\link[=with_debug]{with_debug()}} to install packages with
111 | debugging flags set.
112 |
113 | Other package installation:
114 | \code{\link{uninstall}()}
115 | }
116 | \concept{package installation}
117 |
--------------------------------------------------------------------------------
/man/install_deps.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/install.R
3 | \name{install_deps}
4 | \alias{install_deps}
5 | \alias{install_dev_deps}
6 | \title{Install package dependencies if needed.}
7 | \usage{
8 | install_deps(
9 | pkg = ".",
10 | dependencies = NA,
11 | repos = getOption("repos"),
12 | type = getOption("pkgType"),
13 | upgrade = c("default", "ask", "always", "never"),
14 | quiet = FALSE,
15 | build = TRUE,
16 | build_opts = c("--no-resave-data", "--no-manual", " --no-build-vignettes"),
17 | ...
18 | )
19 |
20 | install_dev_deps(
21 | pkg = ".",
22 | dependencies = TRUE,
23 | repos = getOption("repos"),
24 | type = getOption("pkgType"),
25 | upgrade = c("default", "ask", "always", "never"),
26 | quiet = FALSE,
27 | build = TRUE,
28 | build_opts = c("--no-resave-data", "--no-manual", " --no-build-vignettes"),
29 | ...
30 | )
31 | }
32 | \arguments{
33 | \item{pkg}{The package to use, can be a file path to the package or a
34 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
35 |
36 | \item{dependencies}{Which dependencies do you want to check?
37 | Can be a character vector (selecting from "Depends", "Imports",
38 | "LinkingTo", "Suggests", or "Enhances"), or a logical vector.
39 |
40 | \code{TRUE} is shorthand for "Depends", "Imports", "LinkingTo" and
41 | "Suggests". \code{NA} is shorthand for "Depends", "Imports" and "LinkingTo"
42 | and is the default. \code{FALSE} is shorthand for no dependencies (i.e.
43 | just check this package, not its dependencies).
44 |
45 | The value "soft" means the same as \code{TRUE}, "hard" means the same as \code{NA}.
46 |
47 | You can also specify dependencies from one or more additional fields,
48 | common ones include:
49 | \itemize{
50 | \item Config/Needs/website - for dependencies used in building the pkgdown site.
51 | \item Config/Needs/coverage for dependencies used in calculating test coverage.
52 | }}
53 |
54 | \item{repos}{A character vector giving repositories to use.}
55 |
56 | \item{type}{Type of package to \code{update}.}
57 |
58 | \item{upgrade}{Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default"
59 | respects the value of the \code{R_REMOTES_UPGRADE} environment variable if set,
60 | and falls back to "ask" if unset. "ask" prompts the user for which out of
61 | date packages to upgrade. For non-interactive sessions "ask" is equivalent
62 | to "always". \code{TRUE} and \code{FALSE} are also accepted and correspond to
63 | "always" and "never" respectively.}
64 |
65 | \item{quiet}{If \code{TRUE}, suppress output.}
66 |
67 | \item{build}{if \code{TRUE} \code{\link[pkgbuild:build]{pkgbuild::build()}}s the package first:
68 | this ensures that the installation is completely clean, and prevents any
69 | binary artefacts (like \file{.o}, \code{.so}) from appearing in your local
70 | package directory, but is considerably slower, because every compile has
71 | to start from scratch.
72 |
73 | One downside of installing from a built tarball is that the package is
74 | installed from a temporary location. This means that any source references,
75 | at R level or C/C++ level, will point to dangling locations. The debuggers
76 | will not be able to find the sources for step-debugging. If you're
77 | installing the package for development, consider setting \code{build} to
78 | \code{FALSE}.}
79 |
80 | \item{build_opts}{Options to pass to \verb{R CMD build}, only used when \code{build} is \code{TRUE}.}
81 |
82 | \item{...}{additional arguments passed to \code{\link[remotes:install_deps]{remotes::install_deps()}}
83 | when installing dependencies.}
84 | }
85 | \description{
86 | \code{install_deps()} will install the
87 | user dependencies needed to run the package, \code{install_dev_deps()} will also
88 | install the development dependencies needed to test and build the package.
89 | }
90 | \examples{
91 | \dontrun{install_deps(".")}
92 | }
93 |
--------------------------------------------------------------------------------
/man/is.package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/package.R
3 | \name{is.package}
4 | \alias{is.package}
5 | \title{Is the object a package?}
6 | \usage{
7 | is.package(x)
8 | }
9 | \description{
10 | Is the object a package?
11 | }
12 | \keyword{internal}
13 |
--------------------------------------------------------------------------------
/man/lint.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/lint.R
3 | \name{lint}
4 | \alias{lint}
5 | \title{Lint all source files in a package}
6 | \usage{
7 | lint(pkg = ".", cache = TRUE, ...)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{cache}{Store the lint results so repeated lints of the same content use
14 | the previous results. Consult the lintr package to learn more about its
15 | caching behaviour.}
16 |
17 | \item{...}{Additional arguments passed to \code{\link[lintr:lint]{lintr::lint_package()}}.}
18 | }
19 | \description{
20 | The default linters correspond to the style guide at
21 | \url{https://style.tidyverse.org/}, however it is possible to override any or all
22 | of them using the \code{linters} parameter.
23 | }
24 | \seealso{
25 | \code{\link[lintr:lint]{lintr::lint_package()}}, \code{\link[lintr:lint]{lintr::lint()}}
26 | }
27 |
--------------------------------------------------------------------------------
/man/loaded_packages.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/session-info.R
3 | \name{loaded_packages}
4 | \alias{loaded_packages}
5 | \title{Return a vector of names of attached packages}
6 | \usage{
7 | loaded_packages()
8 | }
9 | \value{
10 | A data frame with columns package and path, giving the name of
11 | each package and the path it was loaded from.
12 | }
13 | \description{
14 | Return a vector of names of attached packages
15 | }
16 | \keyword{internal}
17 |
--------------------------------------------------------------------------------
/man/missing_s3.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/missing-s3.R
3 | \name{missing_s3}
4 | \alias{missing_s3}
5 | \title{Find missing s3 exports.}
6 | \usage{
7 | missing_s3(pkg = ".")
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 | }
13 | \description{
14 | The method is heuristic - looking for objs with a period in their name.
15 | }
16 |
--------------------------------------------------------------------------------
/man/package_file.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/package.R
3 | \name{package_file}
4 | \alias{package_file}
5 | \title{Find file in a package.}
6 | \usage{
7 | package_file(..., path = ".")
8 | }
9 | \arguments{
10 | \item{...}{Components of the path.}
11 |
12 | \item{path}{Place to start search for package directory.}
13 | }
14 | \description{
15 | It always starts by walking up the path until it finds the root directory,
16 | i.e. a directory containing \code{DESCRIPTION}. If it cannot find the root
17 | directory, or it can't find the specified path, it will throw an error.
18 | }
19 | \examples{
20 | \dontrun{
21 | package_file("figures", "figure_1")
22 | }
23 | }
24 | \keyword{internal}
25 |
--------------------------------------------------------------------------------
/man/r_env_vars.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/R.R
3 | \name{r_env_vars}
4 | \alias{r_env_vars}
5 | \title{Environment variables to set when calling R}
6 | \usage{
7 | r_env_vars()
8 | }
9 | \value{
10 | a named character vector
11 | }
12 | \description{
13 | Devtools sets a number of environmental variables to ensure consistent
14 | between the current R session and the new session, and to ensure that
15 | everything behaves the same across systems. It also suppresses a common
16 | warning on windows, and sets \code{NOT_CRAN} so you can tell that your
17 | code is not running on CRAN. If \code{NOT_CRAN} has been set externally, it
18 | is not overwritten.
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/reexports.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/package-deps.R, R/pkgbuild.R, R/pkgload.R,
3 | % R/remotes.R, R/session-info.R
4 | \docType{import}
5 | \name{reexports}
6 | \alias{reexports}
7 | \alias{parse_deps}
8 | \alias{check_dep_version}
9 | \alias{with_debug}
10 | \alias{clean_dll}
11 | \alias{has_devel}
12 | \alias{find_rtools}
13 | \alias{unload}
14 | \alias{github_pull}
15 | \alias{github_release}
16 | \alias{session_info}
17 | \alias{package_info}
18 | \title{Objects exported from other packages}
19 | \keyword{internal}
20 | \description{
21 | These objects are imported from other packages. Follow the links
22 | below to see their documentation.
23 |
24 | \describe{
25 | \item{pkgbuild}{\code{\link[pkgbuild]{clean_dll}}, \code{\link[pkgbuild:has_rtools]{find_rtools}}, \code{\link[pkgbuild:has_compiler]{has_devel}}, \code{\link[pkgbuild]{with_debug}}}
26 |
27 | \item{pkgload}{\code{\link[pkgload]{check_dep_version}}, \code{\link[pkgload]{parse_deps}}, \code{\link[pkgload]{unload}}}
28 |
29 | \item{remotes}{\code{\link[remotes:github_refs]{github_pull}}, \code{\link[remotes:github_refs]{github_release}}}
30 |
31 | \item{sessioninfo}{\code{\link[sessioninfo]{package_info}}, \code{\link[sessioninfo]{session_info}}}
32 | }}
33 |
34 |
--------------------------------------------------------------------------------
/man/release.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/release.R
3 | \name{release}
4 | \alias{release}
5 | \title{Release package to CRAN.}
6 | \usage{
7 | release(pkg = ".", check = FALSE, args = NULL)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{check}{if \code{TRUE}, run checking, otherwise omit it. This
14 | is useful if you've just checked your package and you're ready to
15 | release it.}
16 |
17 | \item{args}{An optional character vector of additional command
18 | line arguments to be passed to \verb{R CMD build}.}
19 | }
20 | \description{
21 | Run automated and manual tests, then post package to CRAN.
22 | }
23 | \details{
24 | The package release process will:
25 | \itemize{
26 | \item Confirm that the package passes \verb{R CMD check} on relevant platforms
27 | \item Confirm that important files are up-to-date
28 | \item Build the package
29 | \item Submit the package to CRAN, using comments in "cran-comments.md"
30 | }
31 |
32 | You can add arbitrary extra questions by defining an (un-exported) function
33 | called \code{release_questions()} that returns a character vector
34 | of additional questions to ask.
35 |
36 | You also need to read the CRAN repository policy at
37 | 'https://cran.r-project.org/web/packages/policies.html' and make
38 | sure you're in line with the policies. \code{release} tries to automate as
39 | many of polices as possible, but it's impossible to be completely
40 | comprehensive, and they do change in between releases of devtools.
41 | }
42 | \seealso{
43 | \code{\link[usethis:use_release_issue]{usethis::use_release_issue()}} to create a checklist of release
44 | tasks that you can use in addition to or in place of \code{release}.
45 | }
46 |
--------------------------------------------------------------------------------
/man/release_checks.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/check-devtools.R
3 | \name{release_checks}
4 | \alias{release_checks}
5 | \title{Custom devtools release checks.}
6 | \usage{
7 | release_checks(pkg = ".", built_path = NULL)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 | }
13 | \description{
14 | This function performs additional checks prior to release. It is called
15 | automatically by \code{\link[=release]{release()}}.
16 | }
17 | \keyword{internal}
18 |
--------------------------------------------------------------------------------
/man/reload.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/reload.R
3 | \name{reload}
4 | \alias{reload}
5 | \title{Unload and reload package.}
6 | \usage{
7 | reload(pkg = ".", quiet = FALSE)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{quiet}{if \code{TRUE} suppresses output from this function.}
14 | }
15 | \description{
16 | This attempts to unload and reload an \emph{installed} package. If the package is
17 | not loaded already, it does nothing. It's not always possible to cleanly
18 | unload a package: see the caveats in \code{\link[=unload]{unload()}} for some of the potential
19 | failure points. If in doubt, restart R and reload the package with
20 | \code{\link[=library]{library()}}.
21 | }
22 | \examples{
23 | \dontrun{
24 | # Reload package that is in current directory
25 | reload(".")
26 |
27 | # Reload package that is in ./ggplot2/
28 | reload("ggplot2/")
29 |
30 | # Can use inst() to find the package path
31 | # This will reload the installed ggplot2 package
32 | reload(pkgload::inst("ggplot2"))
33 | }
34 | }
35 | \seealso{
36 | \code{\link[=load_all]{load_all()}} to load a package for interactive development.
37 | }
38 |
--------------------------------------------------------------------------------
/man/revdep.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/revdep.R
3 | \name{revdep}
4 | \alias{revdep}
5 | \alias{revdep_maintainers}
6 | \title{Reverse dependency tools.}
7 | \usage{
8 | revdep(
9 | pkg,
10 | dependencies = c("Depends", "Imports", "Suggests", "LinkingTo"),
11 | recursive = FALSE,
12 | ignore = NULL,
13 | bioconductor = FALSE
14 | )
15 |
16 | revdep_maintainers(pkg = ".")
17 | }
18 | \arguments{
19 | \item{pkg}{Package name. This is unlike most devtools packages which
20 | take a path because you might want to determine dependencies for a package
21 | that you don't have installed. If omitted, defaults to the name of the
22 | current package.}
23 |
24 | \item{dependencies}{A character vector listing the types of dependencies
25 | to follow.}
26 |
27 | \item{recursive}{If \code{TRUE} look for full set of recursive dependencies.}
28 |
29 | \item{ignore}{A character vector of package names to ignore. These packages
30 | will not appear in returned vector.}
31 |
32 | \item{bioconductor}{If \code{TRUE} also look for dependencies amongst
33 | Bioconductor packages.}
34 | }
35 | \description{
36 | Tools to check and notify maintainers of all CRAN and Bioconductor
37 | packages that depend on the specified package.
38 | }
39 | \details{
40 | The first run in a session will be time-consuming because it must download
41 | all package metadata from CRAN and Bioconductor. Subsequent runs will
42 | be faster.
43 | }
44 | \examples{
45 | \dontrun{
46 | revdep("ggplot2")
47 |
48 | revdep("ggplot2", ignore = c("xkcd", "zoo"))
49 | }
50 | }
51 | \seealso{
52 | The \href{https://github.com/r-lib/revdepcheck}{revdepcheck} package can
53 | be used to run R CMD check on all reverse dependencies.
54 | }
55 | \keyword{internal}
56 |
--------------------------------------------------------------------------------
/man/run_examples.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/run-examples.R
3 | \name{run_examples}
4 | \alias{run_examples}
5 | \title{Run all examples in a package.}
6 | \usage{
7 | run_examples(
8 | pkg = ".",
9 | start = NULL,
10 | show = deprecated(),
11 | run_donttest = FALSE,
12 | run_dontrun = FALSE,
13 | fresh = FALSE,
14 | document = TRUE,
15 | run = deprecated(),
16 | test = deprecated()
17 | )
18 | }
19 | \arguments{
20 | \item{pkg}{The package to use, can be a file path to the package or a
21 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
22 |
23 | \item{start}{Where to start running the examples: this can either be the
24 | name of \code{Rd} file to start with (with or without extensions), or
25 | a topic name. If omitted, will start with the (lexicographically) first
26 | file. This is useful if you have a lot of examples and don't want to
27 | rerun them every time you fix a problem.}
28 |
29 | \item{show}{DEPRECATED.}
30 |
31 | \item{run_donttest}{if \code{TRUE}, do run \verb{\\donttest} sections in the Rd files.}
32 |
33 | \item{run_dontrun}{if \code{TRUE}, do run \verb{\\dontrun} sections in the Rd files.}
34 |
35 | \item{fresh}{if \code{TRUE}, will be run in a fresh R session. This has
36 | the advantage that there's no way the examples can depend on anything in
37 | the current session, but interactive code (like \code{\link[=browser]{browser()}})
38 | won't work.}
39 |
40 | \item{document}{if \code{TRUE}, \code{\link[=document]{document()}} will be run to ensure
41 | examples are updated before running them.}
42 |
43 | \item{run, test}{Deprecated, see \code{run_dontrun} and \code{run_donttest} above.}
44 | }
45 | \description{
46 | One of the most frustrating parts of \verb{R CMD check} is getting all of your
47 | examples to pass - whenever one fails you need to fix the problem and then
48 | restart the whole process. This function makes it a little easier by
49 | making it possible to run all examples from an R function.
50 | }
51 | \concept{example functions}
52 | \keyword{programming}
53 |
--------------------------------------------------------------------------------
/man/save_all.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/save-all.R
3 | \name{save_all}
4 | \alias{save_all}
5 | \title{Save all documents in an active IDE session.}
6 | \usage{
7 | save_all()
8 | }
9 | \description{
10 | Helper function wrapping IDE-specific calls to save all documents in the
11 | active session. In this form, callers of \code{save_all()} don't need to
12 | execute any IDE-specific code. This function can be extended to include
13 | other IDE implementations of their equivalent
14 | \code{rstudioapi::documentSaveAll()} methods.
15 | }
16 |
--------------------------------------------------------------------------------
/man/show_news.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/show-news.R
3 | \name{show_news}
4 | \alias{show_news}
5 | \title{Show package news}
6 | \usage{
7 | show_news(pkg = ".", latest = TRUE, ...)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{latest}{if \code{TRUE}, only show the news for the most recent
14 | version.}
15 |
16 | \item{...}{other arguments passed on to \code{news}}
17 | }
18 | \description{
19 | Show package news
20 | }
21 |
--------------------------------------------------------------------------------
/man/source_gist.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/run-source.R
3 | \name{source_gist}
4 | \alias{source_gist}
5 | \title{Run a script on gist}
6 | \usage{
7 | source_gist(id, ..., filename = NULL, sha1 = NULL, quiet = FALSE)
8 | }
9 | \arguments{
10 | \item{id}{either full url (character), gist ID (numeric or character of
11 | numeric).}
12 |
13 | \item{...}{other options passed to \code{\link[=source]{source()}}}
14 |
15 | \item{filename}{if there is more than one R file in the gist, which one to
16 | source (filename ending in '.R')? Default \code{NULL} will source the
17 | first file.}
18 |
19 | \item{sha1}{The SHA-1 hash of the file at the remote URL. This is highly
20 | recommend as it prevents you from accidentally running code that's not
21 | what you expect. See \code{\link[=source_url]{source_url()}} for more information on
22 | using a SHA-1 hash.}
23 |
24 | \item{quiet}{if \code{FALSE}, the default, prints informative messages.}
25 | }
26 | \description{
27 | \dQuote{Gist is a simple way to share snippets and pastes with others.
28 | All gists are git repositories, so they are automatically versioned,
29 | forkable and usable as a git repository.}
30 | \url{https://gist.github.com/}
31 | }
32 | \examples{
33 | \dontrun{
34 | # You can run gists given their id
35 | source_gist(6872663)
36 | source_gist("6872663")
37 |
38 | # Or their html url
39 | source_gist("https://gist.github.com/hadley/6872663")
40 | source_gist("gist.github.com/hadley/6872663")
41 |
42 | # It's highly recommend that you run source_gist with the optional
43 | # sha1 argument - this will throw an error if the file has changed since
44 | # you first ran it
45 | source_gist(6872663, sha1 = "54f1db27e60")
46 | # Wrong hash will result in error
47 | source_gist(6872663, sha1 = "54f1db27e61")
48 |
49 | #' # You can speficy a particular R file in the gist
50 | source_gist(6872663, filename = "hi.r")
51 | source_gist(6872663, filename = "hi.r", sha1 = "54f1db27e60")
52 | }
53 | }
54 | \seealso{
55 | \code{\link[=source_url]{source_url()}}
56 | }
57 |
--------------------------------------------------------------------------------
/man/source_url.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/run-source.R
3 | \name{source_url}
4 | \alias{source_url}
5 | \title{Run a script through some protocols such as http, https, ftp, etc.}
6 | \usage{
7 | source_url(url, ..., sha1 = NULL)
8 | }
9 | \arguments{
10 | \item{url}{url}
11 |
12 | \item{...}{other options passed to \code{\link[=source]{source()}}}
13 |
14 | \item{sha1}{The (prefix of the) SHA-1 hash of the file at the remote URL.}
15 | }
16 | \description{
17 | If a SHA-1 hash is specified with the \code{sha1} argument, then this
18 | function will check the SHA-1 hash of the downloaded file to make sure it
19 | matches the expected value, and throw an error if it does not match. If the
20 | SHA-1 hash is not specified, it will print a message displaying the hash of
21 | the downloaded file. The purpose of this is to improve security when running
22 | remotely-hosted code; if you have a hash of the file, you can be sure that
23 | it has not changed. For convenience, it is possible to use a truncated SHA1
24 | hash, down to 6 characters, but keep in mind that a truncated hash won't be
25 | as secure as the full hash.
26 | }
27 | \examples{
28 | \dontrun{
29 |
30 | source_url("https://gist.github.com/hadley/6872663/raw/hi.r")
31 |
32 | # With a hash, to make sure the remote file hasn't changed
33 | source_url("https://gist.github.com/hadley/6872663/raw/hi.r",
34 | sha1 = "54f1db27e60bb7e0486d785604909b49e8fef9f9")
35 |
36 | # With a truncated hash
37 | source_url("https://gist.github.com/hadley/6872663/raw/hi.r",
38 | sha1 = "54f1db27e60")
39 | }
40 | }
41 | \seealso{
42 | \code{\link[=source_gist]{source_gist()}}
43 | }
44 |
--------------------------------------------------------------------------------
/man/spell_check.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/spell-check.R
3 | \name{spell_check}
4 | \alias{spell_check}
5 | \title{Spell checking}
6 | \usage{
7 | spell_check(pkg = ".", vignettes = TRUE, use_wordlist = TRUE)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{vignettes}{also check all \code{rmd} and \code{rnw} files in the pkg \code{vignettes} folder}
14 |
15 | \item{use_wordlist}{ignore words in the package \link[spelling:wordlist]{WORDLIST} file}
16 | }
17 | \description{
18 | Runs a spell check on text fields in the package description file, manual
19 | pages, and optionally vignettes. Wraps the \link[spelling:spell_check_package]{spelling}
20 | package.
21 | }
22 |
--------------------------------------------------------------------------------
/man/submit_cran.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/release.R
3 | \name{submit_cran}
4 | \alias{submit_cran}
5 | \title{Submit a package to CRAN}
6 | \usage{
7 | submit_cran(pkg = ".", args = NULL)
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{args}{An optional character vector of additional command
14 | line arguments to be passed to \verb{R CMD build}.}
15 | }
16 | \description{
17 | This submits your package to CRAN using the web-form submission process.
18 | After submission, you will receive an email asking you to confirm submission
19 | \itemize{
20 | \item this is used to check that the package is submitted by the maintainer.
21 | }
22 |
23 | You may prefer to use \code{submit_cran()} indirectly, by calling \code{\link[=release]{release()}}
24 | instead. \code{release()} performs many checks verifying that your package is
25 | indeed ready for CRAN, before eventually asking for your confirmation that
26 | you'd like to submit it to CRAN (which it does by calling \code{submit_cran()}).
27 |
28 | Whether to use \code{release()} or \code{submit_cran()} depends on the rest of your
29 | development process. If you want to be super cautious, use \code{release()}, even
30 | though it may be redundant with other checks you have performed. On the other
31 | hand, if you have many other checks in place (such as automated checks via
32 | GitHub Actions and the task list generated by
33 | \code{\link[usethis:use_release_issue]{usethis::use_release_issue()}}), it makes sense to use \code{submit_cran()}
34 | directly.
35 | }
36 | \keyword{internal}
37 |
--------------------------------------------------------------------------------
/man/test.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/test.R
3 | \name{test}
4 | \alias{test}
5 | \alias{test_active_file}
6 | \alias{test_coverage}
7 | \alias{test_coverage_active_file}
8 | \title{Execute testthat tests in a package}
9 | \usage{
10 | test(pkg = ".", filter = NULL, stop_on_failure = FALSE, export_all = TRUE, ...)
11 |
12 | test_active_file(file = find_active_file(), ...)
13 |
14 | test_coverage(pkg = ".", show_report = interactive(), ...)
15 |
16 | test_coverage_active_file(
17 | file = find_active_file(),
18 | filter = TRUE,
19 | show_report = interactive(),
20 | export_all = TRUE,
21 | ...
22 | )
23 | }
24 | \arguments{
25 | \item{pkg}{The package to use, can be a file path to the package or a
26 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
27 |
28 | \item{filter}{If not \code{NULL}, only tests with file names matching this
29 | regular expression will be executed. Matching is performed on the file
30 | name after it's stripped of \code{"test-"} and \code{".R"}.}
31 |
32 | \item{stop_on_failure}{If \code{TRUE}, throw an error if any tests fail.}
33 |
34 | \item{export_all}{If \code{TRUE} (the default), export all objects.
35 | If \code{FALSE}, export only the objects that are listed as exports
36 | in the NAMESPACE file.}
37 |
38 | \item{...}{additional arguments passed to wrapped functions.}
39 |
40 | \item{file}{One or more source or test files. If a source file the
41 | corresponding test file will be run. The default is to use the active file
42 | in RStudio (if available).}
43 |
44 | \item{show_report}{Show the test coverage report.}
45 | }
46 | \description{
47 | \itemize{
48 | \item \code{test()} runs all tests in a package. It's a shortcut for
49 | \code{\link[testthat:test_dir]{testthat::test_dir()}}
50 | \item \code{test_active_file()} runs \code{test()} on the active file.
51 | \item \code{test_coverage()} computes test coverage for your package. It's a
52 | shortcut for \code{\link[covr:package_coverage]{covr::package_coverage()}} plus \code{\link[covr:report]{covr::report()}}.
53 | \item \code{test_coverage_active_file()} computes test coverage for the active file. It's a
54 | shortcut for \code{\link[covr:file_coverage]{covr::file_coverage()}} plus \code{\link[covr:report]{covr::report()}}.
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/man/uninstall.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/uninstall.R
3 | \name{uninstall}
4 | \alias{uninstall}
5 | \title{Uninstall a local development package}
6 | \usage{
7 | uninstall(pkg = ".", unload = TRUE, quiet = FALSE, lib = .libPaths()[[1]])
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{unload}{if \code{TRUE} (the default), ensures the package is unloaded, prior
14 | to uninstalling.}
15 |
16 | \item{quiet}{If \code{TRUE}, suppress output.}
17 |
18 | \item{lib}{a character vector giving the library directories to remove the
19 | packages from. If missing, defaults to the first element in
20 | \code{\link{.libPaths}()}.}
21 | }
22 | \description{
23 | Uses \code{remove.packages()} to uninstall the package. To uninstall a package
24 | from a non-default library, use in combination with \code{\link[withr:with_libpaths]{withr::with_libpaths()}}.
25 | }
26 | \seealso{
27 | \code{\link[=with_debug]{with_debug()}} to install packages with debugging flags set.
28 |
29 | Other package installation:
30 | \code{\link{install}()}
31 | }
32 | \concept{package installation}
33 |
--------------------------------------------------------------------------------
/man/uses_testthat.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/test.R
3 | \name{uses_testthat}
4 | \alias{uses_testthat}
5 | \title{Does a package use testthat?}
6 | \usage{
7 | uses_testthat(pkg = ".")
8 | }
9 | \description{
10 | Does a package use testthat?
11 | }
12 | \keyword{internal}
13 |
--------------------------------------------------------------------------------
/man/wd.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/wd.R
3 | \name{wd}
4 | \alias{wd}
5 | \title{Set working directory.}
6 | \usage{
7 | wd(pkg = ".", path = "")
8 | }
9 | \arguments{
10 | \item{pkg}{The package to use, can be a file path to the package or a
11 | package object. See \code{\link[=as.package]{as.package()}} for more information.}
12 |
13 | \item{path}{path within package. Leave empty to change working directory
14 | to package directory.}
15 | }
16 | \description{
17 | Set working directory.
18 | }
19 |
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/revdep/.gitignore:
--------------------------------------------------------------------------------
1 | **/
2 | summary.html
3 |
--------------------------------------------------------------------------------
/revdep/README.md:
--------------------------------------------------------------------------------
1 | # Revdeps
2 |
3 | ## Failed to check (4)
4 |
5 | |package |version |error |warning |note |
6 | |:-------|:-------|:-----|:-------|:----|
7 | |ctsem |3.7.1 |1 | | |
8 | |NA |? | | | |
9 | |NA |? | | | |
10 | |nlmixr2 |? | | | |
11 |
12 |
--------------------------------------------------------------------------------
/revdep/check.R:
--------------------------------------------------------------------------------
1 | library("devtools")
2 |
3 | revdep_check_resume()
4 | revdep_check_save_summary()
5 | revdep_check_print_problems()
6 |
7 | # revdep_email(date = "Mar 1", only_problems = TRUE)
8 |
--------------------------------------------------------------------------------
/revdep/cran.md:
--------------------------------------------------------------------------------
1 | ## revdepcheck results
2 |
3 | We checked 369 reverse dependencies (367 from CRAN + 2 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.
4 |
5 | * We saw 0 new problems
6 | * We failed to check 2 packages
7 |
8 | Issues with CRAN packages are summarised below.
9 |
10 | ### Failed to check
11 |
12 | * ctsem (NA)
13 | * nlmixr2 (NA)
14 |
--------------------------------------------------------------------------------
/revdep/email.yml:
--------------------------------------------------------------------------------
1 | release_version: 2.0.0
2 | release_date: October 1st
3 | rel_release_date: TWO WEEKS
4 | my_news_url: https://github.com/r-lib/devtools/blob/master/NEWS.md#devtools-development
5 |
--------------------------------------------------------------------------------
/revdep/problems.md:
--------------------------------------------------------------------------------
1 | *Wow, no problems at all. :)*
--------------------------------------------------------------------------------
/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 | # This file is part of the standard setup for testthat.
2 | # It is recommended that you do not modify it.
3 | #
4 | # Where should you do additional test configuration?
5 | # Learn more about the roles of various files in:
6 | # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
7 | # * https://testthat.r-lib.org/articles/special-files.html
8 |
9 | library(testthat)
10 | library(devtools)
11 |
12 | test_check("devtools")
13 |
--------------------------------------------------------------------------------
/tests/testthat/_snaps/active.md:
--------------------------------------------------------------------------------
1 | # find_active_file() gives useful error if no RStudio
2 |
3 | Code
4 | find_active_file()
5 | Condition
6 | Error:
7 | ! Argument `file` is missing, with no default
8 |
9 | # fails if can't find tests
10 |
11 | Code
12 | find_test_file("R/foo.blah")
13 | Condition
14 | Error:
15 | ! Don't know how to find tests associated with the active file 'foo.blah'
16 | Code
17 | find_test_file("R/foo.R")
18 | Condition
19 | Error:
20 | ! No test files found
21 |
22 |
--------------------------------------------------------------------------------
/tests/testthat/_snaps/build-readme.md:
--------------------------------------------------------------------------------
1 | # useful errors if too few or too many
2 |
3 | Code
4 | build_readme(pkg)
5 | Condition
6 | Error in `build_readme()`:
7 | ! Can't find 'README.Rmd' or 'inst/README.Rmd'.
8 |
9 | ---
10 |
11 | Code
12 | build_readme(pkg)
13 | Condition
14 | Error in `build_readme()`:
15 | ! Can't have both 'README.Rmd' and 'inst/README.Rmd'.
16 |
17 |
--------------------------------------------------------------------------------
/tests/testthat/_snaps/check-win.md:
--------------------------------------------------------------------------------
1 | # change_maintainer_email checks fields
2 |
3 | Code
4 | change_maintainer_email(path, "x@example.com")
5 | Condition
6 | Error:
7 | ! DESCRIPTION must use Authors@R field when changing `email`
8 |
9 | ---
10 |
11 | Code
12 | change_maintainer_email(path, "x@example.com")
13 | Condition
14 | Error:
15 | ! DESCRIPTION can't use Maintainer field when changing `email`
16 |
17 |
--------------------------------------------------------------------------------
/tests/testthat/_snaps/package.md:
--------------------------------------------------------------------------------
1 | # package_file() gives useful errors
2 |
3 | Code
4 | package_file(path = 1)
5 | Condition
6 | Error in `package_file()`:
7 | ! `path` must be a string.
8 | Code
9 | package_file(path = "doesntexist")
10 | Condition
11 | Error in `package_file()`:
12 | ! 'doesntexist' is not a directory.
13 | Code
14 | package_file(path = "/")
15 | Condition
16 | Error in `package_file()`:
17 | ! Could not find package root.
18 | i Is '/' inside a package?
19 |
20 | # create argument is deprecated
21 |
22 | Code
23 | x <- as.package(path, create = TRUE)
24 | Condition
25 | Warning:
26 | The `create` argument of `as.package()` is deprecated as of devtools 2.5.0.
27 |
28 |
--------------------------------------------------------------------------------
/tests/testthat/_snaps/run-source.md:
--------------------------------------------------------------------------------
1 | # gist with multiple files uses first with warning
2 |
3 | Code
4 | source_gist("605a984e764f9ed358556b4ce48cbd08", sha1 = "f176f5e1fe0", local = environment())
5 | Message
6 | 2 .R files in gist, using first
7 | i Sourcing gist "605a984e764f9ed358556b4ce48cbd08"
8 |
9 | # errors with bad id
10 |
11 | Code
12 | source_gist("xxxx")
13 | Condition
14 | Error in `source_gist()`:
15 | ! Invalid gist id specification "xxxx"
16 |
17 | # error if file doesn't exist or no files
18 |
19 | Code
20 | find_gist("605a984e764f9ed358556b4ce48cbd08", 1)
21 | Condition
22 | Error:
23 | ! `filename` must be `NULL`, or a single filename ending in .R/.r
24 | Code
25 | find_gist("605a984e764f9ed358556b4ce48cbd08", "c.r")
26 | Condition
27 | Error:
28 | ! 'c.r' not found in gist
29 | Code
30 | find_gist("c535eee2d02e5f47c8e7642811bc327c")
31 | Condition
32 | Error:
33 | ! No R files found in gist
34 |
35 | # check_sha1() checks or reports sha1 as needed
36 |
37 | Code
38 | check_sha1(path, NULL)
39 | Message
40 | i SHA-1 hash of file is "9f7efafc467018e11a7efc4bb7089ff0e5bff371"
41 | Code
42 | check_sha1(path, "f")
43 | Condition
44 | Error in `check_sha1()`:
45 | ! `sha1` must be at least 6 characters, not 1.
46 | Code
47 | check_sha1(path, "ffffff")
48 | Condition
49 | Error in `check_sha1()`:
50 | ! `sha1` ("ffffff") doesn't match SHA-1 hash of downloaded file ("9f7efa")
51 |
52 |
--------------------------------------------------------------------------------
/tests/testthat/_snaps/sitrep.md:
--------------------------------------------------------------------------------
1 | # check_for_rstudio_updates
2 |
3 | Code
4 | writeLines(check_for_rstudio_updates("windows", "haha-no-wut", TRUE))
5 | Output
6 | Unable to check for RStudio updates (you're using haha-no-wut).
7 |
8 | ---
9 |
10 | Code
11 | writeLines(check_for_rstudio_updates("darwin", "0.0.1", TRUE))
12 | Output
13 | RStudio {VERSION} is now available (you're using 0.0.1).
14 | Download at: https://www.rstudio.com/products/rstudio/download/
15 |
16 | ---
17 |
18 | Code
19 | writeLines(check_for_rstudio_updates("windows", "1.4.1717", TRUE))
20 | Output
21 | RStudio {VERSION} is now available (you're using 1.4.1717).
22 | Download at: https://www.rstudio.com/products/rstudio/download/
23 |
24 | ---
25 |
26 | Code
27 | writeLines(check_for_rstudio_updates("darwin", "2021.09.1+372", TRUE))
28 | Output
29 | RStudio {VERSION} is now available (you're using 2021.09.1+372).
30 | Download at: https://www.rstudio.com/products/rstudio/download/
31 |
32 | ---
33 |
34 | Code
35 | writeLines(check_for_rstudio_updates("windows", "2021.09.0-daily+328", TRUE))
36 | Output
37 | RStudio {VERSION} is now available (you're using 2021.09.0-daily+328).
38 | Download at: https://www.rstudio.com/products/rstudio/download/
39 |
40 |
--------------------------------------------------------------------------------
/tests/testthat/archive.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/tests/testthat/archive.rds
--------------------------------------------------------------------------------
/tests/testthat/check-results-note.log:
--------------------------------------------------------------------------------
1 | * using log directory ‘/private/tmp/Rtmpe1I3BZ/devtools.Rcheck’
2 | * using R version 3.2.3 (2015-12-10)
3 | * using platform: x86_64-apple-darwin13.4.0 (64-bit)
4 | * using session charset: UTF-8
5 | * using option ‘--as-cran’
6 | * checking for file ‘devtools/DESCRIPTION’ ... OK
7 | * this is package ‘devtools’ version ‘1.10.0.9000’
8 | * checking package namespace information ... OK
9 | * checking package dependencies ... OK
10 | * checking if this is a source package ... OK
11 | * checking if there is a namespace ... OK
12 | * checking for executable files ... OK
13 | * checking for hidden files and directories ... OK
14 | * checking for portable file names ... OK
15 | * checking for sufficient/correct file permissions ... OK
16 | * checking whether package ‘devtools’ can be installed ... OK
17 | * checking installed package size ... OK
18 | * checking package directory ... OK
19 | * checking ‘build’ directory ... OK
20 | * checking DESCRIPTION meta-information ... OK
21 | * checking top-level files ... OK
22 | * checking for left-over files ... OK
23 | * checking index information ... OK
24 | * checking package subdirectories ... OK
25 | * checking R files for non-ASCII characters ... OK
26 | * checking R files for syntax errors ... OK
27 | * checking whether the package can be loaded ... OK
28 | * checking whether the package can be loaded with stated dependencies ... OK
29 | * checking whether the package can be unloaded cleanly ... OK
30 | * checking whether the namespace can be loaded with stated dependencies ... OK
31 | * checking whether the namespace can be unloaded cleanly ... OK
32 | * checking loading without being on the library search path ... OK
33 | * checking dependencies in R code ... OK
34 | * checking S3 generic/method consistency ... OK
35 | * checking replacement functions ... OK
36 | * checking foreign function calls ... NOTE
37 | Registration problem:
38 | Evaluating ‘dll$foo’ during check gives error
39 | ‘object 'dll' not found’:
40 | .C(dll$foo, 0L)
41 | See chapter ‘System and foreign language interfaces’ in the ‘Writing R
42 | Extensions’ manual.
43 | * checking R code for possible problems ... NOTE
44 | Found the following calls to attach():
45 | File ‘devtools/R/package-env.r’:
46 | attach(NULL, name = pkg_env_name(pkg))
47 | File ‘devtools/R/shims.r’:
48 | attach(e, name = "devtools_shims", warn.conflicts = FALSE)
49 | See section ‘Good practice’ in ‘?attach’.
50 | * checking Rd files ... OK
51 | * checking Rd metadata ... OK
52 | * checking Rd line widths ... OK
53 | * checking Rd cross-references ... OK
54 | * checking for missing documentation entries ... OK
55 | * checking for code/documentation mismatches ... OK
56 | * checking Rd \usage sections ... OK
57 | * checking Rd contents ... OK
58 | * checking for unstated dependencies in examples ... OK
59 | * checking line endings in C/C++/Fortran sources/headers ... OK
60 | * checking compiled code ... OK
61 | * checking installed files from ‘inst/doc’ ... OK
62 | * checking files in ‘vignettes’ ... OK
63 | * checking examples ... OK
64 | ** found \donttest examples: check also with --run-donttest
65 | * checking for unstated dependencies in ‘tests’ ... OK
66 | * checking tests ... OK
67 | Running ‘has-devel.R’
68 | Running ‘test-that.R’ [33s/42s]
69 | * checking for unstated dependencies in vignettes ... OK
70 | * checking package vignettes in ‘inst/doc’ ... OK
71 | * checking running R code from vignettes ... OK
72 | * checking re-building of vignette outputs ... OK
73 | * checking PDF version of manual ... OK
74 | * DONE
75 | Status: 2 NOTEs
76 |
--------------------------------------------------------------------------------
/tests/testthat/helper.R:
--------------------------------------------------------------------------------
1 | # This is a VERY trimmed down version of create_local_thing from usethis
2 | local_package_create <- function(envir = parent.frame()) {
3 | dir <- withr::local_tempdir(.local_envir = envir)
4 |
5 | usethis::ui_silence({
6 | create_package(dir, rstudio = FALSE, open = FALSE, check_name = FALSE)
7 | })
8 |
9 | dir
10 | }
11 |
12 | local_package_copy <- function(path, env = parent.frame()) {
13 | temp_path <- withr::local_tempdir(.local_envir = env)
14 |
15 | dir_copy(path, temp_path, overwrite = TRUE)
16 | temp_path
17 | }
18 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/HEAD:
--------------------------------------------------------------------------------
1 | ref: refs/heads/master
2 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/config:
--------------------------------------------------------------------------------
1 | [core]
2 | repositoryformatversion = 0
3 | filemode = true
4 | bare = true
5 | [remote "origin"]
6 | url = https://github.com/r-lib/devtools.git
7 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/description:
--------------------------------------------------------------------------------
1 | Unnamed repository; edit this file 'description' to name the repository.
2 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/info/exclude:
--------------------------------------------------------------------------------
1 | # git ls-files --others --exclude-from=.git/info/exclude
2 | # Lines that start with '#' are comments.
3 | # For a project mostly in C, the following would be a good set of
4 | # exclude patterns (uncomment them if you want to use them):
5 | # *.[oa]
6 | # *~
7 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/objects/pack/pack-c4e0f1d1d68408f260cbbf0a533ad5f6bfd5524e.idx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/tests/testthat/shallowRepo/objects/pack/pack-c4e0f1d1d68408f260cbbf0a533ad5f6bfd5524e.idx
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/objects/pack/pack-c4e0f1d1d68408f260cbbf0a533ad5f6bfd5524e.pack:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/tests/testthat/shallowRepo/objects/pack/pack-c4e0f1d1d68408f260cbbf0a533ad5f6bfd5524e.pack
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/packed-refs:
--------------------------------------------------------------------------------
1 | # pack-refs with: peeled fully-peeled
2 | 21d5d9401101dcf2baada3db424e4de0e9c7f869 refs/heads/master
3 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/refs/tags/v1.10.0:
--------------------------------------------------------------------------------
1 | acae7cb43bc9618d5be8a7932e37bdc7728f8782
2 |
--------------------------------------------------------------------------------
/tests/testthat/shallowRepo/shallow:
--------------------------------------------------------------------------------
1 | a5615c0d64ec60be7a8a8e3ff21f8575ac292a17
2 |
--------------------------------------------------------------------------------
/tests/testthat/test-active.R:
--------------------------------------------------------------------------------
1 | test_that("find_active_file() gives useful error if no RStudio", {
2 | expect_snapshot(find_active_file(), error = TRUE)
3 | })
4 |
5 | test_that("fails if can't find tests", {
6 | dir <- local_package_create()
7 | withr::local_dir(dir)
8 |
9 | expect_snapshot(error = TRUE, {
10 | find_test_file("R/foo.blah")
11 | find_test_file("R/foo.R")
12 | })
13 | })
14 |
15 | test_that("can determine file type", {
16 | expect_equal(test_file_type("R/foo.R"), "R")
17 | expect_equal(test_file_type("R/foo.c"), NA_character_)
18 |
19 | expect_equal(test_file_type("src/foo.c"), "src")
20 | expect_equal(test_file_type("src/foo.R"), NA_character_)
21 |
22 | expect_equal(test_file_type("tests/testthat/test-foo.R"), "test")
23 | expect_equal(test_file_type("tests/testthat/test-foo.c"), NA_character_)
24 | expect_equal(test_file_type("tests/testthat/foo.R"), NA_character_)
25 |
26 | expect_equal(test_file_type("DESCRIPTION"), NA_character_)
27 | })
28 |
--------------------------------------------------------------------------------
/tests/testthat/test-build-readme.R:
--------------------------------------------------------------------------------
1 | test_that("can build README in root directory", {
2 | skip_on_cran()
3 |
4 | pkg <- local_package_create()
5 | suppressMessages(usethis::with_project(pkg, use_readme_rmd()))
6 |
7 | suppressMessages(build_readme(pkg))
8 | expect_true(file_exists(path(pkg, "README.md")))
9 | expect_false(file_exists(path(pkg, "README.html")))
10 | })
11 |
12 | test_that("can build README in inst/", {
13 | skip_on_cran()
14 |
15 | pkg <- local_package_create()
16 | suppressMessages(usethis::with_project(pkg, use_readme_rmd()))
17 | dir_create(pkg, "inst")
18 | file_move(
19 | path(pkg, "README.Rmd"),
20 | path(pkg, "inst", "README.Rmd")
21 | )
22 |
23 | suppressMessages(build_readme(pkg))
24 | expect_true(file_exists(path(pkg, "inst", "README.md")))
25 | expect_false(file_exists(path(pkg, "README.Rmd")))
26 | expect_false(file_exists(path(pkg, "README.md")))
27 | expect_false(file_exists(path(pkg, "inst", "README.html")))
28 | })
29 |
30 | test_that("useful errors if too few or too many", {
31 | pkg <- local_package_create()
32 | expect_snapshot(build_readme(pkg), error = TRUE)
33 |
34 | suppressMessages(usethis::with_project(pkg, use_readme_rmd()))
35 | dir_create(pkg, "inst")
36 | file_copy(path(pkg, "README.Rmd"), path(pkg, "inst", "README.Rmd"))
37 | expect_snapshot(build_readme(pkg), error = TRUE)
38 | })
39 |
40 | test_that("don't error for README in another directory", {
41 | skip_on_cran()
42 |
43 | pkg <- local_package_create()
44 | suppressMessages(usethis::with_project(pkg, use_readme_rmd(open = FALSE)))
45 | dir_create(pkg, "data-raw")
46 | file_create(pkg, "data-raw", "README.md")
47 |
48 | expect_no_error(suppressMessages(build_readme(pkg)))
49 | })
50 |
--------------------------------------------------------------------------------
/tests/testthat/test-build-site.R:
--------------------------------------------------------------------------------
1 | test_that("Package pkgdown site can be built ", {
2 | # This test requires internet
3 | skip_if_offline()
4 | skip_on_cran()
5 |
6 | destination <- path(tempdir(), "testPkgdown", "docs")
7 |
8 | build_output <- capture.output({
9 | build_site(
10 | path = "testPkgdown",
11 | override = list(destination = destination)
12 | )
13 | }, type = c("output"))
14 |
15 | build_output <- paste(build_output, collapse = "\n")
16 |
17 | expect_true(file_exists(path(destination, "index.html")),
18 | info = build_output,
19 | label = "created site index"
20 | )
21 | expect_true(file_exists(path(destination, "reference", "index.html")),
22 | info = build_output,
23 | label = "created reference index"
24 | )
25 | expect_true(file_exists(path(destination, "articles", "index.html")),
26 | info = build_output,
27 | label = "created articles index"
28 | )
29 | expect_true(file_exists(path(destination, "articles", "test.html")),
30 | info = build_output,
31 | label = "created articles index"
32 | )
33 | })
34 |
--------------------------------------------------------------------------------
/tests/testthat/test-check-doc.R:
--------------------------------------------------------------------------------
1 | test_that("check_man works", {
2 | # tools:::.check_Rd_xrefs which is called by `check_man()` assumes the base
3 | # and recommended packages will all be in the library path, which is not the
4 | # case during R CMD check, so we only run these tests interactively
5 |
6 | skip_if_not(interactive())
7 |
8 | pkg <- local_package_create()
9 | dir.create(file.path(pkg, "man"))
10 | writeLines(c("
11 | \\name{foo}
12 | \\title{Foo bar}
13 | \\usage{
14 | foo(x)
15 | }
16 | \\arguments{\\item{foo}{}}
17 | "), file.path(pkg, "man", "foo.Rd"))
18 |
19 | expect_output(
20 | check_man(pkg),
21 | "Undocumented arguments"
22 | )
23 | })
24 |
--------------------------------------------------------------------------------
/tests/testthat/test-check-win.R:
--------------------------------------------------------------------------------
1 | test_that("change_maintainer_email checks fields", {
2 | path <- withr::local_tempfile()
3 |
4 | desc <- desc::desc(text = "")
5 | desc$write(path)
6 | expect_snapshot(change_maintainer_email(path, "x@example.com"), error = TRUE)
7 |
8 | desc <- desc::desc(text = c(
9 | "Authors@R: person('x', 'y')",
10 | "Maintainer: foo "
11 | ))
12 | desc$write(path)
13 | expect_snapshot(change_maintainer_email(path, "x@example.com"), error = TRUE)
14 | })
15 |
--------------------------------------------------------------------------------
/tests/testthat/test-check.R:
--------------------------------------------------------------------------------
1 | test_that("can determine when to document", {
2 | expect_false(can_document(list()))
3 | # TODO: switch to expect_snapshot()
4 | expect_output(
5 | expect_message(
6 | expect_false(can_document(list(roxygennote = "15.0.00"))),
7 | "doesn't match required"
8 | )
9 | )
10 | expect_true(can_document(list(roxygennote = packageVersion("roxygen2"))))
11 | })
12 |
13 | test_that("fail instead of sending an email to wrong recipient", {
14 | # The testTest package has both Authors@R and Maintainer field - this causes problems in change_maintainer_email().
15 | # The function checks if the provided email is actually the one in the maintainer field instead of sending the report to the wrong recipient
16 | expect_error(check_win_release(path("testTest"), email = "foo@bar.com"))
17 | })
18 |
--------------------------------------------------------------------------------
/tests/testthat/test-install.R:
--------------------------------------------------------------------------------
1 | test_that("vignettes built on install", {
2 | skip_on_cran()
3 |
4 | if (!pkgbuild::has_latex()) {
5 | skip("pdflatex not available")
6 | }
7 |
8 | pkg <- local_package_copy(test_path("testVignettesBuilt"))
9 |
10 | withr::local_temp_libpaths()
11 | install(pkg, reload = FALSE, quiet = TRUE, build_vignettes = TRUE)
12 |
13 | vigs <- vignette(package = "testVignettesBuilt")$results
14 | expect_equal(nrow(vigs), 1)
15 | expect_equal(vigs[3], "new")
16 | })
17 |
--------------------------------------------------------------------------------
/tests/testthat/test-package.R:
--------------------------------------------------------------------------------
1 | test_that("package_file() gives useful errors", {
2 | expect_snapshot(error = TRUE, {
3 | package_file(path = 1)
4 | package_file(path = "doesntexist")
5 | package_file(path = "/")
6 | })
7 | })
8 |
9 | test_that("create argument is deprecated", {
10 | path <- local_package_create()
11 | expect_snapshot(x <- as.package(path, create = TRUE))
12 | })
13 |
--------------------------------------------------------------------------------
/tests/testthat/test-reload.R:
--------------------------------------------------------------------------------
1 | test_that("reload works", {
2 | withr::local_temp_libpaths()
3 |
4 | pkg <- as.package(test_path("testTest"))
5 | pkg_name <- pkg$package
6 |
7 | install(pkg, quiet = TRUE)
8 | on.exit(unload(pkg$package), add = TRUE)
9 |
10 | expect_false(is_loaded(pkg))
11 |
12 | # Do nothing if the package is not loaded
13 | expect_error(reload(pkg, quiet = TRUE), NA)
14 | expect_false(is_loaded(pkg))
15 |
16 | # Reload if loaded
17 | requireNamespace(pkg_name, quietly = TRUE)
18 | expect_true(is_loaded(pkg))
19 | reload(pkg, quiet = TRUE)
20 | expect_true(is_loaded(pkg))
21 |
22 | # Re-attach if attached
23 | unload(pkg$package, quiet = TRUE)
24 | library(pkg_name, character.only = TRUE, quietly = TRUE)
25 | expect_true(is_loaded(pkg))
26 | expect_true(is_attached(pkg))
27 | reload(pkg, quiet = TRUE)
28 | expect_true(is_loaded(pkg))
29 | expect_true(is_attached(pkg))
30 | })
31 |
--------------------------------------------------------------------------------
/tests/testthat/test-run-examples.R:
--------------------------------------------------------------------------------
1 | test_that("Can run an example", {
2 | pkg <- "testHelp"
3 | expect_output(
4 | suppressMessages(run_examples(pkg = pkg, document = FALSE)),
5 | "You called foofoo.",
6 | fixed = TRUE
7 | )
8 | })
9 |
--------------------------------------------------------------------------------
/tests/testthat/test-run-source.R:
--------------------------------------------------------------------------------
1 | test_that("gist containing single file works unambiguously", {
2 | skip_if_offline()
3 | skip_on_cran()
4 | skip_on_ci()
5 |
6 | a <- 10
7 | source_gist(
8 | "a65ddd06db40213f1a921237c55defbe",
9 | sha1 = "f176f5e1fe05b69b1ef799fdd1e4bac6341aff51",
10 | local = environment(),
11 | quiet = TRUE
12 | )
13 | expect_equal(a, 1)
14 | })
15 |
16 | test_that("gist with multiple files uses first with warning", {
17 | skip_if_offline()
18 | skip_on_cran()
19 | skip_on_ci()
20 |
21 | a <- 10
22 | expect_snapshot(
23 | source_gist(
24 | "605a984e764f9ed358556b4ce48cbd08",
25 | sha1 = "f176f5e1fe0",
26 | local = environment()
27 | )
28 | )
29 | expect_equal(a, 1)
30 | })
31 |
32 | test_that("errors with bad id", {
33 | expect_snapshot(source_gist("xxxx"), error = TRUE)
34 | })
35 |
36 | test_that("can specify filename", {
37 | skip_if_offline()
38 | skip_on_cran()
39 | skip_on_ci()
40 |
41 | b <- 10
42 | source_gist(
43 | "605a984e764f9ed358556b4ce48cbd08",
44 | filename = "b.r",
45 | sha1 = "8d1c53241c425a9a52700726809b7f2c164bde72",
46 | local = environment(),
47 | quiet = TRUE
48 | )
49 | expect_equal(b, 2)
50 | })
51 |
52 | test_that("error if file doesn't exist or no files", {
53 | skip_if_offline()
54 | skip_on_cran()
55 | skip_on_ci()
56 |
57 | expect_snapshot(error = TRUE, {
58 | find_gist("605a984e764f9ed358556b4ce48cbd08", 1)
59 | find_gist("605a984e764f9ed358556b4ce48cbd08", "c.r")
60 | find_gist("c535eee2d02e5f47c8e7642811bc327c")
61 | })
62 |
63 | })
64 |
65 | test_that("check_sha1() checks or reports sha1 as needed", {
66 | path <- withr::local_tempfile()
67 | writeBin("abc\n", path)
68 |
69 | expect_snapshot(error = TRUE, {
70 | check_sha1(path, NULL)
71 | check_sha1(path, "f")
72 | check_sha1(path, "ffffff")
73 | })
74 | })
75 |
--------------------------------------------------------------------------------
/tests/testthat/test-sitrep.R:
--------------------------------------------------------------------------------
1 | test_that("check_for_rstudio_updates", {
2 | skip_if_offline()
3 | skip_on_cran()
4 |
5 | # the IDE ends up calling this with `os = "mac"` on macOS, but we would send
6 | # "darwin" in that case, so I test with "darwin"
7 | # also mix in some "windows"
8 |
9 | # returns nothing rstudio not available
10 | expect_null(check_for_rstudio_updates("darwin", "1.0.0", FALSE))
11 |
12 | # returns nothing if the version is ahead of the current version
13 | expect_null(check_for_rstudio_updates("windows", "2030.12.0+123", TRUE))
14 |
15 | # returns something if ...
16 | local_edition(3)
17 | scrub_current_version <- function(message) {
18 | sub("(?<=^RStudio )[0-9\\.\\+]+", "{VERSION}", message, perl = TRUE)
19 | }
20 |
21 | # version is not understood by the service
22 | expect_snapshot(
23 | writeLines(check_for_rstudio_updates("windows", "haha-no-wut", TRUE))
24 | )
25 |
26 | # version is behind the current version
27 |
28 | # truly ancient
29 | expect_snapshot(
30 | writeLines(check_for_rstudio_updates("darwin", "0.0.1", TRUE)),
31 | transform = scrub_current_version
32 | )
33 |
34 | # Juliet Rose, does not have long_version, last before numbering changed
35 | expect_snapshot(
36 | writeLines(check_for_rstudio_updates("windows", "1.4.1717", TRUE)),
37 | transform = scrub_current_version
38 | )
39 |
40 | # new scheme, introduced 2021-08
41 | # YYYY.MM.[-(daily|preview)]+[.pro]
42 | # YYY.MM is th expected date of release for dailies and previews
43 |
44 | # an out-of-date preview
45 | expect_snapshot(
46 | writeLines(check_for_rstudio_updates("darwin", "2021.09.1+372", TRUE)),
47 | transform = scrub_current_version
48 | )
49 |
50 | # an out-of-date daily
51 | expect_snapshot(
52 | writeLines(check_for_rstudio_updates("windows", "2021.09.0-daily+328", TRUE)),
53 | transform = scrub_current_version
54 | )
55 | })
56 |
--------------------------------------------------------------------------------
/tests/testthat/test-test.R:
--------------------------------------------------------------------------------
1 | test_test <- function(...) {
2 | suppressMessages(test(..., reporter = "silent"))
3 | }
4 | test_test_active_file <- function(...) {
5 | suppressMessages(test_active_file(..., reporter = "silent"))
6 | }
7 |
8 | test_that("Package can be tested with testthat not on search path", {
9 | pkg1 <- test_path("testTest")
10 | pkg2 <- test_path("testTestWithDepends")
11 |
12 | testthat_pos <- which(search() == "package:testthat")
13 | if (length(testthat_pos) > 0) {
14 | testthat_env <- detach(pos = testthat_pos)
15 | on.exit(attach(testthat_env, testthat_pos), add = TRUE)
16 | }
17 |
18 | test_test(pkg1)
19 | expect_true(TRUE)
20 | test_test(pkg2)
21 | expect_true(TRUE)
22 | })
23 |
24 | test_that("Filtering works with devtools::test", {
25 | out <- test_test(test_path("testTest"), filter = "dummy")
26 | expect_equal(length(out), 1)
27 | })
28 |
29 | test_that("devtools::test_active_file works", {
30 | out <- test_test_active_file(test_path("testTest/tests/testthat/test-dummy.R"))
31 | expect_equal(length(out), 1)
32 | })
33 |
34 | test_that("TESTTHAT_PKG environment variable is set", {
35 | withr::local_envvar("TESTTHAT_PKG" = "incorrect")
36 |
37 | test_test(
38 | test_path("testTest"),
39 | filter = "envvar",
40 | stop_on_failure = TRUE
41 | )
42 | test_test_active_file(
43 | test_path("testTest/tests/testthat/test-envvar.R"),
44 | stop_on_failure = TRUE
45 | )
46 |
47 | expect_true(TRUE)
48 | })
49 |
50 | test_that("stop_on_failure defaults to FALSE", {
51 | expect_error(
52 | test_test(test_path("testTestWithFailure")),
53 | NA
54 | )
55 | expect_error(
56 | test_test(test_path("testTestWithFailure"), stop_on_failure = TRUE),
57 | "Test failures"
58 | )
59 | })
60 |
--------------------------------------------------------------------------------
/tests/testthat/test-uninstall.R:
--------------------------------------------------------------------------------
1 | test_that("uninstall() unloads and removes from library", {
2 | withr::local_temp_libpaths()
3 |
4 | # Install package
5 | install(test_path("testHelp"), quiet = TRUE)
6 | expect_true(require(testHelp, quietly = TRUE))
7 | expect_true("testHelp" %in% loaded_packages()$package)
8 |
9 | # Uninstall package
10 | uninstall(test_path("testHelp"), quiet = TRUE)
11 | expect_false("testHelp" %in% loaded_packages()$package)
12 | suppressWarnings(expect_false(require(testHelp, quietly = TRUE)))
13 | })
14 |
--------------------------------------------------------------------------------
/tests/testthat/test-utils.R:
--------------------------------------------------------------------------------
1 | test_that("case-insensitive sort order", {
2 | expect_equal(sort_ci(rev(letters)), letters)
3 | expect_equal(sort_ci(rev(LETTERS)), LETTERS)
4 | expect_equal(sort_ci(c(letters[1:3], LETTERS[1:3])), c("A", "a", "B", "b", "C", "c"))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-vignettes.R:
--------------------------------------------------------------------------------
1 | test_that("Sweave vignettes copied into doc", {
2 | if (!pkgbuild::has_latex()) {
3 | skip("pdflatex not available")
4 | }
5 |
6 | pkg <- local_package_copy(test_path("testVignettes"))
7 |
8 | suppressMessages(build_vignettes(pkg, quiet = TRUE))
9 | expect_setequal(
10 | path_file(dir_ls(path(pkg, "doc"))),
11 | c("new.pdf", "new.R", "new.Rnw")
12 | )
13 | })
14 |
15 | test_that("Built files are updated", {
16 | # This test is time dependant and sometimes fails on CRAN because the systems are under heavy load.
17 | skip_on_cran()
18 | pkg <- local_package_copy(test_path("testMarkdownVignettes"))
19 |
20 | suppressMessages(build_vignettes(pkg, quiet = TRUE))
21 | output <- dir_ls(path(pkg, "doc"), regexp = "new")
22 | first <- file_info(output)$modification_time
23 |
24 | Sys.sleep(.01)
25 | suppressMessages(build_vignettes(pkg, quiet = TRUE))
26 | second <- file_info(output)$modification_time
27 |
28 | expect_true(all(second > first))
29 | })
30 |
31 | test_that("Rmarkdown vignettes copied into doc", {
32 | pkg <- local_package_copy(test_path("testMarkdownVignettes"))
33 | doc <- path(pkg, "doc")
34 |
35 | suppressMessages(build_vignettes(pkg, quiet = TRUE))
36 | expect_setequal(path_file(dir_ls(doc)), c("test.html", "test.R", "test.Rmd"))
37 | })
38 |
39 | test_that("extra files copied and removed", {
40 | pkg <- local_package_copy(test_path("testMarkdownVignettes"))
41 | writeLines("a <- 1", path(pkg, "vignettes", "a.R"))
42 |
43 | extras_path <- path(pkg, "vignettes", ".install_extras")
44 | writeLines("a.R", extras_path)
45 |
46 | suppressMessages(build_vignettes(pkg, quiet = TRUE))
47 | expect_true(file_exists(path(pkg, "doc", "a.R")))
48 |
49 | suppressMessages(clean_vignettes(pkg))
50 | expect_false(file_exists(path(pkg, "doc", "a.R")))
51 | })
52 |
53 | test_that(".gitignore updated when building vignettes", {
54 | pkg <- local_package_copy(test_path("testMarkdownVignettes"))
55 | gitignore <- path(pkg, ".gitignore")
56 |
57 | suppressMessages(build_vignettes(pkg, quiet = TRUE))
58 | expect_true(all(c("/Meta/", "/doc/") %in% readLines(gitignore)))
59 | })
60 |
--------------------------------------------------------------------------------
/tests/testthat/testCheckExtrafile/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testCheckExtrafile
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 | Collate:
9 | 'a.r'
10 |
--------------------------------------------------------------------------------
/tests/testthat/testCheckExtrafile/NAMESPACE:
--------------------------------------------------------------------------------
1 | export(a)
2 |
--------------------------------------------------------------------------------
/tests/testthat/testCheckExtrafile/R/a.R:
--------------------------------------------------------------------------------
1 | #' A number.
2 | #' @export
3 | a <- 1
4 |
--------------------------------------------------------------------------------
/tests/testthat/testCheckExtrafile/an_extra_file:
--------------------------------------------------------------------------------
1 | This is an extra file in the package.
2 |
--------------------------------------------------------------------------------
/tests/testthat/testCheckExtrafile/man/a.Rd:
--------------------------------------------------------------------------------
1 | \docType{data}
2 | \name{a}
3 | \alias{a}
4 | \title{A number.}
5 | \format{num 1}
6 | \usage{
7 | a
8 | }
9 | \description{
10 | A number.
11 | }
12 | \keyword{datasets}
13 |
14 |
--------------------------------------------------------------------------------
/tests/testthat/testError/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testError
2 | Title: Test package to check error message gives file/line info
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
--------------------------------------------------------------------------------
/tests/testthat/testError/R/error.R:
--------------------------------------------------------------------------------
1 | f <- function() {
2 | 5 * 10
3 | }
4 |
5 |
6 |
7 | stop("This is an error!") # nolint
8 |
--------------------------------------------------------------------------------
/tests/testthat/testHelp/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testHelp
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description: Test package for devtools help.
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 | RoxygenNote: 6.0.1
9 |
--------------------------------------------------------------------------------
/tests/testthat/testHelp/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(foofoo)
4 |
--------------------------------------------------------------------------------
/tests/testthat/testHelp/R/foofoo.R:
--------------------------------------------------------------------------------
1 | #' Test function for help
2 | #'
3 | #' The purpose of this function is to test out \code{help} and \code{?} from
4 | #' devtools.
5 | #'
6 | #' @examples
7 | #' stopifnot(foofoo() == 'You called foofoo.')
8 | #' @export
9 | foofoo <- function() "You called foofoo."
10 |
--------------------------------------------------------------------------------
/tests/testthat/testHelp/man/foofoo.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/foofoo.r
3 | \name{foofoo}
4 | \alias{foofoo}
5 | \title{Test function for help}
6 | \usage{
7 | foofoo()
8 | }
9 | \description{
10 | The purpose of this function is to test out \code{help} and \code{?} from
11 | devtools.
12 | }
13 | \examples{
14 | stopifnot(foofoo() == 'You called foofoo.')
15 | }
16 |
--------------------------------------------------------------------------------
/tests/testthat/testMarkdownVignettes/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^Meta$
2 | ^doc$
3 |
--------------------------------------------------------------------------------
/tests/testthat/testMarkdownVignettes/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testMarkdownVignettes
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 | VignetteBuilder: knitr
9 | Suggests: knitr, rmarkdown
10 |
--------------------------------------------------------------------------------
/tests/testthat/testMarkdownVignettes/vignettes/test.Rmd:
--------------------------------------------------------------------------------
1 |
8 |
9 | This is a test.
10 |
11 | ```{r}
12 | 1 + 2
13 | ```
14 |
--------------------------------------------------------------------------------
/tests/testthat/testMissingNsObject/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testMissingNsObject
2 | Title: Tools to make developing R code easier. This package lists 'b' as an
3 | export in NAMESPACE, but the 'b' object doesn't exist.
4 | License: GPL-2
5 | Description:
6 | Version: 0.1
7 |
--------------------------------------------------------------------------------
/tests/testthat/testMissingNsObject/NAMESPACE:
--------------------------------------------------------------------------------
1 | export(a)
2 | export(b)
--------------------------------------------------------------------------------
/tests/testthat/testMissingNsObject/R/a.R:
--------------------------------------------------------------------------------
1 | a <- 1
2 |
--------------------------------------------------------------------------------
/tests/testthat/testPkgdown/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testPkgdown
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Authors@R: c(
6 | person("Hadley", email = "h.wickham@gmail.com", role = c("aut", "cre")))
7 | Maintainer: Hadley
8 | Version: 0.1
9 | VignetteBuilder: knitr
10 | Suggests: knitr,
11 | pkgdown
12 | RoxygenNote: 6.1.1
13 |
--------------------------------------------------------------------------------
/tests/testthat/testPkgdown/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(pkgdown_test_test)
4 |
--------------------------------------------------------------------------------
/tests/testthat/testPkgdown/R/pkgdown-test-test.R:
--------------------------------------------------------------------------------
1 |
2 | #' pkgdown_test_test
3 | #'
4 | #' @param x marks the spot
5 | #'
6 | #' @return FALSE
7 | #' @export
8 | #'
9 | pkgdown_test_test <- function(x) {
10 | return(FALSE)
11 | }
12 |
--------------------------------------------------------------------------------
/tests/testthat/testPkgdown/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | title: pkgdown test
2 |
--------------------------------------------------------------------------------
/tests/testthat/testPkgdown/man/pkgdown_test_test.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pkgdown-test-test.R
3 | \name{pkgdown_test_test}
4 | \alias{pkgdown_test_test}
5 | \title{pkgdown_test_test}
6 | \usage{
7 | pkgdown_test_test(x)
8 | }
9 | \arguments{
10 | \item{x}{marks the spot}
11 | }
12 | \value{
13 | FALSE
14 | }
15 | \description{
16 | pkgdown_test_test
17 | }
18 |
--------------------------------------------------------------------------------
/tests/testthat/testPkgdown/vignettes/test.Rmd:
--------------------------------------------------------------------------------
1 |
5 |
6 | This is a test.
7 |
8 | ```{r}
9 | library(testPkgdown)
10 |
11 | pkgdown_test_test()
12 |
13 | 1 + 2
14 | ```
15 |
--------------------------------------------------------------------------------
/tests/testthat/testTest/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testTest
2 | Title: Tools to Make Developing R Code Easier
3 | License: GPL-2
4 | Description: Package description.
5 | Authors@R:
6 | c(person(given = "Hadley",
7 | family = "Wickham",
8 | role = c("aut", "cre"),
9 | email = "h.wickham@gmail.com"))
10 | Maintainer: Hadley
11 | Version: 0.1
12 | Suggests:
13 | testthat
14 | RoxygenNote: 5.0.1
15 |
--------------------------------------------------------------------------------
/tests/testthat/testTest/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 |
--------------------------------------------------------------------------------
/tests/testthat/testTest/R/dummy.R:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tests/testthat/testTest/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(testTest)
3 |
4 | test_check("testTest")
5 |
--------------------------------------------------------------------------------
/tests/testthat/testTest/tests/testthat/test-dummy.R:
--------------------------------------------------------------------------------
1 | test_that("multiplication works", {
2 | expect_equal(2 * 2, 4)
3 | })
4 |
--------------------------------------------------------------------------------
/tests/testthat/testTest/tests/testthat/test-envvar.R:
--------------------------------------------------------------------------------
1 | test_that("TESTTHAT_PKG environment variable is set", {
2 | expect_equal(Sys.getenv("TESTTHAT_PKG"), "testTest")
3 | })
4 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithDepends/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testTestWithDepends
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 | Depends: R
9 | Suggests: testthat
10 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithDepends/NAMESPACE:
--------------------------------------------------------------------------------
1 | exportPattern("^[^\\.]")
2 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithDepends/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(testTestWithDepends)
3 |
4 | test_check("testTestWithDepends")
5 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithDepends/tests/testthat/test-dummy.R:
--------------------------------------------------------------------------------
1 | test_that("multiplication works", {
2 | expect_equal(2 * 2, 4)
3 | })
4 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithFailure/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testTestWithFailure
2 | Title: Tools to Make Developing R Code Easier
3 | License: GPL-2
4 | Description: Package description.
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 | Suggests:
9 | testthat
10 | RoxygenNote: 5.0.1
11 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithFailure/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithFailure/R/dummy.R:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithFailure/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(testTest)
3 |
4 | test_check("testTest")
5 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithFailure/tests/testthat/test-fail.R:
--------------------------------------------------------------------------------
1 | test_that("failing test", {
2 | fail("Broken")
3 | })
4 |
--------------------------------------------------------------------------------
/tests/testthat/testTestWithFailure/tests/testthat/test-warn.R:
--------------------------------------------------------------------------------
1 | test_that("warning from test", {
2 | warning("Beware!") # nolint
3 | })
4 |
--------------------------------------------------------------------------------
/tests/testthat/testUseData/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testUseData
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 |
--------------------------------------------------------------------------------
/tests/testthat/testUseData/NAMESPACE:
--------------------------------------------------------------------------------
1 | export(sysdata_export)
2 |
--------------------------------------------------------------------------------
/tests/testthat/testUseData/R/a.R:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tests/testthat/testVignetteExtras/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^Meta$
2 | ^doc$
3 |
--------------------------------------------------------------------------------
/tests/testthat/testVignetteExtras/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testVignettes
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 |
--------------------------------------------------------------------------------
/tests/testthat/testVignetteExtras/NAMESPACE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/tests/testthat/testVignetteExtras/NAMESPACE
--------------------------------------------------------------------------------
/tests/testthat/testVignetteExtras/vignettes/a.R:
--------------------------------------------------------------------------------
1 | a <- 1
2 |
--------------------------------------------------------------------------------
/tests/testthat/testVignetteExtras/vignettes/new.Rnw:
--------------------------------------------------------------------------------
1 | \documentclass[oneside]{article}
2 |
3 | \begin{document}
4 | Test
5 | \end{document}
--------------------------------------------------------------------------------
/tests/testthat/testVignettes/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^Meta$
2 | ^doc$
3 |
--------------------------------------------------------------------------------
/tests/testthat/testVignettes/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testVignettes
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 |
--------------------------------------------------------------------------------
/tests/testthat/testVignettes/NAMESPACE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-lib/devtools/2aa51ef9b508d9ee760f3d94c64c6cc0eded99d9/tests/testthat/testVignettes/NAMESPACE
--------------------------------------------------------------------------------
/tests/testthat/testVignettes/vignettes/new.Rnw:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 |
3 | \begin{document}
4 | Test
5 | \end{document}
6 |
--------------------------------------------------------------------------------
/tests/testthat/testVignettesBuilt/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: testVignettesBuilt
2 | Title: Tools to make developing R code easier
3 | License: GPL-2
4 | Description:
5 | Author: Hadley
6 | Maintainer: Hadley
7 | Version: 0.1
8 |
--------------------------------------------------------------------------------
/tests/testthat/testVignettesBuilt/NAMESPACE:
--------------------------------------------------------------------------------
1 | export(function_with_unusual_name)
--------------------------------------------------------------------------------
/tests/testthat/testVignettesBuilt/R/code.R:
--------------------------------------------------------------------------------
1 | function_with_unusual_name <- function() {
2 | print("Hi!")
3 | }
--------------------------------------------------------------------------------
/tests/testthat/testVignettesBuilt/vignettes/new.Rnw:
--------------------------------------------------------------------------------
1 | %\VignetteIndexEntry{New}
2 |
3 | \documentclass{article}
4 | \begin{document}
5 |
6 | <<>>=
7 | library(testVignettesBuilt)
8 | function_with_unusual_name()
9 | @
10 |
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/vignettes/dependencies.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Devtools dependencies"
3 | author: "Jim Hester, Hadley Wickham"
4 | date: "`r Sys.Date()`"
5 | output:
6 | rmarkdown::html_vignette:
7 | keep_md: true
8 | vignette: >
9 | %\VignetteIndexEntry{Devtools dependencies}
10 | %\VignetteEngine{knitr::rmarkdown}
11 | %\VignetteEncoding{UTF-8}
12 | ---
13 |
14 | # Package remotes
15 |
16 | Devtools version 1.9 supports package dependency installation for packages not
17 | yet in a standard package repository such as [CRAN](https://cran.r-project.org)
18 | or [Bioconductor](http://bioconductor.org).
19 |
20 | You can mark any regular dependency defined in the `Depends`, `Imports`,
21 | `Suggests` or `Enhances` fields as being installed from a remote location by
22 | adding the remote location to `Remotes` in your `DESCRIPTION` file. This will
23 | cause devtools to download and install them prior to installing your package (so they won't be installed from CRAN).
24 |
25 | The remote dependencies specified in `Remotes` should be described in the following form.
26 |
27 | ```
28 | Remotes: [type::], [type2::]
29 | ```
30 |
31 | The `type` is an optional parameter. If the type is missing the default is
32 | to install from GitHub. Additional remote dependencies should be separated by
33 | commas, just like normal dependencies elsewhere in the `DESCRIPTION` file.
34 |
35 | It is important to remember that you **must always declare the dependency in the usual way**, i.e. include it in `Depends`, `Imports`, `Suggests` or `Enhances`. The `Remotes` field only provides instructions on where to install the dependency from. In this example `DESCRIPTION` file, note how rlang appears in `Imports` and in `Remotes`:
36 |
37 | ```
38 | Package: xyz
39 | Title: What the Package Does (One Line, Title Case)
40 | Version: 0.0.0.9000
41 | Authors@R:
42 | person(given = "First",
43 | family = "Last",
44 | role = c("aut", "cre"),
45 | email = "first.last@example.com")
46 | Description: What the package does (one paragraph).
47 | License: MIT + file LICENSE
48 | Imports:
49 | rlang
50 | Remotes:
51 | r-lib/rlang
52 | ```
53 |
54 | ### GitHub
55 |
56 | Because GitHub is the most commonly used unofficial package distribution in R, it's the default:
57 |
58 | ```yaml
59 | Remotes: hadley/testthat
60 | ```
61 |
62 | You can also specify a specific hash, tag, or pull request (using the same syntax as `install_github()` if you want a particular commit. Otherwise the latest commit on the HEAD of the branch is used.
63 |
64 | ```yaml
65 | Remotes: hadley/httr@v0.4,
66 | klutometis/roxygen#142,
67 | hadley/testthat@c67018fa4970
68 | ```
69 |
70 | A type of `github` can be specified, but is not required
71 |
72 | ```yaml
73 | Remotes: github::hadley/ggplot2
74 | ```
75 |
76 | ### Other sources
77 |
78 | All of the currently supported install sources are available, see the 'See
79 | Also' section in `?install` for a complete list.
80 |
81 | ```yaml
82 | # GitLab
83 | Remotes: gitlab::jimhester/covr
84 |
85 | # Git
86 | Remotes: git::git@bitbucket.org:djnavarro/lsr.git
87 |
88 | # Bitbucket
89 | Remotes: bitbucket::sulab/mygene.r@default, djnavarro/lsr
90 |
91 | # Bioconductor
92 | Remotes: bioc::3.3/SummarizedExperiment#117513, bioc::release/Biobase
93 |
94 | # SVN
95 | Remotes: svn::https://github.com/tidyverse/stringr
96 |
97 | # URL
98 | Remotes: url::https://github.com/tidyverse/stringr/archive/main.zip
99 |
100 | # Local
101 | Remotes: local::/pkgs/testthat
102 |
103 | # Gitorious
104 | Remotes: gitorious::r-mpc-package/r-mpc-package
105 | ```
106 |
107 | ### CRAN submission
108 |
109 | When you submit your package to CRAN, all of its dependencies must also be available on CRAN. For this reason, `release()` will warn you if you try to release a package with a `Remotes` field.
110 |
--------------------------------------------------------------------------------