boppers-uptime 0.1.2 → 0.1.3
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 +5 -5
- data/.rubocop.yml +9 -115
- data/CODE_OF_CONDUCT.md +24 -23
- data/{gems.rb → Gemfile} +0 -0
- data/Gemfile.lock +110 -0
- data/README.md +23 -11
- data/boppers-uptime.gemspec +8 -5
- data/lib/boppers/uptime/version.rb +1 -1
- data/lib/boppers/uptime.rb +40 -26
- metadata +34 -21
- data/.travis.yml +0 -19
- data/gems.locked +0 -82
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 352d9afed3bf65cbd02d2759a09fe956a89bd8900351add2d441d6de6821ba2b
|
|
4
|
+
data.tar.gz: 848cc4c1562b834c531f2cf7093e722630f0be9b2a13bae3825bb07d07c1b45a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2051f46124d11e53e125278aed06a11c07994d625d7c03f9a3fdb54b97c04e79bde2f04f8e4a20fc1bbd8feae5f3fd7ee75cec1530031d74672684c7d35da8c8
|
|
7
|
+
data.tar.gz: 4ed3d520401c32a3f21757ac0b2b788ef0cffdd6b570135c0375c6054c9a0e730fc33fcf8fd9164dd0552e7bfd4faa648932fc05f36185e71398783f5e0c760c
|
data/.rubocop.yml
CHANGED
|
@@ -1,116 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Style/Alias:
|
|
5
|
-
EnforcedStyle: prefer_alias_method
|
|
6
|
-
|
|
7
|
-
Style/FrozenStringLiteralComment:
|
|
8
|
-
EnforcedStyle: always
|
|
9
|
-
|
|
10
|
-
Style/ClassCheck:
|
|
11
|
-
EnforcedStyle: kind_of?
|
|
12
|
-
|
|
13
|
-
Metrics/LineLength:
|
|
14
|
-
Max: 80
|
|
15
|
-
|
|
16
|
-
Style/BlockDelimiters:
|
|
17
|
-
Enabled: false
|
|
18
|
-
|
|
19
|
-
Style/RegexpLiteral:
|
|
20
|
-
Enabled: false
|
|
21
|
-
|
|
22
|
-
Metrics/AbcSize:
|
|
23
|
-
Enabled: false
|
|
24
|
-
|
|
25
|
-
Style/PerlBackrefs:
|
|
26
|
-
Enabled: false
|
|
27
|
-
|
|
28
|
-
ClassLength:
|
|
29
|
-
Enabled: false
|
|
30
|
-
|
|
31
|
-
CyclomaticComplexity:
|
|
32
|
-
Enabled: false
|
|
33
|
-
|
|
34
|
-
Documentation:
|
|
35
|
-
Enabled: false
|
|
36
|
-
|
|
37
|
-
Encoding:
|
|
38
|
-
Enabled: false
|
|
39
|
-
|
|
40
|
-
FileName:
|
|
41
|
-
Enabled: false
|
|
42
|
-
|
|
43
|
-
IfUnlessModifier:
|
|
44
|
-
Enabled: false
|
|
45
|
-
|
|
46
|
-
MethodLength:
|
|
47
|
-
Enabled: false
|
|
48
|
-
|
|
49
|
-
ModuleFunction:
|
|
50
|
-
Enabled: false
|
|
1
|
+
---
|
|
2
|
+
inherit_gem:
|
|
3
|
+
rubocop-fnando: .rubocop.yml
|
|
51
4
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Proc:
|
|
59
|
-
Enabled: false
|
|
60
|
-
|
|
61
|
-
SingleLineBlockParams:
|
|
62
|
-
Enabled: false
|
|
63
|
-
|
|
64
|
-
VariableInterpolation:
|
|
65
|
-
Enabled: false
|
|
66
|
-
|
|
67
|
-
Style/TrailingCommaInLiteral:
|
|
68
|
-
Enabled: false
|
|
69
|
-
|
|
70
|
-
WhileUntilModifier:
|
|
71
|
-
Enabled: false
|
|
72
|
-
|
|
73
|
-
PredicateName:
|
|
74
|
-
NamePrefixBlacklist:
|
|
75
|
-
- is_
|
|
76
|
-
|
|
77
|
-
StringLiterals:
|
|
78
|
-
EnforcedStyle: double_quotes
|
|
79
|
-
|
|
80
|
-
DotPosition:
|
|
81
|
-
EnforcedStyle: leading
|
|
82
|
-
|
|
83
|
-
SpaceBeforeBlockBraces:
|
|
84
|
-
EnforcedStyle: space
|
|
85
|
-
|
|
86
|
-
SpaceInsideBlockBraces:
|
|
87
|
-
EnforcedStyle: no_space
|
|
88
|
-
|
|
89
|
-
DoubleNegation:
|
|
90
|
-
Enabled: false
|
|
91
|
-
|
|
92
|
-
SpaceInsideBlockBraces:
|
|
93
|
-
SpaceBeforeBlockParameters: false
|
|
94
|
-
|
|
95
|
-
SpaceInsideHashLiteralBraces:
|
|
96
|
-
Enabled: false
|
|
97
|
-
|
|
98
|
-
PercentLiteralDelimiters:
|
|
99
|
-
PreferredDelimiters:
|
|
100
|
-
'%': '{}'
|
|
101
|
-
'%i': '{}'
|
|
102
|
-
'%q': '{}'
|
|
103
|
-
'%Q': '{}'
|
|
104
|
-
'%r': '{}'
|
|
105
|
-
'%s': '{}'
|
|
106
|
-
'%w': '{}'
|
|
107
|
-
'%W': '{}'
|
|
108
|
-
'%x': '{}'
|
|
109
|
-
|
|
110
|
-
Style/CollectionMethods:
|
|
111
|
-
PreferredMethods:
|
|
112
|
-
collect: 'map'
|
|
113
|
-
collect!: 'map!'
|
|
114
|
-
inject: 'reduce'
|
|
115
|
-
detect: 'find'
|
|
116
|
-
find_all: 'select'
|
|
5
|
+
AllCops:
|
|
6
|
+
TargetRubyVersion: 3.0
|
|
7
|
+
NewCops: enable
|
|
8
|
+
Exclude:
|
|
9
|
+
- vendor/**/*
|
|
10
|
+
- gemfiles/**/*
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -5,30 +5,30 @@
|
|
|
5
5
|
In the interest of fostering an open and welcoming environment, we as
|
|
6
6
|
contributors and maintainers pledge to making participation in our project and
|
|
7
7
|
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
-
orientation.
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
+
experience, nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
11
|
|
|
12
12
|
## Our Standards
|
|
13
13
|
|
|
14
14
|
Examples of behavior that contributes to creating a positive environment
|
|
15
15
|
include:
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
- Using welcoming and inclusive language
|
|
18
|
+
- Being respectful of differing viewpoints and experiences
|
|
19
|
+
- Gracefully accepting constructive criticism
|
|
20
|
+
- Focusing on what is best for the community
|
|
21
|
+
- Showing empathy towards other community members
|
|
22
22
|
|
|
23
23
|
Examples of unacceptable behavior by participants include:
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
advances
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
- Public or private harassment
|
|
29
|
+
- Publishing others' private information, such as a physical or electronic
|
|
30
30
|
address, without explicit permission
|
|
31
|
-
|
|
31
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
|
32
32
|
professional setting
|
|
33
33
|
|
|
34
34
|
## Our Responsibilities
|
|
@@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable
|
|
|
37
37
|
behavior and are expected to take appropriate and fair corrective action in
|
|
38
38
|
response to any instances of unacceptable behavior.
|
|
39
39
|
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
41
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
42
|
+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
|
43
|
+
contributor for other behaviors that they deem inappropriate, threatening,
|
|
44
|
+
offensive, or harmful.
|
|
45
45
|
|
|
46
46
|
## Scope
|
|
47
47
|
|
|
@@ -58,8 +58,9 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
|
58
58
|
reported by contacting the project team at fnando.vieira@gmail.com. All
|
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
|
62
|
-
Further details of specific enforcement policies may be posted
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
62
|
+
incident. Further details of specific enforcement policies may be posted
|
|
63
|
+
separately.
|
|
63
64
|
|
|
64
65
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
66
|
faith may face temporary or permanent repercussions as determined by other
|
|
@@ -67,8 +68,8 @@ members of the project's leadership.
|
|
|
67
68
|
|
|
68
69
|
## Attribution
|
|
69
70
|
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
72
|
+
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
73
|
|
|
73
74
|
[homepage]: http://contributor-covenant.org
|
|
74
75
|
[version]: http://contributor-covenant.org/version/1/4/
|
data/{gems.rb → Gemfile}
RENAMED
|
File without changes
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
boppers-uptime (0.1.3)
|
|
5
|
+
boppers (>= 0.0.11)
|
|
6
|
+
tzinfo
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.8.1)
|
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
13
|
+
aitch (1.2.1)
|
|
14
|
+
nokogiri
|
|
15
|
+
ast (2.4.2)
|
|
16
|
+
awesome_print (1.9.2)
|
|
17
|
+
boppers (0.0.11)
|
|
18
|
+
aitch
|
|
19
|
+
thor
|
|
20
|
+
byebug (11.1.3)
|
|
21
|
+
coderay (1.1.3)
|
|
22
|
+
concurrent-ruby (1.1.10)
|
|
23
|
+
crack (0.4.5)
|
|
24
|
+
rexml
|
|
25
|
+
docile (1.4.0)
|
|
26
|
+
hashdiff (1.0.1)
|
|
27
|
+
json (2.6.3)
|
|
28
|
+
method_source (1.0.0)
|
|
29
|
+
minitest (5.16.3)
|
|
30
|
+
minitest-utils (0.4.8)
|
|
31
|
+
minitest
|
|
32
|
+
mocha (2.0.2)
|
|
33
|
+
ruby2_keywords (>= 0.0.5)
|
|
34
|
+
nokogiri (1.13.10-arm64-darwin)
|
|
35
|
+
racc (~> 1.4)
|
|
36
|
+
parallel (1.22.1)
|
|
37
|
+
parser (3.1.3.0)
|
|
38
|
+
ast (~> 2.4.1)
|
|
39
|
+
pry (0.14.1)
|
|
40
|
+
coderay (~> 1.1)
|
|
41
|
+
method_source (~> 1.0)
|
|
42
|
+
pry-byebug (3.10.1)
|
|
43
|
+
byebug (~> 11.0)
|
|
44
|
+
pry (>= 0.13, < 0.15)
|
|
45
|
+
pry-meta (0.0.10)
|
|
46
|
+
awesome_print
|
|
47
|
+
pry
|
|
48
|
+
pry-byebug
|
|
49
|
+
pry-remote
|
|
50
|
+
pry-remote (0.1.8)
|
|
51
|
+
pry (~> 0.9)
|
|
52
|
+
slop (~> 3.0)
|
|
53
|
+
public_suffix (5.0.1)
|
|
54
|
+
racc (1.6.2)
|
|
55
|
+
rainbow (3.1.1)
|
|
56
|
+
rake (13.0.6)
|
|
57
|
+
regexp_parser (2.6.1)
|
|
58
|
+
rexml (3.2.5)
|
|
59
|
+
rubocop (1.40.0)
|
|
60
|
+
json (~> 2.3)
|
|
61
|
+
parallel (~> 1.10)
|
|
62
|
+
parser (>= 3.1.2.1)
|
|
63
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
64
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
65
|
+
rexml (>= 3.2.5, < 4.0)
|
|
66
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
|
67
|
+
ruby-progressbar (~> 1.7)
|
|
68
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
69
|
+
rubocop-ast (1.24.0)
|
|
70
|
+
parser (>= 3.1.1.0)
|
|
71
|
+
rubocop-fnando (0.0.17)
|
|
72
|
+
rubocop
|
|
73
|
+
rubocop-performance
|
|
74
|
+
rubocop-performance (1.15.1)
|
|
75
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
76
|
+
rubocop-ast (>= 0.4.0)
|
|
77
|
+
ruby-progressbar (1.11.0)
|
|
78
|
+
ruby2_keywords (0.0.5)
|
|
79
|
+
simplecov (0.22.0)
|
|
80
|
+
docile (~> 1.1)
|
|
81
|
+
simplecov-html (~> 0.11)
|
|
82
|
+
simplecov_json_formatter (~> 0.1)
|
|
83
|
+
simplecov-html (0.12.3)
|
|
84
|
+
simplecov_json_formatter (0.1.4)
|
|
85
|
+
slop (3.6.0)
|
|
86
|
+
thor (1.2.1)
|
|
87
|
+
tzinfo (2.0.5)
|
|
88
|
+
concurrent-ruby (~> 1.0)
|
|
89
|
+
unicode-display_width (2.3.0)
|
|
90
|
+
webmock (3.18.1)
|
|
91
|
+
addressable (>= 2.8.0)
|
|
92
|
+
crack (>= 0.3.2)
|
|
93
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
94
|
+
|
|
95
|
+
PLATFORMS
|
|
96
|
+
arm64-darwin-22
|
|
97
|
+
|
|
98
|
+
DEPENDENCIES
|
|
99
|
+
boppers-uptime!
|
|
100
|
+
bundler
|
|
101
|
+
minitest-utils
|
|
102
|
+
mocha
|
|
103
|
+
pry-meta
|
|
104
|
+
rake
|
|
105
|
+
rubocop-fnando
|
|
106
|
+
simplecov
|
|
107
|
+
webmock
|
|
108
|
+
|
|
109
|
+
BUNDLED WITH
|
|
110
|
+
2.3.26
|
data/README.md
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A [bopper](https://github.com/fnando/boppers) to check if your sites are online.
|
|
4
4
|
|
|
5
|
-
[](https://travis-ci.org/fnando/boppers-uptime)
|
|
6
|
-
[](https://codeclimate.com/github/fnando/boppers-uptime)
|
|
7
|
-
[](https://codeclimate.com/github/fnando/boppers-uptime)
|
|
8
5
|
[](https://rubygems.org/gems/boppers-uptime)
|
|
9
6
|
[](https://rubygems.org/gems/boppers-uptime)
|
|
10
7
|
|
|
@@ -36,27 +33,42 @@ Available options:
|
|
|
36
33
|
|
|
37
34
|
- `name:` The target monitoring's name. Required.
|
|
38
35
|
- `url`: The url that will be monitored. Required.
|
|
39
|
-
- `status`: The expected HTTP status (can be an array of numbers). Default to
|
|
40
|
-
|
|
36
|
+
- `status`: The expected HTTP status (can be an array of numbers). Default to
|
|
37
|
+
`200`.
|
|
38
|
+
- `contain`: The returned URL must include that given text (may also be a
|
|
39
|
+
regular expression).
|
|
41
40
|
- `min_failures`: Only notify after reaching this threadshold. Defaults to `2`.
|
|
42
41
|
- `interval`: The polling interval. Defaults to `30` (seconds).
|
|
43
42
|
- `timezone:` The timezone for displaying dates. Defaults to `Etc/UTC`.
|
|
44
|
-
- `format`: How the time will be formatted. Defaults to `%Y-%m-%dT%H:%M:%S%:z`
|
|
43
|
+
- `format`: How the time will be formatted. Defaults to `%Y-%m-%dT%H:%M:%S%:z`
|
|
44
|
+
(e.g. `2017-10-18T19:31:29-02:00`).
|
|
45
45
|
|
|
46
46
|
## Development
|
|
47
47
|
|
|
48
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
49
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
|
50
|
+
prompt that will allow you to experiment.
|
|
49
51
|
|
|
50
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
52
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
53
|
+
release a new version, update the version number in `version.rb`, and then run
|
|
54
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
|
55
|
+
git commits and tags, and push the `.gem` file to
|
|
56
|
+
[rubygems.org](https://rubygems.org).
|
|
51
57
|
|
|
52
58
|
## Contributing
|
|
53
59
|
|
|
54
|
-
Bug reports and pull requests are welcome on GitHub at
|
|
60
|
+
Bug reports and pull requests are welcome on GitHub at
|
|
61
|
+
https://github.com/fnando/boppers-uptime. This project is intended to be a safe,
|
|
62
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
|
63
|
+
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
55
64
|
|
|
56
65
|
## License
|
|
57
66
|
|
|
58
|
-
The gem is available as open source under the terms of the
|
|
67
|
+
The gem is available as open source under the terms of the
|
|
68
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
|
59
69
|
|
|
60
70
|
## Code of Conduct
|
|
61
71
|
|
|
62
|
-
Everyone interacting in the Boppers project’s codebases, issue trackers, chat
|
|
72
|
+
Everyone interacting in the Boppers project’s codebases, issue trackers, chat
|
|
73
|
+
rooms and mailing lists is expected to follow the
|
|
74
|
+
[code of conduct](https://github.com/fnando/boppers-uptime/blob/main/CODE_OF_CONDUCT.md).
|
data/boppers-uptime.gemspec
CHANGED
|
@@ -6,7 +6,9 @@ Gem::Specification.new do |spec|
|
|
|
6
6
|
spec.name = "boppers-uptime"
|
|
7
7
|
spec.version = Boppers::Uptime::VERSION
|
|
8
8
|
spec.authors = ["Nando Vieira"]
|
|
9
|
-
spec.email = ["fnando.
|
|
9
|
+
spec.email = ["me@fnando.com"]
|
|
10
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
11
|
+
spec.metadata = {"rubygems_mfa_required" => "true"}
|
|
10
12
|
|
|
11
13
|
spec.summary = "A bopper to check if your sites are online."
|
|
12
14
|
spec.description = spec.summary
|
|
@@ -20,14 +22,15 @@ Gem::Specification.new do |spec|
|
|
|
20
22
|
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
|
21
23
|
spec.require_paths = ["lib"]
|
|
22
24
|
|
|
23
|
-
spec.add_dependency "boppers"
|
|
25
|
+
spec.add_dependency "boppers", ">= 0.0.11"
|
|
24
26
|
spec.add_dependency "tzinfo"
|
|
25
27
|
|
|
26
28
|
spec.add_development_dependency "bundler"
|
|
27
|
-
spec.add_development_dependency "rake"
|
|
28
29
|
spec.add_development_dependency "minitest-utils"
|
|
29
|
-
spec.add_development_dependency "
|
|
30
|
+
spec.add_development_dependency "mocha"
|
|
30
31
|
spec.add_development_dependency "pry-meta"
|
|
32
|
+
spec.add_development_dependency "rake"
|
|
33
|
+
spec.add_development_dependency "rubocop-fnando"
|
|
34
|
+
spec.add_development_dependency "simplecov"
|
|
31
35
|
spec.add_development_dependency "webmock"
|
|
32
|
-
spec.add_development_dependency "mocha"
|
|
33
36
|
end
|
data/lib/boppers/uptime.rb
CHANGED
|
@@ -9,30 +9,45 @@ module Boppers
|
|
|
9
9
|
class Uptime
|
|
10
10
|
FORMAT = "%Y-%m-%dT%H:%M:%S%:z"
|
|
11
11
|
|
|
12
|
-
attr_reader :name,
|
|
13
|
-
:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
attr_reader :name,
|
|
13
|
+
:url,
|
|
14
|
+
:interval,
|
|
15
|
+
:status,
|
|
16
|
+
:contain,
|
|
17
|
+
:min_failures,
|
|
18
|
+
:timezone,
|
|
19
|
+
:format,
|
|
20
|
+
:failures,
|
|
21
|
+
:failed_at
|
|
22
|
+
|
|
23
|
+
def initialize(
|
|
24
|
+
name:,
|
|
25
|
+
url:,
|
|
26
|
+
interval: 30,
|
|
27
|
+
status: 200,
|
|
28
|
+
contain: nil,
|
|
29
|
+
min_failures: 2,
|
|
30
|
+
timezone: Time.now.getlocal.zone,
|
|
31
|
+
format: FORMAT
|
|
32
|
+
)
|
|
18
33
|
@name = name
|
|
19
34
|
@url = url
|
|
20
35
|
@interval = interval
|
|
21
36
|
@status = [status].flatten.map(&:to_i)
|
|
22
37
|
@contain = contain
|
|
23
38
|
@min_failures = min_failures
|
|
24
|
-
@timezone = find_timezone(timezone)
|
|
39
|
+
@timezone = find_timezone(timezone) || find_timezone("Etc/UTC")
|
|
25
40
|
@format = format
|
|
26
41
|
@failures = []
|
|
27
42
|
end
|
|
28
43
|
|
|
29
44
|
def call
|
|
30
45
|
succeed = begin
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
response = HttpClient.get(url, {}, {}, timeout: 1)
|
|
47
|
+
valid_response?(response)
|
|
48
|
+
rescue SocketError, Timeout::Error, Net::OpenTimeout # rubocop:disable Lint/ShadowedException
|
|
49
|
+
false
|
|
50
|
+
end
|
|
36
51
|
|
|
37
52
|
return succeed! if succeed
|
|
38
53
|
|
|
@@ -56,8 +71,8 @@ module Boppers
|
|
|
56
71
|
validations = []
|
|
57
72
|
|
|
58
73
|
validations << status.include?(response.code)
|
|
59
|
-
validations << response.body.include?(contain) if contain.
|
|
60
|
-
validations << response.body.match?(contain) if contain.
|
|
74
|
+
validations << response.body.include?(contain) if contain.is_a?(String)
|
|
75
|
+
validations << response.body.match?(contain) if contain.is_a?(Regexp)
|
|
61
76
|
|
|
62
77
|
validations.all?
|
|
63
78
|
end
|
|
@@ -66,15 +81,16 @@ module Boppers
|
|
|
66
81
|
duration = RelativeTime.call(offline_at, online_at)
|
|
67
82
|
|
|
68
83
|
title = "#{name} is up"
|
|
69
|
-
message =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
message = "#{name} is back online at #{format_time(online_at)}, " \
|
|
85
|
+
"after #{duration} of downtime.\n" \
|
|
86
|
+
"You can check it at #{url}."
|
|
87
|
+
|
|
88
|
+
Boppers.notify(
|
|
89
|
+
:uptime,
|
|
90
|
+
title: title,
|
|
91
|
+
message: message,
|
|
92
|
+
options: {color: :green}
|
|
93
|
+
)
|
|
78
94
|
end
|
|
79
95
|
|
|
80
96
|
def went_offline!
|
|
@@ -104,10 +120,8 @@ module Boppers
|
|
|
104
120
|
def find_timezone(name)
|
|
105
121
|
TZInfo::Timezone.get(name)
|
|
106
122
|
rescue TZInfo::InvalidTimezoneIdentifier
|
|
107
|
-
name = name.to_sym
|
|
108
|
-
|
|
109
123
|
TZInfo::Timezone.all.find do |zone|
|
|
110
|
-
zone.current_period.abbreviation == name
|
|
124
|
+
zone.current_period.abbreviation.to_s == name
|
|
111
125
|
end
|
|
112
126
|
end
|
|
113
127
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boppers-uptime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nando Vieira
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-12-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: boppers
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.0.11
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 0.0.11
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: tzinfo
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,7 +53,7 @@ dependencies:
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: minitest-utils
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
@@ -67,7 +67,7 @@ dependencies:
|
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
70
|
+
name: mocha
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
@@ -81,7 +81,7 @@ dependencies:
|
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: pry-meta
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - ">="
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: rake
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - ">="
|
|
@@ -109,7 +109,7 @@ dependencies:
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: rubocop-fnando
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
115
|
- - ">="
|
|
@@ -123,7 +123,21 @@ dependencies:
|
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
126
|
+
name: simplecov
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: webmock
|
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
|
128
142
|
requirements:
|
|
129
143
|
- - ">="
|
|
@@ -138,21 +152,20 @@ dependencies:
|
|
|
138
152
|
version: '0'
|
|
139
153
|
description: A bopper to check if your sites are online.
|
|
140
154
|
email:
|
|
141
|
-
- fnando.
|
|
155
|
+
- me@fnando.com
|
|
142
156
|
executables: []
|
|
143
157
|
extensions: []
|
|
144
158
|
extra_rdoc_files: []
|
|
145
159
|
files:
|
|
146
160
|
- ".gitignore"
|
|
147
161
|
- ".rubocop.yml"
|
|
148
|
-
- ".travis.yml"
|
|
149
162
|
- CODE_OF_CONDUCT.md
|
|
163
|
+
- Gemfile
|
|
164
|
+
- Gemfile.lock
|
|
150
165
|
- LICENSE.txt
|
|
151
166
|
- README.md
|
|
152
167
|
- Rakefile
|
|
153
168
|
- boppers-uptime.gemspec
|
|
154
|
-
- gems.locked
|
|
155
|
-
- gems.rb
|
|
156
169
|
- lib/boppers-uptime.rb
|
|
157
170
|
- lib/boppers/uptime.rb
|
|
158
171
|
- lib/boppers/uptime/relative_time.rb
|
|
@@ -160,8 +173,9 @@ files:
|
|
|
160
173
|
homepage: https://rubygems.org/gems/boppers-uptime
|
|
161
174
|
licenses:
|
|
162
175
|
- MIT
|
|
163
|
-
metadata:
|
|
164
|
-
|
|
176
|
+
metadata:
|
|
177
|
+
rubygems_mfa_required: 'true'
|
|
178
|
+
post_install_message:
|
|
165
179
|
rdoc_options: []
|
|
166
180
|
require_paths:
|
|
167
181
|
- lib
|
|
@@ -169,16 +183,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
169
183
|
requirements:
|
|
170
184
|
- - ">="
|
|
171
185
|
- !ruby/object:Gem::Version
|
|
172
|
-
version:
|
|
186
|
+
version: 3.0.0
|
|
173
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
188
|
requirements:
|
|
175
189
|
- - ">="
|
|
176
190
|
- !ruby/object:Gem::Version
|
|
177
191
|
version: '0'
|
|
178
192
|
requirements: []
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
signing_key:
|
|
193
|
+
rubygems_version: 3.3.26
|
|
194
|
+
signing_key:
|
|
182
195
|
specification_version: 4
|
|
183
196
|
summary: A bopper to check if your sites are online.
|
|
184
197
|
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
language: ruby
|
|
3
|
-
cache: bundler
|
|
4
|
-
rvm:
|
|
5
|
-
- 2.4.2
|
|
6
|
-
before_install:
|
|
7
|
-
- gem install bundler
|
|
8
|
-
- bundle install
|
|
9
|
-
before_script:
|
|
10
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
11
|
-
- chmod +x ./cc-test-reporter
|
|
12
|
-
- "./cc-test-reporter before-build"
|
|
13
|
-
after_script:
|
|
14
|
-
- "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
|
|
15
|
-
notifications:
|
|
16
|
-
email: false
|
|
17
|
-
env:
|
|
18
|
-
global:
|
|
19
|
-
secure: CBI+2WSAlg+MijEc5o3hKW6svE659sM2LiuC9LqtXOH17iRNS0uENBZyuzcI+sCYtHzb+wJuTYtQX8RsUsaB2tl3CWOJBtazDWwNUUyhS4PgRCK36nRXdaXSA1tQ24zK6Z9/MbgJ+YYReW/9zNSvwFjy1sxLCHTAtKTzbBTmaAWHgoG/bLzw8Rl4tPFdI3UZwQGzEvbJLjE/9F6kS0X8Hm49UmmzvkQ6FI7kS16WT1cW3Kybnnx1Nd+HbzQe40cFz6vjjEuVwCcS0hNmpVyzU/PGXO8Y0am/BhdHcpiV4CCDzdARkwwjYMSM2MBSt8XzuPn75sFvmQjawChcD2zwbKXYpjo74XWhqoKwfzJrZTJiPGcTcA3acEhgr80RURdgCG4bzmhrOHYZdZ42KDDJAVNLPnICeHe5fXtAe5/AJUIFdEmRkQZLhNc8MWB9gFvaXFglm/D9shuQABM1zODNNr03AU0Hnw1hgy/WKyO0tAKlZsqWaanBV9QLbSgDzWUWYjXoNN3WT8ESLjMrebUlkA9xhNzURbsOKEgS9RJW3D6KZ249IaPojxay3o3kAbSV7G87isnQnBU411Z5N2jLveB+/+PE/jHYN2NuZ+xoUIMv/eoeUTH9rGS0lWhZ+CjK+U83jYLad9Fm0a0A7KiKjpML4sslufyCjaG4W/wATtQ=
|
data/gems.locked
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
boppers-uptime (0.1.2)
|
|
5
|
-
boppers
|
|
6
|
-
tzinfo
|
|
7
|
-
|
|
8
|
-
GEM
|
|
9
|
-
remote: https://rubygems.org/
|
|
10
|
-
specs:
|
|
11
|
-
addressable (2.5.2)
|
|
12
|
-
public_suffix (>= 2.0.2, < 4.0)
|
|
13
|
-
aitch (1.0.2)
|
|
14
|
-
nokogiri (>= 1.6.0)
|
|
15
|
-
awesome_print (1.8.0)
|
|
16
|
-
boppers (0.0.3)
|
|
17
|
-
aitch
|
|
18
|
-
thor
|
|
19
|
-
byebug (9.1.0)
|
|
20
|
-
coderay (1.1.2)
|
|
21
|
-
crack (0.4.3)
|
|
22
|
-
safe_yaml (~> 1.0.0)
|
|
23
|
-
docile (1.1.5)
|
|
24
|
-
hashdiff (0.3.7)
|
|
25
|
-
json (2.1.0)
|
|
26
|
-
metaclass (0.0.4)
|
|
27
|
-
method_source (0.9.0)
|
|
28
|
-
mini_portile2 (2.3.0)
|
|
29
|
-
minitest (5.10.3)
|
|
30
|
-
minitest-utils (0.4.0)
|
|
31
|
-
minitest
|
|
32
|
-
mocha (1.3.0)
|
|
33
|
-
metaclass (~> 0.0.1)
|
|
34
|
-
nokogiri (1.8.1)
|
|
35
|
-
mini_portile2 (~> 2.3.0)
|
|
36
|
-
pry (0.11.2)
|
|
37
|
-
coderay (~> 1.1.0)
|
|
38
|
-
method_source (~> 0.9.0)
|
|
39
|
-
pry-byebug (3.5.0)
|
|
40
|
-
byebug (~> 9.1)
|
|
41
|
-
pry (~> 0.10)
|
|
42
|
-
pry-meta (0.0.10)
|
|
43
|
-
awesome_print
|
|
44
|
-
pry
|
|
45
|
-
pry-byebug
|
|
46
|
-
pry-remote
|
|
47
|
-
pry-remote (0.1.8)
|
|
48
|
-
pry (~> 0.9)
|
|
49
|
-
slop (~> 3.0)
|
|
50
|
-
public_suffix (3.0.0)
|
|
51
|
-
rake (12.2.1)
|
|
52
|
-
safe_yaml (1.0.4)
|
|
53
|
-
simplecov (0.15.1)
|
|
54
|
-
docile (~> 1.1.0)
|
|
55
|
-
json (>= 1.8, < 3)
|
|
56
|
-
simplecov-html (~> 0.10.0)
|
|
57
|
-
simplecov-html (0.10.2)
|
|
58
|
-
slop (3.6.0)
|
|
59
|
-
thor (0.20.0)
|
|
60
|
-
thread_safe (0.3.6)
|
|
61
|
-
tzinfo (1.2.4)
|
|
62
|
-
thread_safe (~> 0.1)
|
|
63
|
-
webmock (3.1.0)
|
|
64
|
-
addressable (>= 2.3.6)
|
|
65
|
-
crack (>= 0.3.2)
|
|
66
|
-
hashdiff
|
|
67
|
-
|
|
68
|
-
PLATFORMS
|
|
69
|
-
ruby
|
|
70
|
-
|
|
71
|
-
DEPENDENCIES
|
|
72
|
-
boppers-uptime!
|
|
73
|
-
bundler
|
|
74
|
-
minitest-utils
|
|
75
|
-
mocha
|
|
76
|
-
pry-meta
|
|
77
|
-
rake
|
|
78
|
-
simplecov
|
|
79
|
-
webmock
|
|
80
|
-
|
|
81
|
-
BUNDLED WITH
|
|
82
|
-
1.16.0
|