c3s 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +0 -1
- data/Rakefile +1 -1
- data/c3s.gemspec +3 -3
- data/lib/c3s.rb +1 -1
- data/lib/component.rb +2 -1
- data/lib/model.rb +1 -0
- data/lib/republisher.rb +5 -3
- metadata +5 -5
data/Manifest
CHANGED
data/Rakefile
CHANGED
data/c3s.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{c3s}
|
5
|
-
s.version = "0.4.
|
5
|
+
s.version = "0.4.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ricardo Otero"]
|
9
|
-
s.date = %q{2010-11-
|
9
|
+
s.date = %q{2010-11-22}
|
10
10
|
s.description = %q{C3s library gem.}
|
11
11
|
s.email = %q{oterosantos@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb"]
|
13
|
-
s.files = ["README.rdoc", "Rakefile", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb", "Manifest"
|
13
|
+
s.files = ["README.rdoc", "Rakefile", "c3s.gemspec", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb", "Manifest"]
|
14
14
|
s.homepage = %q{http://github.com/rikas/c3s}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "C3s", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
data/lib/c3s.rb
CHANGED
data/lib/component.rb
CHANGED
@@ -107,6 +107,7 @@ module C3s
|
|
107
107
|
# iq:: [Jabber::IQ] the received IQ packet
|
108
108
|
def handle_set(iq)
|
109
109
|
stanza = iq.query.first_element(config['name']) # TODO assuming that pubsubnode = xml root
|
110
|
+
root_node = stanza
|
110
111
|
data = {}
|
111
112
|
|
112
113
|
# It's admin setting the information for someone
|
@@ -140,7 +141,7 @@ module C3s
|
|
140
141
|
if object.errors.count == 0
|
141
142
|
$LOG.info "Publishing data to node #{config['name']}:#{data[:jid]} (data changed: #{changed})"
|
142
143
|
c3snode = C3s::Node.new("#{config['name']}:#{data[:jid]}")
|
143
|
-
self.publish_to_pubsub(c3snode,
|
144
|
+
self.publish_to_pubsub(c3snode, object.to_xml, changed)
|
144
145
|
send_ok(iq)
|
145
146
|
end
|
146
147
|
|
data/lib/model.rb
CHANGED
@@ -69,6 +69,7 @@ module C3sModel
|
|
69
69
|
# options:: [Hash] options
|
70
70
|
def to_xml(options={})
|
71
71
|
xml = first_element(options)
|
72
|
+
xml.add_attribute('xmlns', self.xmlns)
|
72
73
|
self.attributes.each do |key, val|
|
73
74
|
# Don't include ignored attributes or foreign keys
|
74
75
|
if !IGNORE_ATTR.include?(key) && !key.match(/.+_id/)
|
data/lib/republisher.rb
CHANGED
@@ -17,7 +17,9 @@ module C3s
|
|
17
17
|
# will receive context.
|
18
18
|
def connect
|
19
19
|
super
|
20
|
-
|
20
|
+
if config['subscribe_nodes']
|
21
|
+
subscribe_nodes()
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
##
|
@@ -56,13 +58,13 @@ module C3s
|
|
56
58
|
event.each_element("//items/") do |items|
|
57
59
|
c3snode = C3s::Node.new(items.attributes['node'])
|
58
60
|
next unless c3snode
|
59
|
-
handle_items_publication(items)
|
61
|
+
handle_items_publication(c3snode, items)
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
63
65
|
##
|
64
66
|
# Handles the publicated items and the republishing on new node(s)
|
65
|
-
def handle_items_publication(items)
|
67
|
+
def handle_items_publication(c3snode, items)
|
66
68
|
items.each_element("//item/") do |item|
|
67
69
|
begin
|
68
70
|
c3snode.provider = config['name'] # TODO - assuming that provider_name.eql?(pubsub_root_nodes)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c3s
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 6
|
10
|
+
version: 0.4.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ricardo Otero
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-22 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -42,6 +42,7 @@ extra_rdoc_files:
|
|
42
42
|
files:
|
43
43
|
- README.rdoc
|
44
44
|
- Rakefile
|
45
|
+
- c3s.gemspec
|
45
46
|
- lib/c3s.rb
|
46
47
|
- lib/c3s_logger.rb
|
47
48
|
- lib/component.rb
|
@@ -55,7 +56,6 @@ files:
|
|
55
56
|
- lib/pubsub/subscriber.rb
|
56
57
|
- lib/republisher.rb
|
57
58
|
- Manifest
|
58
|
-
- c3s.gemspec
|
59
59
|
has_rdoc: true
|
60
60
|
homepage: http://github.com/rikas/c3s
|
61
61
|
licenses: []
|