confluencer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -1
- data/VERSION +1 -1
- data/confluencer.gemspec +2 -2
- data/lib/confluence/client.rb +10 -4
- data/lib/confluence/page.rb +1 -1
- data/lib/confluence/record.rb +5 -7
- data/lib/confluence/space.rb +1 -1
- data/spec/confluence/record_spec.rb +16 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
= confluencer
|
2
2
|
|
3
|
-
|
3
|
+
Easy to use, ActiveRecord-like classes to find spaces, pages and bookmarks as well as adding new ones and updating existing ones. Very much work in progress, every version will most likely break your code. I will update the README when the codebase is more stable.
|
4
|
+
|
5
|
+
Uses the Confluence XMLRPC API (v1).
|
4
6
|
|
5
7
|
== Note on Patches/Pull Requests
|
6
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/confluencer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{confluencer}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gabor Ratky"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-12}
|
13
13
|
s.description = %q{ActiveRecord-like classes to access Confluence through XMLRPC.}
|
14
14
|
s.email = %q{rgabo@rgabostyle.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/confluence/client.rb
CHANGED
@@ -83,9 +83,15 @@ module Confluence
|
|
83
83
|
else
|
84
84
|
log.debug "#{method_name}(#{(args.collect {|a| a.inspect}).join(', ')})"
|
85
85
|
end
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
|
87
|
+
begin
|
88
|
+
result = proxy.send(method_name, *([@token] + args))
|
89
|
+
log.debug(result.inspect)
|
90
|
+
result
|
91
|
+
rescue EOFError => e
|
92
|
+
log.warn "Could not complete XMLRPC call, retrying... Error: #{e.inspect}"
|
93
|
+
retry
|
94
|
+
end
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|
@@ -118,7 +124,7 @@ module Confluence
|
|
118
124
|
begin
|
119
125
|
block.call
|
120
126
|
rescue XMLRPC::FaultException => e
|
121
|
-
log.warn message = e.faultString.rpartition(':').last
|
127
|
+
log.warn message = e.faultString.rpartition(':').last.strip
|
122
128
|
|
123
129
|
case message
|
124
130
|
when /Transaction rolled back/
|
data/lib/confluence/page.rb
CHANGED
@@ -8,7 +8,7 @@ module Confluence
|
|
8
8
|
record_attr_accessor :title, :creator, :modifier, :content
|
9
9
|
record_attr_accessor :created, :modified, :version
|
10
10
|
record_attr_accessor :url
|
11
|
-
|
11
|
+
|
12
12
|
def children(klass = self.class)
|
13
13
|
children = client.getChildren(page_id)
|
14
14
|
children.collect { |child| klass.find(:id => child["id"]) } if children
|
data/lib/confluence/record.rb
CHANGED
@@ -44,13 +44,17 @@ module Confluence
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def client
|
48
|
+
Record.client
|
49
|
+
end
|
50
|
+
|
47
51
|
attr_accessor :attributes
|
48
52
|
|
49
53
|
# Initializes a new record.
|
50
54
|
#
|
51
55
|
# ==== Parameters
|
52
56
|
# hash<Hash>:: A hash containing the attributes and its values. Keys can be Strings or Symbols.
|
53
|
-
def initialize(hash)
|
57
|
+
def initialize(hash = {})
|
54
58
|
@attributes = {}
|
55
59
|
|
56
60
|
# iterate through each key/value pair and set attribute keyed by symbol
|
@@ -86,11 +90,5 @@ module Confluence
|
|
86
90
|
|
87
91
|
@labels = value
|
88
92
|
end
|
89
|
-
|
90
|
-
private
|
91
|
-
|
92
|
-
def client
|
93
|
-
Record.client
|
94
|
-
end
|
95
93
|
end
|
96
94
|
end
|
data/lib/confluence/space.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
2
|
|
3
3
|
describe Confluence::Record do
|
4
|
-
it "should
|
5
|
-
|
4
|
+
it "should store the client" do
|
5
|
+
Confluence::Record.client = 'client'
|
6
|
+
|
7
|
+
Confluence::Record.client.should == 'client'
|
8
|
+
Confluence::Record.new.client.should == 'client'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should initialize new record from hash" do
|
12
|
+
record = Confluence::Record.new(:foo => 'bar', 'string' => 'works')
|
6
13
|
|
7
14
|
record[:foo].should == 'bar'
|
15
|
+
record[:string].should == 'works'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should return the id of the record" do
|
19
|
+
record = Confluence::Record.new 'id' => '12345'
|
20
|
+
|
21
|
+
record.record_id.should == '12345'
|
8
22
|
end
|
9
23
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gabor Ratky
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-12 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|