fairtilizer-vpim 0.695
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +510 -0
- data/COPYING +58 -0
- data/README +182 -0
- data/lib/vpim.rb +13 -0
- data/lib/vpim/address.rb +219 -0
- data/lib/vpim/agent/atomize.rb +104 -0
- data/lib/vpim/agent/base.rb +73 -0
- data/lib/vpim/agent/calendars.rb +173 -0
- data/lib/vpim/agent/handler.rb +26 -0
- data/lib/vpim/agent/ics.rb +161 -0
- data/lib/vpim/attachment.rb +102 -0
- data/lib/vpim/date.rb +222 -0
- data/lib/vpim/dirinfo.rb +277 -0
- data/lib/vpim/duration.rb +119 -0
- data/lib/vpim/enumerator.rb +32 -0
- data/lib/vpim/field.rb +614 -0
- data/lib/vpim/icalendar.rb +384 -0
- data/lib/vpim/maker/vcard.rb +16 -0
- data/lib/vpim/property/base.rb +193 -0
- data/lib/vpim/property/common.rb +315 -0
- data/lib/vpim/property/location.rb +38 -0
- data/lib/vpim/property/priority.rb +43 -0
- data/lib/vpim/property/recurrence.rb +69 -0
- data/lib/vpim/property/resources.rb +24 -0
- data/lib/vpim/repo.rb +261 -0
- data/lib/vpim/rfc2425.rb +367 -0
- data/lib/vpim/rrule.rb +591 -0
- data/lib/vpim/time.rb +40 -0
- data/lib/vpim/vcard.rb +1426 -0
- data/lib/vpim/version.rb +18 -0
- data/lib/vpim/vevent.rb +187 -0
- data/lib/vpim/view.rb +90 -0
- data/lib/vpim/vjournal.rb +58 -0
- data/lib/vpim/vpim.rb +65 -0
- data/lib/vpim/vtodo.rb +103 -0
- data/samples/README.mutt +93 -0
- data/samples/ab-query.rb +57 -0
- data/samples/agent.ru +10 -0
- data/samples/cmd-itip.rb +156 -0
- data/samples/ex_cpvcard.rb +55 -0
- data/samples/ex_get_vcard_photo.rb +22 -0
- data/samples/ex_mkv21vcard.rb +34 -0
- data/samples/ex_mkvcard.rb +64 -0
- data/samples/ex_mkyourown.rb +29 -0
- data/samples/ics-dump.rb +210 -0
- data/samples/ics-to-rss.rb +84 -0
- data/samples/mutt-aliases-to-vcf.rb +45 -0
- data/samples/osx-wrappers.rb +86 -0
- data/samples/reminder.rb +209 -0
- data/samples/rrule.rb +71 -0
- data/samples/tabbed-file-to-vcf.rb +390 -0
- data/samples/vcf-dump.rb +86 -0
- data/samples/vcf-lines.rb +61 -0
- data/samples/vcf-to-ics.rb +22 -0
- data/samples/vcf-to-mutt.rb +121 -0
- data/test/test_agent_atomize.rb +84 -0
- data/test/test_agent_calendars.rb +128 -0
- data/test/test_agent_ics.rb +96 -0
- data/test/test_all.rb +17 -0
- data/test/test_date.rb +120 -0
- data/test/test_dur.rb +41 -0
- data/test/test_field.rb +156 -0
- data/test/test_ical.rb +437 -0
- data/test/test_misc.rb +13 -0
- data/test/test_repo.rb +129 -0
- data/test/test_rrule.rb +1030 -0
- data/test/test_vcard.rb +973 -0
- data/test/test_view.rb +79 -0
- metadata +140 -0
data/samples/vcf-dump.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$-w = true
|
4
|
+
$:.unshift File.dirname($0) + '/../lib'
|
5
|
+
|
6
|
+
require 'pp'
|
7
|
+
require 'getoptlong'
|
8
|
+
require 'vpim/vcard'
|
9
|
+
|
10
|
+
HELP =<<EOF
|
11
|
+
Usage: #{$0} <vcard>...
|
12
|
+
|
13
|
+
Options
|
14
|
+
-h,--help Print this helpful message.
|
15
|
+
-n,--name Print the vCard name.
|
16
|
+
-d,--debug Print debug information.
|
17
|
+
|
18
|
+
Examples:
|
19
|
+
EOF
|
20
|
+
|
21
|
+
opt_name = nil
|
22
|
+
opt_debug = nil
|
23
|
+
|
24
|
+
opts = GetoptLong.new(
|
25
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
26
|
+
[ "--name", "-n", GetoptLong::NO_ARGUMENT ],
|
27
|
+
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
|
28
|
+
)
|
29
|
+
|
30
|
+
opts.each do |opt, arg|
|
31
|
+
case opt
|
32
|
+
when "--help" then
|
33
|
+
puts HELP
|
34
|
+
exit 0
|
35
|
+
|
36
|
+
when "--name" then
|
37
|
+
opt_name = true
|
38
|
+
|
39
|
+
when "--debug" then
|
40
|
+
opt_debug = true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if ARGV.length < 1
|
45
|
+
puts "no vcard files specified, try -h!"
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
49
|
+
ARGV.each do |file|
|
50
|
+
|
51
|
+
cards = Vpim::Vcard.decode(open(file))
|
52
|
+
|
53
|
+
cards.each do |card|
|
54
|
+
card.each do |field|
|
55
|
+
puts "..#{field.name.capitalize}=#{field.value.inspect}"
|
56
|
+
|
57
|
+
if field.group
|
58
|
+
puts " group=#{field.group}"
|
59
|
+
end
|
60
|
+
|
61
|
+
field.each_param do |param, values|
|
62
|
+
puts " #{param}=[#{values.join(", ")}]"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
if opt_name
|
67
|
+
begin
|
68
|
+
puts "#name=#{card.name.formatted}"
|
69
|
+
rescue
|
70
|
+
puts "! failed to decode name!"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
if opt_debug
|
76
|
+
card.groups.sort.each do |group|
|
77
|
+
card.enum_by_group(group).each do |field|
|
78
|
+
puts "#{group} -> #{field.inspect}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
puts ""
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$-w = true
|
4
|
+
$:.unshift File.dirname($0) + '/../lib'
|
5
|
+
|
6
|
+
require 'pp'
|
7
|
+
require 'getoptlong'
|
8
|
+
require 'vpim/vcard'
|
9
|
+
|
10
|
+
HELP =<<EOF
|
11
|
+
Usage: #{$0} <vcard>...
|
12
|
+
|
13
|
+
Options
|
14
|
+
-h,--help Print this helpful message.
|
15
|
+
|
16
|
+
Examples:
|
17
|
+
EOF
|
18
|
+
|
19
|
+
opt_name = nil
|
20
|
+
opt_debug = nil
|
21
|
+
|
22
|
+
opts = GetoptLong.new(
|
23
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
24
|
+
[ "--name", "-n", GetoptLong::NO_ARGUMENT ],
|
25
|
+
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
|
26
|
+
)
|
27
|
+
|
28
|
+
opts.each do |opt, arg|
|
29
|
+
case opt
|
30
|
+
when "--help" then
|
31
|
+
puts HELP
|
32
|
+
exit 0
|
33
|
+
|
34
|
+
when "--name" then
|
35
|
+
opt_name = true
|
36
|
+
|
37
|
+
when "--debug" then
|
38
|
+
opt_debug = true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if ARGV.length < 1
|
43
|
+
puts "no vcard files specified, try -h!"
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
|
47
|
+
ARGV.each do |file|
|
48
|
+
|
49
|
+
cards = Vpim::Vcard.decode(open(file))
|
50
|
+
|
51
|
+
cards.each do |card|
|
52
|
+
card.lines.each_with_index do |line, i|
|
53
|
+
print line.name
|
54
|
+
if line.group.length > 0
|
55
|
+
print " (", line.group, ")"
|
56
|
+
end
|
57
|
+
print ": ", line.value.inspect, "\n"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'vpim/vcard'
|
4
|
+
require 'vpim/icalendar'
|
5
|
+
|
6
|
+
$in = ARGV.first ? File.open(ARGV.shift) : $stdin
|
7
|
+
$out = ARGV.first ? File.open(ARGV.shift, 'w') : $stdout
|
8
|
+
|
9
|
+
cal = Vpim::Icalendar.create
|
10
|
+
|
11
|
+
Vpim::Vcard.decode($in).each do |card|
|
12
|
+
if card.birthday
|
13
|
+
cal.push Vpim::Icalendar::Vevent.create_yearly(
|
14
|
+
card.birthday,
|
15
|
+
"Birthday for #{card['fn'].strip}"
|
16
|
+
)
|
17
|
+
$stderr.puts "#{card['fn']} -> bday #{cal.events.last.dtstart}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
puts cal.encode
|
22
|
+
|
@@ -0,0 +1,121 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# For a query command, mutt expects output of the form:
|
4
|
+
#
|
5
|
+
# informational line
|
6
|
+
# <email>TAB<name>[TAB<other info>]
|
7
|
+
# ...
|
8
|
+
#
|
9
|
+
# For an alias command, mutt expects output of the form:
|
10
|
+
# alias NICKNAME EMAIL
|
11
|
+
#
|
12
|
+
# NICKNAME shouldn't have spaces, and EMAIL can be either "user@example.com",
|
13
|
+
# "<user@example.com>", or "User <user@example.com>".
|
14
|
+
|
15
|
+
$-w = true
|
16
|
+
$:.unshift File.dirname($0) + '/../lib'
|
17
|
+
|
18
|
+
|
19
|
+
require 'getoptlong'
|
20
|
+
require 'vpim/vcard'
|
21
|
+
|
22
|
+
HELP =<<EOF
|
23
|
+
Usage: vcf-to-mutt.rb [--aliases] [query]
|
24
|
+
|
25
|
+
Queries a vCard file and prints the results in Mutt's query result format, or
|
26
|
+
as a Mutt alias file. No query matches all vCards.
|
27
|
+
|
28
|
+
The query is matched against all fields, so you can use 'climbers' to match all
|
29
|
+
vCards that has that string in the Notes field if you want to email all the
|
30
|
+
rock climbers you know. Or you can query all vCards with addresses in a
|
31
|
+
particular city, you get the idea.
|
32
|
+
|
33
|
+
Options
|
34
|
+
-h,--help Print this helpful message.
|
35
|
+
-a,--aliases Output an alias file, otherwise output a query response.
|
36
|
+
|
37
|
+
Examples:
|
38
|
+
|
39
|
+
Put in your muttrc file (either ~/.muttrc or ~/.mutt/muttrc) a line such as:
|
40
|
+
|
41
|
+
set query_command = "vcf-to-mutt.rb '%s' < ~/mycards.vcf"
|
42
|
+
|
43
|
+
Bugs:
|
44
|
+
|
45
|
+
The aliases output file bases the alias name on the nickname, or the full
|
46
|
+
name, but either way, they aren't guaranteed to be unique if you have more than
|
47
|
+
email address in a vCard, or more than one vCard for the same nickname or full
|
48
|
+
name.
|
49
|
+
EOF
|
50
|
+
|
51
|
+
opt_query = ''
|
52
|
+
opt_aliases = false
|
53
|
+
|
54
|
+
opts = GetoptLong.new(
|
55
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
56
|
+
[ "--aliases", "-a", GetoptLong::NO_ARGUMENT ]
|
57
|
+
)
|
58
|
+
|
59
|
+
opts.each do |opt, arg|
|
60
|
+
case opt
|
61
|
+
when "--help" then
|
62
|
+
puts HELP
|
63
|
+
exit 0
|
64
|
+
|
65
|
+
when "--aliases" then
|
66
|
+
opt_aliases = true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
opt_query = ARGV.first
|
71
|
+
|
72
|
+
module Mutt
|
73
|
+
def Mutt.vcard_query(cards, query)
|
74
|
+
query = query.downcase if query
|
75
|
+
cards.find_all do |card|
|
76
|
+
card.detect do |f|
|
77
|
+
!query || f.value.downcase.include?(query)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def Mutt.query_print(cards, caption)
|
83
|
+
puts caption
|
84
|
+
|
85
|
+
cards.each do
|
86
|
+
|vcard|
|
87
|
+
# find the email addresses
|
88
|
+
vcard.enum_by_name("email").each do |f|
|
89
|
+
nn = vcard.nickname
|
90
|
+
nn = nn ? "\t#{nn}" : ""
|
91
|
+
puts "#{f.value}\t#{vcard['fn']}#{nn}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def Mutt.alias_print(cards)
|
97
|
+
cards.each do
|
98
|
+
|vcard|
|
99
|
+
# find the email addresses
|
100
|
+
vcard.enum_by_name("email").each do |f|
|
101
|
+
em = f.value
|
102
|
+
fn = vcard['fn']
|
103
|
+
nn = vcard.nickname || fn.gsub(/\s+/,'')
|
104
|
+
puts "alias #{nn} #{fn} <#{em}>"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
cards = Vpim::Vcard.decode($stdin)
|
112
|
+
|
113
|
+
matches = Mutt::vcard_query(cards, opt_query)
|
114
|
+
|
115
|
+
if opt_aliases
|
116
|
+
Mutt::alias_print(matches)
|
117
|
+
else
|
118
|
+
qstr = opt_query == '' ? '<all records>' : opt_query;
|
119
|
+
Mutt::query_print(matches, "Query #{qstr} against #{cards.size} vCards:")
|
120
|
+
end
|
121
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'test/common'
|
2
|
+
|
3
|
+
require 'vpim/agent/atomize'
|
4
|
+
require 'vpim/icalendar'
|
5
|
+
require 'vpim/view'
|
6
|
+
|
7
|
+
class TextAgentAtomize < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def atomize(cal, feeduri, caluri, filter=nil)
|
10
|
+
ical = Vpim::Icalendar.decode(cal).first
|
11
|
+
if filter
|
12
|
+
ical = filter.call(ical)
|
13
|
+
end
|
14
|
+
feed = Vpim::Agent::Atomize.calendar(ical, feeduri, caluri)
|
15
|
+
return ical, feed
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_minimal
|
19
|
+
ical, feed = atomize(<<'__', "http://example.com/feed", "http://example.com/calendar")
|
20
|
+
BEGIN:VCALENDAR
|
21
|
+
BEGIN:VEVENT
|
22
|
+
DTSTART:20090214T144503
|
23
|
+
END:VEVENT
|
24
|
+
END:VCALENDAR
|
25
|
+
__
|
26
|
+
|
27
|
+
assert_equal(feed.entries.size, 1)
|
28
|
+
assert_equal("http://example.com/feed", feed.id)
|
29
|
+
assert_equal("http://example.com/calendar", feed.title)
|
30
|
+
assert(feed.to_xml.to_str)
|
31
|
+
assert_equal(nil, feed.entries.first.title)
|
32
|
+
assert_equal(nil, feed.entries.first.content)
|
33
|
+
#puts feed.to_xml
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_small
|
37
|
+
ical, feed = atomize(<<'__', "http://example.com/feed", "http://example.com/calendar")
|
38
|
+
BEGIN:VCALENDAR
|
39
|
+
BEGIN:VEVENT
|
40
|
+
DTSTART:20090214T144503
|
41
|
+
SUMMARY:I am summarized
|
42
|
+
DESCRIPTION:And I am described
|
43
|
+
UID:very, very, unique
|
44
|
+
END:VEVENT
|
45
|
+
END:VCALENDAR
|
46
|
+
__
|
47
|
+
|
48
|
+
assert_equal(feed.entries.size, 1)
|
49
|
+
assert_equal("http://example.com/feed", feed.id)
|
50
|
+
assert_equal("http://example.com/calendar", feed.title)
|
51
|
+
assert_equal("I am summarized", feed.entries.first.title)
|
52
|
+
assert_equal("And I am described", feed.entries.first.content)
|
53
|
+
assert(feed.to_xml.to_str)
|
54
|
+
#puts feed.to_xml
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_recurring
|
58
|
+
filter = proc do |cal|
|
59
|
+
Vpim::View.week(cal)
|
60
|
+
end
|
61
|
+
ical, feed = atomize(<<'__', "http://example.com/feed", "http://example.com/calendar", filter)
|
62
|
+
BEGIN:VCALENDAR
|
63
|
+
BEGIN:VEVENT
|
64
|
+
DTSTART:20090214T144503
|
65
|
+
RRULE:FREQ=weekly
|
66
|
+
SUMMARY:I am summarized
|
67
|
+
DESCRIPTION:And I am described
|
68
|
+
UID:very, very, unique
|
69
|
+
END:VEVENT
|
70
|
+
END:VCALENDAR
|
71
|
+
__
|
72
|
+
|
73
|
+
#puts feed.to_xml
|
74
|
+
assert_equal(1, feed.entries.size)
|
75
|
+
assert_equal("http://example.com/feed", feed.id)
|
76
|
+
assert_equal("http://example.com/calendar", feed.title)
|
77
|
+
assert_equal("I am summarized", feed.entries.first.title)
|
78
|
+
assert_equal("And I am described", feed.entries.first.content)
|
79
|
+
assert(feed.to_xml.to_str)
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
|
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'vpim/repo'
|
4
|
+
require 'vpim/agent/calendars'
|
5
|
+
require 'test/common'
|
6
|
+
|
7
|
+
class TestAgentCalendars < Test::Unit::TestCase
|
8
|
+
Apple3 = Vpim::Repo::Apple3
|
9
|
+
Directory = Vpim::Repo::Directory
|
10
|
+
Uri = Vpim::Repo::Uri
|
11
|
+
Agent = Vpim::Agent
|
12
|
+
Path = Agent::Path
|
13
|
+
NotFound = Agent::NotFound
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@testdir = Dir.getwd + "/test" #File.dirname($0) doesn't work with rcov :-(
|
17
|
+
@caldir = @testdir + "/calendars"
|
18
|
+
@eventsz = Dir[@caldir + "/**/*.ics"].size
|
19
|
+
assert(@testdir)
|
20
|
+
assert(test(?d, @caldir), "no caldir "+@caldir)
|
21
|
+
end
|
22
|
+
|
23
|
+
def assert_is_text_calendar(text)
|
24
|
+
lines = text.split("\n")
|
25
|
+
lines = lines.first, lines.last
|
26
|
+
assert_equal("BEGIN:VCALENDAR", lines.first.upcase, lines)
|
27
|
+
assert_equal("END:VCALENDAR", lines.last.upcase, lines)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_agent_calendars
|
31
|
+
repo = Apple3.new(@caldir)
|
32
|
+
rest = Agent::Calendars.new(repo)
|
33
|
+
|
34
|
+
out1, form = rest.get(Path.new("http://host/here", "/here"))
|
35
|
+
assert_equal("text/html", form)
|
36
|
+
#puts(out1)
|
37
|
+
|
38
|
+
out1, form = rest.get(Path.new("http://host/here/weather%2fLeavenworth", "/here"))
|
39
|
+
assert_equal("text/html", form)
|
40
|
+
#puts(out1)
|
41
|
+
|
42
|
+
out2, form = rest.get(Path.new("http://host/here/weather%2fLeavenworth/calendar", "/here"))
|
43
|
+
assert_equal("text/calendar", form)
|
44
|
+
assert_is_text_calendar(out2)
|
45
|
+
|
46
|
+
#assert_equal(out1, out2)
|
47
|
+
|
48
|
+
assert_raise(Vpim::Agent::NotFound) do
|
49
|
+
rest.get(Path.new("http://host/here/weather%2fLeavenworth/an_unknown_protocol", "/here"))
|
50
|
+
end
|
51
|
+
assert_raise(Vpim::Agent::NotFound) do
|
52
|
+
rest.get(Path.new("http://host/here/no_such_calendar", "/here"))
|
53
|
+
end
|
54
|
+
|
55
|
+
assert_equal(["","/","/"], Vpim::Agent::Path.split_path("/%2F/%2F"))
|
56
|
+
assert_equal(["/","/"], Vpim::Agent::Path.split_path("%2F/%2F"))
|
57
|
+
assert_equal(["calendars", "weather/Leavenworth"],
|
58
|
+
Vpim::Agent::Path.split_path("calendars/weather%2FLeavenworth"))
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_agent_calendar_atom
|
62
|
+
repo = Apple3.new(@caldir)
|
63
|
+
rest = Agent::Calendars.new(repo)
|
64
|
+
|
65
|
+
out, form = rest.get(Path.new("http://host/here/weather%2fLeavenworth/atom", "/here"))
|
66
|
+
assert_equal("application/atom+xml", form)
|
67
|
+
#pp out
|
68
|
+
#assert_is_atom(out)
|
69
|
+
end
|
70
|
+
|
71
|
+
def _test_path_shift(url, shifts)
|
72
|
+
# last shift should be a nil
|
73
|
+
shifts << nil
|
74
|
+
|
75
|
+
# presence or absence of a trailing / should not affect shifting
|
76
|
+
["", "/"].each do |trailer|
|
77
|
+
path = Path.new(url + trailer)
|
78
|
+
shifts.each do |_|
|
79
|
+
assert_equal(_, path.shift)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_path_shift
|
85
|
+
_test_path_shift("http://host.ex", [])
|
86
|
+
_test_path_shift("http://host.ex/a", ["a"])
|
87
|
+
_test_path_shift("http://host.ex/a/b", ["a", "b"])
|
88
|
+
_test_path_shift("http://host.ex/a/b/c", ["a", "b", "c"])
|
89
|
+
end
|
90
|
+
|
91
|
+
def _test_path_prefix(base, parts, shifts, prefix)
|
92
|
+
path = Path.new(base+parts.join("/"))
|
93
|
+
shifts.times{ path.shift }
|
94
|
+
assert_equal(prefix, path.prefix)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_path_prefix
|
98
|
+
_test_path_prefix("http://host.ex/", [], 0, "/")
|
99
|
+
_test_path_prefix("http://host.ex/", ["a"], 0, "/")
|
100
|
+
_test_path_prefix("http://host.ex/", ["a"], 1, "/")
|
101
|
+
_test_path_prefix("http://host.ex/", ["a"], 2, "/a/")
|
102
|
+
_test_path_prefix("http://host.ex/", ["a"], 3, "/a/")
|
103
|
+
_test_path_prefix("http://host.ex/", ["a", "b"], 0, "/")
|
104
|
+
_test_path_prefix("http://host.ex/", ["a", "b"], 1, "/")
|
105
|
+
_test_path_prefix("http://host.ex/", ["a", "b"], 2, "/a/")
|
106
|
+
_test_path_prefix("http://host.ex/", ["a", "b"], 3, "/a/b/")
|
107
|
+
end
|
108
|
+
|
109
|
+
=begin
|
110
|
+
def test_atomize
|
111
|
+
repo = Apple3.new(@caldir)
|
112
|
+
cal = repo.find{true}
|
113
|
+
a = Vpim::Agent::Atomize.new(cal)
|
114
|
+
assert( a.get(Path.new("http://example.com/path")))
|
115
|
+
end
|
116
|
+
|
117
|
+
def x_test_uri_query
|
118
|
+
uri = "http://example.com/ics/atom?http://localhost:9876"
|
119
|
+
|
120
|
+
repo = Uri.new("http://localhost:9876")
|
121
|
+
rest = Agent::Calendars.new(repo)
|
122
|
+
out1, form = rest.get(Path.new("http://example.com/ics", "/ics/atom"))
|
123
|
+
p [out1, form]
|
124
|
+
end
|
125
|
+
=end
|
126
|
+
|
127
|
+
end
|
128
|
+
|