sensu-extension 1.5.0 → 1.5.1

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: 66d4b42c107bd8c3222c6bf9bde3d51416d2994e
4
- data.tar.gz: de237f24063a3e5090c5014a0d25b43c85f50010
3
+ metadata.gz: 3848d5a6ac3573fb24a66f65f7c2ffdc5fd9a273
4
+ data.tar.gz: e8893192f3a39452907118fc2842366e1229a12c
5
5
  SHA512:
6
- metadata.gz: da4a0a2de45cb011e69f4a59c4280e62d969d021deeac6ec86f685cea3abecd084c2c266c5e38996b3cba817647b9ec62ce0bda686f40362473ba2e57c564ddf
7
- data.tar.gz: 2c997462ea1119b396d7ed561a140c6f7ddd09dd739b808594a9d1bc9fafcacc1ce9253b7d2e173c599c3c2f02f2eb83e8197945cf810b963fb8d99e082c4218
6
+ metadata.gz: eab1916ba3b2a8fd8639bf71663b29f5f6ca1cdd764105d13493b9d510bc24878b8cd26ac571ff2b0bedb1280e3e73397b9a9190b555d4e8bbe2926099828460
7
+ data.tar.gz: 31fc2a02662a154ab1141be6c83717f48fa9a206049a9461bae961d706d75f1ebe11196c3b06dac984b6efa6c3ddf0eb79aea0958fadc69f3e42796f2e7b160f
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-extension"
5
- spec.version = "1.5.0"
5
+ spec.version = "1.5.1"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu extension library"
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.homepage = "https://github.com/sensu/sensu-extension"
11
11
  spec.license = "MIT"
12
12
 
13
- spec.files = `git ls-files -z`.split("\x0")
13
+ spec.files = Dir.glob("lib/**/*") + %w[sensu-extension.gemspec README.md LICENSE.txt]
14
14
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
16
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -87,18 +87,11 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
91
- - ".travis.yml"
92
- - Gemfile
93
90
  - LICENSE.txt
94
91
  - README.md
95
- - Rakefile
96
92
  - lib/sensu/extension.rb
97
93
  - lib/sensu/extension/constants.rb
98
94
  - sensu-extension.gemspec
99
- - spec/base_spec.rb
100
- - spec/categories_spec.rb
101
- - spec/helpers.rb
102
95
  homepage: https://github.com/sensu/sensu-extension
103
96
  licenses:
104
97
  - MIT
@@ -119,11 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
112
  version: '0'
120
113
  requirements: []
121
114
  rubyforge_project:
122
- rubygems_version: 2.4.5.1
115
+ rubygems_version: 2.6.3
123
116
  signing_key:
124
117
  specification_version: 4
125
118
  summary: The Sensu extension library
126
- test_files:
127
- - spec/base_spec.rb
128
- - spec/categories_spec.rb
129
- - spec/helpers.rb
119
+ test_files: []
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 1.8.7
5
- - 1.9.2
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.0
9
- - jruby-1.7.18
10
- notifications:
11
- irc:
12
- - "irc.freenode.net#sensu"
13
- addons:
14
- code_climate:
15
- repo_token: 767b23081fd38d849be07cd85ade8b06120135f8f983b1c7ead44f2ef0272f6d
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in sensu-extension.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/spec/base_spec.rb DELETED
@@ -1,110 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers")
2
- require "sensu/extension"
3
- require "logger"
4
-
5
- describe "Sensu::Extension::Base" do
6
- include Helpers
7
-
8
- before do
9
- @extension = Sensu::Extension::Base.new
10
- end
11
-
12
- it "can provide the extension API" do
13
- expect(@extension).to respond_to(:name, :name_alias, :description, :definition, :safe_run, :has_key?, :[])
14
- end
15
-
16
- it "can provide default method return values" do
17
- expect(@extension.post_init).to be(true)
18
- expect(@extension.stop).to be(true)
19
- expect(@extension.name).to eq("base")
20
- expect(@extension.name_alias).to eq(nil)
21
- expect(@extension.description).to eq("extension description (change me)")
22
- expect(@extension.definition).to eq({:type => "extension", :name => "base"})
23
- end
24
-
25
- it "can have a logger" do
26
- @extension.logger = Logger.new("/dev/null")
27
- @extension.logger.formatter = Proc.new do |severity, datetime, progname, message|
28
- expect(severity).to eq("INFO")
29
- expect(message).to eq("test")
30
- end
31
- @extension.logger.info("test")
32
- end
33
-
34
- it "can have settings" do
35
- settings = {:foo => 1}
36
- @extension.settings = settings
37
- expect(@extension.settings).to eq(settings)
38
- end
39
-
40
- it "can run without data" do
41
- async_wrapper do
42
- @extension.run do |output, status|
43
- expect(output).to eq("noop")
44
- expect(status).to eq(0)
45
- async_done
46
- end
47
- end
48
- end
49
-
50
- it "can run a proc without data" do
51
- async_wrapper do
52
- callback = Proc.new do |output, status|
53
- expect(output).to eq("noop")
54
- expect(status).to eq(0)
55
- async_done
56
- end
57
- @extension.run(&callback)
58
- end
59
- end
60
-
61
- it "can run with event data" do
62
- async_wrapper do
63
- event = {:foo => 1}
64
- @extension.run(event) do |output, status|
65
- expect(output).to eq("noop")
66
- expect(status).to eq(0)
67
- async_done
68
- end
69
- end
70
- end
71
-
72
- it "can pass event data to run" do
73
- async_wrapper do
74
- event = {:foo => 1}
75
- @extension.safe_run(event) do |output, status|
76
- expect(output).to eq("noop")
77
- expect(status).to eq(0)
78
- async_done
79
- end
80
- end
81
- end
82
-
83
- it "can catch some run errors" do
84
- async_wrapper do
85
- @extension.safe_run do |output, status|
86
- raise "boom" if status == 0
87
- expect(output.split("\n").first).to eq("RuntimeError: boom")
88
- expect(status).to eq(2)
89
- async_done
90
- end
91
- end
92
- end
93
-
94
- it "can provide hash like access to definition()" do
95
- expect(@extension.has_key?(:type)).to be(true)
96
- expect(@extension.has_key?(:name)).to be(true)
97
- expect(@extension[:type]).to eq("extension")
98
- expect(@extension[:name]).to eq("base")
99
- end
100
-
101
- it "can provide a list of decendant classes" do
102
- expected = [
103
- Sensu::Extension::Bridge,
104
- Sensu::Extension::Check,
105
- Sensu::Extension::Mutator,
106
- Sensu::Extension::Handler
107
- ]
108
- expect(Sensu::Extension::Base.descendants).to include(*expected)
109
- end
110
- end
@@ -1,52 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers")
2
- require "sensu/extension"
3
-
4
- describe "Sensu::Extension::Bridge" do
5
- include Helpers
6
-
7
- it "inherits Base" do
8
- expect(Sensu::Extension::Bridge.superclass).to eq(Sensu::Extension::Base)
9
- extension = Sensu::Extension::Bridge.new
10
- expect(extension).to respond_to(:name, :name_alias, :description, :definition, :safe_run, :stop, :has_key?, :[])
11
- end
12
- end
13
-
14
- describe "Sensu::Extension::Check" do
15
- include Helpers
16
-
17
- it "inherits Base" do
18
- expect(Sensu::Extension::Check.superclass).to eq(Sensu::Extension::Base)
19
- extension = Sensu::Extension::Check.new
20
- expect(extension).to respond_to(:name, :name_alias, :description, :definition, :safe_run, :stop, :has_key?, :[])
21
- end
22
- end
23
-
24
- describe "Sensu::Extension::Filter" do
25
- include Helpers
26
-
27
- it "inherits Base" do
28
- expect(Sensu::Extension::Filter.superclass).to eq(Sensu::Extension::Base)
29
- extension = Sensu::Extension::Filter.new
30
- expect(extension).to respond_to(:name, :name_alias, :description, :definition, :safe_run, :stop, :has_key?, :[])
31
- end
32
- end
33
-
34
- describe "Sensu::Extension::Mutator" do
35
- include Helpers
36
-
37
- it "inherits Base" do
38
- expect(Sensu::Extension::Mutator.superclass).to eq(Sensu::Extension::Base)
39
- extension = Sensu::Extension::Mutator.new
40
- expect(extension).to respond_to(:name, :name_alias, :description, :definition, :safe_run, :stop, :has_key?, :[])
41
- end
42
- end
43
-
44
- describe "Sensu::Extension::Handler" do
45
- include Helpers
46
-
47
- it "inherits Base" do
48
- expect(Sensu::Extension::Handler.superclass).to eq(Sensu::Extension::Base)
49
- extension = Sensu::Extension::Handler.new
50
- expect(extension).to respond_to(:name, :name_alias, :description, :definition, :safe_run, :stop, :has_key?, :[])
51
- end
52
- end
data/spec/helpers.rb DELETED
@@ -1,29 +0,0 @@
1
- require "rspec"
2
- require "eventmachine"
3
-
4
- unless RUBY_VERSION < "1.9" || RUBY_PLATFORM =~ /java/
5
- require "codeclimate-test-reporter"
6
- CodeClimate::TestReporter.start
7
- end
8
-
9
- module Helpers
10
- def timer(delay, &callback)
11
- periodic_timer = EM::PeriodicTimer.new(delay) do
12
- callback.call
13
- periodic_timer.cancel
14
- end
15
- end
16
-
17
- def async_wrapper(&callback)
18
- EM.run do
19
- timer(10) do
20
- raise "test timed out"
21
- end
22
- callback.call
23
- end
24
- end
25
-
26
- def async_done
27
- EM.stop_event_loop
28
- end
29
- end