ferrum-har 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/ferrum/har/command_extension.rb +79 -0
- data/lib/ferrum/har/version.rb +1 -1
- data/lib/ferrum/har.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece6969fb3a3135a534510dbbee3a94544dfceaaebbf7ffdf2ca3b7ef9483a0c
|
4
|
+
data.tar.gz: f1feb7448c4b4cd86b823e22f433f650bcbe7f2bae13b68668d35efaebc427a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f60149634aababca262378cf044e8ffdd9c4dd0f6e34556ce336d3f50aec819ff43a7aea21cac26e30fa8cb7b820cb964d7a9ae9538d22c38c2a1c2d38582b2
|
7
|
+
data.tar.gz: 21cdba221d68c0ae8eebb2ab4d915b33f17d4c9d4058110101a94729ece0bd95080e99d5ddd55943c6ff604e3c31901199c6d54e0c11172d1d8460241c4169e0
|
data/README.md
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This module is prepended to Ferrum::Browser::Command to check options required by ferrum-har
|
4
|
+
module Ferrum
|
5
|
+
module Har
|
6
|
+
class ConfigurationError < RuntimeError
|
7
|
+
end
|
8
|
+
|
9
|
+
module BrowserCommandExtension
|
10
|
+
def merge_options
|
11
|
+
super.tap do |options|
|
12
|
+
check_har_related_browser_options(options)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private def check_har_related_browser_options(options)
|
17
|
+
options = options.transform_keys(&:to_s)
|
18
|
+
|
19
|
+
check_disable_extensions_option(options)
|
20
|
+
check_load_extension_option(options)
|
21
|
+
check_auto_open_option(options)
|
22
|
+
check_headless_option(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
private def check_disable_extensions_option(options)
|
26
|
+
disable_extensions_option_value = options.key?("disable-extensions")
|
27
|
+
return unless disable_extensions_option_value
|
28
|
+
|
29
|
+
raise Ferrum::Har::ConfigurationError, <<~MSG
|
30
|
+
The ferrum-har gem requires the 'disable-extensions' browser option to be absent,
|
31
|
+
ie: extensions should be allowed. The gem will do this for you automatically, but if you
|
32
|
+
override the value, then ferrum-har will not work.
|
33
|
+
|
34
|
+
It was found to be set to '#{disable_extensions_option_value}'.
|
35
|
+
MSG
|
36
|
+
end
|
37
|
+
|
38
|
+
private def check_load_extension_option(options)
|
39
|
+
load_extension_option_value = options["load-extension"]
|
40
|
+
return unless load_extension_option_value != "#{Ferrum::Har::GEM_DIR}/extension"
|
41
|
+
|
42
|
+
raise Ferrum::Har::ConfigurationError, <<~MSG
|
43
|
+
The ferrum-har gem requires the 'load-extension' browser option to be set to
|
44
|
+
'#{Ferrum::Har::GEM_DIR}/extension'. It will do this for you automatically, but if you
|
45
|
+
override the value, then ferrum-har will not work.
|
46
|
+
|
47
|
+
It was found to be set to '#{load_extension_option_value}'.
|
48
|
+
MSG
|
49
|
+
end
|
50
|
+
|
51
|
+
private def check_auto_open_option(options)
|
52
|
+
auto_open_value = options["auto-open-devtools-for-tabs"]
|
53
|
+
return if auto_open_value.nil?
|
54
|
+
|
55
|
+
raise Ferrum::Har::ConfigurationError, <<~MSG
|
56
|
+
The ferrum-har gem requires the 'auto-open-devtools-for-tabs' browser option be enabled,
|
57
|
+
'#{Ferrum::Har::GEM_DIR}/extension'. It will do this for you automatically, but if you
|
58
|
+
override the value, then ferrum-har will not work.
|
59
|
+
ie: set to nil.
|
60
|
+
|
61
|
+
It was found to be set to '#{auto_open_value}'.
|
62
|
+
MSG
|
63
|
+
end
|
64
|
+
|
65
|
+
private def check_headless_option(options)
|
66
|
+
headless_value = options["headless"]
|
67
|
+
return unless options.key?("headless") && [false, nil].include?(headless_value)
|
68
|
+
|
69
|
+
raise Ferrum::Har::ConfigurationError, <<~MSG
|
70
|
+
If you are using ferrum headless, the ferrum-har gem requires the browser
|
71
|
+
option 'headless' to be set to 'new' instead of true or nil. Read this for more details:
|
72
|
+
https://developer.chrome.com/docs/chromium/new-headless
|
73
|
+
|
74
|
+
It was found to be set to '#{headless_value}'.
|
75
|
+
MSG
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/ferrum/har/version.rb
CHANGED
data/lib/ferrum/har.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "ferrum"
|
4
4
|
require "ferrum/browser/options/chrome"
|
5
5
|
require "ferrum/har/version"
|
6
|
+
require "ferrum/har/command_extension"
|
6
7
|
require "ferrum/har/page_extension"
|
7
8
|
require "ferrum/har/options_extension"
|
8
9
|
|
@@ -17,3 +18,6 @@ Ferrum::Page.prepend(Ferrum::Har::PageExtension)
|
|
17
18
|
|
18
19
|
# Add the #merge_default method to Ferrum::Browser::Options::Chrome
|
19
20
|
Ferrum::Browser::Options::Chrome.prepend(Ferrum::Har::OptionsExtension)
|
21
|
+
|
22
|
+
# Add the #check_har_related_browser_options method to Ferrum::Browser::Command
|
23
|
+
Ferrum::Browser::Command.prepend(Ferrum::Har::BrowserCommandExtension)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ferrum-har
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Lascelles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- extension/panel.html
|
53
53
|
- extension/panel.js
|
54
54
|
- lib/ferrum/har.rb
|
55
|
+
- lib/ferrum/har/command_extension.rb
|
55
56
|
- lib/ferrum/har/options_extension.rb
|
56
57
|
- lib/ferrum/har/page_extension.rb
|
57
58
|
- lib/ferrum/har/version.rb
|