vortex_client 0.5.6 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/examples/change_folder_type.rb +10 -0
- data/{create_collection.rb → examples/create_collection.rb} +0 -0
- data/examples/create_collection_flymake.rb +15 -0
- data/examples/ldap_util.rb +52 -0
- data/examples/person_presentation.rb +162 -0
- data/{publish_article.rb → examples/publish_article.rb} +0 -0
- data/examples/publish_article_flymake.rb +16 -0
- data/{publish_event.rb → examples/publish_event.rb} +0 -0
- data/examples/publish_event_flymake.rb +18 -0
- data/{sitemap.rb → examples/sitemap.rb} +0 -0
- data/examples/sitemap_flymake.rb +106 -0
- data/examples/sitemap_flymake_flymake.rb +106 -0
- data/lib/vortex_client/item_extensions.rb +43 -0
- data/lib/vortex_client.rb +56 -3
- metadata +26 -11
- data/convert_faq.rb +0 -298
data/Rakefile
CHANGED
@@ -11,9 +11,10 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/thomasfl/vortex_client"
|
12
12
|
gem.authors = ["Thomas Flemming"]
|
13
13
|
gem.executables = ["vrtx-sync"]
|
14
|
-
gem.add_dependency "net_dav", ">= 0.
|
14
|
+
gem.add_dependency "net_dav", ">= 0.5.0"
|
15
15
|
gem.add_dependency "highline", ">= 1.5.1"
|
16
16
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
17
|
+
gem.files.include %w(lib/vortex_client.rb lib/vortex_client/string_utils.rb lib/vortex_client/item_extensions.rb bin/vrtx-sync)
|
17
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
19
|
end
|
19
20
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.8
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'vortex_client'
|
3
|
+
|
4
|
+
vortex = Vortex::Connection.new(ARGV[0])
|
5
|
+
vortex.find('.',:recursive => true,:suppress_errors => true) do |item|
|
6
|
+
if(item.type == :directory) then
|
7
|
+
puts "Converting " +item.url.to_s
|
8
|
+
item.proppatch('<v:collection-type xmlns:v="vrtx">person-listing</v:collection-type>')
|
9
|
+
end
|
10
|
+
end
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'vortex_client'
|
3
|
+
include Vortex
|
4
|
+
|
5
|
+
vortex = Vortex::Connection.new("https://vortex-dav.uio.no/", ENV['DAVUSER'], ENV['DAVPASS'])
|
6
|
+
vortex.cd('/brukere/thomasfl/events/')
|
7
|
+
|
8
|
+
collection = ArticleListingCollection.new(:url => 'my-collection', :title => 'My articles')
|
9
|
+
path = vortex.create(collection)
|
10
|
+
puts "Created folder: " + path
|
11
|
+
|
12
|
+
|
13
|
+
collection = EventListingCollection.new(:title => 'My events')
|
14
|
+
path = vortex.create(collection)
|
15
|
+
puts "Created folder: " + path
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ldap'
|
3
|
+
|
4
|
+
# Simple utility to get real name from username by querying
|
5
|
+
# ldap.uio.no
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
# realname = ldap_realname(username)
|
9
|
+
#
|
10
|
+
# Install:
|
11
|
+
# sudo gem install ruby-ldap
|
12
|
+
#
|
13
|
+
#
|
14
|
+
# Author: Thomas.Flemming@usit.uio.no 2010
|
15
|
+
|
16
|
+
def ldap_realname(username)
|
17
|
+
|
18
|
+
begin
|
19
|
+
# Workaround for bug in jruby-ldap-0.0.1:
|
20
|
+
LDAP::load_configuration()
|
21
|
+
rescue
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
ldap_host = 'ldap.uio.no'
|
26
|
+
conn = LDAP::Conn.new(ldap_host, LDAP::LDAP_PORT)
|
27
|
+
filter = "(uid=#{username})";
|
28
|
+
base_dn = "dc=uio,dc=no"
|
29
|
+
|
30
|
+
if conn.bound? then
|
31
|
+
conn.unbind()
|
32
|
+
end
|
33
|
+
|
34
|
+
ansatt = nil
|
35
|
+
conn.bind do
|
36
|
+
|
37
|
+
conn.search2("dc=uio,dc=no", LDAP::LDAP_SCOPE_SUBTREE,
|
38
|
+
"(uid=#{username})", nil, false, 0, 0).each do |entry|
|
39
|
+
|
40
|
+
brukernavn = entry.to_hash["uid"][0]
|
41
|
+
fornavn = entry.to_hash["givenName"][0]
|
42
|
+
etternavn = entry.to_hash["sn"][0]
|
43
|
+
# epost = entry.to_hash["mail"][0]
|
44
|
+
# adresse = entry.to_hash["postalAddress"][0]
|
45
|
+
|
46
|
+
return fornavn + " " + etternavn
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,162 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'rubygems'
|
3
|
+
require 'vortex_client'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'time'
|
6
|
+
## require 'ldap_util'
|
7
|
+
|
8
|
+
class PersonPresentasjon
|
9
|
+
|
10
|
+
def initialize(uri,user,pwd)
|
11
|
+
@vortex = Vortex::Connection.new(uri,user,pwd)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def find_pictures(src_url, dest_url, language)
|
16
|
+
count = 0
|
17
|
+
@vortex.find('.',:recursive => true,:suppress_errors => true) do |item|
|
18
|
+
url = item.url.to_s
|
19
|
+
if(item.type == :directory) then
|
20
|
+
new_url = url.gsub(src_url,dest_url)
|
21
|
+
create_person_listing_folder(new_url)
|
22
|
+
elsif(url.match(/\.jpg$|\.png$/i)) then
|
23
|
+
dest_folder = url.gsub(src_url,dest_url)
|
24
|
+
dest_folder = dest_folder.sub(/\.jpg$|\.png$/i,'/')
|
25
|
+
create_person_presentation(url, dest_folder, language)
|
26
|
+
end
|
27
|
+
|
28
|
+
# exit if(count > 6) # TODO Remove this
|
29
|
+
count += 1
|
30
|
+
end
|
31
|
+
|
32
|
+
puts
|
33
|
+
puts "Done creating " + count.to_s + " presentations."
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_person_listing_folder(new_url)
|
37
|
+
mkdir(new_url)
|
38
|
+
puts "Reading folder: " + new_url
|
39
|
+
props = '<v:collection-type xmlns:v="vrtx">person-listing</v:collection-type>' +
|
40
|
+
'<v:resourceType xmlns:v="vrtx">person-listing</v:resourceType>'
|
41
|
+
begin
|
42
|
+
@vortex.proppatch(new_url, props )
|
43
|
+
rescue
|
44
|
+
puts "Warning: problems patching folder: " + new_url
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_person_presentation(url, dest_folder, language)
|
49
|
+
username = dest_folder.sub(/\/$/,'')[/([^\/]*)$/,1]
|
50
|
+
dest_image_url = dest_folder + url[/([^\/]*)$/,1]
|
51
|
+
mkdir(dest_folder)
|
52
|
+
copy(url,dest_image_url)
|
53
|
+
create_json_doc(username, dest_folder, dest_image_url, language)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def mkdir(url)
|
58
|
+
begin
|
59
|
+
@vortex.mkdir(url)
|
60
|
+
rescue
|
61
|
+
puts "Warning: mkdir(" + url + ") exists."
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def copy(src,dest)
|
66
|
+
begin
|
67
|
+
@vortex.copy(src,dest)
|
68
|
+
rescue
|
69
|
+
puts "Warning: cp(src," + dest + ") exists."
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def person_presentation_json(args)
|
74
|
+
image_path = args[:image_path]
|
75
|
+
image_path = image_path.sub(/^https?:\/\/[^\/]*/i,'')
|
76
|
+
image_path = File.basename(image_path)
|
77
|
+
if(args[:language] && args[:language] == :english) then
|
78
|
+
html_xxx = '<h2>Tasks performed<\/h2>\r\n<p>Add information about job duties, as a short text or a bulleted list:<\/p>' +
|
79
|
+
'\r\n<ul>\r\n' +
|
80
|
+
'<li><Task 1><\/li>\r\n' +
|
81
|
+
'<li><Task 1><\/li>\r\n' +
|
82
|
+
'<li>...<\/li>\r\n<\/ul>\r\n<h2>Background<\/h2>\r\n<p>Add information about previous education and employment.<\/p>'
|
83
|
+
html = ''
|
84
|
+
else
|
85
|
+
html = '<h2>Arbeidsområder<\/h2>\r\n<p>Her kan du skrive om arbeidsområder, ' +
|
86
|
+
'enten som kort tekst eller som listepunkter:</p>' +
|
87
|
+
'\r\n' +
|
88
|
+
'<ul>\r\n <li><Arbeidsområde 1></li>\r\n '+
|
89
|
+
'<li><Arbeidsområde 1></li>\r\n <li>...</li>\r\n</ul>' +
|
90
|
+
'\r\n<h2>Bakgrunn</h2>\r\n<p>Eventuelt kort om tidligere arbeidserfaring og utdanning.</p>'
|
91
|
+
end
|
92
|
+
|
93
|
+
json = ''
|
94
|
+
json = <<EOF
|
95
|
+
{
|
96
|
+
"resourcetype": "person",
|
97
|
+
"properties": {
|
98
|
+
"getExternalPersonInfo": "true",
|
99
|
+
"picture": "#{image_path}",
|
100
|
+
"content": "#{html}",
|
101
|
+
"getExternalScientificInformation": "false",
|
102
|
+
"username": "#{args[:username]}",
|
103
|
+
"getRelatedGroups": "true",
|
104
|
+
"getRelatedProjects": "true"
|
105
|
+
}
|
106
|
+
}
|
107
|
+
EOF
|
108
|
+
return json
|
109
|
+
end
|
110
|
+
|
111
|
+
def proppatch_person_presentasjon(json_url,language)
|
112
|
+
time = Time.now.httpdate.to_s
|
113
|
+
properties = '<v:publish-date xmlns:v="vrtx">' + time + '</v:publish-date>' +
|
114
|
+
'<v:userSpecifiedCharacterEncoding xmlns:v="vrtx">utf-8</v:userSpecifiedCharacterEncoding>' +
|
115
|
+
'<d:getcontenttype>application/json</d:getcontenttype>' +
|
116
|
+
'<v:resourceType xmlns:v="vrtx">person</v:resourceType>'
|
117
|
+
if(language == :english) then
|
118
|
+
properties += '<d:getcontentlanguage>en</d:getcontentlanguage>'
|
119
|
+
else
|
120
|
+
## properties += '<d:getcontentlanguage>no</d:getcontentlanguage>'
|
121
|
+
end
|
122
|
+
|
123
|
+
begin
|
124
|
+
@vortex.proppatch(json_url, properties)
|
125
|
+
rescue
|
126
|
+
puts "Warning: error while proppatching: " + json_url
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def create_json_doc(username, path, image_path, language)
|
131
|
+
json = person_presentation_json(:username => username, :image_path => image_path, :language => language)
|
132
|
+
json_url = path + 'index.html'
|
133
|
+
|
134
|
+
puts "Create person page: " + json_url
|
135
|
+
@vortex.put_string(json_url,json)
|
136
|
+
proppatch_person_presentasjon(json_url, language)
|
137
|
+
|
138
|
+
# realname = ldap_realname(username)
|
139
|
+
# if(realname) then
|
140
|
+
# @vortex.proppatch(path, '<v:userTitle xmlns:v="vrtx">' + realname + '</v:userTitle>')
|
141
|
+
# else
|
142
|
+
# puts "Warning: Unable to get info from ldap on: " + username
|
143
|
+
# end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
user = ENV['DAVUSER'] # ask("Username : ") {|q| q.echo = true}
|
149
|
+
pass = ENV['DAVPASS'] # ask("Password : ") {|q| q.echo = false}
|
150
|
+
if(!pass)then
|
151
|
+
puts "Usage: export DAVPASS=pass "
|
152
|
+
exit
|
153
|
+
end
|
154
|
+
|
155
|
+
host = 'https://www2-dav.uio.no'
|
156
|
+
|
157
|
+
src_url = host + '/personer/person-bilder/'
|
158
|
+
dest_url = host + '/english/people/' # 'personpresentasjoner/'
|
159
|
+
|
160
|
+
presentasjoner = PersonPresentasjon.new(src_url, user, pass)
|
161
|
+
presentasjoner.find_pictures(src_url, dest_url, :english)
|
162
|
+
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'vortex_client'
|
3
|
+
include Vortex
|
4
|
+
|
5
|
+
vortex = Vortex::Connection.new("https://vortex-dav.uio.no/")
|
6
|
+
|
7
|
+
vortex.cd('/brukere/thomasfl/nyheter/')
|
8
|
+
article = HtmlArticle.new(:title => "My new title",
|
9
|
+
:introduction => "Short introduction",
|
10
|
+
:body => "<p>Longer body</p>",
|
11
|
+
:publishedDate => Time.now,
|
12
|
+
:author => "Thomas Flemming")
|
13
|
+
path = vortex.publish(article)
|
14
|
+
puts "published " + path
|
15
|
+
|
16
|
+
# => published https://vortex-dav.uio.no/brukere/thomasfl/nyheter/my-new-title.html
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'vortex_client'
|
3
|
+
include Vortex
|
4
|
+
|
5
|
+
vortex = Vortex::Connection.new("https://vortex-dav.uio.no/")
|
6
|
+
vortex.cd('/brukere/thomasfl/events/')
|
7
|
+
event = HtmlEvent.new(:title => "My Sample Event 1",
|
8
|
+
:introduction => "Sample event introduction",
|
9
|
+
:body => "<p>Hello world</p>",
|
10
|
+
:startDate => "19.06.2010 17:56",
|
11
|
+
:endDate => "19.06.2010 19:00",
|
12
|
+
:location => "Forskningsveien 3B",
|
13
|
+
:mapUrl => "http://maps.google.com/123",
|
14
|
+
:tags => ["vortex","testing","ruby"],
|
15
|
+
:publishedDate => Time.now )
|
16
|
+
path = vortex.publish(event)
|
17
|
+
puts "published " + path
|
18
|
+
|
File without changes
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generate sitemap from WebDAV tree:
|
3
|
+
#
|
4
|
+
# Example:
|
5
|
+
#
|
6
|
+
# $ruby generate_vortex_sitemap.rb http://www.iss.uio.no/
|
7
|
+
#
|
8
|
+
# Author: Thomas Flemming, thomas.flemming@usit.uio.no 2010
|
9
|
+
#
|
10
|
+
require "net/https"
|
11
|
+
require "uri"
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'vortex_client'
|
15
|
+
require 'open-uri'
|
16
|
+
|
17
|
+
user = ask("Username : ") {|q| q.echo = true}
|
18
|
+
pwd = ask("Pssword : ") {|q| q.echo = false}
|
19
|
+
|
20
|
+
|
21
|
+
# Returns "200" if everything's ok.
|
22
|
+
def responseCode(url)
|
23
|
+
uri = URI.parse(url)
|
24
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
25
|
+
if(uri.scheme == "https")
|
26
|
+
http.use_ssl = true
|
27
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
28
|
+
end
|
29
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
30
|
+
response = http.request(request)
|
31
|
+
return response.code
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def property(item, xpath)
|
36
|
+
namespaces = {'v' => "vrtx",'d' => "DAV:"}
|
37
|
+
xml = item.propfind
|
38
|
+
xml.xpath(xpath, namespaces).inner_text
|
39
|
+
end
|
40
|
+
|
41
|
+
def dav_url2http_url(url)
|
42
|
+
if(url =~ /\/vortex-dav\./)
|
43
|
+
url = url.sub( /\/vortex-dav\./, '/vortex.' )
|
44
|
+
else
|
45
|
+
url = url.sub(/https:\/\/www-dav\./,'http://www.')
|
46
|
+
end
|
47
|
+
return url
|
48
|
+
end
|
49
|
+
|
50
|
+
def http_url2dav_url(url)
|
51
|
+
url = url.sub(/^http:\/\//i,'https://')
|
52
|
+
url = url.sub(/^https?:\/\/www\./i,'https://www-dav.')
|
53
|
+
return url
|
54
|
+
end
|
55
|
+
|
56
|
+
def outline_number(url)
|
57
|
+
@numbering = [] if(@numbering == nil)
|
58
|
+
@prev_url = "" if(@prev_url == nil)
|
59
|
+
|
60
|
+
size = url.split(/\//).size
|
61
|
+
prev_size = @prev_url.split(/\//).size
|
62
|
+
|
63
|
+
if(size > prev_size)
|
64
|
+
@numbering << 1
|
65
|
+
end
|
66
|
+
|
67
|
+
if(size < prev_size)
|
68
|
+
index = size - 1
|
69
|
+
# index = @numbering.size - 2
|
70
|
+
@numbering = @numbering[0..index]
|
71
|
+
@numbering[index] = @numbering.last + 1
|
72
|
+
end
|
73
|
+
|
74
|
+
if(prev_size == size)
|
75
|
+
index = @numbering.size - 1
|
76
|
+
@numbering[index] = @numbering.last + 1
|
77
|
+
end
|
78
|
+
|
79
|
+
@prev_url = url
|
80
|
+
return @numbering.join(".")
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
url = ARGV[0]
|
85
|
+
dav_url = http_url2dav_url(url)
|
86
|
+
|
87
|
+
vortex = Vortex::Connection.new(dav_url,user,pwd)
|
88
|
+
|
89
|
+
vortex.find('.',:recursive => true,:suppress_errors => true) do |item|
|
90
|
+
url = item.url.to_s
|
91
|
+
if(url =~ /\/$/ ) # Print folders onlye
|
92
|
+
collectionTitle = property(item,'.//v:collectionTitle') # Vortex folder title
|
93
|
+
resourceType = property(item,'.//v:resourceType') # Vortex folder type
|
94
|
+
http_url = dav_url2http_url(url)
|
95
|
+
responseCode = responseCode(http_url)
|
96
|
+
path = URI.parse(url).path
|
97
|
+
foldername = path[/\/([^\/]*)\/$/,1]
|
98
|
+
|
99
|
+
if(responseCode == "200" and not(foldername =~ /^[\.|_]/ or path =~ /^\/vrtx\// ) )
|
100
|
+
number = outline_number(path)
|
101
|
+
puts "#{number};#{foldername};#{http_url};#{collectionTitle}"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generate sitemap from WebDAV tree:
|
3
|
+
#
|
4
|
+
# Example:
|
5
|
+
#
|
6
|
+
# $ruby generate_vortex_sitemap.rb http://www.iss.uio.no/
|
7
|
+
#
|
8
|
+
# Author: Thomas Flemming, thomas.flemming@usit.uio.no 2010
|
9
|
+
#
|
10
|
+
require "net/https"
|
11
|
+
require "uri"
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'vortex_client'
|
15
|
+
require 'open-uri'
|
16
|
+
|
17
|
+
user = ask("Username : ") {|q| q.echo = true}
|
18
|
+
pwd = ask("Pssword : ") {|q| q.echo = false}
|
19
|
+
|
20
|
+
|
21
|
+
# Returns "200" if everything's ok.
|
22
|
+
def responseCode(url)
|
23
|
+
uri = URI.parse(url)
|
24
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
25
|
+
if(uri.scheme == "https")
|
26
|
+
http.use_ssl = true
|
27
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
28
|
+
end
|
29
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
30
|
+
response = http.request(request)
|
31
|
+
return response.code
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def property(item, xpath)
|
36
|
+
namespaces = {'v' => "vrtx",'d' => "DAV:"}
|
37
|
+
xml = item.propfind
|
38
|
+
xml.xpath(xpath, namespaces).inner_text
|
39
|
+
end
|
40
|
+
|
41
|
+
def dav_url2http_url(url)
|
42
|
+
if(url =~ /\/vortex-dav\./)
|
43
|
+
url = url.sub( /\/vortex-dav\./, '/vortex.' )
|
44
|
+
else
|
45
|
+
url = url.sub(/https:\/\/www-dav\./,'http://www.')
|
46
|
+
end
|
47
|
+
return url
|
48
|
+
end
|
49
|
+
|
50
|
+
def http_url2dav_url(url)
|
51
|
+
url = url.sub(/^http:\/\//i,'https://')
|
52
|
+
url = url.sub(/^https?:\/\/www\./i,'https://www-dav.')
|
53
|
+
return url
|
54
|
+
end
|
55
|
+
|
56
|
+
def outline_number(url)
|
57
|
+
@numbering = [] if(@numbering == nil)
|
58
|
+
@prev_url = "" if(@prev_url == nil)
|
59
|
+
|
60
|
+
size = url.split(/\//).size
|
61
|
+
prev_size = @prev_url.split(/\//).size
|
62
|
+
|
63
|
+
if(size > prev_size)
|
64
|
+
@numbering << 1
|
65
|
+
end
|
66
|
+
|
67
|
+
if(size < prev_size)
|
68
|
+
index = size - 1
|
69
|
+
# index = @numbering.size - 2
|
70
|
+
@numbering = @numbering[0..index]
|
71
|
+
@numbering[index] = @numbering.last + 1
|
72
|
+
end
|
73
|
+
|
74
|
+
if(prev_size == size)
|
75
|
+
index = @numbering.size - 1
|
76
|
+
@numbering[index] = @numbering.last + 1
|
77
|
+
end
|
78
|
+
|
79
|
+
@prev_url = url
|
80
|
+
return @numbering.join(".")
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
url = ARGV[0]
|
85
|
+
dav_url = http_url2dav_url(url)
|
86
|
+
|
87
|
+
vortex = Vortex::Connection.new(dav_url,user,pwd)
|
88
|
+
|
89
|
+
vortex.find('.',:recursive => true,:suppress_errors => true) do |item|
|
90
|
+
url = item.url.to_s
|
91
|
+
if(url =~ /\/$/ ) # Print folders onlye
|
92
|
+
collectionTitle = property(item,'.//v:collectionTitle') # Vortex folder title
|
93
|
+
resourceType = property(item,'.//v:resourceType') # Vortex folder type
|
94
|
+
http_url = dav_url2http_url(url)
|
95
|
+
responseCode = responseCode(http_url)
|
96
|
+
path = URI.parse(url).path
|
97
|
+
foldername = path[/\/([^\/]*)\/$/,1]
|
98
|
+
|
99
|
+
if(responseCode == "200" and not(foldername =~ /^[\.|_]/ or path =~ /^\/vrtx\// ) )
|
100
|
+
number = outline_number(path)
|
101
|
+
puts "#{number};#{foldername};#{http_url};#{collectionTitle}"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Extend Net::DAV::Item
|
2
|
+
|
3
|
+
module Net
|
4
|
+
class DAV
|
5
|
+
class Item
|
6
|
+
|
7
|
+
def property(xpath)
|
8
|
+
namespaces = {'v' => "vrtx",'d' => "DAV:"}
|
9
|
+
xml = propfind
|
10
|
+
res = xml.xpath(xpath, namespaces)
|
11
|
+
if(res != nil)then
|
12
|
+
if(res.size > 0)then
|
13
|
+
return res.first.inner_text
|
14
|
+
else
|
15
|
+
return res.inner_text
|
16
|
+
end
|
17
|
+
end
|
18
|
+
return nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def method_missing(method, *args, &block)
|
22
|
+
result = property('.//v:' + method.to_s)
|
23
|
+
if(result != nil or result != "")then
|
24
|
+
return result
|
25
|
+
end
|
26
|
+
|
27
|
+
result = property('.//d:' + method.to_s)
|
28
|
+
if(result != nil or result != "")then
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
|
32
|
+
result = property('.//' + method.to_s)
|
33
|
+
if(result != nil or result != "")then
|
34
|
+
return result
|
35
|
+
end
|
36
|
+
|
37
|
+
raise "Method missing: Net::DAV::Item." + method.to_s
|
38
|
+
return nil
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/vortex_client.rb
CHANGED
@@ -17,11 +17,31 @@ module Vortex
|
|
17
17
|
#
|
18
18
|
# Examples:
|
19
19
|
#
|
20
|
-
#
|
20
|
+
# Prompt for username and password:
|
21
21
|
#
|
22
22
|
# vortex = Vortex::Connection.new("https://www-dav.server.com") =>
|
23
|
-
#
|
24
|
-
#
|
23
|
+
# Username: tiger
|
24
|
+
# Password: *****
|
25
|
+
#
|
26
|
+
# Retrieve password from KeyChain if running on OS X. Username must be the
|
27
|
+
# the same on server as user locally.
|
28
|
+
#
|
29
|
+
# Requires 'osx_keychain' and 'RubyInline' gem. To install
|
30
|
+
# $ sudo gem install RubyInline
|
31
|
+
# $ sudo gem instal osx_keychain
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# vortex = Vortex::Connection.new("https://www-dav.server.com", :use_osx_keychain => true)
|
35
|
+
# Password not found in OS X KeyChain.
|
36
|
+
# Enter password to store new password in OS X KeyChain.
|
37
|
+
# Password: *****
|
38
|
+
# Password for 'tiger' on 'www-dav.server.com' stored in OS X KeyChain.
|
39
|
+
#
|
40
|
+
# Supply username and password. Not recommended:
|
41
|
+
#
|
42
|
+
# vortex = Vortex::Connection.new("https://www-dav.server.com",user,pass)
|
43
|
+
#
|
44
|
+
#
|
25
45
|
def initialize(uri, *args)
|
26
46
|
@uri = uri
|
27
47
|
@uri = URI.parse(@uri) if @uri.is_a? String
|
@@ -29,6 +49,39 @@ module Vortex
|
|
29
49
|
@handler = NetHttpHandler.new(@uri)
|
30
50
|
@handler.verify_server = false # This defaults to true in Net::DAV
|
31
51
|
if(args != [])
|
52
|
+
if(args[0][:use_osx_keychain])then
|
53
|
+
|
54
|
+
# Retrieve password from OS X KeyChain.
|
55
|
+
osx = (RUBY_PLATFORM =~ /darwin/)
|
56
|
+
if(osx)then
|
57
|
+
|
58
|
+
require 'osx_keychain'
|
59
|
+
keychain = OSXKeychain.new
|
60
|
+
user = ENV['USER']
|
61
|
+
pass = keychain[@uri.host, user ]
|
62
|
+
|
63
|
+
if(pass == nil) then
|
64
|
+
puts "Password not found in OS X KeyChain. "
|
65
|
+
puts "Enter password to store new password in OS X KeyChain."
|
66
|
+
## @handler.user = ask("Username: ") {|q| q.echo = true}
|
67
|
+
## Todo: store username in a config file so we can have
|
68
|
+
## different username locally and on server
|
69
|
+
pass = ask("Password: ") {|q| q.echo = "*"} # false => no echo
|
70
|
+
keychain[@uri.host, user] = pass
|
71
|
+
puts "Password for '#{user}' on '#{@uri.host}' stored in OS X KeyChain."
|
72
|
+
@handler.user = user
|
73
|
+
@handler.pass = pass
|
74
|
+
else
|
75
|
+
@handler.user = user
|
76
|
+
@handler.pass = pass
|
77
|
+
end
|
78
|
+
return @handler
|
79
|
+
|
80
|
+
else
|
81
|
+
puts "Warning: Not running on OS X."
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
32
85
|
@handler.user = args[0]
|
33
86
|
@handler.pass = args[1]
|
34
87
|
else
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 8
|
9
|
+
version: 0.5.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Thomas Flemming
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-08 00:00:00 +02:00
|
18
18
|
default_executable: vrtx-sync
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +26,9 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 0.
|
29
|
+
- 5
|
30
|
+
- 0
|
31
|
+
version: 0.5.0
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -74,13 +74,16 @@ files:
|
|
74
74
|
- Rakefile
|
75
75
|
- VERSION
|
76
76
|
- bin/vrtx-sync
|
77
|
-
-
|
78
|
-
- create_collection.rb
|
77
|
+
- examples/change_folder_type.rb
|
78
|
+
- examples/create_collection.rb
|
79
|
+
- examples/ldap_util.rb
|
80
|
+
- examples/person_presentation.rb
|
81
|
+
- examples/publish_article.rb
|
82
|
+
- examples/publish_event.rb
|
83
|
+
- examples/sitemap.rb
|
79
84
|
- lib/vortex_client.rb
|
85
|
+
- lib/vortex_client/item_extensions.rb
|
80
86
|
- lib/vortex_client/string_utils.rb
|
81
|
-
- publish_article.rb
|
82
|
-
- publish_event.rb
|
83
|
-
- sitemap.rb
|
84
87
|
- test/helper.rb
|
85
88
|
- test/test_acl.rb
|
86
89
|
- test/test_date_conversion.rb
|
@@ -134,3 +137,15 @@ test_files:
|
|
134
137
|
- test/test_vortex_pic.rb
|
135
138
|
- test/test_vortex_tags.rb
|
136
139
|
- test/test_vortex_utils.rb
|
140
|
+
- examples/change_folder_type.rb
|
141
|
+
- examples/create_collection.rb
|
142
|
+
- examples/create_collection_flymake.rb
|
143
|
+
- examples/ldap_util.rb
|
144
|
+
- examples/person_presentation.rb
|
145
|
+
- examples/publish_article.rb
|
146
|
+
- examples/publish_article_flymake.rb
|
147
|
+
- examples/publish_event.rb
|
148
|
+
- examples/publish_event_flymake.rb
|
149
|
+
- examples/sitemap.rb
|
150
|
+
- examples/sitemap_flymake.rb
|
151
|
+
- examples/sitemap_flymake_flymake.rb
|
data/convert_faq.rb
DELETED
@@ -1,298 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'open-uri'
|
4
|
-
require 'hpricot'
|
5
|
-
# require 'webdavtools'
|
6
|
-
require 'vortex_client'
|
7
|
-
include Vortex
|
8
|
-
|
9
|
-
# Convert vortex xml faq til html faq:
|
10
|
-
# Example:
|
11
|
-
#
|
12
|
-
# ruby convert_faq.rb https://www-dav.uio.no/faq/studier/fronter.xml https://www-dav.usit.uio.no/it/fronter/faq.html
|
13
|
-
#
|
14
|
-
# Author: Thomas Flemming, 2010
|
15
|
-
#
|
16
|
-
|
17
|
-
ARTICLE_HEADER = <<EOF
|
18
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
20
|
-
<head>
|
21
|
-
<title>##title##</title>
|
22
|
-
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
|
23
|
-
|
24
|
-
</head>
|
25
|
-
<body>
|
26
|
-
<style type="text/css">
|
27
|
-
.vrtx-published-date {
|
28
|
-
display: none;
|
29
|
-
}
|
30
|
-
</style>
|
31
|
-
<br />
|
32
|
-
${resource:toc}
|
33
|
-
EOF
|
34
|
-
|
35
|
-
ARTICLE_FOOTER = <<EOF
|
36
|
-
</body>
|
37
|
-
</html>
|
38
|
-
EOF
|
39
|
-
|
40
|
-
|
41
|
-
# Parsing av HTML koden til FAQ med 2 nivåer
|
42
|
-
def scrape_faq_2_levels(url)
|
43
|
-
html = ""
|
44
|
-
doc = Hpricot(open(url))
|
45
|
-
doc.search(".faqOverskrift") do |item|
|
46
|
-
html += "<h2 class=\"faqOverskrift\">" + item.inner_html + "</h2>\n"
|
47
|
-
item = item.next_sibling
|
48
|
-
while item and item.name != "h2" and item.name != "br"
|
49
|
-
|
50
|
-
if item.attributes["class"] and item.attributes["class"] =~ /faqOverskrift/ then
|
51
|
-
puts "Parse error: Unwanted item: " + item.to_s
|
52
|
-
end
|
53
|
-
|
54
|
-
if not( item.name == "a" and item.inner_text == "") then
|
55
|
-
if item.attributes["class"] and item.attributes["class"] =~ /faqSporsmal/ then
|
56
|
-
html += "<h3 class=\"faqSporsmal\">" + item.inner_html + "</h3>\n"
|
57
|
-
else
|
58
|
-
html += item.to_s + "\n"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
item = item.next_sibling
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
return html
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
def scrape_faq_1_level(url)
|
70
|
-
doc = Hpricot(open(url))
|
71
|
-
html = ""
|
72
|
-
doc.search(".faqSporsmal") do |item|
|
73
|
-
html += "<h2 class=\"faqSporsmal\">" + item.inner_html + "</h2>\n"
|
74
|
-
item = item.next_sibling
|
75
|
-
while item and ((item.attributes["class"] =~ /faqSporsmal/) == nil) and item.name != "h2" and item.name != "br"
|
76
|
-
item = item.next_sibling if(item.name == "a" and item.inner_html == "")
|
77
|
-
if(item.attributes["class"] =~ /faqSvar/) then
|
78
|
-
html += item.inner_html.to_s + "\n"
|
79
|
-
else
|
80
|
-
html += item.to_s + "\n"
|
81
|
-
end
|
82
|
-
|
83
|
-
item = item.next_sibling
|
84
|
-
end
|
85
|
-
end
|
86
|
-
return html
|
87
|
-
end
|
88
|
-
|
89
|
-
# Skrap html kode til faq og konverter til nytt format
|
90
|
-
def scrape_faq_html(url)
|
91
|
-
|
92
|
-
doc = Hpricot(open(url))
|
93
|
-
|
94
|
-
if( doc.search(".faqOverskrift").size == 0 ) then
|
95
|
-
puts "Konverting FAQ with 1 level..."
|
96
|
-
return scrape_faq_1_level(url)
|
97
|
-
else
|
98
|
-
puts "Konverting FAQ with 2 levels..."
|
99
|
-
return scrape_faq_2_levels(url)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def davUrl2webUrl(url)
|
104
|
-
if(url =~ /^https:\/\/([^\/]*)-dav(\..*)/)then
|
105
|
-
return "http://" + $1 + $2
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# Extracts introduction from FAQ
|
110
|
-
def scrape_faq_introduction(url)
|
111
|
-
introduction = ""
|
112
|
-
doc = Hpricot(open(url))
|
113
|
-
|
114
|
-
doc.search("h1") do |item|
|
115
|
-
|
116
|
-
item = item.next_sibling
|
117
|
-
|
118
|
-
while item and item.name != "h2" and item.name != "h3"
|
119
|
-
introduction = introduction + item.inner_html # text
|
120
|
-
item = item.next_sibling
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
introduction = introduction.gsub(/</,"<").gsub(/>/,">")
|
126
|
-
introduction = introduction.gsub("ø","ø").gsub("å","å").gsub("æ","æ")
|
127
|
-
introduction = introduction.gsub("Ø","Ø").gsub("Å","Å").gsub("&Aelig;","Æ")
|
128
|
-
introduction = introduction.gsub(/"/m,""")
|
129
|
-
introduction = introduction.gsub(/'/m,"") #’")
|
130
|
-
introduction = introduction.sub(/\n/m," ").sub(/\r/m," ")
|
131
|
-
introduction = introduction.sub(/^\s*/, "").chop!
|
132
|
-
return introduction
|
133
|
-
end
|
134
|
-
|
135
|
-
# Konverterter WebDAV properties fra managed-xml dokumenter til article dokumenter.
|
136
|
-
def convert_dav_propes(dav_url)
|
137
|
-
props_arr = []
|
138
|
-
unwanted_properties =
|
139
|
-
["v:guessedcharacterencoding",
|
140
|
-
"v:schema",
|
141
|
-
# Example: <customdefined xmlns="http://www.uio.no/visual-profile">true</..
|
142
|
-
# "customdefined",
|
143
|
-
# Derived properties that dont' need to be set:
|
144
|
-
"d:displayname",
|
145
|
-
"d:getcontentlength",
|
146
|
-
"d:getetag",
|
147
|
-
"v:collection",
|
148
|
-
"v:propertieslastmodified",
|
149
|
-
"v:propertiesmodifiedby",
|
150
|
-
"d:resourcetype",
|
151
|
-
"v:title"
|
152
|
-
]
|
153
|
-
props = Hpricot( @vortex_source.propfind(dav_url).to_s )
|
154
|
-
props.search("d:resourcetype/*") do |item|
|
155
|
-
if item.is_a?(Hpricot::Elem) and (unwanted_properties.grep(item.name) == [] )
|
156
|
-
prop =
|
157
|
-
case item.name
|
158
|
-
when "v:managedxmltitle"
|
159
|
-
title = item.inner_html
|
160
|
-
"<v:userTitle xmlns:v=\"vrtx\">#{title}</v:userTitle>"
|
161
|
-
when "v:characterencoding"
|
162
|
-
item.to_s.gsub(/UTF-/,"utf-") +
|
163
|
-
"<v:userSpecifiedCharacterEncoding xmlns:v=\"vrtx\">utf-8</v:userSpecifiedCharacterEncoding>"
|
164
|
-
when "v:resourcetype"
|
165
|
-
"<v:resourceType xmlns:v=\"vrtx\">article</v:resourceType>" +
|
166
|
-
"<v:xhtml10-type xmlns:v=\"vrtx\">article</v:xhtml10-type>"
|
167
|
-
when "v:contentlastmodified"
|
168
|
-
lastModifiedDate = item.inner_html
|
169
|
-
# Articles needs published-date to be visible. Use lastModified:
|
170
|
-
props_arr << "<v:published-date xmlns:v=\"vrtx\">#{lastModifiedDate}</v:published-date>"
|
171
|
-
item.to_s
|
172
|
-
when "customdefined"
|
173
|
-
item.to_s.gsub(/customdefined/, "customDefined") # attribute name is camelCase in article
|
174
|
-
when "editoremail"
|
175
|
-
item.to_s.gsub(/editoremail/, "editorEmail") # attribute name is camelCase in article
|
176
|
-
when "editorname"
|
177
|
-
item.to_s.gsub(/editorname/, "editorName") # attribute name is camelCase in article
|
178
|
-
else
|
179
|
-
item.to_s
|
180
|
-
end
|
181
|
-
props_arr << prop
|
182
|
-
end
|
183
|
-
end
|
184
|
-
return props_arr.sort().join("\n")
|
185
|
-
end
|
186
|
-
|
187
|
-
def convert_faq(dav_url, new_dav_url)
|
188
|
-
url = davUrl2webUrl(dav_url)
|
189
|
-
puts "Scraping html from: " + url
|
190
|
-
|
191
|
-
# Scrape document title
|
192
|
-
begin
|
193
|
-
doc = Hpricot(open(url))
|
194
|
-
rescue
|
195
|
-
puts "Kunne ikke åpne url: " + url
|
196
|
-
return
|
197
|
-
end
|
198
|
-
title = doc.search("title").inner_text
|
199
|
-
new_html = ARTICLE_HEADER.gsub(/##title##/, title) + scrape_faq_html(url) + ARTICLE_FOOTER
|
200
|
-
|
201
|
-
new_props = convert_dav_propes(dav_url)
|
202
|
-
|
203
|
-
introduction = scrape_faq_introduction(url)
|
204
|
-
if(introduction != nil and introduction != "") then
|
205
|
-
new_props = new_props + "<introduction>#{introduction}</introduction>"
|
206
|
-
end
|
207
|
-
|
208
|
-
# WebDAV.delete(new_dav_url)
|
209
|
-
# WebDAV.publish(new_dav_url, new_html, new_props)
|
210
|
-
begin
|
211
|
-
@vortex_dest.delete(new_dav_url)
|
212
|
-
rescue
|
213
|
-
end
|
214
|
-
# puts "DEBUG: " + new_dav_url + new_html + new_props
|
215
|
-
@vortex_dest.put_string(new_dav_url, new_html)
|
216
|
-
@vortex_dest.proppatch(new_dav_url, new_props)
|
217
|
-
|
218
|
-
end
|
219
|
-
|
220
|
-
|
221
|
-
#
|
222
|
-
# Generer rapport med oversikt over alle FAQ'er
|
223
|
-
#
|
224
|
-
HEADER = <<EOF
|
225
|
-
<table border="1">
|
226
|
-
<tbody>
|
227
|
-
<tr>
|
228
|
-
<th bgcolor="#c0c0c0" align="left" bordercolor="#FFFFFF">Tittel</th>
|
229
|
-
<th bgcolor="#c0c0c0" align="left" bordercolor="#FFFFFF">Orginal plassering</th>
|
230
|
-
<th bgcolor="#c0c0c0" align="left" bordercolor="#FFFFFF">Epost</th>
|
231
|
-
<th bgcolor="#c0c0c0" align="left" bordercolor="#FFFFFF">Status</th>
|
232
|
-
<th bgcolor="#c0c0c0" align="left" bordercolor="#FFFFFF">Skal konverteres til</th>
|
233
|
-
<th bgcolor="#c0c0c0" align="left" bordercolor="#FFFFFF">Er konvertert</th>
|
234
|
-
</tr>
|
235
|
-
EOF
|
236
|
-
|
237
|
-
def print_status_report(dav_url)
|
238
|
-
arr = []
|
239
|
-
count = 0
|
240
|
-
@vortex_source.find(dav_url, :recursive => true) do |item|
|
241
|
-
|
242
|
-
if( item.basename =~ /.xml$/ and (not(item.basename =~ /index.xml$/ )))then
|
243
|
-
url = item.href
|
244
|
-
url = url.sub(/^https/, "http").sub(/-dav\.uio\.no/,".uio.no")
|
245
|
-
arr.push([item.title, url, item.basename])
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
puts HEADER
|
250
|
-
arr.sort.each do |item|
|
251
|
-
# puts item[0] + item[1] + item[2]
|
252
|
-
puts "<tr>"
|
253
|
-
puts " <td>" + item[0] + "</td><td><a href=\"#{item[1]}\">#{item[2]}</a></td>"
|
254
|
-
puts " <td> </td><td> </td><td> </td><td> </td>"
|
255
|
-
puts "</tr>"
|
256
|
-
end
|
257
|
-
puts "</table>"
|
258
|
-
end
|
259
|
-
|
260
|
-
# Konverter alle FAQ dokumentene
|
261
|
-
def convert_recursively(url)
|
262
|
-
@vortex_source.find(dav_url, :recursive => true) do |item|
|
263
|
-
if( item.basename =~ /.xml$/ and (not(item.basename =~ /index.xml$/ )))then
|
264
|
-
puts "Converterting: " + item.basename.ljust(40) + item.title
|
265
|
-
dav_url = item.href
|
266
|
-
new_dav_url = dav_url.sub(/\.xml$/,".html")
|
267
|
-
convert_faq(dav_url, new_dav_url)
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
|
273
|
-
# Usage:
|
274
|
-
#
|
275
|
-
# convert_faq()
|
276
|
-
#
|
277
|
-
# convert_faq("https://www-dav.usit.uio.no/it/epost/faq/thunderbird-itansv.xml",
|
278
|
-
# "https://vortex-dav.uio.no/brukere/thomasfl/thunderbird-itansv-faq.html")
|
279
|
-
# convert_faq("https://www-dav.uio.no/faq/studier/teologi-studentinfo.xml", "https://www-dav.tf.uio.no/studier/faq.html")
|
280
|
-
# convert_faq("https://www-dav.uio.no/faq/for_ansatte/usit-nyansatte.xml",
|
281
|
-
# "https://www-dav.usit.uio.no/for-ansatte/ny-usit/nyansatt.html")
|
282
|
-
# exit
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
# Les inn gammel og ny url
|
287
|
-
src_url = ARGV[0]
|
288
|
-
dest_url = ARGV[1]
|
289
|
-
if(not(src_url and dest_url))
|
290
|
-
puts "Usage: ruby convert src_dav_url destinatio_dav_url"
|
291
|
-
exit
|
292
|
-
end
|
293
|
-
|
294
|
-
@vortex_source = Vortex::Connection.new(src_url, ENV['DAVUSER'], ENV['DAVPASS'])
|
295
|
-
@vortex_dest = Vortex::Connection.new(dest_url, ENV['DAVUSER'], ENV['DAVPASS'])
|
296
|
-
|
297
|
-
convert_faq(src_url, dest_url)
|
298
|
-
puts "Published FAQ article to: " + dest_url
|