m2config 0.5.3 → 0.5.4
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.
- checksums.yaml +4 -4
- data/lib/m2config/handler.rb +0 -5
- data/lib/m2config/mongrel2.mime.yml +2 -0
- data/lib/m2config/version.rb +1 -1
- data/spec/handler_spec.rb +5 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1686b2f58b1d2458e9db47c9e88af841b0b15332
|
4
|
+
data.tar.gz: 7c44815043517753897c2e1a680b9a1956d09990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3047f3a13d345585396c5181044f560090fa6bfe7990c806df72a80cdfb1b88241e60012b35d07f96131ddeefa58ced9d7bbd754d192d209e65b1fa998f5a38a
|
7
|
+
data.tar.gz: a2a09aefbb0c124c40182ab9602171e89f386f87d24770fba2a48835ea3442c447afb7657950b6a0b9aca12e04e9a90ab662948b3214a7f6e4b2c8fb2656894b
|
data/lib/m2config/handler.rb
CHANGED
@@ -2,14 +2,9 @@ module M2Config
|
|
2
2
|
class Handler < Sequel::Model(:handler)
|
3
3
|
plugin :validation_helpers
|
4
4
|
|
5
|
-
ID_REGEX = /^[-a-zA-Z0-9]+$/
|
6
|
-
|
7
5
|
def initialize( fields )
|
8
6
|
raise ArgumentError, "The send and receive endpoints can not be the same" if
|
9
7
|
fields[:send_spec] == fields[:recv_spec]
|
10
|
-
raise ArgumentError, "Handler send and recv IDs must only use -a-zA-Z0-9" if
|
11
|
-
!(fields[:send_ident] =~ ID_REGEX &&
|
12
|
-
fields[:send_ident] =~ ID_REGEX)
|
13
8
|
fields[:recv_ident] ||= ""
|
14
9
|
super(fields, false)
|
15
10
|
save
|
data/lib/m2config/version.rb
CHANGED
data/spec/handler_spec.rb
CHANGED
@@ -7,43 +7,34 @@ describe M2Config::Handler do
|
|
7
7
|
it "needs the ØMQ addresses and a send identifier" do
|
8
8
|
M2Config::Handler.new({ send_spec:"tcp://10.0.0.1:8989",
|
9
9
|
recv_spec:"tcp://10.0.0.1:9898",
|
10
|
-
send_ident: "dev
|
10
|
+
send_ident: "dev.example.com ID"})
|
11
11
|
res = CFG.db[:handler].first
|
12
12
|
res[:send_spec].should eq("tcp://10.0.0.1:8989")
|
13
13
|
res[:recv_spec].should eq("tcp://10.0.0.1:9898")
|
14
|
-
res[:send_ident].should eq("dev
|
14
|
+
res[:send_ident].should eq("dev.example.com ID")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "turns nil into empty string when recv_ident is not set" do
|
18
18
|
M2Config::Handler.new({ send_spec:"tcp://10.0.0.1:8989",
|
19
19
|
recv_spec:"tcp://10.0.0.1:9898",
|
20
|
-
send_ident: "dev
|
20
|
+
send_ident: "dev.example.com ID"})
|
21
21
|
res = CFG.db[:handler].first
|
22
22
|
res[:recv_ident].should be_empty
|
23
23
|
end
|
24
24
|
|
25
|
-
describe "helps you spot common mistakes
|
25
|
+
describe "helps you spot common mistakes" do
|
26
26
|
it "yells when the addresses are the same" do
|
27
27
|
expect do
|
28
28
|
M2Config::Handler.new({send_spec:"tcp://10.0.0.1:8989", recv_spec:"tcp://10.0.0.1:8989", send_ident: "dev.example.com ID"})
|
29
29
|
end.to raise_exception(ArgumentError, /send and receive endpoints can not be the same/i)
|
30
30
|
end
|
31
31
|
|
32
|
-
it "yells when the send ID does not respect Mongrel2's constraints (UUID = (alpha | digit | '-')+ )" do
|
33
|
-
expect do
|
34
|
-
M2Config::Handler.new({send_spec:"tcp://10.0.0.1:8988", recv_spec:"tcp://10.0.0.1:8989", send_ident: "dev.example.com ID"})
|
35
|
-
end.to raise_exception(ArgumentError, /Handler send and recv IDs must only use -a-zA-Z0-9/i)
|
36
|
-
expect do
|
37
|
-
M2Config::Handler.new({send_spec:"tcp://10.0.0.1:8988", recv_spec:"tcp://10.0.0.1:8989", recv_ident: "dev.example.com ID"})
|
38
|
-
end.to raise_exception(ArgumentError, /Handler send and recv IDs must only use -a-zA-Z0-9/i)
|
39
|
-
end
|
40
|
-
|
41
32
|
end
|
42
33
|
end
|
43
34
|
|
44
35
|
describe '#type' do
|
45
36
|
it 'returns its type' do
|
46
|
-
M2Config::Handler.new({send_spec:"tcp://10.0.0.1:8988", recv_spec:"tcp://10.0.0.1:8989", send_ident: "dev
|
37
|
+
M2Config::Handler.new({send_spec:"tcp://10.0.0.1:8988", recv_spec:"tcp://10.0.0.1:8989", send_ident: "dev.example.com ID"}).type.should eq("handler")
|
47
38
|
end
|
48
39
|
end
|
49
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m2config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Meuret
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
154
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.1.11
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Manage your Mongrel2 configuration database using handy model classes that
|