confluencer 0.1.1
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/.document +5 -0
- data/.gitignore +21 -0
- data/.rvmrc +1 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/bin/confluencer +8 -0
- data/bin/confluencer-bookmarks +8 -0
- data/confluencer.gems +3 -0
- data/confluencer.gemspec +73 -0
- data/lib/confluence/bookmark.rb +27 -0
- data/lib/confluence/client.rb +69 -0
- data/lib/confluence/page.rb +29 -0
- data/lib/confluence/record.rb +76 -0
- data/lib/confluencer.rb +15 -0
- data/lib/confluencer/app.rb +48 -0
- data/lib/confluencer/bookmarks.rb +65 -0
- data/script/console +14 -0
- data/script/console_client.rb +9 -0
- data/script/console_init.rb +5 -0
- data/spec/confluencer_spec.rb +4 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- data/templates/webpage.erb +9 -0
- metadata +116 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.8.7@confluencer
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Gabor Ratky
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= confluencer
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Gabor Ratky. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "confluencer"
|
8
|
+
gem.summary = %Q{Useful scripts and classes to manage Confluence}
|
9
|
+
gem.description = %Q{ActiveRecord-like classes that map to Confluence entities and useful scripts that automate tasks}
|
10
|
+
gem.email = "rgabo@rgabostyle.com"
|
11
|
+
gem.homepage = "http://github.com/rgabo/confluencer"
|
12
|
+
gem.authors = ["Gabor Ratky"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.3.0"
|
14
|
+
gem.add_runtime_dependency "thor", ">= 0.13.4"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
+
spec.libs << 'lib' << 'spec'
|
25
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
end
|
27
|
+
|
28
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
spec.rcov = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :spec => :check_dependencies
|
35
|
+
|
36
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "confluencer #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
data/bin/confluencer
ADDED
data/confluencer.gems
ADDED
data/confluencer.gemspec
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{confluencer}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Gabor Ratky"]
|
12
|
+
s.date = %q{2010-05-03}
|
13
|
+
s.description = %q{ActiveRecord-like classes that map to Confluence entities and useful scripts that automate tasks}
|
14
|
+
s.email = %q{rgabo@rgabostyle.com}
|
15
|
+
s.executables = ["confluencer", "confluencer-bookmarks"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
".rvmrc",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/confluencer",
|
29
|
+
"bin/confluencer-bookmarks",
|
30
|
+
"confluencer.gems",
|
31
|
+
"confluencer.gemspec",
|
32
|
+
"lib/confluence/bookmark.rb",
|
33
|
+
"lib/confluence/client.rb",
|
34
|
+
"lib/confluence/page.rb",
|
35
|
+
"lib/confluence/record.rb",
|
36
|
+
"lib/confluencer.rb",
|
37
|
+
"lib/confluencer/app.rb",
|
38
|
+
"lib/confluencer/bookmarks.rb",
|
39
|
+
"script/console",
|
40
|
+
"script/console_client.rb",
|
41
|
+
"script/console_init.rb",
|
42
|
+
"spec/confluencer_spec.rb",
|
43
|
+
"spec/spec.opts",
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"templates/webpage.erb"
|
46
|
+
]
|
47
|
+
s.homepage = %q{http://github.com/rgabo/confluencer}
|
48
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = %q{1.3.6}
|
51
|
+
s.summary = %q{Useful scripts and classes to manage Confluence}
|
52
|
+
s.test_files = [
|
53
|
+
"spec/confluencer_spec.rb",
|
54
|
+
"spec/spec_helper.rb"
|
55
|
+
]
|
56
|
+
|
57
|
+
if s.respond_to? :specification_version then
|
58
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
59
|
+
s.specification_version = 3
|
60
|
+
|
61
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
62
|
+
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
63
|
+
s.add_runtime_dependency(%q<thor>, [">= 0.13.4"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
66
|
+
s.add_dependency(%q<thor>, [">= 0.13.4"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
70
|
+
s.add_dependency(%q<thor>, [">= 0.13.4"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Confluence
|
2
|
+
class Bookmark < Page
|
3
|
+
BOOKMARKS_PAGE_TITLE = ".bookmarks"
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super(hash)
|
7
|
+
end
|
8
|
+
|
9
|
+
def bookmark_url
|
10
|
+
# return url portion of {bookmark} macro in content
|
11
|
+
content[/\{bookmark:url=([^\}]+)\}/, 1]
|
12
|
+
end
|
13
|
+
|
14
|
+
def description
|
15
|
+
# return description portion of {bookmark} macro in content
|
16
|
+
content[/\{bookmark.*\}([^\{]*)\{bookmark\}/, 1]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find_by_space(spacekey)
|
20
|
+
# get the .bookmarks page for the space
|
21
|
+
bookmarks_page = Page.find_by_title(spacekey, BOOKMARKS_PAGE_TITLE)
|
22
|
+
|
23
|
+
# map each page to a Bookmark
|
24
|
+
bookmarks_page.children.collect {|page| Bookmark.new(page.attributes)}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'xmlrpc/client'
|
2
|
+
require 'ruby-debug'
|
3
|
+
|
4
|
+
# Originally confluence4r, available at: http://confluence.atlassian.com/display/DISC/Confluence4r
|
5
|
+
|
6
|
+
# A useful helper for running Confluence XML-RPC from Ruby. Takes care of
|
7
|
+
# adding the token to each method call (so you can call server.getSpaces()
|
8
|
+
# instead of server.getSpaces(token)). Also takes care of re-logging in
|
9
|
+
# if your login times out.
|
10
|
+
#
|
11
|
+
# Usage:
|
12
|
+
#
|
13
|
+
# client = Confluence::Client.new("http://confluence.atlassian.com")
|
14
|
+
# client.login("user", "password")
|
15
|
+
# puts client.getSpaces()
|
16
|
+
#
|
17
|
+
module Confluence
|
18
|
+
class Client
|
19
|
+
PREFIX = "confluence1"
|
20
|
+
|
21
|
+
attr_reader :username, :token
|
22
|
+
|
23
|
+
def initialize(options = {})
|
24
|
+
server_url = options[:url]
|
25
|
+
server_url += "/rpc/xmlrpc" unless server_url[-11..-1] == "/rpc/xmlrpc"
|
26
|
+
@server_url = server_url
|
27
|
+
|
28
|
+
client = XMLRPC::Client.new_from_uri(server_url)
|
29
|
+
|
30
|
+
@confluence = client.proxy(PREFIX)
|
31
|
+
@token = options[:token]
|
32
|
+
end
|
33
|
+
|
34
|
+
def logged_in?
|
35
|
+
!@token.nil?
|
36
|
+
end
|
37
|
+
|
38
|
+
def login(username, password)
|
39
|
+
@username = username
|
40
|
+
@password = password
|
41
|
+
|
42
|
+
request do |confluence|
|
43
|
+
@token = confluence.login(@username, @password)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def logout
|
48
|
+
request do |confluence|
|
49
|
+
confluence.logout(@token)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def method_missing(method_name, *args)
|
54
|
+
request do |confluence|
|
55
|
+
confluence.send(method_name, *([@token] + args))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def request(&block)
|
62
|
+
begin
|
63
|
+
block.call(@confluence)
|
64
|
+
rescue XMLRPC::FaultException => e
|
65
|
+
raise e.faultString
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Confluence
|
2
|
+
class Page < Record
|
3
|
+
record_attr_accessor :id => :page_id
|
4
|
+
record_attr_accessor :parentId, :space
|
5
|
+
record_attr_accessor :title, :creator, :modifier, :content
|
6
|
+
record_attr_accessor :created, :modified
|
7
|
+
record_attr_accessor :url
|
8
|
+
|
9
|
+
def children
|
10
|
+
client.getChildren(page_id).collect { |child| Page.find_by_id(child["id"]) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def store
|
14
|
+
initialize(client.storePage(attributes))
|
15
|
+
end
|
16
|
+
|
17
|
+
def remove
|
18
|
+
client.removePage(page_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.find_by_id(pageid)
|
22
|
+
self.new(client.getPage(pageid))
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.find_by_title(spacekey, title)
|
26
|
+
self.new(client.getPage(spacekey, title))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Confluence
|
2
|
+
class Record
|
3
|
+
class << self
|
4
|
+
def record_attr_accessor(*args)
|
5
|
+
|
6
|
+
attributes = {}
|
7
|
+
|
8
|
+
# iterate through each argument
|
9
|
+
args.each do |arg|
|
10
|
+
attributes = case arg
|
11
|
+
when Symbol: { arg => arg }
|
12
|
+
when Hash: arg
|
13
|
+
else break
|
14
|
+
end
|
15
|
+
|
16
|
+
attributes.each_pair do |key, name|
|
17
|
+
class_eval %Q{
|
18
|
+
def #{name}
|
19
|
+
self[:#{key}]
|
20
|
+
end
|
21
|
+
|
22
|
+
def #{name}=(value)
|
23
|
+
self[:#{key}] = value
|
24
|
+
end
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_accessor :attributes
|
32
|
+
|
33
|
+
def initialize(hash)
|
34
|
+
@attributes = Hash[*(hash.keys.map {|k| k.to_sym}).zip(hash.values).flatten]
|
35
|
+
end
|
36
|
+
|
37
|
+
def [](attr)
|
38
|
+
@attributes[attr]
|
39
|
+
end
|
40
|
+
|
41
|
+
def []=(attr, value)
|
42
|
+
@attributes[attr] = value
|
43
|
+
end
|
44
|
+
|
45
|
+
def record_id
|
46
|
+
self[:id]
|
47
|
+
end
|
48
|
+
|
49
|
+
def labels
|
50
|
+
client.getLabelsById(record_id).collect {|label| label["name"]}
|
51
|
+
end
|
52
|
+
|
53
|
+
def labels=(value)
|
54
|
+
existing_labels = labels
|
55
|
+
removed_labels = existing_labels - value
|
56
|
+
added_labels = value - existing_labels
|
57
|
+
|
58
|
+
client.removeLabelByName(removed_labels.join(" "), record_id) unless removed_labels.empty?
|
59
|
+
client.addLabelByName(added_labels.join(" "), record_id) unless added_labels.empty?
|
60
|
+
end
|
61
|
+
|
62
|
+
@@client = nil
|
63
|
+
|
64
|
+
def self.client=(client)
|
65
|
+
@@client = client
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.client
|
69
|
+
@@client
|
70
|
+
end
|
71
|
+
|
72
|
+
def client
|
73
|
+
@@client
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/confluencer.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# ensure that lib is in the load path
|
2
|
+
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'thor'
|
6
|
+
|
7
|
+
require 'confluence/client'
|
8
|
+
require 'confluence/record'
|
9
|
+
require 'confluence/page'
|
10
|
+
require 'confluence/bookmark'
|
11
|
+
|
12
|
+
module Confluencer
|
13
|
+
autoload :App, 'confluencer/app'
|
14
|
+
autoload :Bookmarks, 'confluencer/bookmarks'
|
15
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'thor'
|
3
|
+
|
4
|
+
module Confluencer
|
5
|
+
class App < Thor
|
6
|
+
attr_reader :token
|
7
|
+
|
8
|
+
# -v, --verbose
|
9
|
+
class_option :verbose, :desc => "Verbose output", :type => :boolean, :default => false, :aliases => "-v"
|
10
|
+
|
11
|
+
# XMLRPC url and authentication
|
12
|
+
class_option :url, :type => :string, :required => false, :group => "Confluence", :desc => "URL where Confluence is available"
|
13
|
+
class_option :username, :type => :string, :required => false, :aliases => "-u", :group => "Confluence", :desc => "Confluence username"
|
14
|
+
class_option :password, :type => :string, :required => false, :aliases => "-p", :group => "Confluence", :desc => "Confluence password"
|
15
|
+
|
16
|
+
# explicitly specify default_task => :help
|
17
|
+
default_task :help
|
18
|
+
|
19
|
+
desc "login", "Logs in and verifies the Confluence account"
|
20
|
+
def login
|
21
|
+
with_confluence do |confluence|
|
22
|
+
@token = confluence.login(options[:username], options[:password])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def with_confluence(&block)
|
29
|
+
raise Thor::Error, "Required option '--url' missing." unless options.url?
|
30
|
+
raise Thor::Error, "Required option '--username' missing." unless options.username?
|
31
|
+
raise Thor::Error, "Required option '--password' missing." unless options.password?
|
32
|
+
|
33
|
+
client = Confluence::Client.new(:url => options[:url], :token => @token)
|
34
|
+
|
35
|
+
begin
|
36
|
+
# Record objects should use this clent
|
37
|
+
Confluence::Record::client = client
|
38
|
+
|
39
|
+
block.call(client)
|
40
|
+
|
41
|
+
# Nil out client
|
42
|
+
Confluence::Record::client = nil
|
43
|
+
rescue RuntimeError => e
|
44
|
+
raise Thor::Error, e.message.split(":").last.strip
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'confluencer/app'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
module Confluencer
|
5
|
+
class Bookmarks < Confluencer::App
|
6
|
+
BOOKMARKS_PAGE_TITLE = ".bookmarks"
|
7
|
+
|
8
|
+
desc "list SPACEKEY", "Lists the bookmarks in a given space"
|
9
|
+
def list(spacekey)
|
10
|
+
invoke :login
|
11
|
+
|
12
|
+
with_confluence do
|
13
|
+
# grab all bookmarks from space
|
14
|
+
bookmarks = Confluence::Bookmark.find_by_space(spacekey)
|
15
|
+
|
16
|
+
# print out bookmarks
|
17
|
+
puts bookmarks.collect {|b| "#{b.bookmark_url} (#{b.title})"}.join "\n"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
method_option :parent, :type => :string, :default => "Bookmarks", :desc => "Parent page for the pages created", :required => true
|
22
|
+
method_option :template, :type => :string, :desc => "ERB template to use", :required => true
|
23
|
+
desc "create-pages SPACEKEY", "Creates pages for every bookmark"
|
24
|
+
def create_pages(spacekey)
|
25
|
+
invoke :login
|
26
|
+
|
27
|
+
with_confluence do
|
28
|
+
begin
|
29
|
+
# get parent page
|
30
|
+
parent_page = Confluence::Page.find_by_title(spacekey, options[:parent])
|
31
|
+
rescue RuntimeError
|
32
|
+
# page does not exist yet, create it
|
33
|
+
parent_page = Confluence::Page.new :space => spacekey, :title => options[:parent], :content => ""
|
34
|
+
parent_page.store
|
35
|
+
end
|
36
|
+
|
37
|
+
# grab the title of all existing pages
|
38
|
+
existing_titles = parent_page.children.collect {|page| page.title }
|
39
|
+
|
40
|
+
# grab all bookmarks from space
|
41
|
+
bookmarks = Confluence::Bookmark.find_by_space(spacekey)
|
42
|
+
|
43
|
+
# initialize ERB template
|
44
|
+
template = ERB.new(IO.read(options[:template])) unless bookmarks.empty?
|
45
|
+
|
46
|
+
# add a page for each bookmark, remove bookmark in the process
|
47
|
+
bookmarks.each do |bookmark|
|
48
|
+
puts bookmark.title
|
49
|
+
|
50
|
+
labels = bookmark.labels << "bookmark"
|
51
|
+
|
52
|
+
page = Confluence::Page.new :space => spacekey, :parentId => parent_page.page_id, :title => bookmark.title
|
53
|
+
page.content = template.result(binding)
|
54
|
+
|
55
|
+
# remove bookmark before storing page with same title
|
56
|
+
bookmark.remove
|
57
|
+
page.store
|
58
|
+
|
59
|
+
# update labels
|
60
|
+
page.labels = labels
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
libs = " -r irb/completion"
|
4
|
+
|
5
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/confluencer.rb'}"
|
6
|
+
|
7
|
+
# also initialize a default client for the records
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/console_client.rb'}"
|
9
|
+
|
10
|
+
# load console_init
|
11
|
+
libs << " -r #{File.dirname(__FILE__) + '/console_init.rb'}"
|
12
|
+
|
13
|
+
puts "Loading confluencer..."
|
14
|
+
exec "irb #{libs} --simple-prompt"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# TODO: take client configuration from YAML (console_client.yaml) that is ignored by default, add console_client.yaml.example
|
2
|
+
# initialize client
|
3
|
+
client = Confluence::Client.new :url => "http://192.168.1.80:3800"
|
4
|
+
|
5
|
+
# log in with account
|
6
|
+
client.login('bender', 'futurama')
|
7
|
+
|
8
|
+
# Set client for Confluence records
|
9
|
+
Confluence::Record::client = client
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: confluencer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Gabor Ratky
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-05-03 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
version: 1.3.0
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: thor
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 13
|
44
|
+
- 4
|
45
|
+
version: 0.13.4
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: ActiveRecord-like classes that map to Confluence entities and useful scripts that automate tasks
|
49
|
+
email: rgabo@rgabostyle.com
|
50
|
+
executables:
|
51
|
+
- confluencer
|
52
|
+
- confluencer-bookmarks
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files:
|
56
|
+
- LICENSE
|
57
|
+
- README.rdoc
|
58
|
+
files:
|
59
|
+
- .document
|
60
|
+
- .gitignore
|
61
|
+
- .rvmrc
|
62
|
+
- LICENSE
|
63
|
+
- README.rdoc
|
64
|
+
- Rakefile
|
65
|
+
- VERSION
|
66
|
+
- bin/confluencer
|
67
|
+
- bin/confluencer-bookmarks
|
68
|
+
- confluencer.gems
|
69
|
+
- confluencer.gemspec
|
70
|
+
- lib/confluence/bookmark.rb
|
71
|
+
- lib/confluence/client.rb
|
72
|
+
- lib/confluence/page.rb
|
73
|
+
- lib/confluence/record.rb
|
74
|
+
- lib/confluencer.rb
|
75
|
+
- lib/confluencer/app.rb
|
76
|
+
- lib/confluencer/bookmarks.rb
|
77
|
+
- script/console
|
78
|
+
- script/console_client.rb
|
79
|
+
- script/console_init.rb
|
80
|
+
- spec/confluencer_spec.rb
|
81
|
+
- spec/spec.opts
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
- templates/webpage.erb
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: http://github.com/rgabo/confluencer
|
86
|
+
licenses: []
|
87
|
+
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options:
|
90
|
+
- --charset=UTF-8
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
requirements: []
|
108
|
+
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.3.6
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: Useful scripts and classes to manage Confluence
|
114
|
+
test_files:
|
115
|
+
- spec/confluencer_spec.rb
|
116
|
+
- spec/spec_helper.rb
|