rspec-nagios-formatter 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7640c3e6b0a04f313e1d7af013b74a8edaf1655
4
- data.tar.gz: 4079732f36f692b24b75b73fb3f83637afab54a7
3
+ metadata.gz: c4ed4aa8bca7fc0b7605bef006c7d0aa487fc2e5
4
+ data.tar.gz: db936e41195770c85769ef3cf55c08795fc4e79d
5
5
  SHA512:
6
- metadata.gz: 400ca594178a95806bd8da013f56687c97958c38359d7888ca6588a9a1dca2a23c893e7f85aa867631c1bc84831e55a03c96ae940652cb225c648b17a50cf368
7
- data.tar.gz: 5ffc5ba0c9ec4c8975f8a55cabad6b31394c329749d230aa68e474a7cc34e0022a2114fcc6cce5a752d690231f5ef814dde3da4624bbe9c31b2f56afc5ee20e1
6
+ metadata.gz: ac66bd8f878518a44f892da2b037e4044ba2c0c657ece32643d1a9239736b1c3d9230628f99e100462a52f7008b299188c79a069e288e5484356ad20ca50387e
7
+ data.tar.gz: 3f3de10c21602693fcd026847faaadae2d3324f0e890d58661735bb56eab995860678220c89c1cef9007f75aac43c8a48faa20e4ef127d6085c6d22c9b5c163d
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  *.rej
6
6
  *.patch
7
7
  tmp/aruba/
8
+ .ruby-version
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.8.7
3
4
  - 1.9.2
4
5
  - 1.9.3
5
6
  - 2.0.0
6
- script: "rake spec features"
7
+ script: "bundle exec rake spec features"
7
8
  notifications:
8
9
  email: false
@@ -0,0 +1,53 @@
1
+
2
+ #### [Current]
3
+ * [49a97d0](../../commit/49a97d0) - __(Joshua Hoblitt)__ Merge pull request [#3](../../issues/3) from jeffersongirao/ruby18
4
+
5
+ add ruby 1.8.7 compatibility
6
+ * [d3bd1a4](../../commit/d3bd1a4) - __(Jefferson Girao)__ Adding open3_backport as development dependency since native extensions are not installed during tests
7
+ * [86b8bbd](../../commit/86b8bbd) - __(Jefferson Girao)__ Updating travis config
8
+ * [13ed4b7](../../commit/13ed4b7) - __(Jefferson Girao)__ Remove open3_backport from dependencies
9
+ * [0a66a58](../../commit/0a66a58) - __(Jefferson Girao)__ RUBY_VERSION global var is a string
10
+ * [853721f](../../commit/853721f) - __(Jefferson Girao)__ Adding open3_backport when using Ruby 1.8
11
+ * [5f6cb04](../../commit/5f6cb04) - __(Jefferson Girao)__ Minor refactoring
12
+ * [197d0ae](../../commit/197d0ae) - __(Jefferson Girao)__ compatible with ruby 1.8.7, information abould failed scenarios
13
+ * [40a0f1b](../../commit/40a0f1b) - __(Joshua Hoblitt)__ Merge pull request [#2](../../issues/2) from bitdeli-chef/master
14
+
15
+ Add a Bitdeli Badge to README
16
+ * [36e9fe6](../../commit/36e9fe6) - __(Bitdeli Chef)__ Add a Bitdeli badge to README
17
+
18
+ #### v0.1.1
19
+ * [43c480a](../../commit/43c480a) - __(Joshua Hoblitt)__ bump version to v0.1.1
20
+ * [e34b73a](../../commit/e34b73a) - __(Joshua Hoblitt)__ catch rspec runtimes failures in check_rspec
21
+
22
+ #### v0.1.0
23
+ * [d2ce73e](../../commit/d2ce73e) - __(Joshua Hoblitt)__ bump version to v0.1.0
24
+ * [db912ca](../../commit/db912ca) - __(Joshua Hoblitt)__ Merge pull request [#1](../../issues/1) from jhoblitt/check_rspec
25
+
26
+ Check rspec
27
+ * [b9b1dd6](../../commit/b9b1dd6) - __(Joshua Hoblitt)__ comment/whitespace cleanups
28
+ * [ea34873](../../commit/ea34873) - __(Joshua Hoblitt)__ add check_rspec to README
29
+ * [358e6d4](../../commit/358e6d4) - __(Joshua Hoblitt)__ enable cucumber tests on travis ci
30
+ * [8fc7839](../../commit/8fc7839) - __(Joshua Hoblitt)__ add check_rspec script with cucumber/aruba tests
31
+ * [f5a5165](../../commit/f5a5165) - __(Joshua Hoblitt)__ add see also section to README
32
+
33
+ #### v0.0.3
34
+ * [8d1140b](../../commit/8d1140b) - __(Joshua Hoblitt)__ bump version to v0.0.3
35
+ * [9ebd75a](../../commit/9ebd75a) - __(Joshua Hoblitt)__ actually include files in the gem...
36
+
37
+ #### v0.0.2
38
+ * [29857f9](../../commit/29857f9) - __(Joshua Hoblitt)__ bump version to v0.0.2
39
+ * [4217b47](../../commit/4217b47) - __(Joshua Hoblitt)__ require ruby >= 1.9.2 instead of ==
40
+
41
+ #### v0.0.1
42
+ * [5e7160b](../../commit/5e7160b) - __(Joshua Hoblitt)__ add a description section to README
43
+ * [3fca85b](../../commit/3fca85b) - __(Joshua Hoblitt)__ add basic README
44
+ * [1703444](../../commit/1703444) - __(Joshua Hoblitt)__ add travis ci config
45
+ * [99a6d29](../../commit/99a6d29) - __(Joshua Hoblitt)__ gemspec require ruby 1.9.2
46
+ * [23384a8](../../commit/23384a8) - __(Joshua Hoblitt)__ add shim for require 'rspec_nagios_formatter'
47
+ * [931bb01](../../commit/931bb01) - __(Joshua Hoblitt)__ rename RSpec::Core::Formatters::NagiosFormatter -> RSpec::Nagios::Formatter
48
+
49
+ - fix module/class namespace issues
50
+
51
+ * [a28ea2f](../../commit/a28ea2f) - __(Joshua Hoblitt)__ add spec target to Rakefile
52
+ * [4a5cbf4](../../commit/4a5cbf4) - __(Joshua Hoblitt)__ attempt to implement RSpecNagiosFormatter (broken)
53
+ * [777176c](../../commit/777176c) - __(Joshua Hoblitt)__ first commit
data/README.md CHANGED
@@ -12,6 +12,12 @@ This `gem` provides a simple [RSpec](http://rspec.info/) [custom formatter](http
12
12
  Install
13
13
  -------
14
14
 
15
+ ### requirements
16
+
17
+ [rake](https://github.com/jimweirich/rake) is required for the install process. It can be installed running:
18
+
19
+ gem install rake
20
+
15
21
  ### via rubygems
16
22
 
17
23
  gem install rspec-nagios-formatter
@@ -80,3 +86,7 @@ See Also
80
86
  * [cucumber-nagios](http://auxesis.github.io/cucumber-nagios/)
81
87
  * [RSpec](https://github.com/rspec/rspec)
82
88
  * [Icinga Plugins](http://docs.icinga.org/latest/en/plugins.html)
89
+
90
+
91
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/jhoblitt/rspec-nagios-formatter/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
92
+
@@ -1,7 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'optparse'
4
- require 'open3'
4
+
5
+ if RUBY_VERSION < "1.9"
6
+ require 'open3_backport'
7
+ else
8
+ require 'open3'
9
+ end
10
+
5
11
  require 'timeout'
6
12
 
7
13
  EXIT_CRITICAL = 2
@@ -0,0 +1,27 @@
1
+ #This file needs to be named mkrf_conf.rb
2
+ #so that rubygems will recognize it as a ruby extension
3
+ #file and not think it is a C extension file
4
+
5
+ require 'rubygems/dependency_installer.rb'
6
+
7
+ #Load up the rubygem's dependency installer to
8
+ #installer the gems we want based on the version
9
+ #of Ruby the user has installed
10
+ installer = Gem::DependencyInstaller.new
11
+
12
+ begin
13
+ if RUBY_VERSION < "1.9"
14
+ installer.install "open3_backport", ">=0"
15
+ end
16
+
17
+ rescue
18
+ #Exit with a non-zero value to let rubygems something went wrong
19
+ exit(1)
20
+ end
21
+
22
+ #If this was C, rubygems would attempt to run make
23
+ #Since this is Ruby, rubygems will attempt to run rake
24
+ #If it doesn't find and successfully run a rakefile, it errors out
25
+ f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
26
+ f.write("task :default\n")
27
+ f.close
@@ -11,6 +11,10 @@ class RSpec::Nagios::Formatter < RSpec::Core::Formatters::BaseFormatter
11
11
  output.puts summary_line(duration, example_count, failure_count, pending_count)
12
12
  end
13
13
 
14
+ def rounding(float, precision)
15
+ return ((float * 10**precision).round.to_f) / (10**precision)
16
+ end
17
+
14
18
  def summary_line(duration, example_count, failure_count, pending_count)
15
19
  passing_count = example_count - failure_count
16
20
  # conformance is expressed as a percentage
@@ -18,12 +22,12 @@ class RSpec::Nagios::Formatter < RSpec::Core::Formatters::BaseFormatter
18
22
  if example_count > 0
19
23
  conformance = passing_count / example_count.to_f
20
24
  conformance *= 100
21
- conformance = conformance.round(0)
25
+ conformance = conformance.round
22
26
  else
23
27
  conformance = 0
24
28
  end
25
29
  # limit duration precision to microseconds
26
- time = duration.round(6)
30
+ time = rounding(duration, 6)
27
31
 
28
32
  summary = 'RSPEC'
29
33
  if failure_count == 0
@@ -31,6 +35,7 @@ class RSpec::Nagios::Formatter < RSpec::Core::Formatters::BaseFormatter
31
35
  else
32
36
  summary << " Critical"
33
37
  end
38
+
34
39
  summary << " - " << pluralize(example_count, "example")
35
40
  summary << ", " << pluralize(failure_count, "failure")
36
41
  summary << ", #{pending_count} pending" if pending_count > 0
@@ -43,6 +48,11 @@ class RSpec::Nagios::Formatter < RSpec::Core::Formatters::BaseFormatter
43
48
  summary << " conformance=#{conformance}%"
44
49
  summary << " time=#{time}s"
45
50
 
51
+ if failed_examples.any?
52
+ summary << "\n"
53
+ summary << "#{failed_examples.map { |e| "#{e.location} #{e.full_description}" }.join("\n") }"
54
+ end
55
+
46
56
  summary
47
57
  end
48
58
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Nagios
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -12,9 +12,10 @@ Gem::Specification.new do |s|
12
12
  s.description = %q{A RSpec formatter for the Nagios/Icinga plugin format}
13
13
  s.license = "Apache 2.0"
14
14
 
15
- s.required_ruby_version = ">= 1.9.2"
15
+ s.required_ruby_version = ">= 1.8.7"
16
16
  s.add_runtime_dependency("rspec-core", ">= 2.0.0")
17
17
  s.add_development_dependency("rspec", ">= 2.0.0")
18
+ s.add_development_dependency("open3_backport", ">= 0.0.3")
18
19
  s.add_development_dependency("rspec-expectations", ">= 2.0.0")
19
20
  s.add_development_dependency("rspec-mocks", ">= 2.0.0")
20
21
  s.add_development_dependency("rake", ">= 10.0.0")
@@ -25,4 +26,6 @@ Gem::Specification.new do |s|
25
26
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
26
27
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
28
  s.require_path = "lib"
29
+
30
+ s.extensions = ["ext/mkrf_conf.rb"]
28
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-nagios-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hoblitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-08 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: open3_backport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.3
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec-expectations
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -99,16 +113,19 @@ email:
99
113
  - jhoblitt@cpan.org
100
114
  executables:
101
115
  - check_rspec
102
- extensions: []
116
+ extensions:
117
+ - ext/mkrf_conf.rb
103
118
  extra_rdoc_files: []
104
119
  files:
105
120
  - .gitignore
106
121
  - .travis.yml
122
+ - CHANGELOG.md
107
123
  - Gemfile
108
124
  - LICENSE
109
125
  - README.md
110
126
  - Rakefile
111
127
  - bin/check_rspec
128
+ - ext/mkrf_conf.rb
112
129
  - features/check_rspec/options.feature
113
130
  - features/check_rspec/run.feature
114
131
  - features/support/env.rb
@@ -132,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
149
  requirements:
133
150
  - - '>='
134
151
  - !ruby/object:Gem::Version
135
- version: 1.9.2
152
+ version: 1.8.7
136
153
  required_rubygems_version: !ruby/object:Gem::Requirement
137
154
  requirements:
138
155
  - - '>='
@@ -140,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
157
  version: '0'
141
158
  requirements: []
142
159
  rubyforge_project:
143
- rubygems_version: 2.1.5
160
+ rubygems_version: 2.2.1
144
161
  signing_key:
145
162
  specification_version: 4
146
163
  summary: A RSpec formatter for the Nagios/Icinga plugin format