gerouter 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -1
- data/bin/gerouter +4 -1
- data/lib/ger/router.rb +12 -5
- data/lib/ger/version.rb +1 -1
- data/lib/ger.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ffa5260b088999cbd6775357a9cdc365a2ab446
|
4
|
+
data.tar.gz: edb5889deeb82037ef75ce961c1fcc77bfdbfc16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f182e4e547e4dfeaae3f91477f76f6bfc495d7c4980bab1842fefa2eae310195cfadc46936e843b3838e016a897281b2a75ac4d6fc4c24fc9abb61155eac13f
|
7
|
+
data.tar.gz: baf35a7f00b53c0d90969bb44c72b491e6b5fdc1f1783afadefc46976860dac8d9175564c2489412956b4668d066dd0bbc1c0773eb10953b21c71a69316b0e8d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -47,6 +47,7 @@ Usage: gerouter [options]
|
|
47
47
|
-d, --debug Debug mode
|
48
48
|
-c, --config CONFIGFILE Path to config file
|
49
49
|
-n, --name NAME Name of gerrit
|
50
|
+
-i, --appid APPID Application ID (default: gerouter)
|
50
51
|
```
|
51
52
|
|
52
53
|
You should specify -c and -n options.
|
@@ -100,11 +101,22 @@ The above is also stored in [here][samples].
|
|
100
101
|
* `broker` in gerrit has the broker name
|
101
102
|
* gerrits can share one broker
|
102
103
|
|
104
|
+
Additional properties
|
105
|
+
---------------------------
|
106
|
+
|
107
|
+
gerouter adds some properties into each messages.
|
108
|
+
|
109
|
+
```yaml
|
110
|
+
content_type: application/json
|
111
|
+
app_id: gerouter
|
112
|
+
```
|
113
|
+
|
114
|
+
You can change app_id to your own id using `-i` option.
|
103
115
|
|
104
116
|
Additional attribute in Gerrit event
|
105
117
|
---------------------------
|
106
118
|
|
107
|
-
As below, gerouter adds `
|
119
|
+
As below, gerouter adds `provider` attribute into Gerrit event then send to broker.
|
108
120
|
|
109
121
|
```json
|
110
122
|
{
|
data/bin/gerouter
CHANGED
@@ -25,6 +25,9 @@ begin
|
|
25
25
|
opt.on('-n NAME', '--name', 'Name of gerrit') do |v|
|
26
26
|
OPTS[:name] = v
|
27
27
|
end
|
28
|
+
opt.on('-i APPID', '--appid', "Application ID (default: #{GER::NAME.downcase})") do |v|
|
29
|
+
OPTS[:app_id] = v
|
30
|
+
end
|
28
31
|
opt.parse(ARGV)
|
29
32
|
end
|
30
33
|
|
@@ -33,7 +36,7 @@ begin
|
|
33
36
|
conf = GER.load_config(OPTS[:config]||"#{GER::CONFIG_NAME}")
|
34
37
|
|
35
38
|
if OPTS[:name]
|
36
|
-
GER.start(OPTS[:name], conf)
|
39
|
+
GER.start(OPTS[:name], OPTS[:app_id], conf)
|
37
40
|
else
|
38
41
|
STDOUT.puts conf.names
|
39
42
|
end
|
data/lib/ger/router.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module GerritEventRouter
|
3
3
|
class Router
|
4
|
-
def initialize(name, config)
|
4
|
+
def initialize(name, appid, config)
|
5
5
|
@name = name
|
6
|
+
@appid = appid
|
6
7
|
begin
|
7
8
|
@gerrit = config.gerrits[name]
|
8
9
|
raise "Gerrit name is not found: #{name}" unless @gerrit
|
@@ -21,17 +22,23 @@ module GerritEventRouter
|
|
21
22
|
raise "Router still not be configured" unless @configured
|
22
23
|
|
23
24
|
Signal.trap(:INT) do
|
24
|
-
|
25
|
+
Thread.new do
|
26
|
+
GER.logger.info "Receive signal: INT. terminating."
|
27
|
+
end
|
25
28
|
EM.stop
|
26
29
|
end
|
27
30
|
|
28
31
|
Signal.trap(:TERM) do
|
29
|
-
|
32
|
+
Thread.new do
|
33
|
+
GER.logger.info "Receive signal: TERM. terminating."
|
34
|
+
end
|
30
35
|
EM.stop
|
31
36
|
end
|
32
37
|
|
33
38
|
Signal.trap(:USR2) do
|
34
|
-
|
39
|
+
Thread.new do
|
40
|
+
GER.logger.debug "Receive signal: USR2"
|
41
|
+
end
|
35
42
|
if GER.logger.level == GER::LOG_NORMAL then
|
36
43
|
GER.logger.level = GER::LOG_DEBUG
|
37
44
|
else
|
@@ -83,7 +90,7 @@ module GerritEventRouter
|
|
83
90
|
json["provider"] = provider
|
84
91
|
str = JSON.generate(json)
|
85
92
|
end
|
86
|
-
broker.send(str, :routing_key => @gerrit.routing_key)
|
93
|
+
broker.send(str, :app_id => @appid, :routing_key => @gerrit.routing_key)
|
87
94
|
end
|
88
95
|
end
|
89
96
|
end
|
data/lib/ger/version.rb
CHANGED
data/lib/ger.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gerouter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rinrinne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|