site_watcher 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/site_watcher/version.rb +1 -1
- data/lib/site_watcher.rb +10 -7
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3871bda59d433bb2e423b760919479b402714bcb2ac18ef0d2e6312f3e06a3ee
|
4
|
+
data.tar.gz: b154e6c67de541fe782cdf1583c335ddd30fbc92d98cdc8895d1541f397ac414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50a42cc608c857812f62578cac2f37eca9a7c2a8b1d3b73850c6a95a5ff75f1a940f71b856a069ccb4e93891906b097cc051bcd4b9284ced82beaa0b6e62437b
|
7
|
+
data.tar.gz: 5b2587837c2d4db18c2565c7818146ce7b70e83c2989a39197dde9f3e013456af86d721e3e71f58daf76f66af43b78b945a4ed9d9122ccc7886aa684b9b33049
|
data/lib/site_watcher/version.rb
CHANGED
data/lib/site_watcher.rb
CHANGED
@@ -8,29 +8,30 @@ require "rspec/expectations"
|
|
8
8
|
|
9
9
|
class SiteWatcher
|
10
10
|
def self.watch(opts={}, &block)
|
11
|
-
trap(:SIGINT) { abort(?\n) }
|
12
|
-
|
13
11
|
dsl = DSL::Top.new
|
14
12
|
dsl.instance_eval(&block)
|
15
13
|
|
16
14
|
delay = opts.fetch(:every, 5)
|
17
|
-
logger = opts.fetch(:logger, ::Logger.new($stderr))
|
15
|
+
logger = opts.fetch(:logger, ::Logger.new($stderr, level: :warn))
|
16
|
+
timeout = opts.fetch(:timeout, {connect: 3, read: 10})
|
18
17
|
|
19
18
|
new(
|
20
19
|
dsl.__sw_before_hooks,
|
21
20
|
dsl.__sw_pages,
|
22
21
|
dsl.__sw_after_hooks,
|
23
22
|
delay,
|
24
|
-
logger
|
23
|
+
logger,
|
24
|
+
timeout,
|
25
25
|
).watch
|
26
26
|
end
|
27
27
|
|
28
|
-
def initialize(before_hooks, pages, after_hooks, delay, logger)
|
28
|
+
def initialize(before_hooks, pages, after_hooks, delay, logger, timeout)
|
29
29
|
@before_hooks = before_hooks
|
30
30
|
@pages = pages
|
31
31
|
@after_hooks = after_hooks
|
32
32
|
@delay = delay
|
33
33
|
@logger = logger
|
34
|
+
@timeout = timeout
|
34
35
|
@force = false
|
35
36
|
end
|
36
37
|
|
@@ -44,7 +45,7 @@ class SiteWatcher
|
|
44
45
|
|
45
46
|
@pages.each do |page|
|
46
47
|
begin
|
47
|
-
page.__sw_run!(force)
|
48
|
+
page.__sw_run!(force, @logger, @timeout)
|
48
49
|
@pages.delete(page) if page.__sw_remove_on_fulfillment
|
49
50
|
rescue ::RSpec::Expectations::ExpectationNotMetError
|
50
51
|
rescue => e
|
@@ -147,11 +148,13 @@ class SiteWatcher
|
|
147
148
|
@__sw_remove_on_fulfillment = !!bool
|
148
149
|
end
|
149
150
|
|
150
|
-
def __sw_run!(force
|
151
|
+
def __sw_run!(force, logger, timeout)
|
151
152
|
if @__sw_fetch
|
152
153
|
response = @__sw_fetch.call(@__sw_url)
|
153
154
|
else
|
154
155
|
response = ::HTTP
|
156
|
+
.use(logging: {logger: logger})
|
157
|
+
.timeout(timeout)
|
155
158
|
.headers(@__sw_headers)
|
156
159
|
.request(@__sw_method, @__sw_url, **@__sw_http_opts)
|
157
160
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_watcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Genco
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
113
|
- alexgenco@gmail.com
|
114
114
|
executables: []
|
@@ -123,7 +123,7 @@ homepage: https://github.com/alexgenco/site_watcher
|
|
123
123
|
licenses:
|
124
124
|
- MIT
|
125
125
|
metadata: {}
|
126
|
-
post_install_message:
|
126
|
+
post_install_message:
|
127
127
|
rdoc_options: []
|
128
128
|
require_paths:
|
129
129
|
- lib
|
@@ -138,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
142
|
-
signing_key:
|
141
|
+
rubygems_version: 3.1.4
|
142
|
+
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Periodically monitor a website
|
145
145
|
test_files: []
|