cronwatch 0.5.0 → 0.5.1
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 +4 -4
- data/lib/cronwatch/alerts/webhook.rb +1 -1
- data/lib/cronwatch/http.rb +25 -1
- data/lib/cronwatch/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce9304826bfc7f8e79615453ee7b5c25503d3dbd7d8b803c229152b3e3c93844
|
|
4
|
+
data.tar.gz: ef0e084ae833b0e57f2dd997fa500ca43c6dfcddd65730265e166d7c227f00d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23c832ba7e7ff1e34ca6930f3b9eb7785f6175db5bfec6ef731495f695a16454ea63e0fb474dd305771f33eed145d3ab41fa762ea40baafb8187254c8b1099d5
|
|
7
|
+
data.tar.gz: bdaac367aac5c069fd6c3c3c38117e40c1afa7f073d5cb95c2c56c0a97efa58a0fabe86b1640905d2d01ec44cef44ae78aaff45d03cc4fe9dd9e381295e44d57
|
data/lib/cronwatch/http.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Cronwatch
|
|
|
34
34
|
# past it while the body is still arriving, returns the answer with an
|
|
35
35
|
# empty body, as the SDK's channels treat a body they could not read.
|
|
36
36
|
def post(url, body, headers)
|
|
37
|
-
uri =
|
|
37
|
+
uri = HTTP.postable(url)
|
|
38
38
|
deadline = HTTP.monotonic + @timeout
|
|
39
39
|
request = Net::HTTP::Post.new(uri.request_uri)
|
|
40
40
|
headers.each { |k, v| request[k] = HTTP.trim_header(v) }
|
|
@@ -96,6 +96,30 @@ module Cronwatch
|
|
|
96
96
|
[deadline - monotonic, 0.001].max
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
+
# A URL as fetch reads it: the spaces and control characters around it,
|
|
100
|
+
# and any tab or line break inside it, dropped (a pasted webhook URL often
|
|
101
|
+
# ends in a newline).
|
|
102
|
+
def clean_url(url)
|
|
103
|
+
url.to_s.gsub(/\A[\u0000-\u0020]+|[\u0000-\u0020]+\z/, "").delete("\t\n\r")
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# The URL parsed, once it is one a channel can post to. Refused without
|
|
107
|
+
# quoting it: URI's own errors quote the whole URL, and a webhook URL's
|
|
108
|
+
# path is its credential.
|
|
109
|
+
def postable(url)
|
|
110
|
+
uri = begin
|
|
111
|
+
URI(clean_url(url))
|
|
112
|
+
rescue URI::Error, ArgumentError
|
|
113
|
+
nil
|
|
114
|
+
end
|
|
115
|
+
scheme = uri&.scheme&.downcase
|
|
116
|
+
unless %w[http https].include?(scheme) && uri.host && !uri.host.empty?
|
|
117
|
+
shown = uri&.scheme && uri.host ? "#{scheme}:" : "this URL"
|
|
118
|
+
raise ArgumentError, "only http and https URLs can be posted to, not #{shown}"
|
|
119
|
+
end
|
|
120
|
+
uri
|
|
121
|
+
end
|
|
122
|
+
|
|
99
123
|
# A header value without the spaces, tabs and line breaks around it, as fetch sends it.
|
|
100
124
|
def trim_header(value)
|
|
101
125
|
value.to_s.gsub(/\A[ \t\r\n]+|[ \t\r\n]+\z/, "")
|
data/lib/cronwatch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cronwatch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon C. Phillips
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: fugit
|
|
@@ -27,7 +26,6 @@ dependencies:
|
|
|
27
26
|
description: 'Wrap a job, run a check, get told when it is missed, failed, stuck,
|
|
28
27
|
slow or over budget. The Ruby port of @cronwatch/sdk: same rules, same alerts, same
|
|
29
28
|
stored rows.'
|
|
30
|
-
email:
|
|
31
29
|
executables: []
|
|
32
30
|
extensions: []
|
|
33
31
|
extra_rdoc_files: []
|
|
@@ -107,7 +105,6 @@ metadata:
|
|
|
107
105
|
bug_tracker_uri: https://github.com/phillips-jon/cronwatch/issues
|
|
108
106
|
documentation_uri: https://cronwatch.dev/docs/ruby/
|
|
109
107
|
rubygems_mfa_required: 'true'
|
|
110
|
-
post_install_message:
|
|
111
108
|
rdoc_options: []
|
|
112
109
|
require_paths:
|
|
113
110
|
- lib
|
|
@@ -122,8 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
119
|
- !ruby/object:Gem::Version
|
|
123
120
|
version: '0'
|
|
124
121
|
requirements: []
|
|
125
|
-
rubygems_version: 3.
|
|
126
|
-
signing_key:
|
|
122
|
+
rubygems_version: 3.6.9
|
|
127
123
|
specification_version: 4
|
|
128
124
|
summary: Cron and scheduled-job monitoring that lives inside your app.
|
|
129
125
|
test_files: []
|