c3s 0.4.1 → 0.4.2
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.
- data/Manifest +18 -0
- data/Rakefile +1 -1
- data/c3s.gemspec +4 -4
- data/lib/model.rb +1 -0
- data/lib/pubsub/publisher.rb +8 -1
- data/lib/republisher.rb +3 -2
- metadata +9 -4
data/Manifest
CHANGED
@@ -12,4 +12,22 @@ lib/pubsub/nodetracker.rb
|
|
12
12
|
lib/pubsub/publisher.rb
|
13
13
|
lib/pubsub/subscriber.rb
|
14
14
|
lib/republisher.rb
|
15
|
+
pkg/c3s-0.4.1.gem
|
16
|
+
pkg/c3s-0.4.1.tar.gz
|
17
|
+
pkg/c3s-0.4.1/Manifest
|
18
|
+
pkg/c3s-0.4.1/README.rdoc
|
19
|
+
pkg/c3s-0.4.1/Rakefile
|
20
|
+
pkg/c3s-0.4.1/c3s.gemspec
|
21
|
+
pkg/c3s-0.4.1/lib/c3s.rb
|
22
|
+
pkg/c3s-0.4.1/lib/c3s_logger.rb
|
23
|
+
pkg/c3s-0.4.1/lib/component.rb
|
24
|
+
pkg/c3s-0.4.1/lib/component_connection.rb
|
25
|
+
pkg/c3s-0.4.1/lib/configreader.rb
|
26
|
+
pkg/c3s-0.4.1/lib/databaseadapter.rb
|
27
|
+
pkg/c3s-0.4.1/lib/model.rb
|
28
|
+
pkg/c3s-0.4.1/lib/pubsub/node.rb
|
29
|
+
pkg/c3s-0.4.1/lib/pubsub/nodetracker.rb
|
30
|
+
pkg/c3s-0.4.1/lib/pubsub/publisher.rb
|
31
|
+
pkg/c3s-0.4.1/lib/pubsub/subscriber.rb
|
32
|
+
pkg/c3s-0.4.1/lib/republisher.rb
|
15
33
|
Manifest
|
data/Rakefile
CHANGED
data/c3s.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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.2"
|
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-
|
9
|
+
s.date = %q{2010-09-27}
|
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"]
|
@@ -15,14 +15,14 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "C3s", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{c3s}
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
19
|
s.summary = %q{C3s library gem.}
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
22
22
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
|
-
if Gem::Version.new(Gem::
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
26
|
else
|
27
27
|
end
|
28
28
|
else
|
data/lib/model.rb
CHANGED
@@ -36,6 +36,7 @@ module C3sModel
|
|
36
36
|
def to_xml(options={})
|
37
37
|
xml = first_element(options)
|
38
38
|
self.attributes.each do |key, val|
|
39
|
+
# Don't include ignored attributes or foreign keys
|
39
40
|
if !IGNORE_ATTR.include?(key) && !key.match(/.+_id/)
|
40
41
|
xml.add REXML::Element.new(key).add_text(val.to_s)
|
41
42
|
end
|
data/lib/pubsub/publisher.rb
CHANGED
@@ -37,6 +37,7 @@ module C3s
|
|
37
37
|
def create_node(nodename, options={})
|
38
38
|
return if node_exists?(nodename)
|
39
39
|
config = Jabber::PubSub::NodeConfig.new
|
40
|
+
config = nil if !options || options.empty? # avoid creation of <configure/>
|
40
41
|
|
41
42
|
if options[:father]
|
42
43
|
config.options = config.options.merge({'pubsub#collection' => options[:father]})
|
@@ -68,6 +69,7 @@ module C3s
|
|
68
69
|
$LOG.debug("Creating collection node #{name}...")
|
69
70
|
$LOG.debug("Node config: #{config.options.inspect}")
|
70
71
|
return if node_exists?(name)
|
72
|
+
|
71
73
|
node = @pubsub.create_collection_node(name, config)
|
72
74
|
end
|
73
75
|
|
@@ -78,11 +80,16 @@ module C3s
|
|
78
80
|
# config:: [PubSub::NodeConfig] node configuration
|
79
81
|
def create_leaf_node(name, config)
|
80
82
|
$LOG.debug("Creating leaf node #{name}")
|
81
|
-
$LOG.debug("Node config: #{config.options.inspect}")
|
83
|
+
$LOG.debug("Node config: #{config.options.inspect}") if config
|
82
84
|
return if node_exists?(name)
|
85
|
+
|
83
86
|
node = @pubsub.create_node(name, config)
|
84
87
|
end
|
85
88
|
|
89
|
+
##
|
90
|
+
# Grants node permissions to user admin@domain so that we
|
91
|
+
# can have an admin that can edit/delete every node.
|
92
|
+
# node:: [Pubsub::Node] the node to grant permissions to
|
86
93
|
def grant_owner_to_admin(node)
|
87
94
|
return unless node
|
88
95
|
@pubsub.set_affiliations(node, "admin@#{@client.config['url']}", 'owner')
|
data/lib/republisher.rb
CHANGED
@@ -59,10 +59,11 @@ module C3s
|
|
59
59
|
$LOG.debug("Node built: #{c3snode.to_s}")
|
60
60
|
c3snode.provider = config['name'] # TODO - assuming that provider_name.eql?(pubsub_root_node)
|
61
61
|
$LOG.debug("Call republish() from child")
|
62
|
-
|
63
|
-
|
62
|
+
|
64
63
|
Thread.abort_on_exception = true
|
65
64
|
t = Thread.new do
|
65
|
+
# This must be implemented on the republisher
|
66
|
+
# because the strategy may vary from component to component.
|
66
67
|
republish(c3snode, item)
|
67
68
|
end
|
68
69
|
t.join
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c3s
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Ricardo Otero
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-27 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -70,16 +71,20 @@ rdoc_options:
|
|
70
71
|
require_paths:
|
71
72
|
- lib
|
72
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
73
75
|
requirements:
|
74
76
|
- - ">="
|
75
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
76
79
|
segments:
|
77
80
|
- 0
|
78
81
|
version: "0"
|
79
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
80
84
|
requirements:
|
81
85
|
- - ">="
|
82
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 11
|
83
88
|
segments:
|
84
89
|
- 1
|
85
90
|
- 2
|
@@ -87,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
92
|
requirements: []
|
88
93
|
|
89
94
|
rubyforge_project: c3s
|
90
|
-
rubygems_version: 1.3.
|
95
|
+
rubygems_version: 1.3.7
|
91
96
|
signing_key:
|
92
97
|
specification_version: 3
|
93
98
|
summary: C3s library gem.
|