CalMon 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ to create events in Google Calendar. These events may be used to easily
17
17
  identify when an event (a Cron Job, batch script, etc...) started, stopped,
18
18
  and what its exit status was. For an organization that relies heavily upon
19
19
  the success, timeliness, and regularlity of many many batch jobs, a tool
20
- like that can prove to be a real benefit to systems administrators. }
20
+ like that can prove to be a real benefit to systems administrators.
21
21
  EOF
22
22
 
23
23
  s.rubyforge_project = "CalMon"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- CalMon (0.0.3)
4
+ CalMon (0.0.4)
5
5
  google-api-client
6
6
  jimson
7
7
  rake
@@ -19,19 +19,9 @@ gen_json_req() {
19
19
  shift
20
20
  PARAMS=$(echo $* | sed -e 's/ /,/g')
21
21
  REPLY=$(cat <<EOF
22
- [
23
- {"jsonrpc": "2.0", "method": "${METHOD}", "params": [${PARAMS}], "id": 1},
24
- {"jsonrpc": "2.0", "method":"system.listMethods", "id":2},
25
- {"jsonrpc": "2.0", "method":"system.isAlive", "id":3},
26
- {"jsonrpc": "2.0", "method":"system.isAlive", "id":4},
27
- {"jsonrpc": "2.0", "method": "sub", "params": [40,20], "id": 5}
28
- ]
22
+ {"jsonrpc": "2.0", "method": "${METHOD}", "params": [${PARAMS}], "id": 1}
29
23
  EOF
30
24
  )
31
- }
32
-
33
- gen_json_req start_time '"2012-01-12 12:15:33"'
34
-
35
25
  BODY=${REPLY}
36
26
 
37
27
  SIZE=$(echo ${BODY} | wc -c)
@@ -58,4 +48,9 @@ echo "$RES" | $(dirname $0)/../support/JSON_bash/JSON.sh
58
48
  if [[ $? -eq 0 ]]; then
59
49
  echo; l_info Message successfully sent to ${HOST}:${PORT}
60
50
  fi
51
+ }
52
+
53
+ gen_json_req start_time '"2012-01-12 12:15:33"'
54
+ gen_json_req stop_time '"2012-01-12 12:16:33"'
55
+ gen_json_req running_time '"2012-01-12 12:17:33"'
61
56
 
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
+ #
3
+ # Author:: Randy D. Wallace Jr. (mailto:randy@randywallace.com)
4
+ # Copyright:: Copyright (c) 2012 Randy D. Wallace Jr.
5
+ # License:: MIT
6
+ #
2
7
 
3
8
  require 'rubygems'
4
9
  require "jimson"
@@ -1,3 +1,11 @@
1
+ #
2
+ # Author:: Randy D. Wallace Jr. (mailto:randy@randywallace.com)
3
+ # Copyright:: Copyright (c) 2012 Randy D. Wallace Jr.
4
+ # License:: MIT
5
+ #
6
+
7
+ # This class bridges the gap between the JsonRPC Server and additional
8
+ # handlers for what the client sends to the server.
1
9
 
2
10
  module CalMon
3
11
  class ObserveRPC
@@ -1,3 +1,13 @@
1
+ #
2
+ # Author:: Randy D. Wallace Jr. (mailto:randy@randywallace.com)
3
+ # Copyright:: Copyright (c) 2012 Randy D. Wallace Jr.
4
+ # License:: MIT
5
+ #
6
+
7
+ # This class provides the RPC methods actually handled by the
8
+ # JsonRPC Server. Note that unless the observer is notified the
9
+ # data sent by the remote client won't get anywhere.
10
+
1
11
  require 'observer'
2
12
 
3
13
  module CalMon
@@ -16,6 +26,18 @@ module CalMon
16
26
  "Success"
17
27
  end
18
28
 
29
+ def stop_time timestamp
30
+ changed
31
+ notify_observers(Time.parse(timestamp), __method__.to_s)
32
+ "Success"
33
+ end
34
+
35
+ def running_time timestamp
36
+ changed
37
+ notify_observers(Time.parse(timestamp), __method__.to_s)
38
+ "Success"
39
+ end
40
+
19
41
  def sum(a, b, c)
20
42
  a + b + c
21
43
  end
@@ -1,3 +1,11 @@
1
+ #
2
+ # Author:: Randy D. Wallace Jr. (mailto:randy@randywallace.com)
3
+ # Copyright:: Copyright (c) 2012 Randy D. Wallace Jr.
4
+ # License:: MIT
5
+ #
6
+
7
+ # This class handles attaching the observer to the JsonRPC server and
8
+ # starting the server.
1
9
 
2
10
  require "CalMon/RPC"
3
11
  require "CalMon/ObserveRPC"
@@ -1,3 +1,9 @@
1
+ #
2
+ # Author:: Randy D. Wallace Jr. (mailto:randy@randywallace.com)
3
+ # Copyright:: Copyright (c) 2012 Randy D. Wallace Jr.
4
+ # License:: MIT
5
+ #
6
+
1
7
  module CalMon
2
- VERSION = "0.0.4"
8
+ VERSION = "0.0.5"
3
9
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CalMon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Randy
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-05-02 00:00:00 Z
21
+ date: 2012-05-06 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: rake
@@ -69,7 +69,7 @@ description: |
69
69
  identify when an event (a Cron Job, batch script, etc...) started, stopped,
70
70
  and what its exit status was. For an organization that relies heavily upon
71
71
  the success, timeliness, and regularlity of many many batch jobs, a tool
72
- like that can prove to be a real benefit to systems administrators. }
72
+ like that can prove to be a real benefit to systems administrators.
73
73
 
74
74
  email:
75
75
  - randy@randywallace.com