ferrum_common 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e8ef82a6987019ce9a01dffedf29704905fc53d7f3534cc1654b6a9a7c9220d
4
+ data.tar.gz: b9d2a38f62cc43372635cfcf679f95868c735b5ad8fbf2d482ac9b640df2e06a
5
+ SHA512:
6
+ metadata.gz: 4a7044da6e7ec7c03d56d5b1b2e99f72988476cd93323af8fc9601db4fe9161b534dd8188f9ea57548676776ab05394f5d5c60d7a43fed6bc26ecbd21a93eb2e
7
+ data.tar.gz: 474977a1cb5ec61a2f1ac62a47d275e34e803754c3554a8f5393c7634e0fe23abbf02fae4c7b1b9d9f48763266868fd00ec8e3df139a0ef3297dbc1a0bbeaaba
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Victor Maslov
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.
@@ -0,0 +1,15 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "ferrum_common"
3
+ spec.version = "0.0.0"
4
+ spec.summary = "[WIP] common useful extensions for ferrum or cuprite"
5
+
6
+ spec.author = "Victor Maslov aka Nakilon"
7
+ spec.email = "nakilon@gmail.com"
8
+ spec.license = "MIT"
9
+ spec.metadata = {"source_code_uri" => "https://github.com/nakilon/ferrum_common"}
10
+
11
+ spec.add_dependency "ferrum"
12
+ spec.required_ruby_version = ">=2.5"
13
+
14
+ spec.files = %w{ LICENSE ferrum_common.gemspec lib/ferrum_common.rb }
15
+ end
@@ -0,0 +1,28 @@
1
+ require "ferrum"
2
+ module FerrumCommon
3
+ def self.new **_
4
+ Ferrum::Browser.new(**_).tap do |browser|
5
+ require "browser_reposition"
6
+ browser.extend(BrowserReposition).reposition
7
+ browser.define_singleton_method :redo_until_true do |timeout, msg = nil, &block|
8
+ Timeout.timeout timeout do
9
+ begin
10
+ block.call
11
+ rescue Ferrum::NodeNotFoundError
12
+ redo
13
+ end or (sleep timeout*0.1; redo)
14
+ end
15
+ rescue Timeout::Error
16
+ browser.mhtml path: "temp.mhtml"
17
+ $!.backtrace.reject!{ |_| _[/\/gems\/concurrent-ruby-/] }
18
+ $!.backtrace.reject!{ |_| _[/\/gems\/ferrum-/] }
19
+ raise Timeout::Error, "#{$!.to_s} in redo_until_true #{" (#{msg})" if msg}"
20
+ end
21
+ browser.define_singleton_method :abort do |msg|
22
+ Browser.mhtml path: "temp.mhtml"
23
+ puts Thread.current.backtrace
24
+ abort msg
25
+ end
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ferrum_common
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Victor Maslov aka Nakilon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ferrum
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email: nakilon@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - LICENSE
34
+ - ferrum_common.gemspec
35
+ - lib/ferrum_common.rb
36
+ homepage:
37
+ licenses:
38
+ - MIT
39
+ metadata:
40
+ source_code_uri: https://github.com/nakilon/ferrum_common
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '2.5'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubygems_version: 3.3.25
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: "[WIP] common useful extensions for ferrum or cuprite"
60
+ test_files: []