notifyme 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,25 @@ module NotifyMe
2
2
  class Check
3
3
  class << self
4
4
  def process(args = {})
5
- unless %x{ps -e}.include? args.name
6
- raise "Process #{args.name} is not running!"
5
+ unless %x{ps aux | grep #{args[:name]} | grep -v grep}.strip == ''
6
+ raise "Process #{args[:name]} is not running!"
7
7
  end
8
8
  end
9
9
 
10
10
  def tcp(args = {})
11
11
  require 'socket'
12
- TCPSocket.new(args[:host], args[:port])
12
+ TCPSocket.new(args[:host] || 'localhost', args[:port])
13
+ end
14
+
15
+ def http(args = {})
16
+ require 'http_request'
17
+ url = args[:url]
18
+ hr = HttpRequest.get(url)
19
+ if args[:include]
20
+ raise "The page #{url} doesn't include \"#{args[:include]}\"." unless hr.body.include?(args[:include])
21
+ else
22
+ raise "Can't open #{url}." unless hr.code_200?
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -1,6 +1,6 @@
1
1
  module NotifyMe
2
2
 
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
 
5
5
  autoload :Task, 'notifyme/task'
6
6
  autoload :Log, 'notifyme/log'
metadata CHANGED
@@ -1,58 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: notifyme
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
4
5
  prerelease:
5
- version: 1.0.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - xianhua.zhou
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-12-05 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: daemons
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
23
21
  version: 1.1.0
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.0
30
+ - !ruby/object:Gem::Dependency
27
31
  name: json_pure
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.4.2
38
+ type: :runtime
28
39
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
30
41
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
34
45
  version: 1.4.2
46
+ - !ruby/object:Gem::Dependency
47
+ name: http_request.rb
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.13
35
54
  type: :runtime
36
- version_requirements: *id002
37
- description: NotifyMe takes care more than one tasks and process their results for you, it's similar to *NIX's cronjob.
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.13
62
+ description: NotifyMe takes care more than one tasks and process their results for
63
+ you, it's similar to *NIX's cronjob.
38
64
  email: xianhua.zhou@gmail.com
39
- executables:
65
+ executables:
40
66
  - notifyme_daemon
41
67
  - notifyme
42
68
  extensions: []
43
-
44
69
  extra_rdoc_files: []
45
-
46
- files:
47
- - lib/notifyme.rb
48
- - lib/notifyme/log.rb
70
+ files:
71
+ - lib/vendor/smtp_add_tls_support.rb
72
+ - lib/notifyme/check.rb
73
+ - lib/notifyme/log/file.rb
49
74
  - lib/notifyme/log/mail.rb
50
75
  - lib/notifyme/log/stdout.rb
51
- - lib/notifyme/log/file.rb
76
+ - lib/notifyme/log.rb
52
77
  - lib/notifyme/start.rb
53
- - lib/notifyme/check.rb
54
78
  - lib/notifyme/task.rb
55
- - lib/vendor/smtp_add_tls_support.rb
79
+ - lib/notifyme.rb
56
80
  - CHANGELOG
57
81
  - INSTALL
58
82
  - notifyme_config.rb
@@ -60,30 +84,26 @@ files:
60
84
  - bin/notifyme
61
85
  homepage: http://github.com/xianhuazhou/NotifyMe
62
86
  licenses: []
63
-
64
87
  post_install_message:
65
88
  rdoc_options: []
66
-
67
- require_paths:
89
+ require_paths:
68
90
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
91
+ required_ruby_version: !ruby/object:Gem::Requirement
70
92
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
75
- required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
98
  none: false
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: "0"
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
81
103
  requirements: []
82
-
83
104
  rubyforge_project: notifyme
84
105
  rubygems_version: 1.8.24
85
106
  signing_key:
86
107
  specification_version: 3
87
108
  summary: It's a kind of cronjob.
88
109
  test_files: []
89
-