vpim2 0.0.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.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +504 -0
  3. data/COPYING +58 -0
  4. data/README +182 -0
  5. data/lib/atom.rb +728 -0
  6. data/lib/plist.rb +22 -0
  7. data/lib/vpim.rb +13 -0
  8. data/lib/vpim/address.rb +219 -0
  9. data/lib/vpim/attachment.rb +102 -0
  10. data/lib/vpim/date.rb +222 -0
  11. data/lib/vpim/dirinfo.rb +277 -0
  12. data/lib/vpim/duration.rb +119 -0
  13. data/lib/vpim/enumerator.rb +32 -0
  14. data/lib/vpim/field.rb +614 -0
  15. data/lib/vpim/icalendar.rb +381 -0
  16. data/lib/vpim/maker/vcard.rb +16 -0
  17. data/lib/vpim/property/base.rb +193 -0
  18. data/lib/vpim/property/common.rb +315 -0
  19. data/lib/vpim/property/location.rb +38 -0
  20. data/lib/vpim/property/priority.rb +43 -0
  21. data/lib/vpim/property/recurrence.rb +69 -0
  22. data/lib/vpim/property/resources.rb +24 -0
  23. data/lib/vpim/repo.rb +181 -0
  24. data/lib/vpim/rfc2425.rb +367 -0
  25. data/lib/vpim/rrule.rb +591 -0
  26. data/lib/vpim/vcard.rb +1430 -0
  27. data/lib/vpim/version.rb +18 -0
  28. data/lib/vpim/vevent.rb +187 -0
  29. data/lib/vpim/view.rb +90 -0
  30. data/lib/vpim/vjournal.rb +58 -0
  31. data/lib/vpim/vpim.rb +65 -0
  32. data/lib/vpim/vtodo.rb +103 -0
  33. data/samples/README.mutt +93 -0
  34. data/samples/ab-query.rb +57 -0
  35. data/samples/cmd-itip.rb +156 -0
  36. data/samples/ex_cpvcard.rb +55 -0
  37. data/samples/ex_get_vcard_photo.rb +22 -0
  38. data/samples/ex_mkv21vcard.rb +34 -0
  39. data/samples/ex_mkvcard.rb +64 -0
  40. data/samples/ex_mkyourown.rb +29 -0
  41. data/samples/ics-dump.rb +210 -0
  42. data/samples/ics-to-rss.rb +84 -0
  43. data/samples/mutt-aliases-to-vcf.rb +45 -0
  44. data/samples/osx-wrappers.rb +86 -0
  45. data/samples/reminder.rb +203 -0
  46. data/samples/rrule.rb +71 -0
  47. data/samples/tabbed-file-to-vcf.rb +390 -0
  48. data/samples/vcf-dump.rb +86 -0
  49. data/samples/vcf-lines.rb +61 -0
  50. data/samples/vcf-to-ics.rb +22 -0
  51. data/samples/vcf-to-mutt.rb +121 -0
  52. data/test/test_all.rb +17 -0
  53. data/test/test_date.rb +120 -0
  54. data/test/test_dur.rb +41 -0
  55. data/test/test_field.rb +156 -0
  56. data/test/test_ical.rb +415 -0
  57. data/test/test_repo.rb +158 -0
  58. data/test/test_rrule.rb +1030 -0
  59. data/test/test_vcard.rb +973 -0
  60. data/test/test_view.rb +79 -0
  61. metadata +117 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e38388334af2bcb5a6235eb3596168547bcfe003
4
+ data.tar.gz: 207d33ce42a4bb1ebe680bdf1a3d2c51bda6292f
5
+ SHA512:
6
+ metadata.gz: 5bdb311af081b7bf412a43ac6e26daf6262ba86198c9b5dc6753f45fb07b8406eec2e9324fef7fce703b71e2f29bc76f61b5814b6c200605c2c89ed7b722cab0
7
+ data.tar.gz: 21df70fe991340058a7691b8b3c2b93de498de2ad00d9b98b420e2626fd86953823754e38ac7bfbdcca4c933dfd47c713f9602ff40a33056c55ab51362e3b868
data/CHANGES ADDED
@@ -0,0 +1,504 @@
1
+ 0.657 - 2008-08-14
2
+
3
+ - Date#to_time renamed to Date#vpim_to_time. Apparently Rails also patches the core.
4
+
5
+ - Debian doesn't like RFCs. I think there is a problem with the DFG, not the
6
+ IETF. The value of a standard is that it can't be modified (if anybody could
7
+ publish a modified version of an RFC without restriction chaos would ensue).
8
+ Still, we lost that argument, and I'll try and help packagers out.
9
+
10
+ - View, gives various views of calendars. Experimental.
11
+
12
+ - Fixed doc comment refs to common Property module.
13
+
14
+ - Vtodo#duration and #due now work correctly (the missing one will be calculated
15
+ from the other).
16
+
17
+ - Vevent::Maker#add_rrule, #set_rrule are new, using Rrule::Maker.
18
+
19
+ - There is now (half-of) an Rrule::Maker class to help construct RRULE values.
20
+
21
+ - Vjournal can be encoded now (it was broken).
22
+
23
+ - Better code coverage by the tests.
24
+
25
+ - Recurrence#occurrences now returns an Enumerator instead of an Rrule. Both
26
+ have #each, and both yield the same thing, so that isn't an API change. However,
27
+ Rrule had an each_until, and the Enumerator doesn't. Use the dountil argument
28
+ to #occurrences to get the same effect. The asymetry of this API caused me
29
+ (non-aesthetic) trouble, now Rrule is an internal implementation detail.
30
+ Also, this would have had to change eventually, because occurrences need to
31
+ be the union of multiple RRULE and RDATE fields.
32
+
33
+ - Recurrence#rrule, returns an Rrule for the first RRULE field. Can be used
34
+ as transition.
35
+
36
+ - Icalendar#calscale was broken, and is now unit tested, along with #version
37
+ and #protocol?.
38
+
39
+ - Icalendar#{each,events,todos,journals} all yield components, or return an
40
+ enumerator.
41
+
42
+ - Icalendar is enumerable.
43
+
44
+ - Repo and Repo::Calendar are enumerable.
45
+
46
+ - #occurrences will call Rrule#each if a block is provided
47
+
48
+ - Recurrence rules with DTSTART in UTC will now sortof work (thanks to Max
49
+ Werner for providing the patch).
50
+
51
+ - Added convenience methods for setting and getting title and org fiels (thanks
52
+ to Jade Meskill for providing the patch).
53
+
54
+ - Modified Icalendar#create2 so only prodid can be supplied and cal is yielded
55
+ so events/etc. can be pushed.
56
+
57
+ - Support Highrisehq.com's broken google talk field (see test_vcard.rb for
58
+ examples, thanks to Terry Tong for reporting).
59
+
60
+
61
+ 0.619 - 2008-03-30
62
+
63
+ - Fixed some problems with rescue statements not being specific enough.
64
+
65
+ - Vcard#birthday may now return a DateTime.
66
+
67
+ - Added Vcard#urls
68
+
69
+ - Fixed a mispelled Uri in Vcard#url
70
+
71
+ - Global fix of misspellings of "occurrence"
72
+
73
+ - KAddressBook compatibility fix - allow / in field names, even though it is
74
+ illegal in vCard 3.0.
75
+
76
+
77
+ 0.604 - 2008-03-13
78
+
79
+ - Fixed a bug with lower-case UTF-16 encoded cards not being detected properly.
80
+
81
+ - Skip over invalidly encoded vCard fields when enumerating them.
82
+
83
+
84
+ 0.602 - 2008-03-12
85
+
86
+ - Updated reminder utility to work with iCal 3.
87
+
88
+ - Reworked gem to include tests, samples, and binaries.
89
+
90
+
91
+ 0.597 - 2008-03-01
92
+
93
+ - Support for BYSETPOS in recurrence rules (development supported by ZipDX.com)
94
+
95
+ - Support for FREQ=weekly in recurrence rules (development supported by ZipDX.com)
96
+
97
+ - Fixed an encode_text() bug (patch supplied by Jan Becvar)
98
+
99
+ - Fixed problem with interaction between BYMONTH and BYDAY (patch supplied by
100
+ Sam Stephenson of 32signals.com)
101
+
102
+ - Vevent::Maker - Started adding high-level iCalendar encoding APIs
103
+
104
+ - Vpim::Vcard::Maker - the vCard maker is moved here
105
+
106
+ - Vpim::Maker - deprecated
107
+
108
+ - Vcard::make, Maker::Vcard#delete_if - new
109
+
110
+ - Vcard::Maker#add_name - deprecate, see Vcard::Maker#name
111
+
112
+ - Vcard::Maker#fullname= - deprecate, see Vcard::Maker#name
113
+
114
+ - Added high-level vCard decoding API.
115
+
116
+ - Beginning to depend on ruby1.8. I'm willing to try for backwards compat if I
117
+ get feedback that this causes difficulties.
118
+
119
+ - Icalendar#components - new
120
+
121
+ - Icalendar#vevents - deprecated, see Icalendar#components
122
+
123
+ - split Vtodo and Vjournal into own files
124
+
125
+ - Added Recurrence module to Vtodo and Vjournal
126
+
127
+ - Property::Common#sequence - new
128
+
129
+ - Property::Common#attachments - new
130
+
131
+ - Icalendar::Attachment - new
132
+
133
+ - Maker::Vcard#add_url - new
134
+
135
+ - ex_mkyourown.rb - new example
136
+
137
+ - Modularized the component property accessor methods, and added lots of
138
+ Icalendar property support for Vevent, Vtodo, and Vjournal.
139
+
140
+ - Fixed support for TEXT decoding.
141
+
142
+ - Use Subversion revision as release sub-version.
143
+
144
+ - It appears that a top-level vpim.rb that requires everything else is needed
145
+ for ruby-gems, gemspec seems to work now.
146
+
147
+ - Don't package backup files (.../*.rb~).
148
+
149
+ - Icalendar decoding optimizations. Icalendar.decode is about twice as fast
150
+ now, and more optimizations are scheduled.
151
+
152
+ - Continue the move to using uppercase for all syntactic elements that can be
153
+ mixed case. The API might eventually allow only uppercase, it appears
154
+ case-insensitive comparisons still have a noticeable effect on performance.
155
+
156
+
157
+ 0.17 - 2006-03-08
158
+
159
+ - DirectoryInfo#delete - new
160
+
161
+ - Maker::Vcard#fullname - new
162
+
163
+ - Provide an example of how to create, copy, and modify version 2.1 vCards.
164
+
165
+ - Maker::Vcard.make2 - new
166
+
167
+ - Maker::Vcard.make - deprecated
168
+
169
+ - Profiled decoding of a huge iCalendar file. Performance appears to be
170
+ dominated by overhead of String#downcase (20% of time spent in Field#name?).
171
+ Keeping the field group, field name, and field's parameter's names internally
172
+ in uppercase and using ruby 1.8's String#casecmp? is a first attempt at
173
+ optimization. This is a change in the default case returned, but it aligns
174
+ with the RFC and common usage.
175
+
176
+ - Maker::Vcard.make - full_name is now optional, it will be derived from name/N:
177
+
178
+ - Maker::Vcard#add_field - better argument checking
179
+
180
+ - Maker::Vcard#copy - new
181
+
182
+ - Vcard#[] - now limits return to fields with values
183
+
184
+ - Vcard#name - new
185
+
186
+ - Vcard::Name - new
187
+
188
+ - Vcard#nicknames - new
189
+
190
+ - Field#params and Field#param - deprecated and undocumented, I could never
191
+ remember the difference
192
+
193
+ - Field#pnames - new
194
+
195
+ - Field#pvalues - new
196
+
197
+ - Methods.casecmp? - new
198
+
199
+ - Field#pref= - new
200
+
201
+ - Field#pvalue_idel - new
202
+
203
+ - Field#pvalue_iadd - new
204
+
205
+
206
+ 0.16 - 2006-02-19
207
+
208
+ - Packaged in gem format, experimental.
209
+
210
+ - Read vCards in UTF-8 or UTF-16, big or little endian, with or without a byte
211
+ order mark (BOM).
212
+
213
+ - Fixed bug with rrule occurences containing the end of the interval. Reported
214
+ with patch by Brad Ediger.
215
+
216
+ 0.15 - 2005-07-29
217
+
218
+ - Fixed bug with param values with quoted strings, particularly a quoted string
219
+ containing a : character, like
220
+ name;param="file:///":value
221
+
222
+ Thanks to Tamiji Homma for reporting this and sending me an example calendar.
223
+
224
+ - Vtodo.create - new
225
+ - Icalendar#push - allow Vtodos to be added
226
+
227
+ Thanks to Maximillian Dornseif for contributing the above two Vtodo patches.
228
+
229
+ - Vevent.duration - bug fixes so duration can be calculated from begin/end, and
230
+ end can be calculated from begin/duration
231
+
232
+ - Vcard#nickname that strips whitespace to see if there really is a nickname
233
+
234
+ - Vcard#birthday - returns birthday as a date
235
+
236
+ - Vevent#create_yearly - easy, cheesy way to create yearly recurring events
237
+
238
+ - vcf-to-ics.rb: example of how to create calendars of bdays from vcards
239
+
240
+ - Icalendar.create() like Vevent.create(), it will take arrays of Fields, or
241
+ Hashes of String => value.
242
+
243
+ - maker/vcard.rb: Added support for X-AIM, an Apple extension.
244
+
245
+ 0.14 - 2005-02-01
246
+
247
+ - Fix: if an RRULE didn't ever yield an event (a bug in the rule) dountil was never tested.
248
+
249
+ - Change: don't throw an ArgumentError with infinite events, just stop when the
250
+ Time is no longer representable
251
+
252
+ 0.13 - 2005-01-20
253
+
254
+ - Was calling to_time with an arg, fixed.
255
+
256
+ 0.12 - 2005-01-17
257
+
258
+ - Removed require of pp from the library and utilities where it wasn't needed,
259
+ it was causing problems because it doesn't exist on ruby 1.6 systems.
260
+
261
+ - Added Field#to_date, returns field value as an array of Date objects
262
+
263
+ - Changed Field#to_time - it now auto-detects format of values
264
+ (DATE/DATE-TIME), and doesn't take/require a default_kind argument.
265
+
266
+ - Added IMPP support to Vpim::Maker::Vcard.
267
+
268
+ - Makefile wasn't copying the Maker classes into the release.
269
+
270
+ - Duration value not returned unless it was negative, fixed.
271
+
272
+ - An RRULE's UNTIL was always being assumed to be a DATE-TIME, but it can be a
273
+ DATE. I fixed this, but is something of a hack, see comments and TODO.
274
+
275
+ - Use String#scan instead of String#gsub, when appropriate (I didn't know it
276
+ existed when I stated the project).
277
+
278
+ - Run tests on 3 ruby versions.
279
+
280
+ - Don't include docs in release package, it makes it way too large.
281
+
282
+ - Change: use String.unpack instead of iconv to convert UCS-2 to UTF-8,
283
+ removing dependency on iconv (it wasn't standard in ruby 1.6).
284
+
285
+ - Change: simplified mutt_ab_query.rb, and renamed to vcf-to-mutt.
286
+
287
+ - Change: reminder.rb sorts todo items by priority.
288
+
289
+ - New: Vtodo#priority - the priority of the vTodo component.
290
+
291
+ 0.11 - 2004-11-17
292
+
293
+ - Added a Vpim::Maker::Vcard class to simplify the creation of vCards, modelled
294
+ after the RSS maker from ruby's RSS library.
295
+
296
+ 0.10 - 2004-11-07
297
+
298
+ - If events don't have a recurrence rule, they occur once, but they
299
+ were being returned even if they occurred after "dountil". Fixed.
300
+
301
+ - New sample of converting tab-delimited files to a vcard file, from
302
+ Dane G. Avilla. Thanks!
303
+
304
+ 0.9a - 2004-10-31
305
+
306
+ - Made sure all events occur once in rrules.
307
+
308
+ - New sample of encoding: mutt-aliases-vcard.rb
309
+
310
+ - Added ToDo support to reminder.rb.
311
+
312
+ 0.9 - 2004-06-17
313
+
314
+ - Field now is mutable, you can change the group, value, params, etc.
315
+
316
+ - Using the Enumerator object for DirectoryInfo now, instead of all the
317
+ each_by_X, and field_by_X() APIs.
318
+
319
+ - Moved homepage and docs to Ruby Forge.
320
+
321
+ - DirectoryInfo.create: added a profile argument
322
+
323
+ - DirectoryInfo#push: now pushes to 1 before the end
324
+
325
+ - DirectoryInfo#push_end: pushes onto end, in case you really want to
326
+
327
+ - Field.create: a Date or Time object value will now be encoded as date or time
328
+
329
+ - Vpim.encode_date(): encodes an RFC2425 date
330
+
331
+ - Vpim.encode_time(): encodes an RFC2425 time
332
+
333
+ - Vpim.encode_date_time(): encodes an RFC2425 date-time
334
+
335
+ - Icalendar#encode(): encodes an Icalendar
336
+
337
+ - Icalendar#push(): pushes a calendar component onto a calendar
338
+
339
+ - Vevent#accept(): accepts an event invitation
340
+
341
+ - Vevent#create(): creates a new event
342
+
343
+ - Address#copy(): create a copy of Address. If the original Address was frozen,
344
+ this one won't be.
345
+
346
+ - Address#partstat=(): set or change the PARTSTAT.
347
+
348
+ - Field#copy(): create a copy of Field. If the original Field was frozen, this
349
+ one won't be.
350
+
351
+ 0.8 - 2004-04-01
352
+
353
+ - Moved DirectoryInfo::Field into it's own file, vpim/field.rb.
354
+
355
+ - New: Vpim::Duration - crude way of getting days/hours/mins/secs from a
356
+ duration in seconds.
357
+
358
+ - New: Icalendar#create() and Icalendar#create_reply()
359
+
360
+ - New: Icalendar#encode(), #to_s is an alias to #encode.
361
+
362
+ - New: Icalendar#protocol?()
363
+
364
+ - Change: Icalendar#version() raises an error if there is no VERSION
365
+
366
+ - Change: made all the DirectoryInfo, Vcard, and Field .new() class methods
367
+ private, and replaced with the 2 class methods:
368
+
369
+ - decode() decodes a string, returning a ruby object
370
+ - create() creates a new object
371
+
372
+ and all objects now get encoded using:
373
+
374
+ - encode() takes a ruby object, and encodes it as a string
375
+
376
+ They become more symetrical, and the overloaded meanings of .new() dissappear -
377
+ with .new() are you decoding, encoding, creating...?
378
+
379
+ - Change: Icalendar::Vevent#attendees() can return only attendees
380
+ with a particular URI.
381
+
382
+ - New: Icalendar::Address#==()
383
+
384
+ - New: Icalendar::Vevent#attendee?()
385
+
386
+ - Fixed bug: Field#encode() was adding an unexpecte NL to the line.
387
+
388
+ - Change: Field#name?() can accept a symbol.
389
+
390
+ - New: DirectoryInfo has an #each(), so I included Enumerable. Because of this
391
+ #to_a() now returns all the Fields in a DirectoryInfo.
392
+
393
+ - New: DirectoryInfo#push() and DirectoryInfo@push_uniq().
394
+
395
+ - Change: DirectoryInfo#<<() is now an alias for DirectoryInfo#push()
396
+
397
+ - Change: DirectoryInfo#each() and DirectoryInfo#each_by() now return self
398
+ instead of nil, I think this is more rubyish.
399
+
400
+ - New: Date#to_time() - converts a Date, and maybe a DateTime, to a Time
401
+
402
+ - New: Icalendar#protocol()
403
+
404
+ - New: Icalendar::Address
405
+
406
+ - New: Icalendar::Vevent#organizer()/attendees(), which return an
407
+ Icalendar::Address
408
+
409
+ - New: An array of all the values of fields named name, converted to text,
410
+ using Field.to_text().
411
+
412
+
413
+ 0.7 - 2004-03-21
414
+
415
+ - Bug fixes, not all files were requiring vpim.rb, which had the definition of
416
+ the invalid encoding error.
417
+
418
+ - Implemented much requested feature: ignore empty lines in input. This is an
419
+ invalid encoding, but I'm tired of fighting it.
420
+
421
+
422
+ 0.6 - 2004-03-20
423
+
424
+ WARNING: major API renamings!
425
+
426
+ - Replaced the Vpim::Errors::*Error exception classes with a single exception
427
+ class: Vpim::InvalidEncodingError. That, and a message, is all I really need.
428
+ I don't think people need different classes for different types of encoding
429
+ errors, either the library can decode it for them, or it can't.
430
+
431
+ - Renamed project to "vpim" (to reflect vCard and vCalendar/iCalendar support),
432
+ renamed top-level Rfc2425 module to Vpim, split vard.rb into multiple files.
433
+
434
+ - Add support for iCalendar (RFC2445), see vpim/icalendar.rb. Currently only
435
+ supports VEVENT, no VTODO or VALARM yet, but is useable to print my upcoming
436
+ iCal events.
437
+
438
+ - Implemented the iCalendar recurrence rules mini-language, which is possibly
439
+ of more general use than just for iCalendar.
440
+
441
+ - Fixed bug in time decoding where usec would be nil instead of zero when no
442
+ usec were present in the time value.
443
+
444
+ - Field#to_time now assumes that time is in local time, unless the timezone is
445
+ "Z", meaning UTC.
446
+
447
+ - Field#to_text - new method, unescapes newlines, commas, and escape
448
+ characters.
449
+
450
+ - Field#field(name) - new method, returns the first field named +name+.
451
+
452
+
453
+ 0.5 - 3003-11-23
454
+
455
+ - ab-query.rb - short option for --me was mistyped as -v, instead of -m.
456
+
457
+ - mutt_ab_query.rb - added a --pipe option, so that the output of an other
458
+ script can be directly queried.
459
+
460
+ - New method: Rfc2425.version
461
+
462
+ - Decode vCard 2.1 abbreviated parameters (ones where the name of the parameter
463
+ is missing, only the value is present, which only works for type and encoding).
464
+
465
+ - Vcard.decode() now support UCS-2 encoded vCards, by translating anything that
466
+ looks like UCS-2 to UTF-8 before decoding.
467
+
468
+ 0.4 - 2003-04-14
469
+
470
+ - More support for decoding date, time, and date-time values.
471
+
472
+ - New method Field#to_time().
473
+
474
+ - Can pass an IO object to decode APIs, its entire contents is read as a
475
+ string.
476
+
477
+ - Field#group?() now considers nil as equivalent to no group, so you can use
478
+ each_group(nil) to iterate through all fields without a group.
479
+
480
+ 0.3 -
481
+
482
+ - Added description of how to use mutt_ab_query.rb
483
+
484
+ - Added support for querying the kind of a value, and began support for
485
+ decoding date and time values.
486
+
487
+ 0.2 -
488
+
489
+ - Supports encoding.
490
+
491
+ - Supports accessing values using [].
492
+
493
+ - No longer have methods return an Array, or nil if the array is zero length, I
494
+ just return an Array.
495
+
496
+ - mutt_ab_query.rb - an example of using vcard.rb to do lookups in the OS X
497
+ Address Book from Mutt
498
+
499
+ 0.1 -
500
+
501
+ - First release.
502
+ ---
503
+
504
+ vim:expandtab:tabstop=8:softtabstop=2:shiftwidth=2