syncevolution 0.1.10 → 0.1.11

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: 7db4af2c5cf4bf378560c752ffb6738f852b2b66
4
- data.tar.gz: ae6077dc3044c7f0706446baf900273af0c2fd39
3
+ metadata.gz: f8ba8b2482af3f9161f37a7dd87c8fe5600ad84a
4
+ data.tar.gz: dd6ac85f48af67136ec2dba2cd40fbcb7440e171
5
5
  SHA512:
6
- metadata.gz: bc8194501cbaddba99bfe8d99cc1657552ba7123a5ff07ab201d15e5cbbf06cb7d3c21eb821fd5d3f02baee44e1135868435d82b2773ebcd92ce4f21778ee6c4
7
- data.tar.gz: c81a4b3b53d3c24ac805cde53e0ec2319017e8be53e95e961573329e620afb364129d9a5fde908e9d7da0b50e2c746b78529b71ec29e9520b98bce67426f08c0
6
+ metadata.gz: 597eec647f136ff13666a9372305b2c58dea80823ff90ef1b157f0f1aa46c595b9bb3595aaa5ba1b3c65813cb5a210e5e14256c07d0e1055676617e6ccf932a7
7
+ data.tar.gz: 3a8725ff311d26b9d04966a561bbc6d8475bb727ae2754d46227a7c09b4b3a24e36bd32ab9a0a3509bf5b9e49fd8074d89bef111bf79da41557905eb82aa0315
data/bin/se-config CHANGED
@@ -19,6 +19,68 @@ module SyncEvolution
19
19
  return _inspect(s)
20
20
  end
21
21
 
22
+ def to_gml
23
+ gml = "graph [\n"
24
+ gml << " label #{'syncevolution'.inspect}\n"
25
+ gml << " directed 1\n"
26
+
27
+ nodes = {}
28
+ gml_id = lambda{|node| nodes[id(node)] ||= nodes.size }
29
+
30
+
31
+ @doc.xpath("//context/*[name()='store' or name()='sync']").each{|node|
32
+ gml << " node [\n"
33
+ gml << " id #{gml_id.call(node)}\n"
34
+ gml << " label #{node['name'].inspect}\n"
35
+ gml << " graphics [\n"
36
+ gml << " type #{(node.name == 'sync' ? 'hexagon' : 'rectangle').inspect}\n"
37
+ gml << " w 124.0\n"
38
+ gml << " ]\n"
39
+ gml << " gid #{gml_id.call(node.parent)}\n"
40
+ gml << " ]\n"
41
+ }
42
+
43
+ @doc.xpath('//context').each{|context|
44
+ gml << " node [\n"
45
+ gml << " id #{gml_id.call(context)}\n"
46
+ gml << " label #{context['name'].inspect}\n"
47
+ gml << " isGroup 1\n"
48
+ gml << " ]\n"
49
+ }
50
+
51
+ syncs = 0
52
+
53
+ @doc.xpath('//sync/store').each{|store|
54
+ sync = store.parent
55
+
56
+ if sync['syncURL'] =~ /^local:\/\/@(.+)/
57
+ targetcontext = $1.downcase
58
+ else
59
+ next
60
+ end
61
+
62
+ syncs += 1
63
+
64
+ targetsync = @doc.at("//context[@name=#{_inspect(targetcontext)}]/sync[@name='target-config']")
65
+ targetstore = @doc.at("//context[@name=#{_inspect(targetcontext)}]/store[@name=#{_inspect(store['uri'])}]")
66
+ sourcestore = @doc.at("//context[@name=#{_inspect(store.parent.parent['name'])}]/store[@name=#{_inspect(store['name'])}]")
67
+
68
+ dir = case store['sync']
69
+ when 'two-way' then 'both'
70
+ else throw store['sync'].inspect
71
+ end
72
+
73
+ dashed = " graphics [ style \"dashed\" ]\n"
74
+ gml << " edge [\n source #{gml_id.call(sourcestore)}\n#{dashed} target #{gml_id.call(store.parent)}\n label #{syncs.to_s.inspect}\n ]\n"
75
+ gml << " edge [\n source #{gml_id.call(store.parent)}\n#{dashed} target #{gml_id.call(targetsync)}\n label #{syncs.to_s.inspect}\n ]\n"
76
+ gml << " edge [\n source #{gml_id.call(targetsync)}\n#{dashed} target #{gml_id.call(targetstore)}\n label #{syncs.to_s.inspect}\n ]\n"
77
+ }
78
+
79
+ gml << "]\n"
80
+
81
+ gml
82
+ end
83
+
22
84
  def to_gv
23
85
  gv = "digraph syncevolution {\n"
24
86
 
@@ -344,6 +406,7 @@ OPTS = Trollop::options do
344
406
  opt :shell, "Output shell code"
345
407
  opt :clear, "Clear entire config"
346
408
  opt :graphviz, "Output graphviz code"
409
+ opt :gml, "Output GML graph"
347
410
  opt :indent, "Indent shell code"
348
411
  opt :verify, "Verify configuration"
349
412
  end
@@ -355,3 +418,4 @@ SE.verify
355
418
  puts SE.to_xml if OPTS[:xml]
356
419
  puts SE.to_shell(OPTS[:indent]) if OPTS[:shell]
357
420
  puts SE.to_gv if OPTS[:graphviz]
421
+ puts SE.to_gml if OPTS[:gml]
@@ -1,3 +1,3 @@
1
1
  module SyncEvolution
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syncevolution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Heyns
@@ -97,9 +97,7 @@ files:
97
97
  - lib/syncevolution/version.rb
98
98
  - publish.sh
99
99
  - syncevolution.gemspec
100
- - syncevolution.gv
101
100
  - test/syncevolution.rb
102
- - tt
103
101
  homepage: ''
104
102
  licenses:
105
103
  - MIT
data/syncevolution.gv DELETED
@@ -1,33 +0,0 @@
1
- digraph syncevolution {
2
- subgraph cluster_local {
3
- label = "local";
4
- local_contacts [ shape = folder, label = "contacts"];
5
- local_calendar [ shape = folder, label = "calendar"];
6
- local_google [ shape = component, label = "google"];
7
- local_exchange [ shape = component, label = "exchange"];
8
- }
9
- subgraph cluster_google {
10
- label = "google";
11
- google_contacts [ shape = folder, label = "contacts"];
12
- google_calendar [ shape = folder, label = "calendar"];
13
- google_targetconfig [ shape = component, label = "target-config"];
14
- }
15
- subgraph cluster_exchange {
16
- label = "exchange";
17
- exchange_contacts [ shape = folder, label = "contacts"];
18
- exchange_calendar [ shape = folder, label = "calendar"];
19
- exchange_targetconfig [ shape = component, label = "target-config"];
20
- }
21
- local_contacts -> local_google [label="1", dir=both, style=dashed];
22
- local_google -> google_targetconfig [label="1", dir=both, style=dashed];
23
- google_targetconfig -> google_contacts [label="1", dir=both, style=dashed];
24
- local_calendar -> local_google [label="2", dir=both, style=dashed];
25
- local_google -> google_targetconfig [label="2", dir=both, style=dashed];
26
- google_targetconfig -> google_calendar [label="2", dir=both, style=dashed];
27
- local_contacts -> local_exchange [label="3", dir=both, style=dashed];
28
- local_exchange -> exchange_targetconfig [label="3", dir=both, style=dashed];
29
- exchange_targetconfig -> exchange_contacts [label="3", dir=both, style=dashed];
30
- local_calendar -> local_exchange [label="4", dir=both, style=dashed];
31
- local_exchange -> exchange_targetconfig [label="4", dir=both, style=dashed];
32
- exchange_targetconfig -> exchange_calendar [label="4", dir=both, style=dashed];
33
- }
data/tt DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0"?>
2
- <syncevolution>
3
- <context name="local">
4
- <clear/>
5
- </context>
6
- <context name="google">
7
- <clear/>
8
- </context>
9
- <context name="exchange">
10
- <clear/>
11
- </context>
12
- </syncevolution>