Browse Source

CRAN prep

master
boB Rudis 4 years ago
parent
commit
e4be266699
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 2
      .Rbuildignore
  2. 14
      DESCRIPTION
  3. 6
      NEWS.md
  4. 4
      R/utils-mappers.R
  5. 2
      README.Rmd
  6. 22
      README.md
  7. 23
      cran-comments.md
  8. 0
      inst/extdat/agents.txt
  9. 3
      inst/js/bld
  10. 4
      inst/js/bundle.js
  11. 11
      inst/tinytest/test_uaparserjs.R
  12. 2
      tests/test-all.R
  13. 12
      tests/testthat/test-uaparserjs.R
  14. 5
      tests/tinytest.R

2
.Rbuildignore

@ -6,3 +6,5 @@
^NOTES\.*Rmd$
^NOTES\.*html$
^cran-comments\.md$
^appveyor\.yml$
^CRAN-RELEASE$

14
DESCRIPTION

@ -1,8 +1,8 @@
Package: uaparserjs
Type: Package
Title: Parse 'User-Agent' Strings
Version: 0.3.1
Date: 2020-03-31
Version: 0.3.5
Date: 2020-05-11
Authors@R: c(
person("Bob", "Rudis", , "bob@rud.is", c("aut", "cre")),
person("Lindsey", "Simon", role = "aut", comment = "uap-core"),
@ -15,15 +15,15 @@ Description: Despite there being a section in RFC 7231
to parse consistently. Tools are provided that will take in user agent
strings and return structured R objects. This is a 'V8'-backed package
based on the 'ua-parser' project <https://github.com/ua-parser>.
URL: https://git.rud.is/hrbrmstr/uaparserjs
URL: https://gitlab.comhrbrmstr/uaparserjs
BugReports: https://gitlab.com/hrbrmstr/uaparserjs/issues
License: Apache License 2.0 | file LICENSE
Suggests:
Suggests:
testthat
Depends:
R (>= 3.2.0)
Depends:
R (>= 3.5.0)
Encoding: UTF-8
Imports:
Imports:
progress,
V8
RoxygenNote: 7.1.0

6
NEWS.md

@ -1,3 +1,9 @@
0.3.5
* Updated core parser code (again)
* Added new user agent database
* Addressed issues re:Kurt's "stringsAsFactors" guidance email.
* Switched testing framework
0.3.0
* Updated regexes YAML to latest
* Switched to webpack from browserify

4
R/utils-mappers.R

@ -22,10 +22,6 @@ bind_rows <- function(..., .id = NULL) {
id_vals <- if (is.null(names(res))) 1:length(res) else names(res)
saf <- default.stringsAsFactors()
options(stringsAsFactors = FALSE)
on.exit(options(stringsAsFactors = saf))
idx <- 1
do.call(
rbind.data.frame,

2
README.Rmd

@ -41,7 +41,7 @@ packageVersion("uaparserjs")
dplyr::glimpse(ua_parse("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2"))
agents <- readLines("tests/agents.txt")
agents <- readLines(system.file("extdat", "agents.txt", package = "uaparserjs"))
dplyr::glimpse(ua_parse(agents))

22
README.md

@ -17,7 +17,7 @@ checks](https://cranchecks.info/badges/worst/uaparserjs)](https://cranchecks.inf
[![CRAN
status](https://www.r-pkg.org/badges/version/uaparserjs)](https://www.r-pkg.org/pkg/uaparserjs)
![Minimal R
Version](https://img.shields.io/badge/R%3E%3D-3.2.0-blue.svg)
Version](https://img.shields.io/badge/R%3E%3D-3.5.0-blue.svg)
![License](https://img.shields.io/badge/License-Apache-blue.svg)
# uaparserjs
@ -48,7 +48,7 @@ The following functions are implemented:
## Installation
``` r
install.packages("uaparserjs", repos = "https://cinc.rud.is")
install.packages("uaparserjs", repos = c("https://cinc.rud.is", "https://cloud.r-project.org/"))
# or
remotes::install_git("https://git.rud.is/hrbrmstr/uaparserjs.git")
# or
@ -71,11 +71,11 @@ library(uaparserjs)
# current version
packageVersion("uaparserjs")
## [1] '0.3.1'
## [1] '0.3.5'
dplyr::glimpse(ua_parse("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2"))
## Observations: 1
## Variables: 9
## Rows: 1
## Columns: 9
## $ userAgent <chr> "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15…
## $ ua.family <chr> "Chromium"
## $ ua.major <chr> "15"
@ -86,11 +86,11 @@ dplyr::glimpse(ua_parse("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTM
## $ os.minor <chr> "10"
## $ device.family <chr> "Other"
agents <- readLines("tests/agents.txt")
agents <- readLines(system.file("extdat", "agents.txt", package = "uaparserjs"))
dplyr::glimpse(ua_parse(agents))
## Observations: 1,091
## Variables: 13
## Rows: 1,091
## Columns: 13
## $ userAgent <chr> "Mozilla/5.0 (Windows; U; en-US) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5.1", "Mozill…
## $ ua.family <chr> "AdobeAIR", "Amazon Silk", "Amazon Silk", "Amazon Silk", "Amazon Silk", "Amazon Silk", "Android…
## $ ua.major <chr> "2", "1", "2", "2", "2", "3", "2", "2", "2", "2", "3", "4", "4", "4", "4", "1", "1", "6", "7", …
@ -112,15 +112,15 @@ microbenchmark::microbenchmark(
)
## Unit: milliseconds
## expr min lq mean median uq max neval
## ua_parse(batch_100) 19.66107 20.67153 22.06354 21.40268 22.99938 32.14979 100
## ua_parse(batch_100) 708.7338 721.5558 737.8894 730.8626 742.9891 928.1393 100
```
## uaparserjs Metrics
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| R | 6 | 0.86 | 83 | 0.84 | 39 | 0.66 | 34 | 0.54 |
| Rmd | 1 | 0.14 | 16 | 0.16 | 20 | 0.34 | 29 | 0.46 |
| R | 5 | 0.83 | 72 | 0.82 | 37 | 0.65 | 34 | 0.54 |
| Rmd | 1 | 0.17 | 16 | 0.18 | 20 | 0.35 | 29 | 0.46 |
## Code of Conduct

23
cran-comments.md

@ -1,20 +1,13 @@
## Test environments
* local OS X install, R 3.3.1
* ubuntu 12.04 (on travis-ci), R 3.3.1
* local OS X install, R 4.0.0
* ubuntu 14.04 (on travis-ci), R 4.0.0
* win-builder (devel and release)
## R CMD check results
0 errors | 0 warnings | 1 note
0 errors | 0 warnings | 0 note
* This is a new release.
## Reverse dependencies
This is a new release, so there are no reverse dependencies.
---
win-builder gave a memory error but every other system I've
run this on did the pkg load & tests just fine. It does
generate a large data structure using V8 in the pkg
environment but that's necessary for the actual parsing job.
* Updated core parser code
* Added new user agent database
* Addressed issues re:Kurt's "stringsAsFactors" guidance email.
* Switched testing framework

0
tests/agents.txt → inst/extdat/agents.txt

3
inst/js/bld

@ -1,11 +1,10 @@
npm install --save-dev yaml base-64 uap-ref-impl
const fs = require('fs')
const YAML = require('yaml')
const YAML = require('yaml')
const file = fs.readFileSync('regexes.yaml', 'utf8')
fs.writeFileSync('regexes.json', JSON.stringify(YAML.parse(file)))
base64 -e regexes.json > regexes.b64
webpack --mode="production" index.js -o bundle.js

4
inst/js/bundle.js

File diff suppressed because one or more lines are too long

11
inst/tinytest/test_uaparserjs.R

@ -0,0 +1,11 @@
library(uaparserjs)
# Placeholder with simple test
res <- ua_parse(paste0("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, ",
"like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 ",
"Chrome/15.0.874.106 Safari/535.2", collapse=""))
expect_true(inherits(res, "data.frame"))
expect_equal(res$ua.patch, "874")
expect_equal(res$os.family, "Ubuntu")

2
tests/test-all.R

@ -1,2 +0,0 @@
library(testthat)
test_check("uaparserjs")

12
tests/testthat/test-uaparserjs.R

@ -1,12 +0,0 @@
context("basic functionality")
test_that("we can do something", {
res <- ua_parse(paste0("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, ",
"like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 ",
"Chrome/15.0.874.106 Safari/535.2", collapse=""))
expect_that(res, is_a("data.frame"))
expect_that(res$ua.patch, equals("874"))
expect_that(res$os.family, equals("Ubuntu"))
})

5
tests/tinytest.R

@ -0,0 +1,5 @@
if ( requireNamespace("tinytest", quietly=TRUE) ){
tinytest::test_package("uaparserjs")
}
Loading…
Cancel
Save