Browse Source

Fix CRAN tests

boB Rudis 2 years ago
parent
commit
ca3e87571f
No known key found for this signature in database
15 changed files with 71 additions and 33 deletions
  1. 1
    0
      .Rbuildignore
  2. 5
    3
      DESCRIPTION
  3. 6
    0
      NAMESPACE
  4. 37
    0
      R/dkim.r
  5. 4
    1
      R/gdns-package.r
  6. 1
    1
      R/spf.r
  7. 7
    9
      cran-comments.md
  8. 6
    8
      gdns.Rproj
  9. 0
    1
      man/bulk_query.Rd
  10. 0
    1
      man/gdns.Rd
  11. 0
    1
      man/has_spf.Rd
  12. 1
    2
      man/is_soft_fail.Rd
  13. 0
    1
      man/query.Rd
  14. 2
    3
      man/spf_ipv4s.Rd
  15. 1
    2
      man/split_spf.Rd

+ 1
- 0
.Rbuildignore View File

@@ -6,3 +6,4 @@
6 6
 ^CONDUCT\.md$
7 7
 ^README\.Rmd$
8 8
 ^cran-comments\.md$
9
+^docs$

+ 5
- 3
DESCRIPTION View File

@@ -1,6 +1,6 @@
1 1
 Package: gdns
2 2
 Title: Tools to Work with Google DNS Over HTTPS API
3
-Version: 0.2.0
3
+Version: 0.2.1
4 4
 Authors@R: c(person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")))
5 5
 Maintainer: Bob Rudis <bob@rud.is>
6 6
 Description: To address the problem of insecurity of UDP-based DNS requests,
@@ -23,5 +23,7 @@ Imports:
23 23
     httr,
24 24
     jsonlite,
25 25
     purrr,
26
-    stringi
27
-RoxygenNote: 5.0.1
26
+    stringi,
27
+    tibble,
28
+    dplyr
29
+RoxygenNote: 6.0.1

+ 6
- 0
NAMESPACE View File

@@ -13,13 +13,19 @@ export(spf_ipv6s)
13 13
 export(spf_ptrs)
14 14
 export(split_spf)
15 15
 import(httr)
16
+importFrom(dplyr,as_data_frame)
17
+importFrom(dplyr,bind_cols)
18
+importFrom(dplyr,bind_rows)
16 19
 importFrom(jsonlite,fromJSON)
20
+importFrom(purrr,"%>%")
17 21
 importFrom(purrr,"%||%")
18 22
 importFrom(purrr,map)
19 23
 importFrom(purrr,map_df)
20 24
 importFrom(purrr,safely)
25
+importFrom(stringi,stri_detect_fixed)
21 26
 importFrom(stringi,stri_enc_toutf8)
22 27
 importFrom(stringi,stri_replace_all_regex)
23 28
 importFrom(stringi,stri_split_fixed)
24 29
 importFrom(stringi,stri_split_regex)
25 30
 importFrom(stringi,stri_trim)
31
+importFrom(tibble,data_frame)

+ 37
- 0
R/dkim.r View File

@@ -0,0 +1,37 @@
1
+#' #' Split out all SPF records in a domain's TXT record
2
+#' #'
3
+#' #' Given a vector of TXT records, this function will return a list of vectors
4
+#' #' of all the SPF records for each. If the given TXT record is not an SPF
5
+#' #' record, \code{NA} is returned (which makes it easy to skip with \code{purrr}
6
+#' #' functions).
7
+#' #'
8
+#' #' @param dkim_rec a character vector of DNS TXT records
9
+#' #' @export
10
+#' parse_dkim <- function(dkim_rec) {
11
+#'   purrr::map_df(dkim_rec, .parse_dkim)
12
+#' }
13
+#'
14
+#' .parse_dkim <- function(dkim_rec) {
15
+#'
16
+#'   if (has_dkim(dkim_rec)) {
17
+#'     spf_rec <- stringi::stri_trim(stringi::stri_replace_all_regex(dkim_rec, '"', ""))
18
+#'     recs <- stri_trim(unlist(stringi::stri_split_regex(dkim_rec, ";")))
19
+#'     recs <- grep("v=DKIM1", recs, invert=TRUE, value=TRUE)
20
+#'     purrr::keep(recs, stringi::stri_detect_fixed, "=") %>%
21
+#'       purrr::map_df(~{
22
+#'         x <- stringi::stri_match_all_regex(.x, "(.*)=(.*)")[[1]]
23
+#'         data_frame(key=x[,2], value=x[,3])
24
+#'       })
25
+#'   } else {
26
+#'     NULL
27
+#'   }
28
+#'
29
+#' }
30
+#'
31
+#' #' Test for whether a DNS TXT record is a DKIM record
32
+#' #'
33
+#' #' @param spf_rec a character vector of DNS TXT records
34
+#' #' @export
35
+#' has_dkim <- function(dkim_rec) {
36
+#'   grepl("v=DKIM1", dkim_rec)
37
+#' }

+ 4
- 1
R/gdns-package.r View File

@@ -23,6 +23,9 @@
23 23
 #' @import httr
24 24
 #' @importFrom stringi stri_split_fixed stri_split_regex stri_trim
25 25
 #'                     stri_replace_all_regex stri_enc_toutf8
26
+#'                     stri_detect_fixed
26 27
 #' @importFrom jsonlite fromJSON
27
-#' @importFrom purrr safely map map_df %||%
28
+#' @importFrom tibble data_frame
29
+#' @importFrom purrr safely map map_df %||% %>%
30
+#' @importFrom dplyr bind_rows bind_cols as_data_frame
28 31
 NULL

+ 1
- 1
R/spf.r View File

@@ -2,7 +2,7 @@
2 2
 #'
3 3
 #' Given a vector of TXT records, this function will return a list of vectors
4 4
 #' of all the SPF records for each. If the given TXT record is not an SPF
5
-#' record, \code{NULL} is returned (which makes it easy to skip with \code{purrr}
5
+#' record, \code{NA} is returned (which makes it easy to skip with \code{purrr}
6 6
 #' functions).
7 7
 #'
8 8
 #' @param spf_rec a character vector of DNS TXT records

+ 7
- 9
cran-comments.md View File

@@ -1,19 +1,17 @@
1 1
 ## Test environments
2
-* local OS X install, R 3.3.1
3
-* Travis OS X (R 3.3.1 and oldrel)
4
-* ubuntu 12.04 (on travis-ci), R 3.3.1 & oldrel
5
-* win-builder (devel and release) (caught it today just before the crash)
2
+* local OS X install, R 3.4.0
3
+* ubuntu 12.04 (on travis-ci), R 3.4.0 & oldrel
4
+* win-builder (devel and release) 
6 5
 
7 6
 ## R CMD check results
8 7
 
9
-0 errors | 0 warnings | 1 note (new pkg)
10
-
11
-* This is a new release.
8
+0 errors | 0 warnings | 1 note (maintainer & acronyms)
12 9
 
13 10
 ## Reverse dependencies
14 11
 
15
-This is a new release, so there are no reverse dependencies.
12
+None
16 13
 
17 14
 ---
18 15
 
19
-Added URL ref in DESCRIPTION per note from Kurt (#ty!)
16
+* This is an update release to fix CRAN checks due to the crazy way purrr does dplyr ops. This pkg now Imports the necessary dplyr functions.
17
+* Mis-spelled words aren't mis-spelled. Too many necessary acronyms to use "'" pairs.

+ 6
- 8
gdns.Rproj View File

@@ -5,21 +5,19 @@ SaveWorkspace: No
5 5
 AlwaysSaveHistory: Default
6 6
 
7 7
 EnableCodeIndexing: Yes
8
+UseSpacesForTab: Yes
9
+NumSpacesForTab: 2
8 10
 Encoding: UTF-8
9 11
 
12
+RnwWeave: Sweave
13
+LaTeX: pdfLaTeX
14
+
10 15
 AutoAppendNewline: Yes
11 16
 StripTrailingWhitespace: Yes
12 17
 
13 18
 BuildType: Package
14 19
 PackageUseDevtools: Yes
15 20
 PackageInstallArgs: --no-multiarch --with-keep.source
16
-PackageRoxygenize: rd,collate,namespace
17
-
18
-UseSpacesForTab: Yes
19
-NumSpacesForTab: 2
20
-
21
-RnwWeave: Sweave
22
-LaTeX: pdfLaTeX
23
-
24 21
 PackageBuildArgs: --resave-data
25 22
 PackageCheckArgs: --as-cran
23
+PackageRoxygenize: rd,collate,namespace

+ 0
- 1
man/bulk_query.Rd View File

@@ -41,4 +41,3 @@ gdns::bulk_query(hosts)
41 41
 \references{
42 42
 \url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
43 43
 }
44
-

+ 0
- 1
man/gdns.Rd View File

@@ -26,4 +26,3 @@ for more information.
26 26
 \author{
27 27
 Bob Rudis (bob@rud.is)
28 28
 }
29
-

+ 0
- 1
man/has_spf.Rd View File

@@ -12,4 +12,3 @@ has_spf(spf_rec)
12 12
 \description{
13 13
 Test for whether a DNS TXT record is an SPF record
14 14
 }
15
-

+ 1
- 2
man/is_soft_fail.Rd View File

@@ -1,8 +1,8 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/spf.r
3 3
 \name{is_soft_fail}
4
-\alias{is_hard_fail}
5 4
 \alias{is_soft_fail}
5
+\alias{is_hard_fail}
6 6
 \alias{passes_all}
7 7
 \title{SPF "all" type test}
8 8
 \usage{
@@ -18,4 +18,3 @@ passes_all(spf_rec)
18 18
 \description{
19 19
 SPF "all" type test
20 20
 }
21
-

+ 0
- 1
man/query.Rd View File

@@ -60,4 +60,3 @@ query("17.142.160.59", "PTR")
60 60
 \references{
61 61
 \url{https://developers.google.com/speed/public-dns/docs/dns-over-https}
62 62
 }
63
-

+ 2
- 3
man/spf_ipv4s.Rd View File

@@ -1,11 +1,11 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/spf.r
3 3
 \name{spf_ipv4s}
4
-\alias{spf_exists}
5
-\alias{spf_includes}
6 4
 \alias{spf_ipv4s}
7 5
 \alias{spf_ipv6s}
6
+\alias{spf_includes}
8 7
 \alias{spf_ptrs}
8
+\alias{spf_exists}
9 9
 \title{SPF field extraction functions}
10 10
 \usage{
11 11
 spf_ipv4s(spf_rec)
@@ -24,4 +24,3 @@ spf_exists(spf_rec)
24 24
 \description{
25 25
 Various helper functions to extract SPF record components.
26 26
 }
27
-

+ 1
- 2
man/split_spf.Rd View File

@@ -12,7 +12,6 @@ split_spf(spf_rec)
12 12
 \description{
13 13
 Given a vector of TXT records, this function will return a list of vectors
14 14
 of all the SPF records for each. If the given TXT record is not an SPF
15
-record, \code{NULL} is returned (which makes it easy to skip with \code{purrr}
15
+record, \code{NA} is returned (which makes it easy to skip with \code{purrr}
16 16
 functions).
17 17
 }
18
-

Loading…
Cancel
Save