web_checker 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ef92305c760d6f2cf6929c9845ae1c6da5d890b
4
- data.tar.gz: 21d1617719fb79fa74588205aed58f5e32c077e2
3
+ metadata.gz: 9f1cd10771d7f76d00bfa144400ee87148a88bdf
4
+ data.tar.gz: 7bf020c2d5c6733e5636528ff2914a25f4834516
5
5
  SHA512:
6
- metadata.gz: e8440165c27f431f7dc9af6420b27ed730a2fbef7241cb1a77b52fec3a73e5b708694b9d73b0cd3de2c00af552e8c2da6b42caf28dca354ca6f11b59f57f96a7
7
- data.tar.gz: 378aa55aed03b05979ea83aef3b1414d2f4350c7c62b7493a26e84e35e778710cd2f276551690260b77bc5ea606c3ef0403f67f887cfbd69432ac7ca10fbba62
6
+ metadata.gz: b9a6845c7d07df1f637026018d76e1fba13207e331193ae7f2eac178c16d8822be0c5615e0b37d4da09449a83ca59c6589f9fd131838679448fccc810c3f108f
7
+ data.tar.gz: fe48e0df9400e4e95dd638f0952272d20157e90474a88dfcd22ac0021be58f7d86b9600c3ab4d54d66a5ba1140b27363d1f355cdc379679e56aded270d52bb80
data/bin/web_checker CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'web_checker'
4
- require 'web_checker/cli'
5
4
 
6
5
  WebChecker::CLI.start
data/lib/web_checker.rb CHANGED
@@ -1,5 +1,80 @@
1
- require "web_checker/version"
1
+ require 'web_checker/version'
2
+ require 'thor'
2
3
 
3
4
  module WebChecker
5
+ class CLI < Thor
6
+ default_task :start
4
7
 
8
+ desc 'start', 'Start the web-checker service'
9
+
10
+ method_option :url,
11
+ type: :string,
12
+ required: true,
13
+ banner: 'Url for monitoring'
14
+
15
+ method_option :email,
16
+ type: :string,
17
+ required: true,
18
+ banner: 'Email for notifications'
19
+
20
+ method_option :delivery_method,
21
+ type: :string,
22
+ default: 'sendmail',
23
+ banner: 'Delivery email method'
24
+
25
+ method_option :twilio,
26
+ type: :boolean,
27
+ default: false,
28
+ banner: 'Use twilio for SMS notifications'
29
+
30
+ method_option :phone,
31
+ type: :string,
32
+ banner: 'Mobile phone number for SMS notifications'
33
+
34
+ method_option :twilio_sid,
35
+ type: :string,
36
+ banner: 'Twilio sid value'
37
+
38
+ method_option :twilio_token,
39
+ type: :string,
40
+ banner: 'Twilio token value'
41
+
42
+ method_option :twilio_from,
43
+ type: :string,
44
+ banner: 'Twilio from value'
45
+
46
+ method_option :threshold,
47
+ type: :array,
48
+ default: %w{5 10 50 100 500},
49
+ banner: 'Attempts threshold for notifications'
50
+
51
+ method_option :refresh_rate,
52
+ type: :numeric,
53
+ default: 5,
54
+ banner: 'Refresh rate for checking in seconds'
55
+
56
+ def start
57
+ trap("INT") { self.stop }
58
+
59
+ begin
60
+ @checker = WebChecker::Workflow.new(options)
61
+ rescue WebChecker::NotHttpURIError, WebChecker::InvalidHostError => e
62
+ puts "--url error. #{e.message}"
63
+ exit
64
+ end
65
+
66
+ EventMachine.run do
67
+ @checker.run
68
+ end
69
+ end
70
+
71
+ no_commands do
72
+ def stop
73
+ @checker.cancel
74
+ EventMachine.stop
75
+ exit
76
+ end
77
+ end
78
+
79
+ end
5
80
  end
@@ -1,3 +1,3 @@
1
1
  module WebChecker
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaliy V. Shopov
@@ -183,7 +183,6 @@ files:
183
183
  - Rakefile
184
184
  - bin/web_checker
185
185
  - lib/web_checker.rb
186
- - lib/web_checker/cli.rb
187
186
  - lib/web_checker/http.rb
188
187
  - lib/web_checker/notifications.rb
189
188
  - lib/web_checker/version.rb
@@ -1,81 +0,0 @@
1
- require 'thor'
2
- require 'web_checker/workflow'
3
- require 'eventmachine'
4
-
5
- module WebChecker
6
- class CLI < Thor
7
- default_task :start
8
-
9
- desc 'start', 'Start the web-checker service'
10
-
11
- method_option :url,
12
- type: :string,
13
- required: true,
14
- banner: 'Url for monitoring'
15
-
16
- method_option :email,
17
- type: :string,
18
- required: true,
19
- banner: 'Email for notifications'
20
-
21
- method_option :delivery_method,
22
- type: :string,
23
- default: 'sendmail',
24
- banner: 'Delivery email method'
25
-
26
- method_option :twilio,
27
- type: :boolean,
28
- default: false,
29
- banner: 'Use twilio for SMS notifications'
30
-
31
- method_option :phone,
32
- type: :string,
33
- banner: 'Mobile phone number for SMS notifications'
34
-
35
- method_option :twilio_sid,
36
- type: :string,
37
- banner: 'Twilio sid value'
38
-
39
- method_option :twilio_token,
40
- type: :string,
41
- banner: 'Twilio token value'
42
-
43
- method_option :twilio_from,
44
- type: :string,
45
- banner: 'Twilio from value'
46
-
47
- method_option :threshold,
48
- type: :array,
49
- default: %w{5 10 50 100 500},
50
- banner: 'Attempts threshold for notifications'
51
-
52
- method_option :refresh_rate,
53
- type: :numeric,
54
- default: 5,
55
- banner: 'Refresh rate for checking in seconds'
56
-
57
- def start
58
- trap("INT") { self.stop }
59
-
60
- begin
61
- @checker = WebChecker::Workflow.new(options)
62
- rescue WebChecker::NotHttpURIError, WebChecker::InvalidHostError => e
63
- puts "--url error. #{e.message}"
64
- exit
65
- end
66
-
67
- EventMachine.run do
68
- @checker.run
69
- end
70
- end
71
-
72
- no_commands do
73
- def stop
74
- @checker.cancel
75
- EventMachine.stop
76
- exit
77
- end
78
- end
79
-
80
- end
81
- end