Browse Source

master cran

boB Rudis 8 months ago
parent
commit
24ff888965
No known key found for this signature in database
60 changed files with 345 additions and 108 deletions
  1. 1
    0
      .Rbuildignore
  2. 19
    38
      .travis.yml
  3. 2
    2
      DESCRIPTION
  4. 2
    0
      LICENSE
  5. 21
    0
      LICENSE.md
  6. 6
    0
      NAMESPACE
  7. 4
    0
      NEWS.md
  8. 49
    13
      R/docker-splash.r
  9. 27
    1
      R/splashr.r
  10. 20
    0
      R/user-agents.R
  11. 90
    0
      R/utils-safely.R
  12. 1
    1
      man/as_har.Rd
  13. 1
    1
      man/as_httr_req.Rd
  14. 1
    1
      man/as_response.Rd
  15. 1
    1
      man/execute_lua.Rd
  16. 1
    1
      man/get_content_size.Rd
  17. 1
    1
      man/get_content_type.Rd
  18. 1
    1
      man/get_har_entry.Rd
  19. 1
    1
      man/get_request_type.Rd
  20. 1
    1
      man/get_request_url.Rd
  21. 1
    1
      man/get_response_body.Rd
  22. 1
    1
      man/har_entries.Rd
  23. 1
    1
      man/har_entry_count.Rd
  24. 5
    2
      man/install_splash.Rd
  25. 1
    1
      man/json_fromb64.Rd
  26. 1
    1
      man/killall_splash.Rd
  27. 20
    0
      man/print.splashr.Rd
  28. 1
    1
      man/render_har.Rd
  29. 1
    1
      man/render_html.Rd
  30. 1
    1
      man/render_jpeg.Rd
  31. 1
    1
      man/render_json.Rd
  32. 1
    1
      man/render_png.Rd
  33. 7
    3
      man/splash.Rd
  34. 1
    1
      man/splash_active.Rd
  35. 1
    1
      man/splash_add_lua.Rd
  36. 1
    1
      man/splash_click.Rd
  37. 1
    1
      man/splash_debug.Rd
  38. 1
    1
      man/splash_enable_javascript.Rd
  39. 1
    1
      man/splash_focus.Rd
  40. 1
    1
      man/splash_go.Rd
  41. 1
    1
      man/splash_har.Rd
  42. 1
    1
      man/splash_har_reset.Rd
  43. 1
    1
      man/splash_history.Rd
  44. 1
    1
      man/splash_html.Rd
  45. 1
    1
      man/splash_images.Rd
  46. 1
    1
      man/splash_perf_stats.Rd
  47. 1
    1
      man/splash_plugins.Rd
  48. 1
    1
      man/splash_png.Rd
  49. 1
    1
      man/splash_press.Rd
  50. 1
    1
      man/splash_private_mode.Rd
  51. 1
    1
      man/splash_release.Rd
  52. 1
    1
      man/splash_response_body.Rd
  53. 1
    1
      man/splash_send_keys.Rd
  54. 1
    1
      man/splash_send_text.Rd
  55. 16
    1
      man/splash_user_agent.Rd
  56. 1
    1
      man/splash_version.Rd
  57. 1
    1
      man/splash_wait.Rd
  58. 11
    3
      man/start_splash.Rd
  59. 1
    1
      man/stop_splash.Rd
  60. 2
    2
      tests/testthat/test-splash.R

+ 1
- 0
.Rbuildignore View File

@@ -1,3 +1,4 @@
1
+^LICENSE\.md$
1 2
 ^.*\.Rproj$
2 3
 ^\.Rproj\.user$
3 4
 ^\.travis\.yml$

+ 19
- 38
.travis.yml View File

@@ -15,53 +15,34 @@ env:
15 15
   matrix:
16 16
   include:
17 17
     - dist: trusty
18
-    - dist: trusty
19 18
       r_check_args: '--ignore-vignettes'
20 19
       r_build_args: '--no-build-vignettes'
21
-      addons:
22
-        apt:
23
-          update: true
24
-          packages:
25
-            - libmagick++-dev
26
-            - librsvg2-dev
27
-            - libwebp-dev
28
-            - libpoppler-cpp-dev
29
-            - libtesseract-dev
30
-            - libleptonica-dev
31
-            - tesseract-ocr-eng
32
-            - r-cran-rgdal
33
-            - libfftw3-dev
34
-            - cargo
35
-    - PIP="pip" RETICULATE_PYTHON="/usr/bin/python"
36
-    - PYTHON=3 PIP="pip3" RETICULATE_PYTHON="/usr/bin/python3"
37 20
 
38 21
 addons:
39
-  apt:
40
-    update: true
41
-    sources:
42
-      - sourceline: 'ppa:opencpu/imagemagick'
43
-    packages:
44
-      - libmagick++-dev
45
-      - librsvg2-dev
46
-      - libwebp-dev
47
-      - libpoppler-cpp-dev
48
-      - libtesseract-dev
49
-      - libleptonica-dev
50
-      - tesseract-ocr-eng
51
-      - r-cran-rgdal
52
-      - libfftw3-dev
53
-      - cargo
22
+   apt:
23
+     update: true
24
+     sources:
25
+       - sourceline: 'ppa:opencpu/imagemagick'
26
+       - sourceline: 'ppa:ubuntugis/ppa'
27
+     packages:
28
+       - libmagick++-dev
29
+       - librsvg2-dev
30
+       - libwebp-dev
31
+       - libpoppler-cpp-dev
32
+       - libtesseract-dev
33
+       - libleptonica-dev
34
+       - tesseract-ocr-eng
35
+       - r-cran-rgdal
36
+       - libfftw3-dev
37
+       - cargo
54 38
 
55 39
 bioc_packages:
56 40
   - EBImage
57 41
 
58 42
 before_install:
59
-  - docker pull scrapinghub/splash:3.0
60
-  - docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 -d scrapinghub/splash:3.0
43
+  - docker pull scrapinghub/splash:3.2
44
+  - docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 -d scrapinghub/splash:3.2
61 45
   - docker ps -a
62
-  - sudo apt-get -y install python${PYTHON}-pip python-dev python${PYTHON}-numpy
63
-  - sudo $PIP install -U setuptools
64
-  - sudo $PIP install -U docker
65 46
   - (while true; do echo 'Ping? Pong!'; sleep 500; done) &
66 47
 
67 48
 r:
@@ -70,4 +51,4 @@ r:
70 51
  - devel
71 52
 
72 53
 after_success:
73
-  - Rscript -e 'covr::codecov()'
54
+  - Rscript -e 'covr::codecov()'

+ 2
- 2
DESCRIPTION View File

@@ -2,7 +2,7 @@ Package: splashr
2 2
 Type: Package
3 3
 Title: Tools to Work with the 'Splash' 'JavaScript' Rendering and Scraping Service
4 4
 Version: 0.6.0
5
-Date: 2019-01-13
5
+Date: 2019-02-24
6 6
 Encoding: UTF-8
7 7
 Authors@R: c(
8 8
     person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), 
@@ -18,7 +18,7 @@ Description: 'Splash' <https://github.com/scrapinghub/splash> is a 'JavaScript'
18 18
     page context; getting detailed rendering info in 'HAR' format.
19 19
 URL: http://gitlab.com/hrbrmstr/splashr
20 20
 BugReports: https://gitlab.com/hrbrmstr/splashr/issues
21
-License: AGPL
21
+License: MIT + file LICENSE
22 22
 Suggests:
23 23
     testthat,
24 24
     tibble,

+ 2
- 0
LICENSE View File

@@ -0,0 +1,2 @@
1
+YEAR: 2019
2
+COPYRIGHT HOLDER: Bob Rudis

+ 21
- 0
LICENSE.md View File

@@ -0,0 +1,21 @@
1
+# MIT License
2
+
3
+Copyright (c) 2019 Bob Rudis
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 6
- 0
NAMESPACE View File

@@ -5,6 +5,7 @@ S3method(as.data.frame,harentries)
5 5
 S3method(as.data.frame,harentry)
6 6
 S3method(print,splash_debug)
7 7
 S3method(print,splash_json)
8
+S3method(print,splashr)
8 9
 export("%>%")
9 10
 export(HARviewer)
10 11
 export(HARviewerOutput)
@@ -77,11 +78,16 @@ export(splash_version)
77 78
 export(splash_wait)
78 79
 export(start_splash)
79 80
 export(stop_splash)
81
+export(ua_android_samsung)
82
+export(ua_apple_tv)
83
+export(ua_chromecast)
80 84
 export(ua_ios_safari)
85
+export(ua_kindle)
81 86
 export(ua_linux_chrome)
82 87
 export(ua_linux_firefox)
83 88
 export(ua_macos_chrome)
84 89
 export(ua_macos_safari)
90
+export(ua_ps4)
85 91
 export(ua_splashr)
86 92
 export(ua_win10_chrome)
87 93
 export(ua_win10_firefox)

+ 4
- 0
NEWS.md View File

@@ -2,6 +2,10 @@
2 2
 
3 3
 * Switch Docker orchestration to the `stevedore` package
4 4
 * Fixed minor check on as.data.frame functions
5
+* Cleaned up splashr object printing
6
+* Added Android, Kindle, Apple TV & Chromecast user agents and updated 
7
+  other user agents
8
+* Updated Travis config to not use old docker pkg components
5 9
 
6 10
 0.5.0
7 11
 

+ 49
- 13
R/docker-splash.r View File

@@ -2,6 +2,7 @@
2 2
 #'
3 3
 #' @md
4 4
 #' @param tag Splash Docker image tag to install
5
+#' @return a `docker_image` object or `NULL` if an error occurred.
5 6
 #' @export
6 7
 #' @family splash_docker_helpers
7 8
 #' @examples \dontrun{
@@ -9,9 +10,23 @@
9 10
 #' splash_container <- start_splash()
10 11
 #' stop_splash(splash_container)
11 12
 #' }
12
-install_splash <- function(tag="3.2") {
13
+install_splash <- function(tag="latest") {
14
+
13 15
   docker <- stevedore::docker_client()
14
-  res <- docker$image$pull("scrapinghub/splash", tag=tag, stream=stdout())
16
+
17
+  tryCatch(
18
+    docker$image$pull("scrapinghub/splash", tag=tag, stream=stdout()),
19
+    error = function(e) {
20
+      message("Error pulling image from DockerHub.\n", e)
21
+      return(NULL)
22
+    },
23
+    interrupt = function(e) {
24
+      stop("Terminated by user", call. = FALSE)
25
+    }
26
+  ) -> res
27
+
28
+  invisible(res)
29
+
15 30
 }
16 31
 
17 32
 #' Start a Splash server Docker container
@@ -19,6 +34,10 @@ install_splash <- function(tag="3.2") {
19 34
 #' If using this in an automation context, you should consider adding a
20 35
 #' `Sys.sleep(3)` (or higher) after starting the docker container.
21 36
 #'
37
+#' This uses the `latest` image and passed the `--disable-browser-caches`
38
+#' parameter. If you do not want to use the 3.2.x+ versions of `Splash`
39
+#' you should use your own startup scripts vs this helper function.
40
+#'
22 41
 #' @param tag Splash Docker image tag to start
23 42
 #' @note you need Docker running on your system and have pulled the container with
24 43
 #'       [install_splash] for this to work. You should save the resultant
@@ -27,25 +46,37 @@ install_splash <- function(tag="3.2") {
27 46
 #' @param container_name naem for the container. Defaults to "`splashr`".
28 47
 #' @param remove remove the Splash container instance after it's stopped?
29 48
 #'        Defaults to `FALSE`.
49
+#' @param ... passed on to Splash instance launch parameters
30 50
 #' @family splash_docker_helpers
31
-#' @return `stevedor` container object
51
+#' @return `stevedore` container object
32 52
 #' @export
33 53
 #' @examples \dontrun{
34 54
 #' install_splash()
35 55
 #' splash_container <- start_splash()
36 56
 #' stop_splash(splash_container)
37 57
 #' }
38
-start_splash <- function(tag="3.2", container_name = "splashr", remove=FALSE) {
58
+start_splash <- function(tag="latest", container_name = "splashr", remove=FALSE, ...) {
39 59
 
40 60
   docker <- stevedore::docker_client()
41 61
 
42
-  docker$container$run(
43
-    image = sprintf("scrapinghub/splash:%s", tag),
44
-    name = container_name,
45
-    ports = c("5023:5023", "8051:8051"),
46
-    detach = TRUE,
47
-    rm = remove,
48
-    tty = TRUE
62
+  tryCatch(
63
+    docker$container$run(
64
+      image = sprintf("scrapinghub/splash:%s", tag),
65
+      name = container_name,
66
+      ports = c("5023:5023", "8051:8051", "8050:8050"),
67
+      detach = TRUE,
68
+      rm = remove,
69
+      tty = TRUE,
70
+      "--disable-browser-caches",
71
+      ...
72
+    ),
73
+    error = function(e) {
74
+      message("Error pulling image from DockerHub.")
75
+      return(NULL)
76
+    },
77
+    interrupt = function(e) {
78
+      stop("Terminated by user", call. = FALSE)
79
+    }
49 80
   ) -> splash_inst
50 81
 
51 82
   invisible(splash_inst)
@@ -66,8 +97,10 @@ start_splash <- function(tag="3.2", container_name = "splashr", remove=FALSE) {
66 97
 #' stop_splash(splash_container)
67 98
 #' }
68 99
 stop_splash <- function(splash_container) {
69
-  splash_container$stop()
70
-  splash_container$remove()
100
+  if (inherits(splash_container, "stevedore_object")) {
101
+    splash_container$stop()
102
+    splash_container$remove()
103
+  }
71 104
   invisible(NULL)
72 105
 }
73 106
 
@@ -83,7 +116,9 @@ stop_splash <- function(splash_container) {
83 116
 killall_splash <- function() {
84 117
 
85 118
   docker <- stevedore::docker_client()
119
+
86 120
   x <- docker$container$list(all=TRUE)
121
+
87 122
   for (i in 1:nrow(x)) {
88 123
     if (grepl("bin/splash", x$command[i])) {
89 124
       message(sprintf("Pruning: %s...", x$id[i]))
@@ -94,6 +129,7 @@ killall_splash <- function() {
94 129
       }
95 130
     }
96 131
   }
132
+
97 133
 }
98 134
 
99 135
 

+ 27
- 1
R/splashr.r View File

@@ -2,6 +2,10 @@ splash_url <- function(splash_obj) { sprintf("http://%s:%s", splash_obj$host, sp
2 2
 
3 3
 #' Configure parameters for connecting to a Splash server
4 4
 #'
5
+#'
6
+#' @md
7
+#' @note There is a quick "helper" object named `splash_local` which is preconfigured
8
+#'       with `localhost` as the host name.
5 9
 #' @param host host or IP address
6 10
 #' @param port port the server is running on (default is 8050)
7 11
 #' @param user,pass leave `NULL` if basic auth is not configured. Otherwise,
@@ -11,7 +15,29 @@ splash_url <- function(splash_obj) { sprintf("http://%s:%s", splash_obj$host, sp
11 15
 #' sp <- splash()
12 16
 #' }
13 17
 splash <- function(host, port=8050L, user=NULL, pass=NULL) {
14
-  list(host=host, port=port, user=user, pass=pass)
18
+  obj <- list(host=host, port=port, user=user, pass=pass)
19
+  class(obj) <- c("splashr", "list")
20
+  obj
21
+}
22
+
23
+#' Print for splashr
24
+#'
25
+#' @md
26
+#' @param x a splashr object
27
+#' @param ... unused
28
+#' @keywords internal
29
+#' @return x
30
+#' @export
31
+print.splashr <- function(x, ...) {
32
+
33
+  cat(
34
+    "<splashr instance connection; ",
35
+    if (length(x$user)) sprintf("%s@", x$user) else "",
36
+    x$host, ":", x$port, ">\n", sep=""
37
+  )
38
+
39
+  invisible(x)
40
+
15 41
 }
16 42
 
17 43
 #' @rdname splash

+ 20
- 0
R/user-agents.R View File

@@ -46,3 +46,23 @@ ua_linux_firefox <- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/2010
46 46
 #' @rdname splash_user_agent
47 47
 #' @export
48 48
 ua_ios_safari <- "Mozilla/5.0 (iPad; CPU OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0 Mobile/14C92 Safari/602.1"
49
+
50
+#' @rdname splash_user_agent
51
+#' @export
52
+ua_android_samsung <- "Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36"
53
+
54
+#' @rdname splash_user_agent
55
+#' @export
56
+ua_kindle <- "Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+"
57
+
58
+#' @rdname splash_user_agent
59
+#' @export
60
+ua_ps4 <- "Mozilla/5.0 (PlayStation 4 3.11) AppleWebKit/537.73 (KHTML, like Gecko)"
61
+
62
+#' @rdname splash_user_agent
63
+#' @export
64
+ua_apple_tv <- "AppleTV6,2/11.1"
65
+
66
+#' @rdname splash_user_agent
67
+#' @export
68
+ua_chromecast <- "Mozilla/5.0 (CrKey armv7l 1.5.16041) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.0 Safari/537.36"

+ 90
- 0
R/utils-safely.R View File

@@ -0,0 +1,90 @@
1
+# Less cool counterparts to purrr's side-effect capture-rs
2
+#
3
+# Most of the helper functions are 100% from output.R in purrr repo
4
+#
5
+# @param quiet Hide errors (`TRUE`, the default), or display them
6
+#   as they occur?
7
+# @param otherwise Default value to use when an error occurs.
8
+#
9
+# @return `safely`: wrapped function instead returns a list with
10
+#   components `result` and `error`. One value is always `NULL`.
11
+#
12
+#   `quietly`: wrapped function instead returns a list with components
13
+#   `result`, `output`, `messages` and `warnings`.
14
+#
15
+#   `possibly`: wrapped function uses a default value (`otherwise`)
16
+#   whenever an error occurs.
17
+safely <- function(.f, otherwise = NULL, quiet = TRUE) {
18
+  function(...) capture_error(.f(...), otherwise, quiet)
19
+}
20
+
21
+quietly <- function(.f) {
22
+  function(...) capture_output(.f(...))
23
+}
24
+
25
+possibly <- function(.f, otherwise, quiet = TRUE) {
26
+  force(otherwise)
27
+  function(...) {
28
+    tryCatch(.f(...),
29
+      error = function(e) {
30
+        if (!quiet)
31
+          message("Error: ", e$message)
32
+        otherwise
33
+      },
34
+      interrupt = function(e) {
35
+        stop("Terminated by user", call. = FALSE)
36
+      }
37
+    )
38
+  }
39
+}
40
+
41
+capture_error <- function(code, otherwise = NULL, quiet = TRUE) {
42
+  tryCatch(
43
+    list(result = code, error = NULL),
44
+    error = function(e) {
45
+      if (!quiet)
46
+        message("Error: ", e$message)
47
+
48
+      list(result = otherwise, error = e)
49
+    },
50
+    interrupt = function(e) {
51
+      stop("Terminated by user", call. = FALSE)
52
+    }
53
+  )
54
+}
55
+
56
+capture_output <- function(code) {
57
+  warnings <- character()
58
+  wHandler <- function(w) {
59
+    warnings <<- c(warnings, w$message)
60
+    invokeRestart("muffleWarning")
61
+  }
62
+
63
+  messages <- character()
64
+  mHandler <- function(m) {
65
+    messages <<- c(messages, m$message)
66
+    invokeRestart("muffleMessage")
67
+  }
68
+
69
+  temp <- file()
70
+  sink(temp)
71
+  on.exit({
72
+    sink()
73
+    close(temp)
74
+  })
75
+
76
+  result <- withCallingHandlers(
77
+    code,
78
+    warning = wHandler,
79
+    message = mHandler
80
+  )
81
+
82
+  output <- paste0(readLines(temp, warn = FALSE), collapse = "\n")
83
+
84
+  list(
85
+    result = result,
86
+    output = output,
87
+    warnings = warnings,
88
+    messages = messages
89
+  )
90
+}

+ 1
- 1
man/as_har.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/render-har.R
2
+% Please edit documentation in R/render-har.r
3 3
 \name{as_har}
4 4
 \alias{as_har}
5 5
 \title{Turn a generic Splash HAR response into a HAR object}

+ 1
- 1
man/as_httr_req.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/as_req.R
2
+% Please edit documentation in R/as_req.r
3 3
 \name{as_httr_req}
4 4
 \alias{as_httr_req}
5 5
 \title{Create an httr verb request function from an HAR request}

+ 1
- 1
man/as_response.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/as_request.R
2
+% Please edit documentation in R/as_request.r
3 3
 \name{as_response}
4 4
 \alias{as_response}
5 5
 \title{Return a HAR entry response as an httr::response object}

+ 1
- 1
man/execute_lua.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/execute.R
2
+% Please edit documentation in R/execute.r
3 3
 \name{execute_lua}
4 4
 \alias{execute_lua}
5 5
 \title{Execute a custom rendering script and return a result.}

+ 1
- 1
man/get_content_size.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/content.R
2
+% Please edit documentation in R/content.r
3 3
 \name{get_content_size}
4 4
 \alias{get_content_size}
5 5
 \alias{get_body_size}

+ 1
- 1
man/get_content_type.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{get_content_type}
4 4
 \alias{get_content_type}
5 5
 \alias{is_content_type}

+ 1
- 1
man/get_har_entry.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{get_har_entry}
4 4
 \alias{get_har_entry}
5 5
 \title{Retrieve an entry by index from a HAR object}

+ 1
- 1
man/get_request_type.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{get_request_type}
4 4
 \alias{get_request_type}
5 5
 \alias{is_get}

+ 1
- 1
man/get_request_url.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{get_request_url}
4 4
 \alias{get_request_url}
5 5
 \title{Retrieve request URL}

+ 1
- 1
man/get_response_body.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{get_response_body}
4 4
 \alias{get_response_body}
5 5
 \title{Retrieve the body content of a HAR entry}

+ 1
- 1
man/har_entries.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{har_entries}
4 4
 \alias{har_entries}
5 5
 \title{Retrieve just the HAR entries from a splashr request}

+ 1
- 1
man/har_entry_count.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/helpers.R
2
+% Please edit documentation in R/helpers.r
3 3
 \name{har_entry_count}
4 4
 \alias{har_entry_count}
5 5
 \title{Retrieves number of HAR entries in a response}

+ 5
- 2
man/install_splash.Rd View File

@@ -1,14 +1,17 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/docker-splash.R
2
+% Please edit documentation in R/docker-splash.r
3 3
 \name{install_splash}
4 4
 \alias{install_splash}
5 5
 \title{Retrieve the Docker image for Splash}
6 6
 \usage{
7
-install_splash(tag = "3.2")
7
+install_splash(tag = "latest")
8 8
 }
9 9
 \arguments{
10 10
 \item{tag}{Splash Docker image tag to install}
11 11
 }
12
+\value{
13
+a \code{docker_image} object or \code{NULL} if an error occurred.
14
+}
12 15
 \description{
13 16
 Retrieve the Docker image for Splash
14 17
 }

+ 1
- 1
man/json_fromb64.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/utils.R
2
+% Please edit documentation in R/utils.r
3 3
 \name{json_fromb64}
4 4
 \alias{json_fromb64}
5 5
 \title{Convert a Base64 encoded string into an R object}

+ 1
- 1
man/killall_splash.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/docker-splash.R
2
+% Please edit documentation in R/docker-splash.r
3 3
 \name{killall_splash}
4 4
 \alias{killall_splash}
5 5
 \title{Prune all dead and running Splash Docker containers}

+ 20
- 0
man/print.splashr.Rd View File

@@ -0,0 +1,20 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/splashr.r
3
+\name{print.splashr}
4
+\alias{print.splashr}
5
+\title{Print for splashr}
6
+\usage{
7
+\method{print}{splashr}(x, ...)
8
+}
9
+\arguments{
10
+\item{x}{a splashr object}
11
+
12
+\item{...}{unused}
13
+}
14
+\value{
15
+x
16
+}
17
+\description{
18
+Print for splashr
19
+}
20
+\keyword{internal}

+ 1
- 1
man/render_har.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/render-har.R
2
+% Please edit documentation in R/render-har.r
3 3
 \name{render_har}
4 4
 \alias{render_har}
5 5
 \title{Return information about Splash interaction with a website in HAR format.}

+ 1
- 1
man/render_html.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/render-html.R
2
+% Please edit documentation in R/render-html.r
3 3
 \name{render_html}
4 4
 \alias{render_html}
5 5
 \title{Return the HTML of the javascript-rendered page.}

+ 1
- 1
man/render_jpeg.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/render-jpg.R
2
+% Please edit documentation in R/render-jpg.r
3 3
 \name{render_jpeg}
4 4
 \alias{render_jpeg}
5 5
 \title{Return a image (in JPEG format) of the javascript-rendered page.}

+ 1
- 1
man/render_json.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/render-json.R
2
+% Please edit documentation in R/render-json.r
3 3
 \name{render_json}
4 4
 \alias{render_json}
5 5
 \title{Return a json-encoded dictionary with information about javascript-rendered webpage.}

+ 1
- 1
man/render_png.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/render-png.R
2
+% Please edit documentation in R/render-png.r
3 3
 \name{render_png}
4 4
 \alias{render_png}
5 5
 \title{Return an image (in PNG format) of the javascript-rendered page.}

+ 7
- 3
man/splash.Rd View File

@@ -1,11 +1,11 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/splashr.R
2
+% Please edit documentation in R/splashr.r
3 3
 \docType{data}
4 4
 \name{splash}
5 5
 \alias{splash}
6 6
 \alias{splash_local}
7 7
 \title{Configure parameters for connecting to a Splash server}
8
-\format{An object of class \code{list} of length 4.}
8
+\format{An object of class \code{splashr} (inherits from \code{list}) of length 4.}
9 9
 \usage{
10 10
 splash(host, port = 8050L, user = NULL, pass = NULL)
11 11
 
@@ -16,12 +16,16 @@ splash_local
16 16
 
17 17
 \item{port}{port the server is running on (default is 8050)}
18 18
 
19
-\item{user, pass}{leave `NULL` if basic auth is not configured. Otherwise,
19
+\item{user, pass}{leave \code{NULL} if basic auth is not configured. Otherwise,
20 20
 fill in what you need for basic authentication.}
21 21
 }
22 22
 \description{
23 23
 Configure parameters for connecting to a Splash server
24 24
 }
25
+\note{
26
+There is a quick "helper" object named \code{splash_local} which is preconfigured
27
+with \code{localhost} as the host name.
28
+}
25 29
 \examples{
26 30
 \dontrun{
27 31
 sp <- splash()

+ 1
- 1
man/splash_active.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/splashr.R
2
+% Please edit documentation in R/splashr.r
3 3
 \name{splash_active}
4 4
 \alias{splash_active}
5 5
 \title{Test if a Splash server is up}

+ 1
- 1
man/splash_add_lua.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_add_lua}
4 4
 \alias{splash_add_lua}
5 5
 \title{Add raw lua code into DSL call chain}

+ 1
- 1
man/splash_click.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_click}
4 4
 \alias{splash_click}
5 5
 \title{Trigger mouse click event in web page.}

+ 1
- 1
man/splash_debug.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/splashr.R
2
+% Please edit documentation in R/splashr.r
3 3
 \name{splash_debug}
4 4
 \alias{splash_debug}
5 5
 \alias{print.splash_debug}

+ 1
- 1
man/splash_enable_javascript.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_enable_javascript}
4 4
 \alias{splash_enable_javascript}
5 5
 \title{Enable or disable execution of JavaSript code embedded in the page.}

+ 1
- 1
man/splash_focus.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_focus}
4 4
 \alias{splash_focus}
5 5
 \title{Focus on a document element provided by a CSS selector}

+ 1
- 1
man/splash_go.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_go}
4 4
 \alias{splash_go}
5 5
 \title{Go to an URL.}

+ 1
- 1
man/splash_har.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_har}
4 4
 \alias{splash_har}
5 5
 \title{Return information about Splash interaction with a website in HAR format.}

+ 1
- 1
man/splash_har_reset.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_har_reset}
4 4
 \alias{splash_har_reset}
5 5
 \title{Drops all internally stored HAR records.}

+ 1
- 1
man/splash_history.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/splashr.R
2
+% Please edit documentation in R/splashr.r
3 3
 \name{splash_history}
4 4
 \alias{splash_history}
5 5
 \title{Get information about requests/responses for the pages loaded}

+ 1
- 1
man/splash_html.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_html}
4 4
 \alias{splash_html}
5 5
 \title{Return a HTML snapshot of a current page.}

+ 1
- 1
man/splash_images.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_images}
4 4
 \alias{splash_images}
5 5
 \title{Enable/disable images}

+ 1
- 1
man/splash_perf_stats.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/splashr.R
2
+% Please edit documentation in R/splashr.r
3 3
 \name{splash_perf_stats}
4 4
 \alias{splash_perf_stats}
5 5
 \title{Get Splash performance-related statistics}

+ 1
- 1
man/splash_plugins.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_plugins}
4 4
 \alias{splash_plugins}
5 5
 \title{Enable or disable browser plugins (e.g. Flash).}

+ 1
- 1
man/splash_png.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_png}
4 4
 \alias{splash_png}
5 5
 \title{Return a screenshot of a current page in PNG format.}

+ 1
- 1
man/splash_press.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_press}
4 4
 \alias{splash_press}
5 5
 \title{Trigger mouse press event in web page.}

+ 1
- 1
man/splash_private_mode.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_private_mode}
4 4
 \alias{splash_private_mode}
5 5
 \title{Enable or disable execution of JavaSript code embedded in the page.}

+ 1
- 1
man/splash_release.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_release}
4 4
 \alias{splash_release}
5 5
 \title{Trigger mouse release event in web page.}

+ 1
- 1
man/splash_response_body.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_response_body}
4 4
 \alias{splash_response_body}
5 5
 \title{Enable or disable response content tracking.}

+ 1
- 1
man/splash_send_keys.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_send_keys}
4 4
 \alias{splash_send_keys}
5 5
 \title{Send keyboard events to page context.}

+ 1
- 1
man/splash_send_text.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_send_text}
4 4
 \alias{splash_send_text}
5 5
 \title{Send text as input to page context, literally, character by character.}

+ 16
- 1
man/splash_user_agent.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R, R/user-agents.R
2
+% Please edit documentation in R/dsl.r, R/user-agents.R
3 3
 \docType{data}
4 4
 \name{splash_user_agent}
5 5
 \alias{splash_user_agent}
@@ -15,6 +15,11 @@
15 15
 \alias{ua_linux_chrome}
16 16
 \alias{ua_linux_firefox}
17 17
 \alias{ua_ios_safari}
18
+\alias{ua_android_samsung}
19
+\alias{ua_kindle}
20
+\alias{ua_ps4}
21
+\alias{ua_apple_tv}
22
+\alias{ua_chromecast}
18 23
 \title{Overwrite the User-Agent header for all further requests.}
19 24
 \format{An object of class \code{character} of length 1.}
20 25
 \usage{
@@ -43,6 +48,16 @@ ua_linux_chrome
43 48
 ua_linux_firefox
44 49
 
45 50
 ua_ios_safari
51
+
52
+ua_android_samsung
53
+
54
+ua_kindle
55
+
56
+ua_ps4
57
+
58
+ua_apple_tv
59
+
60
+ua_chromecast
46 61
 }
47 62
 \arguments{
48 63
 \item{splash_obj}{splashr object}

+ 1
- 1
man/splash_version.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/splashr.R
2
+% Please edit documentation in R/splashr.r
3 3
 \name{splash_version}
4 4
 \alias{splash_version}
5 5
 \title{Get Splash version information}

+ 1
- 1
man/splash_wait.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/dsl.R
2
+% Please edit documentation in R/dsl.r
3 3
 \name{splash_wait}
4 4
 \alias{splash_wait}
5 5
 \title{Wait for a period time}

+ 11
- 3
man/start_splash.Rd View File

@@ -1,10 +1,11 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/docker-splash.R
2
+% Please edit documentation in R/docker-splash.r
3 3
 \name{start_splash}
4 4
 \alias{start_splash}
5 5
 \title{Start a Splash server Docker container}
6 6
 \usage{
7
-start_splash(tag = "3.2", container_name = "splashr", remove = FALSE)
7
+start_splash(tag = "latest", container_name = "splashr",
8
+  remove = FALSE, ...)
8 9
 }
9 10
 \arguments{
10 11
 \item{tag}{Splash Docker image tag to start}
@@ -13,14 +14,21 @@ start_splash(tag = "3.2", container_name = "splashr", remove = FALSE)
13 14
 
14 15
 \item{remove}{remove the Splash container instance after it's stopped?
15 16
 Defaults to `FALSE`.}
17
+
18
+\item{...}{passed on to Splash instance launch parameters}
16 19
 }
17 20
 \value{
18
-`stevedor` container object
21
+`stevedore` container object
19 22
 }
20 23
 \description{
21 24
 If using this in an automation context, you should consider adding a
22 25
 `Sys.sleep(3)` (or higher) after starting the docker container.
23 26
 }
27
+\details{
28
+This uses the `latest` image and passed the `--disable-browser-caches`
29
+parameter. If you do not want to use the 3.2.x+ versions of `Splash`
30
+you should use your own startup scripts vs this helper function.
31
+}
24 32
 \note{
25 33
 you need Docker running on your system and have pulled the container with
26 34
       [install_splash] for this to work. You should save the resultant

+ 1
- 1
man/stop_splash.Rd View File

@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/docker-splash.R
2
+% Please edit documentation in R/docker-splash.r
3 3
 \name{stop_splash}
4 4
 \alias{stop_splash}
5 5
 \title{Stop a running a Splash server Docker container}

+ 2
- 2
tests/testthat/test-splash.R View File

@@ -6,7 +6,7 @@ test_that("we can do something", {
6 6
   test_url <- "http://localhost:8050/"
7 7
 
8 8
   xpct <- function(x) {
9
-    spact <- splash_active()
9
+    spact <- splash_active(splash_local)
10 10
     expect_that(spact, equals(TRUE))
11 11
     expect_that(length(splash_debug()), equals(7))
12 12
     expect_that(length(splash_version()), equals(9))
@@ -17,7 +17,7 @@ test_that("we can do something", {
17 17
     expect_that(render_har(url = test_url), is_a("har"))
18 18
   }
19 19
 
20
-  spact <- splash_active()
20
+  spact <- splash_active(splash_local)
21 21
 
22 22
   if (spact) {
23 23
     xpct()

Loading…
Cancel
Save