vpim 0.597 → 0.602
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +420 -0
- data/COPYING +58 -0
- data/README +175 -0
- data/bin/reminder +203 -0
- data/bin/rrule +71 -0
- data/lib/vpim/property/common.rb +1 -1
- data/lib/vpim/repo.rb +116 -0
- data/lib/vpim/time.rb +1 -1
- data/lib/vpim/version.rb +2 -2
- data/samples/README.mutt +93 -0
- data/samples/ab-query.rb +57 -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 +203 -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_all.rb +14 -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 +201 -0
- data/test/test_rrule.rb +979 -0
- data/test/test_vcard.rb +733 -0
- metadata +61 -11
data/CHANGES
ADDED
@@ -0,0 +1,420 @@
|
|
1
|
+
0.602 - 2008-03-12
|
2
|
+
|
3
|
+
- Updated reminder utility to work with iCal 3.
|
4
|
+
- Reworked gem to include tests, samples, and binaries.
|
5
|
+
|
6
|
+
|
7
|
+
0.597 - 2008-03-01
|
8
|
+
|
9
|
+
- Support for BYSETPOS in recurrence rules (development supported by ZipDX.com)
|
10
|
+
|
11
|
+
- Support for FREQ=weekly in recurrence rules (development supported by ZipDX.com)
|
12
|
+
|
13
|
+
- Fixed an encode_text() bug (patch supplied by Jan Becvar)
|
14
|
+
|
15
|
+
- Fixed problem with interaction between BYMONTH and BYDAY (patch supplied by
|
16
|
+
Sam Stephenson of 32signals.com)
|
17
|
+
|
18
|
+
- Vevent::Maker - Started adding high-level iCalendar encoding APIs
|
19
|
+
|
20
|
+
- Vpim::Vcard::Maker - the vCard maker is moved here
|
21
|
+
|
22
|
+
- Vpim::Maker - deprecated
|
23
|
+
|
24
|
+
- Vcard::make, Maker::Vcard#delete_if - new
|
25
|
+
|
26
|
+
- Vcard::Maker#add_name - deprecate, see Vcard::Maker#name
|
27
|
+
|
28
|
+
- Vcard::Maker#fullname= - deprecate, see Vcard::Maker#name
|
29
|
+
|
30
|
+
- Added high-level vCard decoding API.
|
31
|
+
|
32
|
+
- Beginning to depend on ruby1.8. I'm willing to try for backwards compat if I
|
33
|
+
get feedback that this causes difficulties.
|
34
|
+
|
35
|
+
- Icalendar#components - new
|
36
|
+
|
37
|
+
- Icalendar#vevents - deprecated, see Icalendar#components
|
38
|
+
|
39
|
+
- split Vtodo and Vjournal into own files
|
40
|
+
|
41
|
+
- Added Recurrence module to Vtodo and Vjournal
|
42
|
+
|
43
|
+
- Property::Common#sequence - new
|
44
|
+
|
45
|
+
- Property::Common#attachments - new
|
46
|
+
|
47
|
+
- Icalendar::Attachment - new
|
48
|
+
|
49
|
+
- Maker::Vcard#add_url - new
|
50
|
+
|
51
|
+
- ex_mkyourown.rb - new example
|
52
|
+
|
53
|
+
- Modularized the component property accessor methods, and added lots of
|
54
|
+
Icalendar property support for Vevent, Vtodo, and Vjournal.
|
55
|
+
|
56
|
+
- Fixed support for TEXT decoding.
|
57
|
+
|
58
|
+
- Use Subversion revision as release sub-version.
|
59
|
+
|
60
|
+
- It appears that a top-level vpim.rb that requires everything else is needed
|
61
|
+
for ruby-gems, gemspec seems to work now.
|
62
|
+
|
63
|
+
- Don't package backup files (.../*.rb~).
|
64
|
+
|
65
|
+
- Icalendar decoding optimizations. Icalendar.decode is about twice as fast
|
66
|
+
now, and more optimizations are scheduled.
|
67
|
+
|
68
|
+
- Continue the move to using uppercase for all syntactic elements that can be
|
69
|
+
mixed case. The API might eventually allow only uppercase, it appears
|
70
|
+
case-insensitive comparisons still have a noticeable effect on performance.
|
71
|
+
|
72
|
+
|
73
|
+
0.17 - 2006-03-08
|
74
|
+
|
75
|
+
- DirectoryInfo#delete - new
|
76
|
+
|
77
|
+
- Maker::Vcard#fullname - new
|
78
|
+
|
79
|
+
- Provide an example of how to create, copy, and modify version 2.1 vCards.
|
80
|
+
|
81
|
+
- Maker::Vcard.make2 - new
|
82
|
+
|
83
|
+
- Maker::Vcard.make - deprecated
|
84
|
+
|
85
|
+
- Profiled decoding of a huge iCalendar file. Performance appears to be
|
86
|
+
dominated by overhead of String#downcase (20% of time spent in Field#name?).
|
87
|
+
Keeping the field group, field name, and field's parameter's names internally
|
88
|
+
in uppercase and using ruby 1.8's String#casecmp? is a first attempt at
|
89
|
+
optimization. This is a change in the default case returned, but it aligns
|
90
|
+
with the RFC and common usage.
|
91
|
+
|
92
|
+
- Maker::Vcard.make - full_name is now optional, it will be derived from name/N:
|
93
|
+
|
94
|
+
- Maker::Vcard#add_field - better argument checking
|
95
|
+
|
96
|
+
- Maker::Vcard#copy - new
|
97
|
+
|
98
|
+
- Vcard#[] - now limits return to fields with values
|
99
|
+
|
100
|
+
- Vcard#name - new
|
101
|
+
|
102
|
+
- Vcard::Name - new
|
103
|
+
|
104
|
+
- Vcard#nicknames - new
|
105
|
+
|
106
|
+
- Field#params and Field#param - deprecated and undocumented, I could never
|
107
|
+
remember the difference
|
108
|
+
|
109
|
+
- Field#pnames - new
|
110
|
+
|
111
|
+
- Field#pvalues - new
|
112
|
+
|
113
|
+
- Methods.casecmp? - new
|
114
|
+
|
115
|
+
- Field#pref= - new
|
116
|
+
|
117
|
+
- Field#pvalue_idel - new
|
118
|
+
|
119
|
+
- Field#pvalue_iadd - new
|
120
|
+
|
121
|
+
|
122
|
+
0.16 - 2006-02-19
|
123
|
+
|
124
|
+
- Packaged in gem format, experimental.
|
125
|
+
|
126
|
+
- Read vCards in UTF-8 or UTF-16, big or little endian, with or without a byte
|
127
|
+
order mark (BOM).
|
128
|
+
|
129
|
+
- Fixed bug with rrule occurences containing the end of the interval. Reported
|
130
|
+
with patch by Brad Ediger.
|
131
|
+
|
132
|
+
0.15 - 2005-07-29
|
133
|
+
|
134
|
+
- Fixed bug with param values with quoted strings, particularly a quoted string
|
135
|
+
containing a : character, like
|
136
|
+
name;param="file:///":value
|
137
|
+
|
138
|
+
Thanks to Tamiji Homma for reporting this and sending me an example calendar.
|
139
|
+
|
140
|
+
- Vtodo.create - new
|
141
|
+
- Icalendar#push - allow Vtodos to be added
|
142
|
+
|
143
|
+
Thanks to Maximillian Dornseif for contributing the above two Vtodo patches.
|
144
|
+
|
145
|
+
- Vevent.duration - bug fixes so duration can be calculated from begin/end, and
|
146
|
+
end can be calculated from begin/duration
|
147
|
+
|
148
|
+
- Vcard#nickname that strips whitespace to see if there really is a nickname
|
149
|
+
|
150
|
+
- Vcard#birthday - returns birthday as a date
|
151
|
+
|
152
|
+
- Vevent#create_yearly - easy, cheesy way to create yearly recurring events
|
153
|
+
|
154
|
+
- vcf-to-ics.rb: example of how to create calendars of bdays from vcards
|
155
|
+
|
156
|
+
- Icalendar.create() like Vevent.create(), it will take arrays of Fields, or
|
157
|
+
Hashes of String => value.
|
158
|
+
|
159
|
+
- maker/vcard.rb: Added support for X-AIM, an Apple extension.
|
160
|
+
|
161
|
+
0.14 - 2005-02-01
|
162
|
+
|
163
|
+
- Fix: if an RRULE didn't ever yield an event (a bug in the rule) dountil was never tested.
|
164
|
+
|
165
|
+
- Change: don't throw an ArgumentError with infinite events, just stop when the
|
166
|
+
Time is no longer representable
|
167
|
+
|
168
|
+
0.13 - 2005-01-20
|
169
|
+
|
170
|
+
- Was calling to_time with an arg, fixed.
|
171
|
+
|
172
|
+
0.12 - 2005-01-17
|
173
|
+
|
174
|
+
- Removed require of pp from the library and utilities where it wasn't needed,
|
175
|
+
it was causing problems because it doesn't exist on ruby 1.6 systems.
|
176
|
+
|
177
|
+
- Added Field#to_date, returns field value as an array of Date objects
|
178
|
+
|
179
|
+
- Changed Field#to_time - it now auto-detects format of values
|
180
|
+
(DATE/DATE-TIME), and doesn't take/require a default_kind argument.
|
181
|
+
|
182
|
+
- Added IMPP support to Vpim::Maker::Vcard.
|
183
|
+
|
184
|
+
- Makefile wasn't copying the Maker classes into the release.
|
185
|
+
|
186
|
+
- Duration value not returned unless it was negative, fixed.
|
187
|
+
|
188
|
+
- An RRULE's UNTIL was always being assumed to be a DATE-TIME, but it can be a
|
189
|
+
DATE. I fixed this, but is something of a hack, see comments and TODO.
|
190
|
+
|
191
|
+
- Use String#scan instead of String#gsub, when appropriate (I didn't know it
|
192
|
+
existed when I stated the project).
|
193
|
+
|
194
|
+
- Run tests on 3 ruby versions.
|
195
|
+
|
196
|
+
- Don't include docs in release package, it makes it way too large.
|
197
|
+
|
198
|
+
- Change: use String.unpack instead of iconv to convert UCS-2 to UTF-8,
|
199
|
+
removing dependency on iconv (it wasn't standard in ruby 1.6).
|
200
|
+
|
201
|
+
- Change: simplified mutt_ab_query.rb, and renamed to vcf-to-mutt.
|
202
|
+
|
203
|
+
- Change: reminder.rb sorts todo items by priority.
|
204
|
+
|
205
|
+
- New: Vtodo#priority - the priority of the vTodo component.
|
206
|
+
|
207
|
+
0.11 - 2004-11-17
|
208
|
+
|
209
|
+
- Added a Vpim::Maker::Vcard class to simplify the creation of vCards, modelled
|
210
|
+
after the RSS maker from ruby's RSS library.
|
211
|
+
|
212
|
+
0.10 - 2004-11-07
|
213
|
+
|
214
|
+
- If events don't have a recurrence rule, they occur once, but they
|
215
|
+
were being returned even if they occurred after "dountil". Fixed.
|
216
|
+
|
217
|
+
- New sample of converting tab-delimited files to a vcard file, from
|
218
|
+
Dane G. Avilla. Thanks!
|
219
|
+
|
220
|
+
0.9a - 2004-10-31
|
221
|
+
|
222
|
+
- Made sure all events occur once in rrules.
|
223
|
+
|
224
|
+
- New sample of encoding: mutt-aliases-vcard.rb
|
225
|
+
|
226
|
+
- Added ToDo support to reminder.rb.
|
227
|
+
|
228
|
+
0.9 - 2004-06-17
|
229
|
+
|
230
|
+
- Field now is mutable, you can change the group, value, params, etc.
|
231
|
+
|
232
|
+
- Using the Enumerator object for DirectoryInfo now, instead of all the
|
233
|
+
each_by_X, and field_by_X() APIs.
|
234
|
+
|
235
|
+
- Moved homepage and docs to Ruby Forge.
|
236
|
+
|
237
|
+
- DirectoryInfo.create: added a profile argument
|
238
|
+
|
239
|
+
- DirectoryInfo#push: now pushes to 1 before the end
|
240
|
+
|
241
|
+
- DirectoryInfo#push_end: pushes onto end, in case you really want to
|
242
|
+
|
243
|
+
- Field.create: a Date or Time object value will now be encoded as date or time
|
244
|
+
|
245
|
+
- Vpim.encode_date(): encodes an RFC2425 date
|
246
|
+
|
247
|
+
- Vpim.encode_time(): encodes an RFC2425 time
|
248
|
+
|
249
|
+
- Vpim.encode_date_time(): encodes an RFC2425 date-time
|
250
|
+
|
251
|
+
- Icalendar#encode(): encodes an Icalendar
|
252
|
+
|
253
|
+
- Icalendar#push(): pushes a calendar component onto a calendar
|
254
|
+
|
255
|
+
- Vevent#accept(): accepts an event invitation
|
256
|
+
|
257
|
+
- Vevent#create(): creates a new event
|
258
|
+
|
259
|
+
- Address#copy(): create a copy of Address. If the original Address was frozen,
|
260
|
+
this one won't be.
|
261
|
+
|
262
|
+
- Address#partstat=(): set or change the PARTSTAT.
|
263
|
+
|
264
|
+
- Field#copy(): create a copy of Field. If the original Field was frozen, this
|
265
|
+
one won't be.
|
266
|
+
|
267
|
+
0.8 - 2004-04-01
|
268
|
+
|
269
|
+
- Moved DirectoryInfo::Field into it's own file, vpim/field.rb.
|
270
|
+
|
271
|
+
- New: Vpim::Duration - crude way of getting days/hours/mins/secs from a
|
272
|
+
duration in seconds.
|
273
|
+
|
274
|
+
- New: Icalendar#create() and Icalendar#create_reply()
|
275
|
+
|
276
|
+
- New: Icalendar#encode(), #to_s is an alias to #encode.
|
277
|
+
|
278
|
+
- New: Icalendar#protocol?()
|
279
|
+
|
280
|
+
- Change: Icalendar#version() raises an error if there is no VERSION
|
281
|
+
|
282
|
+
- Change: made all the DirectoryInfo, Vcard, and Field .new() class methods
|
283
|
+
private, and replaced with the 2 class methods:
|
284
|
+
|
285
|
+
- decode() decodes a string, returning a ruby object
|
286
|
+
- create() creates a new object
|
287
|
+
|
288
|
+
and all objects now get encoded using:
|
289
|
+
|
290
|
+
- encode() takes a ruby object, and encodes it as a string
|
291
|
+
|
292
|
+
They become more symetrical, and the overloaded meanings of .new() dissappear -
|
293
|
+
with .new() are you decoding, encoding, creating...?
|
294
|
+
|
295
|
+
- Change: Icalendar::Vevent#attendees() can return only attendees
|
296
|
+
with a particular URI.
|
297
|
+
|
298
|
+
- New: Icalendar::Address#==()
|
299
|
+
|
300
|
+
- New: Icalendar::Vevent#attendee?()
|
301
|
+
|
302
|
+
- Fixed bug: Field#encode() was adding an unexpecte NL to the line.
|
303
|
+
|
304
|
+
- Change: Field#name?() can accept a symbol.
|
305
|
+
|
306
|
+
- New: DirectoryInfo has an #each(), so I included Enumerable. Because of this
|
307
|
+
#to_a() now returns all the Fields in a DirectoryInfo.
|
308
|
+
|
309
|
+
- New: DirectoryInfo#push() and DirectoryInfo@push_uniq().
|
310
|
+
|
311
|
+
- Change: DirectoryInfo#<<() is now an alias for DirectoryInfo#push()
|
312
|
+
|
313
|
+
- Change: DirectoryInfo#each() and DirectoryInfo#each_by() now return self
|
314
|
+
instead of nil, I think this is more rubyish.
|
315
|
+
|
316
|
+
- New: Date#to_time() - converts a Date, and maybe a DateTime, to a Time
|
317
|
+
|
318
|
+
- New: Icalendar#protocol()
|
319
|
+
|
320
|
+
- New: Icalendar::Address
|
321
|
+
|
322
|
+
- New: Icalendar::Vevent#organizer()/attendees(), which return an
|
323
|
+
Icalendar::Address
|
324
|
+
|
325
|
+
- New: An array of all the values of fields named name, converted to text,
|
326
|
+
using Field.to_text().
|
327
|
+
|
328
|
+
|
329
|
+
0.7 - 2004-03-21
|
330
|
+
|
331
|
+
- Bug fixes, not all files were requiring vpim.rb, which had the definition of
|
332
|
+
the invalid encoding error.
|
333
|
+
|
334
|
+
- Implemented much requested feature: ignore empty lines in input. This is an
|
335
|
+
invalid encoding, but I'm tired of fighting it.
|
336
|
+
|
337
|
+
|
338
|
+
0.6 - 2004-03-20
|
339
|
+
|
340
|
+
WARNING: major API renamings!
|
341
|
+
|
342
|
+
- Replaced the Vpim::Errors::*Error exception classes with a single exception
|
343
|
+
class: Vpim::InvalidEncodingError. That, and a message, is all I really need.
|
344
|
+
I don't think people need different classes for different types of encoding
|
345
|
+
errors, either the library can decode it for them, or it can't.
|
346
|
+
|
347
|
+
- Renamed project to "vpim" (to reflect vCard and vCalendar/iCalendar support),
|
348
|
+
renamed top-level Rfc2425 module to Vpim, split vard.rb into multiple files.
|
349
|
+
|
350
|
+
- Add support for iCalendar (RFC2445), see vpim/icalendar.rb. Currently only
|
351
|
+
supports VEVENT, no VTODO or VALARM yet, but is useable to print my upcoming
|
352
|
+
iCal events.
|
353
|
+
|
354
|
+
- Implemented the iCalendar recurrence rules mini-language, which is possibly
|
355
|
+
of more general use than just for iCalendar.
|
356
|
+
|
357
|
+
- Fixed bug in time decoding where usec would be nil instead of zero when no
|
358
|
+
usec were present in the time value.
|
359
|
+
|
360
|
+
- Field#to_time now assumes that time is in local time, unless the timezone is
|
361
|
+
"Z", meaning UTC.
|
362
|
+
|
363
|
+
- Field#to_text - new method, unescapes newlines, commas, and escape
|
364
|
+
characters.
|
365
|
+
|
366
|
+
- Field#field(name) - new method, returns the first field named +name+.
|
367
|
+
|
368
|
+
|
369
|
+
0.5 - 3003-11-23
|
370
|
+
|
371
|
+
- ab-query.rb - short option for --me was mistyped as -v, instead of -m.
|
372
|
+
|
373
|
+
- mutt_ab_query.rb - added a --pipe option, so that the output of an other
|
374
|
+
script can be directly queried.
|
375
|
+
|
376
|
+
- New method: Rfc2425.version
|
377
|
+
|
378
|
+
- Decode vCard 2.1 abbreviated parameters (ones where the name of the parameter
|
379
|
+
is missing, only the value is present, which only works for type and encoding).
|
380
|
+
|
381
|
+
- Vcard.decode() now support UCS-2 encoded vCards, by translating anything that
|
382
|
+
looks like UCS-2 to UTF-8 before decoding.
|
383
|
+
|
384
|
+
0.4 - 2003-04-14
|
385
|
+
|
386
|
+
- More support for decoding date, time, and date-time values.
|
387
|
+
|
388
|
+
- New method Field#to_time().
|
389
|
+
|
390
|
+
- Can pass an IO object to decode APIs, its entire contents is read as a
|
391
|
+
string.
|
392
|
+
|
393
|
+
- Field#group?() now considers nil as equivalent to no group, so you can use
|
394
|
+
each_group(nil) to iterate through all fields without a group.
|
395
|
+
|
396
|
+
0.3 -
|
397
|
+
|
398
|
+
- Added description of how to use mutt_ab_query.rb
|
399
|
+
|
400
|
+
- Added support for querying the kind of a value, and began support for
|
401
|
+
decoding date and time values.
|
402
|
+
|
403
|
+
0.2 -
|
404
|
+
|
405
|
+
- Supports encoding.
|
406
|
+
|
407
|
+
- Supports accessing values using [].
|
408
|
+
|
409
|
+
- No longer have methods return an Array, or nil if the array is zero length, I
|
410
|
+
just return an Array.
|
411
|
+
|
412
|
+
- mutt_ab_query.rb - an example of using vcard.rb to do lookups in the OS X
|
413
|
+
Address Book from Mutt
|
414
|
+
|
415
|
+
0.1 -
|
416
|
+
|
417
|
+
- First release.
|
418
|
+
---
|
419
|
+
|
420
|
+
vim:expandtab:tabstop=8:softtabstop=2:shiftwidth=2
|
data/COPYING
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
vPim is copyrighted free software by Sam Roberts <sroberts@uniserve.com>.
|
2
|
+
|
3
|
+
You can redistribute it and/or modify it under either the terms of the GPL (see
|
4
|
+
the file GPL), or the conditions below:
|
5
|
+
|
6
|
+
1. You may make and give away verbatim copies of the source form of the
|
7
|
+
software without restriction, provided that you duplicate all of the
|
8
|
+
original copyright notices and associated disclaimers.
|
9
|
+
|
10
|
+
2. You may modify your copy of the software in any way, provided that
|
11
|
+
you do at least ONE of the following:
|
12
|
+
|
13
|
+
a) place your modifications in the Public Domain or otherwise make them
|
14
|
+
Freely Available, such as by posting said modifications to Usenet or an
|
15
|
+
equivalent medium, or by allowing the author to include your
|
16
|
+
modifications in the software.
|
17
|
+
|
18
|
+
b) use the modified software only within your corporation or
|
19
|
+
organization.
|
20
|
+
|
21
|
+
c) give non-standard binaries non-standard names, with instructions on
|
22
|
+
where to get the original software distribution.
|
23
|
+
|
24
|
+
d) make other distribution arrangements with the author.
|
25
|
+
|
26
|
+
3. You may distribute the software in object code or binary form,
|
27
|
+
provided that you do at least ONE of the following:
|
28
|
+
|
29
|
+
a) distribute the binaries and library files of the software, together
|
30
|
+
with instructions (in the manual page or equivalent) on where to get the
|
31
|
+
original distribution.
|
32
|
+
|
33
|
+
b) accompany the distribution with the machine-readable source of the
|
34
|
+
software.
|
35
|
+
|
36
|
+
c) give non-standard binaries non-standard names, with instructions on
|
37
|
+
where to get the original software distribution.
|
38
|
+
|
39
|
+
d) make other distribution arrangements with the author.
|
40
|
+
|
41
|
+
4. You may modify and include the part of the software into any other
|
42
|
+
software (possibly commercial). But some files in the distribution
|
43
|
+
are not written by the author, so that they are not under these terms.
|
44
|
+
|
45
|
+
For the list of those files and their copying conditions, see the
|
46
|
+
file LEGAL.
|
47
|
+
|
48
|
+
5. The scripts and library files supplied as input to or produced as
|
49
|
+
output from the software do not automatically fall under the
|
50
|
+
copyright of the software, but belong to whomever generated them,
|
51
|
+
and may be sold commercially, and may be aggregated with this
|
52
|
+
software.
|
53
|
+
|
54
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
55
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
56
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
57
|
+
PURPOSE.
|
58
|
+
|
data/README
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
Author:: Sam Roberts <sroberts@uniserve.com>
|
2
|
+
Copyright:: Copyright (C) 2008 Sam Roberts
|
3
|
+
License:: May be distributed under the same terms as Ruby
|
4
|
+
Homepage:: http://vpim.rubyforge.org
|
5
|
+
Download:: http://rubyforge.org/projects/vpim
|
6
|
+
|
7
|
+
This is a pure-ruby library for decoding and encoding vCard and iCalendar data
|
8
|
+
("personal information") called vPim.
|
9
|
+
|
10
|
+
vCard (RFC 2426) is a format for personal information, see Vpim::Vcard and
|
11
|
+
Vpim::Maker::Vcard.
|
12
|
+
|
13
|
+
iCalendar (RFC 2445) is a format for calendar related information, see
|
14
|
+
Vpim::Icalendar.
|
15
|
+
|
16
|
+
vCard and iCalendar support is built on top of an implementation of the MIME
|
17
|
+
Content-Type for Directory Information (RFC 2425). The basic RFC 2425 format is
|
18
|
+
implemented by Vpim::DirectoryInfo and Vpim::DirectoryInfo::Field.
|
19
|
+
|
20
|
+
The libary is quite useful, but improvements are ongoing. If you find
|
21
|
+
something missing or have suggestions, please contact me. I can't promise
|
22
|
+
instantaneous turnaround, but I might be able to suggest another approach, and
|
23
|
+
features requested by users of vPim go to the top of the todo list. If you need
|
24
|
+
a feature for a commercial project, consider sponsoring development.
|
25
|
+
|
26
|
+
= Project Information
|
27
|
+
|
28
|
+
The latest release can be downloaded from the Ruby Forge project page:
|
29
|
+
|
30
|
+
- http://rubyforge.org/projects/vpim
|
31
|
+
|
32
|
+
For notifications about new releases, or asking questions about vPim, please
|
33
|
+
subscribe to "vpim-talk":
|
34
|
+
|
35
|
+
- http://rubyforge.org/mailman/listinfo/vpim-talk
|
36
|
+
|
37
|
+
= Thanks
|
38
|
+
|
39
|
+
- Ruby Forge: for their generous hosting of this project.
|
40
|
+
- ZipDX.com: for sponsoring support for FREQ=weekly and BYSETPOS in recurrence
|
41
|
+
rules.
|
42
|
+
|
43
|
+
= Examples
|
44
|
+
|
45
|
+
Here's an example to give a sense for how iCalendars are encoded and decoded:
|
46
|
+
|
47
|
+
require 'vpim/icalendar'
|
48
|
+
|
49
|
+
cal = Vpim::Icalendar.create2
|
50
|
+
|
51
|
+
cal.add_event do |e|
|
52
|
+
e.dtstart Date.new(2005, 04, 28)
|
53
|
+
e.dtend Date.new(2005, 04, 29)
|
54
|
+
e.summary "Monthly meet-the-CEO day"
|
55
|
+
e.description <<'---'
|
56
|
+
Unlike last one, this meeting will change your life because
|
57
|
+
we are going to discuss your likely demotion if your work isn't
|
58
|
+
done soon.
|
59
|
+
---
|
60
|
+
e.categories [ 'APPOINTMENT' ]
|
61
|
+
e.categories do |c| c.push 'EDUCATION' end
|
62
|
+
e.url 'http://www.example.com'
|
63
|
+
e.sequence 0
|
64
|
+
e.access_class "PRIVATE"
|
65
|
+
e.transparency 'OPAQUE'
|
66
|
+
|
67
|
+
now = Time.now
|
68
|
+
e.created now
|
69
|
+
e.lastmod now
|
70
|
+
|
71
|
+
|
72
|
+
e.organizer do |o|
|
73
|
+
o.cn = "Example Organizer, Mr."
|
74
|
+
o.uri = "mailto:organizer@example.com"
|
75
|
+
end
|
76
|
+
|
77
|
+
attendee = Vpim::Icalendar::Address.create("mailto:attendee@example.com")
|
78
|
+
attendee.rsvp = true
|
79
|
+
e.add_attendee attendee
|
80
|
+
end
|
81
|
+
|
82
|
+
icsfile = cal.encode
|
83
|
+
|
84
|
+
puts '--- Encode:'
|
85
|
+
|
86
|
+
puts icsfile
|
87
|
+
|
88
|
+
puts '--- Decode:'
|
89
|
+
|
90
|
+
cal = Vpim::Icalendar.decode(icsfile).first
|
91
|
+
|
92
|
+
cal.components do |e|
|
93
|
+
puts e.summary
|
94
|
+
puts e.description
|
95
|
+
puts e.dtstart.to_s
|
96
|
+
puts e.dtend.to_s
|
97
|
+
end
|
98
|
+
|
99
|
+
This produces:
|
100
|
+
|
101
|
+
--- Encode:
|
102
|
+
BEGIN:VCALENDAR
|
103
|
+
VERSION:2.0
|
104
|
+
PRODID:-//Ensemble Independent//vPim 0.357//EN
|
105
|
+
CALSCALE:Gregorian
|
106
|
+
BEGIN:VEVENT
|
107
|
+
DTSTART;VALUE=DATE:20050428
|
108
|
+
DTEND;VALUE=DATE:20050429
|
109
|
+
SUMMARY:Monthly meet-the-CEO day
|
110
|
+
DESCRIPTION:Unlike last one, this meeting will change your life because\nwe
|
111
|
+
are going to discuss your likely demotion if your work isn't\ndone soon.\n
|
112
|
+
CATEGORIES:APPOINTMENT,EDUCATION
|
113
|
+
URL:http://www.example.com
|
114
|
+
SEQUENCE:0
|
115
|
+
CLASS:PRIVATE
|
116
|
+
CREATED:20060402T231755
|
117
|
+
LAST-MODIFIED:20060402T231755
|
118
|
+
ORGANIZER;CN="Example Organizer, Mr.":mailto:organizer@example.com
|
119
|
+
ATTENDEE;RSVP=true:mailto:attendee@example.com
|
120
|
+
END:VEVENT
|
121
|
+
END:VCALENDAR
|
122
|
+
--- Decode:
|
123
|
+
Monthly meet-the-CEO day
|
124
|
+
Unlike last one, this meeting will change your life because
|
125
|
+
we are going to discuss your likely demotion if your work isn't
|
126
|
+
done soon.
|
127
|
+
Thu Apr 28 00:00:00 UTC 2005
|
128
|
+
Fri Apr 29 00:00:00 UTC 2005
|
129
|
+
|
130
|
+
|
131
|
+
More examples of using vPim are provided in samples/.
|
132
|
+
|
133
|
+
vCard examples are:
|
134
|
+
- link:ex_mkvcard.txt: example of creating a vCard
|
135
|
+
- link:ex_cpvcard.txt: example of copying and them modifying a vCard
|
136
|
+
- link:ex_mkv21vcard.txt: example of creating version 2.1 vCard
|
137
|
+
- link:mutt-aliases-to-vcf.txt: convert a mutt aliases file to vCards
|
138
|
+
- link:ex_get_vcard_photo.txt: pull photo data from a vCard
|
139
|
+
- link:ab-query.txt: query the OS X Address Book to find vCards
|
140
|
+
- link:vcf-to-mutt.txt: query vCards for matches, output in formats useful
|
141
|
+
with Mutt (see link:README.mutt for details)
|
142
|
+
- link:tabbed-file-to-vcf.txt: convert a tab-delimited file to vCards, a
|
143
|
+
(small but) complete application contributed by Dane G. Avilla, thanks!
|
144
|
+
- link:vcf-to-ics.txt: example of how to create calendars of birthdays from vCards
|
145
|
+
- link:vcf-dump.txt: utility for dumping contents of .vcf files
|
146
|
+
|
147
|
+
iCalendar examples are:
|
148
|
+
- link:ics-to-rss.txt: prints todos as RSS, or starts a WEBrick servlet
|
149
|
+
that publishes todos as a RSS feed. Thanks to Dave Thomas for this idea,
|
150
|
+
from http://pragprog.com/pragdave/Tech/Blog/ToDos.rdoc.
|
151
|
+
- link:cmd-itip.txt: prints emailed iCalendar invitations in human-readable
|
152
|
+
form, and see link:README.mutt for instruction on mutt integration. I get
|
153
|
+
a lot of meeting invitations from Lotus Notes/Domino users at work, and
|
154
|
+
this is pretty useful in figuring out where and when I am supposed to be.
|
155
|
+
- link:reminder.txt: prints upcoming events and todos, by default from
|
156
|
+
Apple's iCal calendars
|
157
|
+
- link:rrule.txt: utility for printing recurrence rules
|
158
|
+
- link:ics-dump.txt: utility for dumping contents of .ics files
|
159
|
+
module Vpim
|
160
|
+
end
|
161
|
+
|
162
|
+
= Installation
|
163
|
+
|
164
|
+
There is a vPim package installable using ruby-gems.
|
165
|
+
|
166
|
+
It is also installable in the standard way. Untar the package, and see:
|
167
|
+
|
168
|
+
ruby setup.rb --help
|
169
|
+
|
170
|
+
or do:
|
171
|
+
|
172
|
+
$ ruby setup.rb config
|
173
|
+
$ ruby setup.rb setup
|
174
|
+
# ruby setup.rb install (may require root privilege)
|
175
|
+
|