cmon 0.0.1.alpha2 → 0.0.1.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cmon.rb +37 -17
- data/lib/cmon/version.rb +1 -1
- metadata +22 -9
data/lib/cmon.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'cmon/version'
|
2
|
+
require 'rspec/expectations'
|
2
3
|
|
3
4
|
module CMon
|
4
5
|
class Command
|
@@ -7,35 +8,54 @@ module CMon
|
|
7
8
|
@output = `#{cmd}`
|
8
9
|
end
|
9
10
|
attr_reader :command, :output
|
10
|
-
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
|
12
|
+
def include?(text)
|
13
|
+
self.output.include?(text)
|
14
|
+
end
|
15
|
+
|
16
|
+
def =~(regexp)
|
17
|
+
self.output =~ regexp
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(value)
|
21
|
+
self.output == value
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"command: `#{self.command}` \noutput: #{self.output}"
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
29
|
+
module Helpers
|
30
|
+
|
31
|
+
def output_from(cmd)
|
32
|
+
CMon::Command.new(cmd)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
23
37
|
class Runner
|
24
38
|
|
39
|
+
include RSpec::Matchers
|
40
|
+
include Helpers
|
41
|
+
|
25
42
|
def self.run(path)
|
26
43
|
runner = self.new
|
27
44
|
runner.run(path)
|
28
45
|
end
|
29
46
|
|
30
|
-
def run(
|
31
|
-
steps = File.read(
|
32
|
-
|
33
|
-
|
47
|
+
def run(path)
|
48
|
+
steps = File.read(path)
|
49
|
+
begin
|
50
|
+
self.instance_eval(steps)
|
51
|
+
exit 0
|
52
|
+
rescue RSpec::Expectations::ExpectationNotMetError => e
|
53
|
+
puts "C'Mon assumptions failed"
|
54
|
+
puts e.message
|
55
|
+
exit 1
|
56
|
+
end
|
34
57
|
end
|
35
58
|
|
36
|
-
def output_from(cmd)
|
37
|
-
CMon::Command.new(cmd)
|
38
|
-
end
|
39
59
|
end
|
40
60
|
|
41
61
|
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: -3702664366
|
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
|
+
- 3
|
12
|
+
version: 0.0.1.alpha3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Matthew Rudy Jacobs
|
@@ -17,10 +17,24 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-06-15 00:00:00
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
date: 2011-06-15 00:00:00 Z
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: rspec
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
version: 2.0.0
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
24
38
|
description: Write a simple monitoring script to be executed by cron, using an rspec-like assertion syntax
|
25
39
|
email:
|
26
40
|
- matthewrudyjacobs+cmon@gmail.com
|
@@ -34,7 +48,6 @@ files:
|
|
34
48
|
- lib/cmon/version.rb
|
35
49
|
- lib/cmon.rb
|
36
50
|
- bin/cmon
|
37
|
-
has_rdoc: true
|
38
51
|
homepage: https://github.com/matthewrudy/com
|
39
52
|
licenses: []
|
40
53
|
|
@@ -66,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
79
|
requirements: []
|
67
80
|
|
68
81
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.7.2
|
70
83
|
signing_key:
|
71
84
|
specification_version: 3
|
72
85
|
summary: Cron Enabled Monitoring
|