auxesis-cucumber-nagios 0.4.1 → 0.4.3
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/Rakefile
CHANGED
@@ -13,15 +13,6 @@ rescue LoadError
|
|
13
13
|
end
|
14
14
|
|
15
15
|
|
16
|
-
desc "freeze deps"
|
17
|
-
task :deps do
|
18
|
-
deps = ['cucumber', 'webrat', 'mechanize']
|
19
|
-
deps.each do |dep|
|
20
|
-
puts "installing #{dep}"
|
21
|
-
system("gem install #{dep} -i gems --no-rdoc --no-ri")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
16
|
desc "build gem"
|
26
17
|
task :build do
|
27
18
|
system("gem build cucumber-nagios.gemspec")
|
@@ -27,6 +27,9 @@ task :deps do
|
|
27
27
|
puts "\ninstalling dependencies. this will take a few minutes."
|
28
28
|
|
29
29
|
deps.each_pair do |dep, version|
|
30
|
+
if Dir.glob("gems/gems/#{dep}-#{version.split.last}").size > 0
|
31
|
+
next unless ENV["FORCE"]
|
32
|
+
end
|
30
33
|
puts "\ninstalling #{dep} (#{version})"
|
31
34
|
system("gem install #{dep} --version '#{version}' -i gems --no-rdoc --no-ri")
|
32
35
|
end
|
@@ -7,5 +7,17 @@ rescue LoadError
|
|
7
7
|
require 'bin/common'
|
8
8
|
end
|
9
9
|
|
10
|
+
require 'cucumber/rspec_neuter'
|
10
11
|
require 'cucumber/cli/main'
|
11
|
-
|
12
|
+
|
13
|
+
begin
|
14
|
+
# The dup is to keep ARGV intact, so that tools like ruby-debug can respawn.
|
15
|
+
failure = Cucumber::Cli::Main.execute(ARGV.dup)
|
16
|
+
Kernel.exit(failure ? 1 : 0)
|
17
|
+
rescue SystemExit => e
|
18
|
+
Kernel.exit(e.status)
|
19
|
+
rescue Exception => e
|
20
|
+
STDERR.puts("#{e.message} (#{e.class})")
|
21
|
+
STDERR.puts(e.backtrace.join("\n"))
|
22
|
+
Kernel.exit 1
|
23
|
+
end
|
@@ -2,8 +2,9 @@ module Nagios
|
|
2
2
|
class NagiosFormatter < Cucumber::Ast::Visitor
|
3
3
|
def initialize(step_mother, io, options={})
|
4
4
|
super(step_mother)
|
5
|
-
@failed
|
6
|
-
@passed
|
5
|
+
@failed = []
|
6
|
+
@passed = []
|
7
|
+
@warning = []
|
7
8
|
end
|
8
9
|
|
9
10
|
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
@@ -13,6 +14,8 @@ module Nagios
|
|
13
14
|
@passed << step_match
|
14
15
|
when :failed
|
15
16
|
@failed << step_match
|
17
|
+
when :undefined
|
18
|
+
@warning << step_match
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -23,14 +26,16 @@ module Nagios
|
|
23
26
|
|
24
27
|
private
|
25
28
|
def print_summary
|
26
|
-
@total = @failed.size + @passed.size
|
29
|
+
@total = @failed.size + @passed.size + @warning.size
|
27
30
|
message = ""
|
28
31
|
message += "Critical: #{@failed.size}, "
|
29
|
-
message += "Warning:
|
32
|
+
message += "Warning: #{@warning.size}, "
|
30
33
|
message += "#{@passed.size} okay"
|
31
34
|
# nagios performance data
|
32
35
|
message += " | passed=#{@passed.size}"
|
33
|
-
message += ", failed=#{@failed.size}
|
36
|
+
message += ", failed=#{@failed.size}"
|
37
|
+
message += ", nosteps=#{@warning.size}"
|
38
|
+
message += ", total=#{@total}"
|
34
39
|
puts message
|
35
40
|
end
|
36
41
|
end
|