Skip to content

Commit

Permalink
prep for release
Browse files Browse the repository at this point in the history
  • Loading branch information
s-fleck committed May 28, 2019
1 parent f1772fb commit d46721b
Show file tree
Hide file tree
Showing 23 changed files with 271 additions and 181 deletions.
21 changes: 11 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
Type: Package
Package: rotor
Title: Log Rotation and Conditional Backups
Version: 0.2.1.9005
Version: 0.2.2
Authors@R:
person(given = "Stefan",
family = "Fleck",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-3344-9851"))
Maintainer: Stefan Fleck <[email protected]>
Description: Conditionally rotate or back-up files based on their size or the
date of the last backup; inspired by the 'Linux' utility 'logrotate'.
Description: Conditionally rotate or back-up files based on
their size or the date of the last backup; inspired by the 'Linux'
utility 'logrotate'.
License: MIT + file LICENSE
Imports:
tools,
dint,
R6,
dint
tools
Suggests:
testthat,
covr,
crayon,
zip,
rmarkdown,
testthat,
withr,
covr,
rmarkdown
zip
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
13 changes: 6 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# rotor (development version)
# rotor 0.2.2

* Reordered some of the arguments of all `rotate_*()` and `backup_*()`
functions to be more intuitive
* Reordered the arguments of `rotate_*()` and `backup_*()` for more consistency
* default `size` for all all `rotate_*()` and `backup_*()` functions is now
consistently `1` (Byte)
* support for `Inf` `size`
`1` (Byte). This means empty files are never rotated by default.
* support for `Inf` `size` and `age`
* More robust regex for discovering backups of files
* R6 API: BackupQueue subclasses gain a `should_rotate(...)` method that
determines whether rotation/backup should take place.
* R6 API: BackupQueueDate and -DateTime now have a caching mechanism for
backups (defaults to `FALSE`).
* R6 API: BackupQueueDate and BackupQueueDateTime now have a caching mechanism
for backups (defaults to `FALSE`).
* R6 API: BackupQueue* now use setters/getters for all fields.


Expand Down
13 changes: 6 additions & 7 deletions R/BackupQueue.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#' integrate rotor in one of your package, the `BackupQueue` subclasses give
#' you a bit of extra control.
#'
#' As of now, **the R6 API is still under development and subject to change**.
#' More documentation will follow in the foreseable future.
#' As of now, **the R6 API is still experimental and subject to change**.
#'
#'
#' @section Methods:
Expand All @@ -18,16 +17,16 @@
#' be called manually.
#' }
#'
#' \item{`prune()`}{Delet all backups except `max_backups`. See [prune_backups()]}
#' \item{`prune()`}{Delete all backups except `max_backups`. See [prune_backups()]}
#'
#' \item{`push_backup() <BackupQueueIndex>`}{
#' Create a new backup with index 1, push back all other indices.
#' Always calls `$prune()` before it terminates.
#' }
#'
#' \item{`push_backup(overwrite = FALSE, now = Sys.time()) <BackupQueueDate> <BackupQueueDateteime>`}{
#' Create a new backup with a timestamp. The `now` paramter override the
#' real system time. If `overwrite` is `TRUE` exisiting backups with the
#' Create a new backup with a timestamp. The `now` parameter override the
#' real system time. If `overwrite` is `TRUE` existing backups with the
#' same filename (i.e timestamp) are overwritten. Always calls
#' `$prune()` before it terminates.
#' }
Expand Down Expand Up @@ -64,11 +63,11 @@
#' \item{`should_rotate(size, age, now = Sys.time(), last_rotation = self$last_rotation) <BackupQueueDate> <BackupQueueDateteime>`}{
#' Should a file of `size` and `age` be rotated? See `size` and `age`
#' arguments of [`rotate_date()`]. `now` overrides the current system time,
#' `last_rotation`` overrieds the date of the last rotation.
#' `last_rotation`` overrides the date of the last rotation.
#' }
#'
#' \item{`update_backups_cache()`}{
#' Force update of the backups_bache. Only does something if `$cache_backups`
#' Force update of the backups cache. Only does something if `$cache_backups`
#' is `TRUE`.
#' }
#' }
Expand Down
7 changes: 3 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ knitr::opts_chunk$set(

**rotor** provides a cross platform R reimagination of
[logrotate](https://linux.die.net/man/8/logrotate). It is a companion package to
the logging package [lgr](https://github.com/s-fleck/lgr). In addition to
rotating log files, it can also be used as a (primitive) backup tool. For
conditionally creating and deleting backups, rotor relies solely on information
encoded in a suffix of the backup file names (i.e. a timestamp or index). It
the logging package [lgr](https://github.com/s-fleck/lgr). In
contrast to logrotate, rotor relies solely on information encoded in a suffixes
of file names for conditionally creating backups (i.e. a timestamp or index). It
therefore also works with backups created by other tools, as long as the
filename has a format that rotor can understand.

Expand Down
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ status](https://www.r-pkg.org/badges/version/rotor)](https://cran.r-project.org/
**rotor** provides a cross platform R reimagination of
[logrotate](https://linux.die.net/man/8/logrotate). It is a companion
package to the logging package [lgr](https://github.com/s-fleck/lgr). In
addition to rotating log files, it can also be used as a (primitive)
backup tool. For conditionally creating and deleting backups, rotor
relies solely on information encoded in a suffix of the backup file
names (i.e. a timestamp or index). It therefore also works with backups
created by other tools, as long as the filename has a format that rotor
can understand.
contrast to logrotate, rotor relies solely on information encoded in a
suffixes of file names for conditionally creating backups (i.e. a
timestamp or index). It therefore also works with backups created by
other tools, as long as the filename has a format that rotor can
understand.

`rotate()`, `rotate_date()`, and `rotate_time()` move a file and insert
a suffix (either an integer or a timestamp) into the filename. In
Expand Down Expand Up @@ -80,8 +79,8 @@ backup(tf, compression = TRUE)

# display backups of a file
list_backups(tf)
#> [1] "/tmp/RtmplvAoSn/rotor/mylogfile.1.log.zip"
#> [2] "/tmp/RtmplvAoSn/rotor/mylogfile.2.log"
#> [1] "/tmp/RtmplU947x/rotor/mylogfile.1.log.zip"
#> [2] "/tmp/RtmplU947x/rotor/mylogfile.2.log"
```

`rotate()` also backs up a file, but replaces the original file with an
Expand All @@ -90,9 +89,9 @@ empty one.
``` r
rotate(tf)
list_backups(tf)
#> [1] "/tmp/RtmplvAoSn/rotor/mylogfile.1.log"
#> [2] "/tmp/RtmplvAoSn/rotor/mylogfile.2.log.zip"
#> [3] "/tmp/RtmplvAoSn/rotor/mylogfile.3.log"
#> [1] "/tmp/RtmplU947x/rotor/mylogfile.1.log"
#> [2] "/tmp/RtmplU947x/rotor/mylogfile.2.log.zip"
#> [3] "/tmp/RtmplU947x/rotor/mylogfile.3.log"

# the original file is now empty
readLines(tf)
Expand All @@ -115,10 +114,10 @@ backup(tf, max_backups = 4)
backup(tf, max_backups = 4)

list_backups(tf)
#> [1] "/tmp/RtmplvAoSn/rotor/mylogfile.1.log"
#> [2] "/tmp/RtmplvAoSn/rotor/mylogfile.2.log"
#> [3] "/tmp/RtmplvAoSn/rotor/mylogfile.3.log"
#> [4] "/tmp/RtmplvAoSn/rotor/mylogfile.4.log.zip"
#> [1] "/tmp/RtmplU947x/rotor/mylogfile.1.log"
#> [2] "/tmp/RtmplU947x/rotor/mylogfile.2.log"
#> [3] "/tmp/RtmplU947x/rotor/mylogfile.3.log"
#> [4] "/tmp/RtmplU947x/rotor/mylogfile.4.log.zip"
```

We can also use `prune_backups()` to delete old backups. Other than
Expand All @@ -137,8 +136,8 @@ timestamped backups.
backup_date(tf)
rotate_time(tf)
list_backups(tf)
#> [1] "/tmp/RtmplvAoSn/rotor/mylogfile.2019-05-16--14-47-44.log"
#> [2] "/tmp/RtmplvAoSn/rotor/mylogfile.2019-05-16.log"
#> [1] "/tmp/RtmplU947x/rotor/mylogfile.2019-05-28--07-51-44.log"
#> [2] "/tmp/RtmplU947x/rotor/mylogfile.2019-05-28.log"
```

``` r
Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

0 errors | 0 warnings | 1 note

* Resubmission
* Added examples to the documentation of rotate() and co.
* This is a new release.
* fleshed out R6 API
* fixed edge-case bug on macOS related to timezones
* new features and bugfixes
9 changes: 5 additions & 4 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d46721b

Please sign in to comment.