scashin133-vpim 9.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/CHANGES +510 -0
  4. data/COPYING +58 -0
  5. data/LICENSE +20 -0
  6. data/Makefile +135 -0
  7. data/README +182 -0
  8. data/README.rdoc +17 -0
  9. data/Rakefile +54 -0
  10. data/THANKS +2 -0
  11. data/VERSION +1 -0
  12. data/ex_fmt_convert.rb +25 -0
  13. data/ex_ics_api.rb +54 -0
  14. data/lib/vpim/address.rb +219 -0
  15. data/lib/vpim/agent/atomize.rb +104 -0
  16. data/lib/vpim/agent/base.rb +73 -0
  17. data/lib/vpim/agent/calendars.rb +173 -0
  18. data/lib/vpim/agent/handler.rb +26 -0
  19. data/lib/vpim/agent/ics.rb +161 -0
  20. data/lib/vpim/attachment.rb +102 -0
  21. data/lib/vpim/date.rb +222 -0
  22. data/lib/vpim/dirinfo.rb +277 -0
  23. data/lib/vpim/duration.rb +119 -0
  24. data/lib/vpim/enumerator.rb +32 -0
  25. data/lib/vpim/field.rb +618 -0
  26. data/lib/vpim/icalendar.rb +384 -0
  27. data/lib/vpim/maker/vcard.rb +16 -0
  28. data/lib/vpim/property/base.rb +193 -0
  29. data/lib/vpim/property/common.rb +315 -0
  30. data/lib/vpim/property/location.rb +38 -0
  31. data/lib/vpim/property/priority.rb +43 -0
  32. data/lib/vpim/property/recurrence.rb +69 -0
  33. data/lib/vpim/property/resources.rb +24 -0
  34. data/lib/vpim/repo.rb +261 -0
  35. data/lib/vpim/rfc2425.rb +371 -0
  36. data/lib/vpim/rrule.rb +591 -0
  37. data/lib/vpim/time.rb +40 -0
  38. data/lib/vpim/vcard.rb +1426 -0
  39. data/lib/vpim/version.rb +19 -0
  40. data/lib/vpim/vevent.rb +187 -0
  41. data/lib/vpim/view.rb +90 -0
  42. data/lib/vpim/vjournal.rb +58 -0
  43. data/lib/vpim/vpim.rb +65 -0
  44. data/lib/vpim/vtodo.rb +103 -0
  45. data/lib/vpim.rb +13 -0
  46. data/mbox2vcard.rb +89 -0
  47. data/outline.sh +4 -0
  48. data/profile.rb +6 -0
  49. data/profile.txt +276 -0
  50. data/samples/README.mutt +93 -0
  51. data/samples/ab-query.rb +57 -0
  52. data/samples/agent.ru +10 -0
  53. data/samples/cmd-itip.rb +156 -0
  54. data/samples/ex_cpvcard.rb +55 -0
  55. data/samples/ex_get_vcard_photo.rb +22 -0
  56. data/samples/ex_mkv21vcard.rb +34 -0
  57. data/samples/ex_mkvcard.rb +64 -0
  58. data/samples/ex_mkyourown.rb +29 -0
  59. data/samples/ics-dump.rb +210 -0
  60. data/samples/ics-to-rss.rb +84 -0
  61. data/samples/mutt-aliases-to-vcf.rb +45 -0
  62. data/samples/osx-wrappers.rb +86 -0
  63. data/samples/reminder.rb +209 -0
  64. data/samples/rrule.rb +71 -0
  65. data/samples/tabbed-file-to-vcf.rb +390 -0
  66. data/samples/vcf-dump.rb +86 -0
  67. data/samples/vcf-lines.rb +61 -0
  68. data/samples/vcf-to-ics.rb +22 -0
  69. data/samples/vcf-to-mutt.rb +121 -0
  70. data/setup.rb +1585 -0
  71. data/stamp.rb +29 -0
  72. data/test/calendars/weather.calendar/Events/1205042405-0-0.ics +17 -0
  73. data/test/calendars/weather.calendar/Events/1205128857-1-1205128857.ics +21 -0
  74. data/test/calendars/weather.calendar/Events/1205215257-2--1884536782.ics +22 -0
  75. data/test/calendars/weather.calendar/Events/1205301657-3--679062325.ics +21 -0
  76. data/test/calendars/weather.calendar/Events/1205388057-4-526584932.ics +20 -0
  77. data/test/calendars/weather.calendar/Events/1205474457-5-1732404989.ics +21 -0
  78. data/test/calendars/weather.calendar/Events/1205560857-6--1356569450.ics +21 -0
  79. data/test/calendars/weather.calendar/Events/1205647257-7--150403793.ics +22 -0
  80. data/test/calendars/weather.calendar/Events/1205712057-8-1055761864.ics +20 -0
  81. data/test/calendars/weather.calendar/Info.plist +20 -0
  82. data/test/common.rb +51 -0
  83. data/test/test_agent_atomize.rb +84 -0
  84. data/test/test_agent_calendars.rb +128 -0
  85. data/test/test_agent_ics.rb +96 -0
  86. data/test/test_all.rb +14 -0
  87. data/test/test_date.rb +120 -0
  88. data/test/test_dur.rb +41 -0
  89. data/test/test_field.rb +156 -0
  90. data/test/test_ical.rb +437 -0
  91. data/test/test_misc.rb +13 -0
  92. data/test/test_repo.rb +129 -0
  93. data/test/test_rrule.rb +1030 -0
  94. data/test/test_vcard.rb +1017 -0
  95. data/test/test_view.rb +79 -0
  96. data/test/weekly.ics +40 -0
  97. data/vpim.gemspec +157 -0
  98. metadata +206 -0
data/profile.txt ADDED
@@ -0,0 +1,276 @@
1
+ ensemble:~/p/ruby/vpim/trunk % time /opt/local/bin/ruby -I lib -rprofile ./profile.rb
2
+ % cumulative self self total
3
+ time seconds seconds calls ms/call ms/call name
4
+ 20.53 73.27 73.27 80616 0.91 1.25 Vpim::Methods.casecmp?
5
+ 17.16 134.53 61.26 16916 3.62 47.95 Array#each
6
+ 7.87 162.61 28.08 66300 0.42 2.09 Proc#call
7
+ 7.63 189.85 27.24 79313 0.34 1.59 Vpim::DirectoryInfo::Field#name?
8
+ 4.71 206.67 16.82 6506 2.59 3.89 Vpim::DirectoryInfo::Field#decode0
9
+ 2.76 216.51 9.84 84516 0.12 0.12 String#==
10
+ 2.64 225.92 9.41 14300 0.66 1.68 Vpim::DirectoryInfo#enum_by_name
11
+ 2.53 234.94 9.02 80616 0.11 0.11 String#casecmp
12
+ 2.40 243.51 8.57 80691 0.11 0.11 Fixnum#==
13
+ 2.33 251.82 8.31 66300 0.13 0.13 Proc#==
14
+ 2.09 259.29 7.47 14300 0.52 14.92 Vpim::DirectoryInfo#each
15
+ 2.00 266.43 7.14 14300 0.50 15.42 Vpim::Enumerator#each
16
+ 1.80 272.85 6.42 6506 0.99 5.17 Vpim::DirectoryInfo::Field#initialize
17
+ 1.69 278.89 6.04 23413 0.26 26.02 Class#new
18
+ 1.66 284.80 5.91 1300 4.55 212.08 Vpim::Icalendar::Vevent#initialize
19
+ 1.48 290.08 5.28 7800 0.68 19.36 Vpim::DirectoryInfo#text
20
+ 1.46 295.30 5.22 14300 0.37 0.54 Proc#new
21
+ 1.07 299.11 3.81 6502 0.59 1.03 Vpim::DirectoryInfo::Field#param
22
+ 1.06 302.89 3.78 1 3780.00 4800.00 IO#each
23
+ 1.01 306.49 3.60 6502 0.55 1.58 Vpim::DirectoryInfo::Field#encoding
24
+ 0.99 310.02 3.53 6502 0.54 2.29 Vpim::DirectoryInfo::Field#value
25
+ 0.97 313.49 3.47 5200 0.67 15.40 Vpim::DirectoryInfo#field
26
+ 0.96 316.93 3.44 14300 0.24 0.24 Vpim::Enumerator#initialize
27
+ 0.87 320.03 3.10 7800 0.40 17.11 Enumerable.map
28
+ 0.82 322.97 2.94 6506 0.45 5.97 Vpim::DirectoryInfo::Field#decode
29
+ 0.72 325.54 2.57 22114 0.12 0.12 String#upcase
30
+ 0.69 328.01 2.47 14300 0.17 0.17 Object#initialize
31
+ 0.65 330.34 2.33 2600 0.90 1.71 String#scan
32
+ 0.49 332.09 1.75 16913 0.10 0.10 Array#<<
33
+ 0.48 333.81 1.72 7802 0.22 0.30 Hash#[]
34
+ 0.45 335.41 1.60 10405 0.15 0.15 Array#first
35
+ 0.42 336.91 1.50 7802 0.19 0.20 Kernel.===
36
+ 0.41 338.37 1.46 1301 1.12 3.43 Vpim::DirectoryInfo#initialize
37
+ 0.37 339.70 1.33 1300 1.02 4.68 Vpim::DirectoryInfo::Field#to_text
38
+ 0.36 340.97 1.27 1 1270.00 40120.00 Array#collect
39
+ 0.35 342.23 1.26 13024 0.10 0.10 Fixnum#>
40
+ 0.33 343.41 1.18 7808 0.15 0.15 Module#===
41
+ 0.29 344.46 1.05 6506 0.16 0.19 Hash#each
42
+ 0.29 345.48 1.02 1300 0.78 20.22 Vpim::DirectoryInfo#[]
43
+ 0.23 346.29 0.81 6506 0.12 0.12 String#length
44
+ 0.23 347.10 0.81 7806 0.10 0.10 Kernel.freeze
45
+ 0.22 347.90 0.80 7807 0.10 0.10 Array#push
46
+ 0.22 348.67 0.77 6506 0.12 0.12 MatchData#[]
47
+ 0.20 349.37 0.70 7809 0.09 0.09 String#to_str
48
+ 0.19 350.04 0.67 1301 0.51 5.18 Vpim.outer_inner
49
+ 0.18 350.67 0.63 3900 0.16 0.16 String#gsub
50
+ 0.17 351.29 0.62 6502 0.10 0.10 Hash#default
51
+ 0.17 351.88 0.59 6506 0.09 0.09 String#strip!
52
+ 0.16 352.46 0.58 1301 0.45 4.16 Vpim::DirectoryInfo#create
53
+ 0.16 353.04 0.58 6506 0.09 0.09 String#chomp!
54
+ 0.16 353.61 0.57 6506 0.09 0.09 String#size
55
+ 0.15 354.16 0.55 1303 0.42 1.44 Vpim::DirectoryInfo::Field#value?
56
+ 0.15 354.71 0.55 10411 0.05 0.05 Array#last
57
+ 0.15 355.25 0.54 1302 0.41 2.30 Enumerable.detect
58
+ 0.15 355.77 0.52 1300 0.40 0.88 Vpim.decode_text
59
+ 0.13 356.24 0.47 6526 0.07 0.07 Kernel.kind_of?
60
+ 0.04 356.40 0.16 1300 0.12 0.12 Hash#key?
61
+ 0.04 356.55 0.15 27 5.56 41.11 Kernel.require
62
+ 0.03 356.65 0.10 1301 0.08 0.08 Array#pop
63
+ 0.03 356.74 0.09 1300 0.07 0.07 Hash#[]=
64
+ 0.01 356.78 0.04 259 0.15 0.15 Module#method_added
65
+ 0.01 356.80 0.02 3 6.67 10.00 Integer#gcd
66
+ 0.01 356.82 0.02 3 6.67 20.00 Rational#reduce
67
+ 0.00 356.83 0.01 1 10.00 10.00 Date#civil_to_jd
68
+ 0.00 356.84 0.01 5 2.00 2.00 Rational#initialize
69
+ 0.00 356.85 0.01 1 10.00 20.00 Date#valid_civil?
70
+ 0.00 356.86 0.01 91 0.11 0.11 Symbol#to_i
71
+ 0.00 356.87 0.01 2 5.00 30.00 Rational#/
72
+ 0.00 356.88 0.01 82 0.12 0.12 Fixnum#*
73
+ 0.00 356.89 0.01 91 0.11 0.11 Fixnum#to_s
74
+ 0.00 356.89 0.00 107 0.00 0.00 Kernel.singleton_method_added
75
+ 0.00 356.89 0.00 5 0.00 0.00 Module#included
76
+ 0.00 356.89 0.00 2 0.00 0.00 Array#join
77
+ 0.00 356.89 0.00 28 0.00 0.00 Module#module_eval
78
+ 0.00 356.89 0.00 1 0.00 0.00 Class#new0
79
+ 0.00 356.89 0.00 2 0.00 0.00 Date#os?
80
+ 0.00 356.89 0.00 4 0.00 0.00 Float#*
81
+ 0.00 356.89 0.00 2 0.00 0.00 Fixnum#<=
82
+ 0.00 356.89 0.00 1 0.00 0.00 Module#module_function
83
+ 0.00 356.89 0.00 1 0.00 25780.00 Vpim.expand
84
+ 0.00 356.89 0.00 1 0.00 0.00 Kernel.singleton_method_undefined
85
+ 0.00 356.89 0.00 1 0.00 40.00 Rational#-
86
+ 0.00 356.89 0.00 24 0.00 0.00 Fixnum#>>
87
+ 0.00 356.89 0.00 10 0.00 0.00 Float#floor
88
+ 0.00 356.89 0.00 8 0.00 0.00 Module#private_class_method
89
+ 0.00 356.89 0.00 11 0.00 0.00 Fixnum#+
90
+ 0.00 356.89 0.00 4 0.00 0.00 Module#attr_reader
91
+ 0.00 356.89 0.00 3 0.00 0.00 Fixnum#<<
92
+ 0.00 356.89 0.00 3 0.00 20.00 Object#Rational
93
+ 0.00 356.89 0.00 2 0.00 0.00 Module#attr
94
+ 0.00 356.89 0.00 7 0.00 7.14 Date#once
95
+ 0.00 356.89 0.00 1 0.00 0.00 Date#jd_to_civil
96
+ 0.00 356.89 0.00 1 0.00 0.00 File#initialize
97
+ 0.00 356.89 0.00 1 0.00 90.00 Date#new
98
+ 0.00 356.89 0.00 1 0.00 356550.00 Vpim::Icalendar#decode
99
+ 0.00 356.89 0.00 6 0.00 0.00 Fixnum#div
100
+ 0.00 356.89 0.00 14 0.00 0.00 Class#inherited
101
+ 0.00 356.89 0.00 2 0.00 0.00 Module#public
102
+ 0.00 356.89 0.00 1 0.00 0.00 Array#==
103
+ 0.00 356.89 0.00 2 0.00 0.00 Hash#keys
104
+ 0.00 356.89 0.00 1 0.00 0.00 Module#undef_method
105
+ 0.00 356.89 0.00 5 0.00 0.00 Module#append_features
106
+ 0.00 356.89 0.00 47 0.00 0.00 Fixnum#[]
107
+ 0.00 356.89 0.00 1 0.00 10.00 Vpim::DirectoryInfo#check_begin_end
108
+ 0.00 356.89 0.00 4 0.00 0.00 Float#coerce
109
+ 0.00 356.89 0.00 22 0.00 0.00 Module#alias_method
110
+ 0.00 356.89 0.00 2 0.00 0.00 Module#method_undefined
111
+ 0.00 356.89 0.00 6 0.00 0.00 Float#/
112
+ 0.00 356.89 0.00 1 0.00 285850.00 Vpim::Icalendar#initialize
113
+ 0.00 356.89 0.00 1 0.00 0.00 Date#initialize
114
+ 0.00 356.89 0.00 2 0.00 0.00 Array#+
115
+ 0.00 356.89 0.00 1 0.00 4800.00 Vpim.unfold
116
+ 0.00 356.89 0.00 12 0.00 0.00 Fixnum#<
117
+ 0.00 356.89 0.00 23 0.00 0.00 Module#private
118
+ 0.00 356.89 0.00 5 0.00 0.00 Module#include
119
+ 0.00 356.89 0.00 5 0.00 2.00 Rational#new!
120
+ 0.00 356.89 0.00 6 0.00 0.00 Fixnum#abs
121
+ 0.00 356.89 0.00 26 0.00 1.54 Fixnum#-
122
+ 0.00 356.89 0.00 1 0.00 44920.00 Vpim.decode
123
+ 0.00 356.89 0.00 26 0.00 0.00 Symbol#to_s
124
+ 0.00 356.89 0.00 1 0.00 0.00 Kernel.open
125
+ 0.00 356.89 0.00 1 0.00 0.00 Integer#to_r
126
+ 0.00 356.89 0.00 1 0.00 0.00 Rational#coerce
127
+ 0.00 356.89 0.00 1 0.00 70.00 Date#jd_to_ajd
128
+ 0.00 356.89 0.00 4 0.00 0.00 Fixnum#/
129
+ 0.00 356.89 0.00 1 0.00 356890.00 #toplevel
130
+
131
+ /opt/local/bin/ruby -I lib -rprofile ./profile.rb 356.98s user 10.38s system 100% cpu 6:07.22 total
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ ensemble:~/p/ruby/vpim/trunk % ruby -I lib profile.rb
148
+ % cumulative self self total
149
+ time seconds seconds calls ms/call ms/call name
150
+ 21.81 68.34 68.34 79313 0.86 1.33 Vpim::DirectoryInfo::Field#name?
151
+
152
+ Ruby1.8 has #casecmp! Make Vpim.casecmp() that uses it, if available?
153
+
154
+ 19.56 129.63 61.29 16916 3.62 42.75 Array#each
155
+ 7.98 154.64 25.01 66300 0.38 1.78 Proc#call
156
+ 6.76 175.83 21.19 167734 0.13 0.13 String#downcase
157
+ 4.24 189.10 13.27 6506 2.04 3.06 Vpim::DirectoryInfo::Field#decode0
158
+ 2.75 197.71 8.61 79313 0.11 0.11 String#to_s
159
+ 2.74 206.28 8.57 66300 0.13 0.13 Proc#==
160
+ 2.66 214.61 8.33 83216 0.10 0.10 String#==
161
+ 2.35 221.97 7.36 14300 0.51 1.56 Vpim::DirectoryInfo#enum_by_name
162
+ 2.15 228.71 6.74 14300 0.47 13.28 Vpim::DirectoryInfo#each
163
+ 2.01 235.01 6.30 1300 4.85 189.24 Vpim::Icalendar::Vevent#initialize
164
+ 1.83 240.74 5.73 23413 0.24 23.04 Class#new
165
+ 1.82 246.44 5.70 14300 0.40 13.68 Vpim::Enumerator#each
166
+ 1.44 250.94 4.50 14300 0.31 0.31 Vpim::Enumerator#initialize
167
+ 1.44 255.44 4.50 14300 0.31 0.48 Proc#new
168
+ 1.37 259.74 4.30 7800 0.55 17.27 Vpim::DirectoryInfo#text
169
+ 1.23 263.59 3.85 5202 0.74 2.56 Vpim::DirectoryInfo::Field#value
170
+ 1.22 267.40 3.81 1 3810.00 4840.00 IO#each
171
+ 1.19 271.12 3.72 6506 0.57 3.69 Vpim::DirectoryInfo::Field#initialize
172
+ 1.06 274.43 3.31 6506 0.51 4.53 Vpim::DirectoryInfo::Field#decode
173
+ 1.05 277.72 3.29 5202 0.63 1.17 Vpim::DirectoryInfo::Field#param
174
+ 0.99 280.83 3.11 5200 0.60 14.05 Vpim::DirectoryInfo#field
175
+ 0.93 283.73 2.90 5202 0.56 1.73 Vpim::DirectoryInfo::Field#encoding
176
+ 0.89 286.52 2.79 7800 0.36 15.11 Enumerable.map
177
+ 0.78 288.97 2.45 2600 0.94 1.65 String#scan
178
+ 0.74 291.29 2.32 14300 0.16 0.16 Object#initialize
179
+ 0.56 293.03 1.74 6502 0.27 0.37 Hash#[]
180
+ 0.54 294.72 1.69 1 1690.00 31160.00 Array#collect
181
+ 0.45 296.14 1.42 16913 0.08 0.08 Array#<<
182
+ 0.44 297.51 1.37 13024 0.11 0.11 Fixnum#>
183
+ 0.35 298.61 1.10 1300 0.85 1.05 Vpim.decode_text
184
+ 0.33 299.63 1.02 6502 0.16 0.17 Kernel.===
185
+ 0.32 300.63 1.00 1303 0.77 1.17 Vpim::DirectoryInfo::Field#value?
186
+ 0.31 301.59 0.96 1301 0.74 3.25 Vpim::DirectoryInfo#initialize
187
+ 0.30 302.52 0.93 10405 0.09 0.09 Array#first
188
+ 0.27 303.36 0.84 1300 0.65 4.62 Vpim::DirectoryInfo::Field#to_text
189
+ 0.24 304.12 0.76 6526 0.12 0.12 Kernel.kind_of?
190
+ 0.23 304.85 0.73 7808 0.09 0.09 Module#===
191
+ 0.22 305.53 0.68 5202 0.13 0.13 Hash#default
192
+ 0.22 306.21 0.68 6506 0.10 0.10 String#size
193
+ 0.22 306.89 0.68 1301 0.52 4.96 Vpim.outer_inner
194
+ 0.21 307.55 0.66 6506 0.10 0.10 MatchData#[]
195
+ 0.21 308.21 0.66 6506 0.10 0.10 String#length
196
+ 0.20 308.85 0.64 6506 0.10 0.10 Kernel.freeze
197
+ 0.19 309.46 0.61 10411 0.06 0.06 Array#last
198
+ 0.19 310.05 0.59 7807 0.08 0.08 Array#push
199
+ 0.19 310.64 0.59 6506 0.09 0.09 String#chomp!
200
+ 0.18 311.21 0.57 1301 0.44 3.79 Vpim::DirectoryInfo#create
201
+ 0.13 311.63 0.42 6506 0.06 0.06 String#to_str
202
+ 0.12 312.02 0.39 1300 0.30 15.86 Vpim::DirectoryInfo#[]
203
+ 0.09 312.29 0.27 3900 0.07 0.07 String#gsub
204
+ 0.07 312.52 0.23 1302 0.18 2.51 Enumerable.detect
205
+ 0.06 312.71 0.19 1300 0.15 0.15 Hash#key?
206
+ 0.05 312.86 0.15 27 5.56 45.56 Kernel.require
207
+ 0.04 313.00 0.14 1300 0.11 0.11 Hash#[]=
208
+ 0.03 313.08 0.08 1300 0.06 0.06 String#upcase
209
+ 0.02 313.13 0.05 1301 0.04 0.04 Array#pop
210
+ 0.01 313.17 0.04 3 13.33 13.33 Integer#gcd
211
+ 0.01 313.20 0.03 28 1.07 1.43 Module#module_eval
212
+ 0.01 313.23 0.03 106 0.28 0.28 Kernel.singleton_method_added
213
+ 0.01 313.25 0.02 252 0.08 0.08 Module#method_added
214
+ 0.00 313.26 0.01 91 0.11 0.11 Fixnum#to_s
215
+ 0.00 313.27 0.01 3 3.33 16.67 Rational#reduce
216
+ 0.00 313.28 0.01 1 10.00 10.00 Date#jd_to_civil
217
+ 0.00 313.29 0.01 12 0.83 0.83 Fixnum#<
218
+ 0.00 313.30 0.01 1 10.00 10.00 Date#civil_to_jd
219
+ 0.00 313.31 0.01 2 5.00 5.00 Module#attr
220
+ 0.00 313.32 0.01 91 0.11 0.11 Symbol#to_i
221
+ 0.00 313.33 0.01 1 10.00 10.00 Rational#coerce
222
+ 0.00 313.33 0.00 1 0.00 70.00 Date#jd_to_ajd
223
+ 0.00 313.33 0.00 1 0.00 0.00 Kernel.singleton_method_undefined
224
+ 0.00 313.33 0.00 24 0.00 0.00 Fixnum#>>
225
+ 0.00 313.33 0.00 5 0.00 2.00 Rational#new!
226
+ 0.00 313.33 0.00 2 0.00 0.00 Array#join
227
+ 0.00 313.33 0.00 1 0.00 0.00 Vpim::DirectoryInfo#check_begin_end
228
+ 0.00 313.33 0.00 3 0.00 0.00 Fixnum#<<
229
+ 0.00 313.33 0.00 1 0.00 21940.00 Vpim.expand
230
+ 0.00 313.33 0.00 7 0.00 8.57 Date#once
231
+ 0.00 313.33 0.00 2 0.00 0.00 Date#os?
232
+ 0.00 313.33 0.00 2 0.00 5.00 Rational#/
233
+ 0.00 313.33 0.00 2 0.00 0.00 Array#+
234
+ 0.00 313.33 0.00 4 0.00 2.50 Module#attr_reader
235
+ 0.00 313.33 0.00 1 0.00 0.00 File#initialize
236
+ 0.00 313.33 0.00 5 0.00 0.00 Module#included
237
+ 0.00 313.33 0.00 75 0.00 0.00 Fixnum#==
238
+ 0.00 313.33 0.00 6 0.00 0.00 Fixnum#div
239
+ 0.00 313.33 0.00 4 0.00 0.00 Float#*
240
+ 0.00 313.33 0.00 2 0.00 0.00 Fixnum#<=
241
+ 0.00 313.33 0.00 82 0.00 0.00 Fixnum#*
242
+ 0.00 313.33 0.00 1 0.00 0.00 Array#==
243
+ 0.00 313.33 0.00 2 0.00 0.00 Hash#keys
244
+ 0.00 313.33 0.00 5 0.00 2.00 Rational#initialize
245
+ 0.00 313.33 0.00 1 0.00 0.00 Module#undef_method
246
+ 0.00 313.33 0.00 10 0.00 0.00 Float#floor
247
+ 0.00 313.33 0.00 1 0.00 0.00 Date#initialize
248
+ 0.00 313.33 0.00 8 0.00 0.00 Module#private_class_method
249
+ 0.00 313.33 0.00 1 0.00 20.00 Date#valid_civil?
250
+ 0.00 313.33 0.00 47 0.00 0.00 Fixnum#[]
251
+ 0.00 313.33 0.00 1 0.00 50.00 Rational#-
252
+ 0.00 313.33 0.00 22 0.00 0.45 Module#alias_method
253
+ 0.00 313.33 0.00 2 0.00 0.00 Module#method_undefined
254
+ 0.00 313.33 0.00 1 0.00 312970.00 Vpim::Icalendar#decode
255
+ 0.00 313.33 0.00 1 0.00 255020.00 Vpim::Icalendar#initialize
256
+ 0.00 313.33 0.00 1 0.00 0.00 Class#new0
257
+ 0.00 313.33 0.00 11 0.00 0.00 Fixnum#+
258
+ 0.00 313.33 0.00 3 0.00 16.67 Object#Rational
259
+ 0.00 313.33 0.00 1 0.00 0.00 Integer#to_r
260
+ 0.00 313.33 0.00 14 0.00 0.00 Class#inherited
261
+ 0.00 313.33 0.00 2 0.00 0.00 Module#public
262
+ 0.00 313.33 0.00 5 0.00 0.00 Module#append_features
263
+ 0.00 313.33 0.00 4 0.00 0.00 Float#coerce
264
+ 0.00 313.33 0.00 6 0.00 0.00 Float#/
265
+ 0.00 313.33 0.00 5 0.00 0.00 Module#include
266
+ 0.00 313.33 0.00 6 0.00 0.00 Fixnum#abs
267
+ 0.00 313.33 0.00 23 0.00 0.00 Module#private
268
+ 0.00 313.33 0.00 1 0.00 36000.00 Vpim.decode
269
+ 0.00 313.33 0.00 26 0.00 2.31 Fixnum#-
270
+ 0.00 313.33 0.00 26 0.00 0.00 Symbol#to_s
271
+ 0.00 313.33 0.00 1 0.00 0.00 Kernel.open
272
+ 0.00 313.33 0.00 1 0.00 90.00 Date#new
273
+ 0.00 313.33 0.00 1 0.00 4840.00 Vpim.unfold
274
+ 0.00 313.33 0.00 4 0.00 0.00 Fixnum#/
275
+ 0.00 313.33 0.00 1 0.00 313330.00 #toplevel
276
+
@@ -0,0 +1,93 @@
1
+
2
+ ** cmd-itip.rb
3
+
4
+ This script pretty-prints iTIP calendar invitations, often sent by email using iMIP
5
+ as text/calendar objects.
6
+
7
+ Download the latest vPim from:
8
+
9
+ http://rubyforge.org/projects/vpim/
10
+
11
+ It requires Ruby to be installed.
12
+
13
+ Install vpim:
14
+
15
+ tar -xzf vpim-XX.tgz
16
+ cd vpim-XX
17
+ ruby install.rb config
18
+ ruby install.rb setup
19
+ sudo ruby install.rb install
20
+
21
+ Install cmd-itip.rb into your path, perhaps without the extension.
22
+
23
+ cp samples/cmd-itip.rb ~/bin/cmd-itip
24
+ chmod +x ~/bin/cmd-itip
25
+
26
+ Modify your ~/.mailcap or /etc/mailcap files to call cmd-itip, add a line like:
27
+
28
+ text/calendar; cmd-itip --myaddr "sroberts@" %s; copiousoutput
29
+
30
+ If you give a REGEX to --myaddr to tell cmd-itip your email addresses, cmd-itip
31
+ will avoid printing some information on the attendees to an invitation.
32
+
33
+ Modify muttrc to autoview calendars with a command like:
34
+
35
+ auto_view text/calendar
36
+
37
+ Notes on Notes;
38
+
39
+ Because Domino sends a close-to-unreadable text/plain attachment along with the
40
+ text/calendar in a multipart/alternative, and the text/plain is first in the
41
+ alternatives, the garbage will be at the top, and the nicely printed calendar
42
+ at the bottom. Because of this, I reorder the view preference so the calendar
43
+ invitation is clearly printed at the top of the message with a muttrc command
44
+ like:
45
+
46
+ alternative_order text/calendar text/plain
47
+
48
+ Domino also includes the calendar twice in the mail message, so you'll see it
49
+ twice, I don't know what to do about that.
50
+
51
+ Notes on application/octet-stream:
52
+
53
+ Some calendar programs, such as Apple's Mail.app, wrongly send iCalendar attachments
54
+ with a content-type of application/octet-stream. In order to be processed correctly, use
55
+ the mutt 1.5 or later capability to lookup the correct MIME content-type based on the
56
+ file extension. Put this in your muttrc file:
57
+
58
+ mime_lookup application/octet-stream
59
+
60
+ and ensure /etc/mime.types or ~/.mime.types contains:
61
+
62
+ text/calendar ics
63
+
64
+
65
+
66
+ ** vcf-to-mutt.rb
67
+
68
+ This script searches a set of vCards can output the results as a Mutt query response,
69
+ or a Mutt aliases file.
70
+
71
+ It used to support querying the OS X Address Book, but that is better done with lbdb, see
72
+ http://www.spinnaker.de/lbdb/.
73
+
74
+ To install, you must:
75
+
76
+ 1 - install vPim (see README)
77
+
78
+ 3 - copy vcf-to-mutt into a directory in your path, such
79
+ as ~/bin, and chmod +x vcf-to-mutt.rb to make it executable.
80
+
81
+ 4 - Put in your muttrc file (either ~/.muttrc or ~/.mutt/muttrc) a line such as:
82
+
83
+ set query_command = "vcf-to-mutt.rb '%s'"
84
+
85
+ 5 - The query command ("Q") will query the address book, control-t will give you auto-completion
86
+ of email addresses, see the Mutt manual page.
87
+
88
+
89
+ ** mutt-aliases-to-vcf.rb
90
+
91
+ This script converts a mutt aliases file into a vCard file.
92
+
93
+
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $-w = true
4
+ $:.unshift File.dirname($0) + '/../lib'
5
+
6
+ require 'osx-wrappers'
7
+
8
+ require 'getoptlong'
9
+ require 'vpim/vcard'
10
+ require 'osx-wrappers'
11
+
12
+ HELP =<<EOF
13
+ Usage: ab-query.rb [--me] [--all]
14
+
15
+ Queries the OS X Address Book for vCards.
16
+
17
+ -h, --help print this helpful message
18
+ -m, --me list my vCard
19
+ -a, --all list all vCards
20
+ EOF
21
+
22
+ opts = GetoptLong.new(
23
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
24
+ [ "--me", "-m", GetoptLong::NO_ARGUMENT ],
25
+ [ "--all", "-a", GetoptLong::NO_ARGUMENT ]
26
+ )
27
+
28
+ abook = nil
29
+
30
+ opts.each do |opt, arg|
31
+ case opt
32
+ when "--help" then
33
+ puts HELP
34
+ exit 0
35
+
36
+ when "--all" then
37
+ abook = OSX::ABAddressBook.sharedAddressBook unless abook
38
+
39
+ abook.people.to_a.each {
40
+ |person|
41
+
42
+ puts person.vCard
43
+ }
44
+
45
+ when "--me" then
46
+ abook = OSX::ABAddressBook.sharedAddressBook unless abook
47
+
48
+ puts abook.me.vCard
49
+ end
50
+ end
51
+
52
+
53
+ unless abook
54
+ puts HELP
55
+ exit 1
56
+ end
57
+
data/samples/agent.ru ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # Run as "rackup agent.ru", default rackup arguments follow:
3
+ #\ -p 4567
4
+
5
+ require "vpim/agent/ics"
6
+
7
+ use Rack::Reloader, 0
8
+
9
+ run Vpim::Agent::Ics
10
+
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $-w = true
4
+ $:.unshift File.dirname($0) + '/../lib'
5
+
6
+ require 'getoptlong'
7
+
8
+ require 'vpim/icalendar'
9
+ require 'vpim/duration'
10
+
11
+ include Vpim
12
+
13
+ # TODO - $0 is the full path, fix it.
14
+ HELP =<<EOF
15
+ Usage: #{$0} <invitation.ics>
16
+
17
+ Options
18
+ -h,--help Print this helpful message.
19
+ -d,--debug Print debug information.
20
+
21
+ -m,--my-addrs My email addresses, a REGEX.
22
+ Examples:
23
+ EOF
24
+
25
+ opt_debug = nil
26
+ opt_print = true
27
+
28
+ # Ways to get this:
29
+ # Use a --mutt option, and steal it from muttrc,
30
+ # from $USER, $LOGNAME,, from /etc/passwd...
31
+ opt_myaddrs = nil
32
+
33
+ opts = GetoptLong.new(
34
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
35
+
36
+ [ "--myaddrs", "-m", GetoptLong::REQUIRED_ARGUMENT ],
37
+
38
+ [ "--accept", "-a", GetoptLong::REQUIRED_ARGUMENT ],
39
+ [ "--reject", "-r", GetoptLong::REQUIRED_ARGUMENT ],
40
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
41
+ )
42
+
43
+ opts.each do |opt, arg|
44
+ case opt
45
+ when "--help" then
46
+ puts HELP
47
+ exit 0
48
+
49
+ when "--debug" then
50
+ require 'pp'
51
+ opt_debug = true
52
+
53
+ when "--myaddrs" then
54
+ opt_myaddrs = Regexp.new(arg, 'i')
55
+ end
56
+ end
57
+
58
+ if ARGV.length < 1
59
+ puts "no input files specified, try -h!\n"
60
+ exit 1
61
+ end
62
+
63
+ ARGV.each do |file|
64
+ cals = Vpim::Icalendar.decode(File.open(file))
65
+
66
+ cals.each do |cal|
67
+ if opt_debug
68
+ puts "vCalendar: version=#{cal.version/10.0} producer='#{cal.producer}'"
69
+ if cal.protocol; puts " protocol-method=#{cal.protocol}"; end
70
+ end
71
+
72
+ events = cal.events
73
+
74
+ if events.size != 1
75
+ raise "!! #{events.size} calendar events is more than 1!"
76
+ end
77
+
78
+ events.each do |e|
79
+ summary = e.summary || e.comment || ''
80
+
81
+ case cal.protocol.upcase
82
+ when 'PUBLISH'
83
+ puts "Notification of: #{summary}"
84
+
85
+ when 'REQUEST'
86
+ puts "Request for: #{summary}"
87
+
88
+ when 'REPLY'
89
+
90
+ else
91
+ raise "!! unhandled protocol type #{cal.protocol}!"
92
+ end
93
+
94
+ puts "Organized by: #{e.organizer.to_s}"
95
+
96
+ # TODO - spec as hours/mins/secs
97
+ e.occurrences.each_with_index do |t, i|
98
+ if(i < 1)
99
+ puts "At time: #{t}" +( e.duration ? " for #{Duration.secs(e.duration).to_s}" : '' )
100
+ else
101
+ puts "... and others"
102
+ break
103
+ end
104
+ end
105
+
106
+ if e.location; puts "Located at: #{e.location}"; end
107
+
108
+ if e.description
109
+ puts finish="-- Description --"
110
+ puts e.description
111
+ end
112
+
113
+ if e.comments
114
+ puts finish="-- Comment --"
115
+ puts " comment=#{e.comments}"
116
+ end
117
+
118
+ if e.attendees.first
119
+
120
+ puts finish="-- Attendees --"
121
+
122
+ e.attendees.each_with_index do |a,i|
123
+ puts "#{i} #{a.to_s}"
124
+ if !opt_myaddrs || a.uri =~ opt_myaddrs
125
+ puts " participation-status: #{a.partstat ? a.partstat.downcase : 'unknown'}"
126
+ puts " response-requested? #{a.rsvp ? 'yes' : 'no'}"
127
+ end
128
+ end
129
+ end
130
+
131
+ if finish
132
+ puts '-' * finish.length
133
+ end
134
+
135
+ if opt_debug
136
+ if e.status; puts " status=#{e.status}"; end
137
+ puts " uid=#{e.uid}"
138
+ puts " dtstamp=#{e.dtstamp.to_s}"
139
+ puts " dtstart=#{e.dtstart.to_s}"
140
+ if e.dtend; puts " dtend=#{e.dtend.to_s}"; end
141
+ if e.rrule; puts " rrule=#{e.rrule}"; end
142
+ end
143
+ end
144
+
145
+ todos = cal.todos
146
+ todos.each do |e|
147
+ s = e.status ? " (#{e.status})" : ''
148
+ puts "Todo#{s}: #{e.summary}"
149
+ end
150
+
151
+ if opt_debug
152
+ pp cals
153
+ end
154
+ end
155
+ end
156
+
@@ -0,0 +1,55 @@
1
+ require 'vpim/vcard'
2
+
3
+ ORIGINAL =<<'---'
4
+ BEGIN:VCARD
5
+ VERSION:3.0
6
+ FN:Jimmy Death
7
+ N:Death;Jimmy;;Dr.;
8
+ TEL:+416 123 1111
9
+ TEL;type=home,pref:+416 123 2222
10
+ TEL;type=work,fax:+416+123+3333
11
+ EMAIL;type=work:drdeath@work.com
12
+ EMAIL;type=pref:drdeath@home.net
13
+ NOTE:Do not call.
14
+ END:VCARD
15
+ ---
16
+
17
+ original = Vpim::Vcard.decode(ORIGINAL).first
18
+
19
+ puts original
20
+
21
+ modified = Vpim::Vcard::Maker.make2 do |maker|
22
+ # Set the fullname field to use family-given name order.
23
+ maker.name do |n|
24
+ n.fullname = "#{original.name.family} #{original.name.given}"
25
+ end
26
+
27
+ # Copy original fields, with some changes:
28
+ # - set only work email addresses and telephone numbers to be preferred.
29
+ # - don't copy notes
30
+ maker.copy(original) do |field|
31
+ if field.name? 'EMAIL'
32
+ field = field.copy
33
+ field.pref = field.type? 'work'
34
+ end
35
+ if field.name? 'TEL'
36
+ field = field.copy
37
+ field.pref = field.type? 'work'
38
+ end
39
+ if field.name? 'NOTE'
40
+ field = nil
41
+ end
42
+ field
43
+ end
44
+ end
45
+
46
+ puts '---'
47
+ puts modified
48
+
49
+ Vpim::Vcard::Maker.make2(modified) do |maker|
50
+ maker.nickname = "Your Last Friend"
51
+ end
52
+
53
+ puts '---'
54
+ puts modified
55
+
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ require 'vpim/vcard'
4
+
5
+ vcf = open(ARGV[0] || 'data/vcf/Sam Roberts.vcf')
6
+
7
+ card = Vpim::Vcard.decode(vcf).first
8
+
9
+ card.photos.each_with_index do |photo, i|
10
+ file = "_photo_#{i}."
11
+
12
+ if photo.format
13
+ file += photo.format.gsub('/', '_')
14
+ else
15
+ # You are your own if PHOTO doesn't include a format. AddressBook.app
16
+ # exports TIFF, for example, but doesn't specify that.
17
+ file += 'tiff'
18
+ end
19
+
20
+ open(file, 'w').write photo.to_s
21
+ end
22
+