Skip to content

Commit

Permalink
Merge branch 'r-1.0-5' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Oct 22, 2016
2 parents c06462b + 77e3ead commit 45c1ce1
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 52 deletions.
5 changes: 5 additions & 0 deletions .Rbuildignore
Expand Up @@ -12,3 +12,8 @@
^cran-comments\.md$
^inst/web$
^inst/staticdocs$
^\.travis\.yml$
^\.deploy_key\.pub$
^\.deploy_key\.enc$
^scripts/deploy-pages\.sh$
^docs$
Binary file added .deploy_key.enc
Binary file not shown.
10 changes: 10 additions & 0 deletions .deploy_key.pub
@@ -0,0 +1,10 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3qkRRQ4XiAiDvxyIj6V1
d2RuaFicbrjiGBQ4ZzbqbhuX6lzejvy2XdaOV/6lZiNHg0wmGpO2qtZI4rAdglx+
RAqOzK2UihtFGxQsCU7YI1J7ei0Vz1rsjq1Tz0J5+IcuTl2bWLihE2O+jufH/+Fm
EUjezx/gx0dv3ycpkCWjWgqIy9Jv62dRtKdu0BAw5F26/ELOwMvC210La2Q40Q2x
6uvFHWET4T2EsqZaT4srnEpeVPBiZSKFtliRFZCU8wk76avDja69d6F/Yih5qi32
ukl8in2O7Nw3d8KtIvYacNyDq3T8XBDCk+rgU42B6BhA5ip1TrHaONaBzzxUBMfO
eQIDAQAB
-----END PUBLIC KEY-----

2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -2,5 +2,5 @@
.Rhistory
.RData
inst/doc
/inst/web
/docs/
/vignettes/*.html
34 changes: 34 additions & 0 deletions .travis.yml
@@ -0,0 +1,34 @@
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
sudo: false
cache: packages

warnings_are_errors: true
env:
global:
- _R_CHECK_FORCE_SUGGESTS_=false
- MAKEFLAGS="-j 2"
- R_CODECOV=true

notifications:
email:
on_success: change
on_failure: change

addons:
apt:
packages:
- libmagick++-dev

r_github_packages:
- krlmlr/travis@develop
- krlmlr/pkgdown@develop

r_packages:
- covr

after_success:
- R -e "travis::deploy(tasks = c('travis::task_install_ssh_keys()'))"
- scripts/deploy-pages.sh
- if [[ "${R_CODECOV}" ]]; then R -e 'covr::codecov()'; fi
8 changes: 3 additions & 5 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: rprojroot
Title: Finding Files in Project Subdirectories
Version: 1.0-4
Version: 1.0-5
Authors@R: person(given = "Kirill", family = "Müller", role = c("aut",
"cre"), email = "krlmlr+r@mailbox.org")
Description: Robust, reliable and flexible paths to files below a
Expand All @@ -18,10 +18,9 @@ VignetteBuilder: knitr
License: GPL-3
LazyData: true
Encoding: UTF-8
URL: https://krlmlr.github.io/rprojroot
URLNote: https://github.com/krlmlr/rprojroot
URL: https://github.com/krlmlr/rprojroot, https://krlmlr.github.io/rprojroot
BugReports: https://github.com/krlmlr/rprojroot/issues
RoxygenNote: 5.0.1
RoxygenNote: 5.0.1.9000
Collate:
'rrmake.R'
'criterion.R'
Expand All @@ -30,4 +29,3 @@ Collate:
'root.R'
'rprojroot-package.R'
'shortcut.R'
'zzz-autoroxy.R'
1 change: 1 addition & 0 deletions NAMESPACE
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method("|",root_criterion)
S3method(as.root_criterion,character)
S3method(as.root_criterion,default)
S3method(as.root_criterion,root_criterion)
Expand Down
16 changes: 11 additions & 5 deletions NEWS.md
@@ -1,23 +1,29 @@
# rprojroot 1.0-4 (2016-05-30)
## rprojroot 1.0-5 (2016-10-22)

- Use Travis instead of wercker.
- Criteria can be combined with the `|` operator (#15).


## rprojroot 1.0-4 (2016-05-30)

- Improve AppVeyor testing.
- Restore compatibility with R < 3.2.
- Add package documentation with a few examples (#13)
- Add package documentation with a few examples (#13).


# rprojroot 1.0-3 (2016-05-13)
## rprojroot 1.0-3 (2016-05-13)

- New root criterion `from_wd`, useful for creating accessors to a known path (#11).
- Clarify difference between `find_file()` and `make_fix_file()` in vignette (#9).
- Remove unexported functions from documentation and examples (#10).


# rprojroot 1.0-2 (2016-03-28)
## rprojroot 1.0-2 (2016-03-28)

- Fix test that fails on Windows only on CRAN.


# rprojroot 1.0-1 (2016-03-26)
## rprojroot 1.0-1 (2016-03-26)

- Updated NEWS.

Expand Down
10 changes: 10 additions & 0 deletions R/criterion.R
Expand Up @@ -101,3 +101,13 @@ format.root_criterion <- function(x, ...) {
print.root_criterion <- function(x, ...) {
cat(paste0(format(x), "\n"))
}

#' @export
`|.root_criterion` <- function(x, y) {
stopifnot(is.root_criterion(y))

root_criterion(
function(path) x$testfun(path) || y$testfun(path),
paste0(x$desc, ", or ", y$desc)
)
}
Empty file removed R/zzz-autoroxy.R
Empty file.
15 changes: 8 additions & 7 deletions README.md
@@ -1,6 +1,6 @@
<!-- README.md is generated from README.Rmd. Please edit that file -->
[rprojroot](https://krlmlr.github.io/rprojroot) [![wercker status](https://app.wercker.com/status/c4dfa136cd78514514e259cc388e880c/s/master "wercker status")](https://app.wercker.com/project/bykey/c4dfa136cd78514514e259cc388e880c) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/rprojroot?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/rprojroot) [![codecov.io](https://codecov.io/github/krlmlr/rprojroot/coverage.svg?branch=master)](https://codecov.io/github/krlmlr/rprojroot?branch=master) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/rprojroot)](https://cran.r-project.org/package=rprojroot)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
[rprojroot](https://krlmlr.github.io/rprojroot) [![Travis-CI Build Status](https://travis-ci.org/krlmlr/rprojroot.svg?branch=master)](https://travis-ci.org/krlmlr/rprojroot) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/rprojroot?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/rprojroot) [![codecov.io](https://codecov.io/github/krlmlr/rprojroot/coverage.svg?branch=master)](https://codecov.io/github/krlmlr/rprojroot?branch=master) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/rprojroot)](https://cran.r-project.org/package=rprojroot)
=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

This package helps accessing files relative to a *project root* to [stop the working directory insanity](https://gist.github.com/jennybc/362f52446fe1ebc4c49f).

Expand All @@ -18,11 +18,12 @@ How do we access the package root? In a robust fashion? Easily:

``` r
dir(rprojroot::find_root("DESCRIPTION"))
#> [1] "appveyor.yml" "DESCRIPTION" "inst"
#> [4] "Makefile" "NAMESPACE" "NEWS.md"
#> [7] "NEWS.md.tmpl" "R" "readme"
#> [10] "README.md" "rprojroot.Rproj" "tests"
#> [13] "vignettes" "wercker.yml"
#> [1] "appveyor.yml" "cran-comments.md" "DESCRIPTION"
#> [4] "docs" "inst" "Makefile"
#> [7] "man" "NAMESPACE" "NEWS.md"
#> [10] "_pkgdown.yml" "R" "readme"
#> [13] "README.md" "rprojroot.Rproj" "scripts"
#> [16] "tests" "vignettes"
```

Installation and further reading
Expand Down
3 changes: 3 additions & 0 deletions _pkgdown.yml
@@ -0,0 +1,3 @@
template:
bootswatch: flatly # https://bootswatch.com/flatly/

2 changes: 1 addition & 1 deletion readme/README.Rmd
Expand Up @@ -18,7 +18,7 @@ knitr::opts_chunk$set(
)
```

[rprojroot](https://krlmlr.github.io/rprojroot) [![wercker status](https://app.wercker.com/status/c4dfa136cd78514514e259cc388e880c/s/master "wercker status")](https://app.wercker.com/project/bykey/c4dfa136cd78514514e259cc388e880c) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/rprojroot?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/rprojroot) [![codecov.io](https://codecov.io/github/krlmlr/rprojroot/coverage.svg?branch=master)](https://codecov.io/github/krlmlr/rprojroot?branch=master) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/rprojroot)](https://cran.r-project.org/package=rprojroot)
[rprojroot](https://krlmlr.github.io/rprojroot) [![Travis-CI Build Status](https://travis-ci.org/krlmlr/rprojroot.svg?branch=master)](https://travis-ci.org/krlmlr/rprojroot) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/rprojroot?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/rprojroot) [![codecov.io](https://codecov.io/github/krlmlr/rprojroot/coverage.svg?branch=master)](https://codecov.io/github/krlmlr/rprojroot?branch=master) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/rprojroot)](https://cran.r-project.org/package=rprojroot)
=================================================================================================================================================================================================================================================================================================================================================

This package helps accessing files relative to a *project root* to [stop the working directory insanity](https://gist.github.com/jennybc/362f52446fe1ebc4c49f).
Expand Down
54 changes: 54 additions & 0 deletions scripts/deploy-pages.sh
@@ -0,0 +1,54 @@
#!/bin/bash

set -e

doc_dir=docs

# adapted from https://github.com/tjmahr/rprime/blob/1e756aea85677ebcbe785e4d3bd65e3b367e0660/deploy-pages.sh
# and https://github.com/RyanHope/gazetools/blob/master/staticdocs-gh_pages.sh
# and https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
#
# For local testing use:
# TRAVIS_OS_NAME=linux TRAVIS_PULL_REQUEST=false TRAVIS_BRANCH=production TRAVIS_REPO_SLUG=rstats-db/DBI TRAVIS_COMMIT=$(git rev-parse HEAD) GITHUB_PAT=<your-PAT> scripts/deploy-pages.sh

if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "production" ] && [ "$GITHUB_PAT" != "" ]; then
# Query name and e-mail of current author
# https://gist.github.com/l15n/3103708
user_email=$(git show --format="%ae" | head -n 1)
user_name=$(git show --format="%an" | head -n 1)

rm -rf $doc_dir
mkdir -p $doc_dir

# Clone the current docs.
git clone --quiet --branch=gh-pages git@github.com:{TRAVIS_REPO_SLUG}.git $doc_dir > /dev/null

# Clean current docs and build anew.
echo -e "Building pkgdown...\n"
rm -r $doc_dir/*
R -q -e "pkgdown::build_site()"

echo -e "Publishing pkgdown...\n"
cd $doc_dir

# Reuse the name and e-mail of the author of the last commit
git config user.email $user_email
git config user.name $user_name

# Include .nojekyll as a directive for github
touch .nojekyll

# Commit and publish
git add -A

git commit --allow-empty -F /dev/stdin <<EOF
Deploy pages from Travis build ${TRAVIS_BUILD_NUMBER}
Build URL: https://travis-ci.org/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_ID}
Commit: ${TRAVIS_COMMIT}
EOF

git push --quiet origin gh-pages

echo -e "Published pkgdown to gh-pages.\n"
fi
11 changes: 11 additions & 0 deletions tests/testthat/test-criterion.R
Expand Up @@ -32,3 +32,14 @@ test_that("Formatting criteria", {
)
expect_match(ret[[1]], "^List of ")
})

test_that("Combining criteria", {
comb_crit <- is_r_package | is_rstudio_project

expect_true(is.root_criterion(comb_crit))

expect_match(format(comb_crit), ", or")

expect_equal(find_root(comb_crit, "hierarchy"),
find_root(is_rstudio_project | is_r_package, "hierarchy/a"))
})
6 changes: 6 additions & 0 deletions vignettes/rprojroot.Rmd
Expand Up @@ -178,6 +178,12 @@ is_projecttemplate_project <- has_file("config/global.dcf", "^version: ")
is_projecttemplate_project
```

You can also combine criteria via the `|` operator:

```{r}
is_r_package | is_rstudio_project
```



### Shortcuts
Expand Down
33 changes: 0 additions & 33 deletions wercker.yml

This file was deleted.

0 comments on commit 45c1ce1

Please sign in to comment.