gerouter 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85849ab81ec85537822c1e48209579e06a37a7d9
4
- data.tar.gz: ce95d3cf8fb70c327af70b23d32afa2951a3eb75
3
+ metadata.gz: 1ffa5260b088999cbd6775357a9cdc365a2ab446
4
+ data.tar.gz: edb5889deeb82037ef75ce961c1fcc77bfdbfc16
5
5
  SHA512:
6
- metadata.gz: 4a46246eba0561be155810e4aa695b2d7928b86fddf4e28e1944605ce81a16b08863f42d66ba2aa99503aae3083e315bfc8f4b0d490c772529762eecc5eb52b0
7
- data.tar.gz: c2ce83ef9c6f9d32443dd242cdad14001741428255b65606a83ec1121fe85302dbc88a696f61c4c1c802abc9c12700b1fb8b2ac0570ca8a83914d97bea858e89
6
+ metadata.gz: 2f182e4e547e4dfeaae3f91477f76f6bfc495d7c4980bab1842fefa2eae310195cfadc46936e843b3838e016a897281b2a75ac4d6fc4c24fc9abb61155eac13f
7
+ data.tar.gz: baf35a7f00b53c0d90969bb44c72b491e6b5fdc1f1783afadefc46976860dac8d9175564c2489412956b4668d066dd0bbc1c0773eb10953b21c71a69316b0e8d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gerouter (0.0.6)
4
+ gerouter (0.0.8)
5
5
  amqp
6
6
  em-ssh
7
7
  eventmachine
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 `misc` attribute into Gerrit event then send to broker.
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
- GER.logger.info "Receive signal: INT. terminating."
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
- GER.logger.info "Receive signal: TERM. terminating."
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
- GER.logger.debug "Receive signal: USR2"
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
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module GerritEventRouter
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
data/lib/ger.rb CHANGED
@@ -23,8 +23,8 @@ module GerritEventRouter
23
23
  Config.new.load(path)
24
24
  end
25
25
 
26
- def start(name, config)
27
- router = Router.new(name, config)
26
+ def start(name, appid, config)
27
+ router = Router.new(name, appid, config)
28
28
  router.start
29
29
  end
30
30
  end
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.7
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-17 00:00:00.000000000 Z
11
+ date: 2013-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine