simplepubsub 0.2.0 → 0.2.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: 9c4513ee74222d8aa5deebdb2c14e81a9c909a5b
4
- data.tar.gz: c7009e918084ad0d56fbc9684ab179bf81ecda10
3
+ metadata.gz: ab32f9c65b4215927e54757ecd94f42a00c8badb
4
+ data.tar.gz: 3940577be197a3fc6ca44dccb4e8dc5a6df1932d
5
5
  SHA512:
6
- metadata.gz: 16ae4e1c743711ebde933b5a28c83c78ae10de79b4dc97596dc8ee68698d8420dfeef86b883dfceb98dc22cfdd7e2bac674c84660ee6a5292750a8e1480e7172
7
- data.tar.gz: 7ea66c7fd40680761b3f47800a1a3db27a917ed250ed247f2d4fe8d02117986a58e5cbd3bbcd19d9f07853fe320bcbc06548a8c8a9dabcc02850eeeb9ef9c82d
6
+ metadata.gz: 8780a95d7ea3a1558d8a137122e4e29284de409414f2d3475beec98c0ffef0e129f7387975f42839fe9db58af41b7319a55b564200f494f8728b2b9b6efbbfb6
7
+ data.tar.gz: 0aba7520c5f13d82b706c60fa94aad3c1d4e0b29bbf18fa29868ba93dee31bc4cfc4e6844ee6616de83b61e96125dade93ebff78d86e5046e40993a2cf3403a1
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/simplepubsub.rb CHANGED
@@ -54,9 +54,10 @@ module SimplePubSub
54
54
 
55
55
  class Server
56
56
 
57
- attr_reader :subscribers
57
+ attr_reader :subscribers, :bridges
58
58
 
59
- def initialize()
59
+ def initialize(hostname)
60
+ @hostname = hostname
60
61
  @subscribers = {'#' => []}
61
62
  @bridges = {'#' => []}
62
63
  end
@@ -114,16 +115,19 @@ module SimplePubSub
114
115
 
115
116
  def bridge_deliver(topic, message, excluded_host=nil)
116
117
 
117
- if excluded_host then
118
+ return 'no matching topic' unless @bridges.has_key? topic
119
+
120
+ if excluded_host then
118
121
  bridges = @bridges[topic].select{|x| x != excluded_host}
119
122
  else
120
123
  bridges = @bridges[topic]
121
124
  end
122
125
 
123
- bridges.each do |bridge|
124
- url = "http://%s/do/simplepubsub/bridge_published?topic=%s&message=%s" % [address, topic, URI.escape(message)]
126
+ bridges.values.each do |address|
127
+ url = "http://%s/do/simplepubsub/bridgepub?topic=%s&hostname=%s&message=%s" % [address, topic, @hostname, URI.escape(message)]
125
128
  r = open(url, 'UserAgent' => USER_AGENT)
126
129
  end
130
+ 'bridge delivered'
127
131
  end
128
132
 
129
133
  end
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- j���,2lo@�v��jA��݈�,JNT4C ��iqJ!`��a
1
+ �3��aMr��}���]�8�/B9d�_�4|_�^����n���+��k�lP2S{� j�@��lRx��+ ÿyOص�Υ�4��t�Z�l�_R����\ n���1����ͼ��Cy��&�v�^Q�Ɣ ��<%��My�JF��7N9�<�"7��л p6j��\0���L����N�+А9�'�CQ����Č��� �|�]�<)��e>U)���Tg���#����/��MQQ����
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplepubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  i0PBE6fLwlIMk8jNNUcX3J1csSMgLNTwE8CwrlSZE8sueHj0pQzICM7lF0gGREO6
32
32
  hQHD0LljU3MusQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2013-06-20 00:00:00.000000000 Z
34
+ date: 2013-06-21 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email:
metadata.gz.sig CHANGED
Binary file