cmon 0.0.1.alpha1 → 0.0.1.alpha2
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.
- data/bin/cmon +3 -10
- data/lib/cmon.rb +37 -0
- data/lib/cmon/version.rb +1 -1
- metadata +5 -5
data/bin/cmon
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
2
|
+
lib = File.expand_path(File.dirname(__FILE__)+'/../lib/')
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
4
|
require 'cmon'
|
5
5
|
|
6
|
-
|
7
|
-
if ARGV[0] == "t"
|
8
|
-
puts "exiting well"
|
9
|
-
exit 0
|
10
|
-
else
|
11
|
-
puts "exiting badly"
|
12
|
-
exit 1
|
13
|
-
end
|
6
|
+
CMon::Runner.run(ARGV[0])
|
data/lib/cmon.rb
CHANGED
@@ -1,4 +1,41 @@
|
|
1
1
|
require 'cmon/version'
|
2
2
|
|
3
3
|
module CMon
|
4
|
+
class Command
|
5
|
+
def initialize(cmd)
|
6
|
+
@command = cmd
|
7
|
+
@output = `#{cmd}`
|
8
|
+
end
|
9
|
+
attr_reader :command, :output
|
10
|
+
|
11
|
+
def should_not_include(text)
|
12
|
+
if self.output.include?(text)
|
13
|
+
puts "CMon assumptions failed"
|
14
|
+
puts "Should Not Include #{text.inspect}"
|
15
|
+
puts
|
16
|
+
puts "Output:"
|
17
|
+
puts self.output
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Runner
|
24
|
+
|
25
|
+
def self.run(path)
|
26
|
+
runner = self.new
|
27
|
+
runner.run(path)
|
28
|
+
end
|
29
|
+
|
30
|
+
def run(file)
|
31
|
+
steps = File.read(file)
|
32
|
+
self.instance_eval(steps)
|
33
|
+
exit 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def output_from(cmd)
|
37
|
+
CMon::Command.new(cmd)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
4
41
|
end
|
data/lib/cmon/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -3702664368
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 1
|
10
10
|
- alpha
|
11
|
-
-
|
12
|
-
version: 0.0.1.
|
11
|
+
- 2
|
12
|
+
version: 0.0.1.alpha2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Matthew Rudy Jacobs
|
@@ -21,7 +21,7 @@ date: 2011-06-15 00:00:00 +08:00
|
|
21
21
|
default_executable:
|
22
22
|
dependencies: []
|
23
23
|
|
24
|
-
description:
|
24
|
+
description: Write a simple monitoring script to be executed by cron, using an rspec-like assertion syntax
|
25
25
|
email:
|
26
26
|
- matthewrudyjacobs+cmon@gmail.com
|
27
27
|
executables:
|
@@ -69,6 +69,6 @@ rubyforge_project:
|
|
69
69
|
rubygems_version: 1.6.2
|
70
70
|
signing_key:
|
71
71
|
specification_version: 3
|
72
|
-
summary:
|
72
|
+
summary: Cron Enabled Monitoring
|
73
73
|
test_files: []
|
74
74
|
|