55
66<!-- badges: start -->
77
8- [ ![ Travis build
9- status] ( https://travis-ci.com/s-fleck/rotor.svg?branch=master )] ( https://travis-ci.com/s-fleck/rotor )
108[ ![ Lifecycle:
11- maturing] ( https://img.shields.io/badge/lifecycle-maturing-blue.svg )] ( https://www.tidyverse.org/lifecycle/#maturing )
12- [ ![ Codecov test
13- coverage] ( https://codecov.io/gh/s-fleck/rotor/branch/master/graph/badge.svg )] ( https://codecov.io/gh/s-fleck/rotor?branch=master )
9+ maturing] ( https://img.shields.io/badge/lifecycle-maturing-blue.svg )] ( https://lifecycle.r-lib.org/articles/stages.html#maturing )
1410[ ![ CRAN
1511status] ( https://www.r-pkg.org/badges/version/rotor )] ( https://cran.r-project.org/package=rotor )
1612<!-- badges: end -->
@@ -83,8 +79,8 @@ backup(tf, compression = TRUE)
8379
8480# display backups of a file
8581list_backups(tf )
86- # > [1] "/tmp/RtmpRZc2Qd /rotor/mylogfile.1.log.zip"
87- # > [2] "/tmp/RtmpRZc2Qd /rotor/mylogfile.2.log"
82+ # > [1] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.1.log.zip"
83+ # > [2] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.2.log"
8884```
8985
9086` rotate() ` also backs up a file, but replaces the original file with an
@@ -93,9 +89,9 @@ empty one.
9389``` r
9490rotate(tf )
9591list_backups(tf )
96- # > [1] "/tmp/RtmpRZc2Qd /rotor/mylogfile.1.log"
97- # > [2] "/tmp/RtmpRZc2Qd /rotor/mylogfile.2.log.zip"
98- # > [3] "/tmp/RtmpRZc2Qd /rotor/mylogfile.3.log"
92+ # > [1] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.1.log"
93+ # > [2] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.2.log.zip"
94+ # > [3] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.3.log"
9995
10096# the original file is now empty
10197readLines(tf )
@@ -118,10 +114,10 @@ backup(tf, max_backups = 4)
118114backup(tf , max_backups = 4 )
119115
120116list_backups(tf )
121- # > [1] "/tmp/RtmpRZc2Qd /rotor/mylogfile.1.log"
122- # > [2] "/tmp/RtmpRZc2Qd /rotor/mylogfile.2.log"
123- # > [3] "/tmp/RtmpRZc2Qd /rotor/mylogfile.3.log"
124- # > [4] "/tmp/RtmpRZc2Qd /rotor/mylogfile.4.log.zip"
117+ # > [1] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.1.log"
118+ # > [2] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.2.log"
119+ # > [3] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.3.log"
120+ # > [4] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /rotor/mylogfile.4.log.zip"
125121```
126122
127123We can also use ` prune_backups() ` to delete old backups. Other than
@@ -153,30 +149,24 @@ backup_time(tf, format = "%Y-%m-%d_%H-%M-%S") # Python logging
153149backup_time(tf , format = " %Y%m%dT%H%M%S" ) # ISO 8601 compatible
154150
155151backup_info(tf )
156- # > path name
157- # > 1 /tmp/RtmpRZc2Qd/rotor/mylogfile.2020-12-11_20-23-35.log mylogfile
158- # > 2 /tmp/RtmpRZc2Qd/rotor/mylogfile.2020-12-11--20-23-35.log mylogfile
159- # > 5 /tmp/RtmpRZc2Qd/rotor/mylogfile.20201211T202335.log mylogfile
160- # > 3 /tmp/RtmpRZc2Qd/rotor/mylogfile.2020-12-11.log mylogfile
161- # > 4 /tmp/RtmpRZc2Qd/rotor/mylogfile.2020-12.log mylogfile
162- # > sfx ext size isdir mode mtime
163- # > 1 2020-12-11_20-23-35 log 26 FALSE 664 2020-12-11 20:23:35
164- # > 2 2020-12-11--20-23-35 log 26 FALSE 664 2020-12-11 20:23:35
165- # > 5 20201211T202335 log 26 FALSE 664 2020-12-11 20:23:35
166- # > 3 2020-12-11 log 26 FALSE 664 2020-12-11 20:23:35
167- # > 4 2020-12 log 26 FALSE 664 2020-12-11 20:23:35
168- # > ctime atime uid gid uname grname
169- # > 1 2020-12-11 20:23:35 2020-12-11 20:23:35 1000 1000 hoelk hoelk
170- # > 2 2020-12-11 20:23:35 2020-12-11 20:23:35 1000 1000 hoelk hoelk
171- # > 5 2020-12-11 20:23:35 2020-12-11 20:23:35 1000 1000 hoelk hoelk
172- # > 3 2020-12-11 20:23:35 2020-12-11 20:23:35 1000 1000 hoelk hoelk
173- # > 4 2020-12-11 20:23:35 2020-12-11 20:23:35 1000 1000 hoelk hoelk
174- # > timestamp
175- # > 1 2020-12-11 20:23:35
176- # > 2 2020-12-11 20:23:35
177- # > 5 2020-12-11 20:23:35
178- # > 3 2020-12-11 00:00:00
179- # > 4 2020-12-01 00:00:00
152+ # > path
153+ # > 1 C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE/rotor/mylogfile.2022-09-02--13-25-45.log
154+ # > 3 C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE/rotor/mylogfile.2022-09-02_13-25-45.log
155+ # > 5 C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE/rotor/mylogfile.20220902T132545.log
156+ # > 2 C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE/rotor/mylogfile.2022-09-02.log
157+ # > 4 C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE/rotor/mylogfile.2022-09.log
158+ # > name sfx ext size isdir mode mtime
159+ # > 1 mylogfile 2022-09-02--13-25-45 log 27 FALSE 666 2022-09-02 13:25:45
160+ # > 3 mylogfile 2022-09-02_13-25-45 log 27 FALSE 666 2022-09-02 13:25:45
161+ # > 5 mylogfile 20220902T132545 log 27 FALSE 666 2022-09-02 13:25:45
162+ # > 2 mylogfile 2022-09-02 log 27 FALSE 666 2022-09-02 13:25:45
163+ # > 4 mylogfile 2022-09 log 27 FALSE 666 2022-09-02 13:25:45
164+ # > ctime atime exe timestamp
165+ # > 1 2022-09-02 13:25:45 2022-09-02 13:25:45 no 2022-09-02 13:25:45
166+ # > 3 2022-09-02 13:25:45 2022-09-02 13:25:45 no 2022-09-02 13:25:45
167+ # > 5 2022-09-02 13:25:45 2022-09-02 13:25:45 no 2022-09-02 13:25:45
168+ # > 2 2022-09-02 13:25:45 2022-09-02 13:25:45 no 2022-09-02 00:00:00
169+ # > 4 2022-09-02 13:25:45 2022-09-02 13:25:45 no 2022-09-01 00:00:00
180170```
181171
182172If we examine the “timestamp” column in the example above, we see that
@@ -208,15 +198,15 @@ by size, age or number of files.
208198
209199``` r
210200cache <- Cache $ new(file.path(tempdir(), " cache-test" ), hashfun = digest :: digest )
211- # > creating directory '/tmp/RtmpRZc2Qd /cache-test'
201+ # > creating directory 'C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /cache-test'
212202key1 <- cache $ push(iris )
213203key2 <- cache $ push(cars )
214204key3 <- cache $ push(mtcars )
215205
216206cache $ files $ path
217- # > [1] "/tmp/RtmpRZc2Qd /cache-test/d3c5d071001b61a9f6131d3004fd0988"
218- # > [2] "/tmp/RtmpRZc2Qd /cache-test/f98a59010652c8e1ee062ed4c43f648e"
219- # > [3] "/tmp/RtmpRZc2Qd /cache-test/a63c70e73b58d0823ab3bcbd3b543d6f"
207+ # > [1] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /cache-test/d3c5d071001b61a9f6131d3004fd0988"
208+ # > [2] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /cache-test/f98a59010652c8e1ee062ed4c43f648e"
209+ # > [3] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /cache-test/a63c70e73b58d0823ab3bcbd3b543d6f"
220210
221211head(cache $ read(key1 ))
222212# > Sepal.Length Sepal.Width Petal.Length Petal.Width Species
@@ -229,7 +219,7 @@ head(cache$read(key1))
229219
230220cache $ prune(max_files = 1 )
231221cache $ files $ path
232- # > [1] "/tmp/RtmpRZc2Qd /cache-test/a63c70e73b58d0823ab3bcbd3b543d6f"
222+ # > [1] "C:/Users/STEFAN~1.FLE/AppData/Local/Temp/RtmpYZSExE /cache-test/a63c70e73b58d0823ab3bcbd3b543d6f"
233223cache $ purge() # deletes all cached files
234224cache $ destroy() # deletes the cache directory
235225```
@@ -239,9 +229,9 @@ cache$destroy() # deletes the cache directory
239229** rotor** ’s dependencies are intentionally kept slim. It only comes with
240230two non-base dependencies:
241231
242- - [ R6] ( https://github.com/r-lib/R6 ) : A light weight system for
232+ - [ R6] ( https://github.com/r-lib/R6 ) : A light weight system for
243233 encapsulated object-oriented programming.
244- - [ dint] ( https://github.com/s-fleck/dint ) : A toolkit for working
234+ - [ dint] ( https://github.com/s-fleck/dint ) : A toolkit for working
245235 year-quarter and year-month dates that I am also the author of. It
246236 is used by ` rotate_date() ` and ` rotate_time() ` to deal with calendar
247237 periods (such as weeks or months).
@@ -251,14 +241,14 @@ anything outside of base R)
251241
252242Optional dependencies:
253243
254- - [ digest] ( https://github.com/eddelbuettel/digest ) ,
244+ - [ digest] ( https://github.com/eddelbuettel/digest ) ,
255245 [ ulid] ( https://cran.r-project.org/package=ulid ) , or
256246 [ uuid] ( https://CRAN.R-project.org/package=uuid ) for generating
257247 hashes or UIDs when using ` Cache ` . Storage keys for cache files can
258248 also be set manually, in which case no external dependencies are
259249 required.
260- - [ zip] ( https://CRAN.R-project.org/package=zip ) is supported as an
250+ - [ zip] ( https://CRAN.R-project.org/package=zip ) is supported as an
261251 alternative to the integrated zip function in R. Might work better
262252 on some systems and worse on others.
263- - [ crayon] ( https://cran.r-project.org/package=crayon ) for terminal
253+ - [ crayon] ( https://cran.r-project.org/package=crayon ) for terminal
264254 colors
0 commit comments