icinga 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/icinga.gemspec +3 -0
- data/lib/icinga/server.rb +20 -0
- data/lib/icinga/version.rb +1 -1
- data/test/icinga/server_spec.rb +24 -0
- data/test/icinga_spec.rb +7 -0
- metadata +29 -3
data/README.md
CHANGED
data/Rakefile
CHANGED
data/icinga.gemspec
CHANGED
@@ -16,4 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
gem.add_development_dependency 'rspec'
|
19
22
|
end
|
data/lib/icinga/server.rb
CHANGED
@@ -1,4 +1,24 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
1
3
|
module Icinga
|
2
4
|
class Server
|
5
|
+
attr_accessor :options
|
6
|
+
|
7
|
+
@@default_options = {
|
8
|
+
:host => "localhost",
|
9
|
+
:port => 80,
|
10
|
+
}
|
11
|
+
|
12
|
+
def connection
|
13
|
+
@conn ||= Net::HTTP.new(@host, @port)
|
14
|
+
end
|
15
|
+
|
16
|
+
def new_request(path)
|
17
|
+
Net::HTTP::Get.new(path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(options={})
|
21
|
+
@options = @@default_options.merge(options)
|
22
|
+
end
|
3
23
|
end
|
4
24
|
end
|
data/lib/icinga/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'icinga'
|
2
|
+
|
3
|
+
describe Icinga::Server do
|
4
|
+
before do
|
5
|
+
@icinga = Icinga::Server.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "when initialized" do
|
9
|
+
it "should set the default port" do
|
10
|
+
@icinga.options[:port].should equal(80)
|
11
|
+
end
|
12
|
+
it "should set the default host" do
|
13
|
+
@icinga.options[:host].should match("localhost")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should create a connection" do
|
18
|
+
@icinga.connection.should be_kind_of(Net::HTTP)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should create a request" do
|
22
|
+
@icinga.new_request("/").should be_kind_of(Net::HTTP::Get)
|
23
|
+
end
|
24
|
+
end
|
data/test/icinga_spec.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icinga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,29 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-12-06 00:00:00.000000000Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &8358620 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *8358620
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &8358040 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *8358040
|
14
36
|
description: Facilitates communication with Icinga servers.
|
15
37
|
email:
|
16
38
|
- jbussdieker@gmail.com
|
@@ -27,6 +49,8 @@ files:
|
|
27
49
|
- lib/icinga.rb
|
28
50
|
- lib/icinga/server.rb
|
29
51
|
- lib/icinga/version.rb
|
52
|
+
- test/icinga/server_spec.rb
|
53
|
+
- test/icinga_spec.rb
|
30
54
|
homepage: ''
|
31
55
|
licenses: []
|
32
56
|
post_install_message:
|
@@ -51,4 +75,6 @@ rubygems_version: 1.8.17
|
|
51
75
|
signing_key:
|
52
76
|
specification_version: 3
|
53
77
|
summary: Icinga API tools
|
54
|
-
test_files:
|
78
|
+
test_files:
|
79
|
+
- test/icinga/server_spec.rb
|
80
|
+
- test/icinga_spec.rb
|