mumboe-vpim 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/CHANGES +510 -0
  2. data/COPYING +58 -0
  3. data/README +185 -0
  4. data/lib/vpim/address.rb +219 -0
  5. data/lib/vpim/agent/atomize.rb +104 -0
  6. data/lib/vpim/agent/base.rb +73 -0
  7. data/lib/vpim/agent/calendars.rb +173 -0
  8. data/lib/vpim/agent/handler.rb +26 -0
  9. data/lib/vpim/agent/ics.rb +161 -0
  10. data/lib/vpim/attachment.rb +102 -0
  11. data/lib/vpim/date.rb +222 -0
  12. data/lib/vpim/dirinfo.rb +277 -0
  13. data/lib/vpim/duration.rb +119 -0
  14. data/lib/vpim/enumerator.rb +32 -0
  15. data/lib/vpim/field.rb +614 -0
  16. data/lib/vpim/icalendar.rb +384 -0
  17. data/lib/vpim/maker/vcard.rb +16 -0
  18. data/lib/vpim/property/base.rb +193 -0
  19. data/lib/vpim/property/common.rb +315 -0
  20. data/lib/vpim/property/location.rb +38 -0
  21. data/lib/vpim/property/priority.rb +43 -0
  22. data/lib/vpim/property/recurrence.rb +69 -0
  23. data/lib/vpim/property/resources.rb +24 -0
  24. data/lib/vpim/repo.rb +261 -0
  25. data/lib/vpim/rfc2425.rb +367 -0
  26. data/lib/vpim/rrule.rb +591 -0
  27. data/lib/vpim/time.rb +40 -0
  28. data/lib/vpim/vcard.rb +1456 -0
  29. data/lib/vpim/version.rb +18 -0
  30. data/lib/vpim/vevent.rb +187 -0
  31. data/lib/vpim/view.rb +90 -0
  32. data/lib/vpim/vjournal.rb +58 -0
  33. data/lib/vpim/vpim.rb +65 -0
  34. data/lib/vpim/vtodo.rb +103 -0
  35. data/lib/vpim.rb +13 -0
  36. data/samples/README.mutt +93 -0
  37. data/samples/ab-query.rb +57 -0
  38. data/samples/agent.ru +10 -0
  39. data/samples/cmd-itip.rb +156 -0
  40. data/samples/ex_cpvcard.rb +55 -0
  41. data/samples/ex_get_vcard_photo.rb +22 -0
  42. data/samples/ex_mkv21vcard.rb +34 -0
  43. data/samples/ex_mkvcard.rb +64 -0
  44. data/samples/ex_mkyourown.rb +29 -0
  45. data/samples/ics-dump.rb +210 -0
  46. data/samples/ics-to-rss.rb +84 -0
  47. data/samples/mutt-aliases-to-vcf.rb +45 -0
  48. data/samples/osx-wrappers.rb +86 -0
  49. data/samples/reminder.rb +209 -0
  50. data/samples/rrule.rb +71 -0
  51. data/samples/tabbed-file-to-vcf.rb +390 -0
  52. data/samples/vcf-dump.rb +86 -0
  53. data/samples/vcf-lines.rb +61 -0
  54. data/samples/vcf-to-ics.rb +22 -0
  55. data/samples/vcf-to-mutt.rb +121 -0
  56. data/test/test_agent_atomize.rb +84 -0
  57. data/test/test_agent_calendars.rb +128 -0
  58. data/test/test_agent_ics.rb +96 -0
  59. data/test/test_all.rb +17 -0
  60. data/test/test_date.rb +120 -0
  61. data/test/test_dur.rb +41 -0
  62. data/test/test_field.rb +156 -0
  63. data/test/test_ical.rb +437 -0
  64. data/test/test_misc.rb +13 -0
  65. data/test/test_repo.rb +129 -0
  66. data/test/test_rrule.rb +1030 -0
  67. data/test/test_vcard.rb +973 -0
  68. data/test/test_view.rb +79 -0
  69. metadata +140 -0
data/test/test_view.rb ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+
5
+ require 'vpim/repo'
6
+ require 'vpim/view'
7
+
8
+ class TestView < Test::Unit::TestCase
9
+ View = Vpim::View
10
+ Icalendar = Vpim::Icalendar
11
+
12
+ def _test_week_events(vc, kind)
13
+ vc = Icalendar.decode(vc.to_s.gsub("EVENT", kind)).first
14
+
15
+ vv = View.week vc
16
+
17
+ reader = kind.downcase + "s"
18
+
19
+ kind = "check against kind=" + kind + "<\n" + vv.to_s + ">\n"
20
+
21
+ assert_no_match(/yesterday/, vv.to_s, kind)
22
+ assert_no_match(/nextweek/, vv.to_s, kind)
23
+
24
+ assert_equal(["starts tomorrow"], vv.send(reader).map{|ve| ve.summary}, kind)
25
+ end
26
+
27
+ def test_week_single
28
+ now = Time.now
29
+ yesterday = now - View::SECSPERDAY
30
+ tomorrow = now + View::SECSPERDAY
31
+ nextweek = now + View::SECSPERDAY * 8
32
+
33
+ vc = Icalendar.create2 do |vc|
34
+ %w{yesterday tomorrow nextweek}.each do |dtstart|
35
+ vc.add_event do |ve|
36
+ ve.dtstart eval(dtstart)
37
+ ve.summary "starts #{dtstart}"
38
+ end
39
+ end
40
+ end
41
+
42
+ _test_week_events(vc, "EVENT")
43
+ _test_week_events(vc, "TODO")
44
+ _test_week_events(vc, "JOURNAL")
45
+ end
46
+
47
+ def test_week_recurring
48
+ now = Time.now
49
+ ago = now - View::SECSPERDAY * 2
50
+
51
+ vc = Icalendar.create2 do |vc|
52
+ vc.add_event do |ve|
53
+ ve.dtstart ago
54
+ ve.dtend ago + View::SECSPERDAY / 2
55
+ ve.add_rrule do |r|
56
+ r.frequency = "daily"
57
+ end
58
+ end
59
+ end
60
+
61
+ vv = View.week vc
62
+
63
+ assert_equal(1, vv.events.to_a.size)
64
+
65
+ ve = vv.events{|e| break e}
66
+
67
+ #p ve
68
+
69
+ #puts "now=" + now.to_s
70
+
71
+ ve.occurrences() do |t|
72
+ p [now, t, t + ve.duration]
73
+ end
74
+
75
+
76
+
77
+ end
78
+ end
79
+
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mumboe-vpim
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.7"
5
+ platform: ruby
6
+ authors:
7
+ - Sam Roberts
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-08 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: |
17
+ This is a pure-ruby library for decoding and encoding vCard and iCalendar data
18
+ ("personal information") called vPim.
19
+
20
+ email: vieuxtech@gmail.com
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files:
26
+ - README
27
+ - CHANGES
28
+ - COPYING
29
+ - samples/README.mutt
30
+ files:
31
+ - lib/vpim/address.rb
32
+ - lib/vpim/agent/atomize.rb
33
+ - lib/vpim/agent/base.rb
34
+ - lib/vpim/agent/calendars.rb
35
+ - lib/vpim/agent/handler.rb
36
+ - lib/vpim/agent/ics.rb
37
+ - lib/vpim/attachment.rb
38
+ - lib/vpim/date.rb
39
+ - lib/vpim/dirinfo.rb
40
+ - lib/vpim/duration.rb
41
+ - lib/vpim/enumerator.rb
42
+ - lib/vpim/field.rb
43
+ - lib/vpim/icalendar.rb
44
+ - lib/vpim/maker/vcard.rb
45
+ - lib/vpim/property/base.rb
46
+ - lib/vpim/property/common.rb
47
+ - lib/vpim/property/location.rb
48
+ - lib/vpim/property/priority.rb
49
+ - lib/vpim/property/recurrence.rb
50
+ - lib/vpim/property/resources.rb
51
+ - lib/vpim/repo.rb
52
+ - lib/vpim/rfc2425.rb
53
+ - lib/vpim/rrule.rb
54
+ - lib/vpim/time.rb
55
+ - lib/vpim/vcard.rb
56
+ - lib/vpim/version.rb
57
+ - lib/vpim/vevent.rb
58
+ - lib/vpim/view.rb
59
+ - lib/vpim/vjournal.rb
60
+ - lib/vpim/vpim.rb
61
+ - lib/vpim/vtodo.rb
62
+ - lib/vpim.rb
63
+ - samples/ab-query.rb
64
+ - samples/agent.ru
65
+ - samples/cmd-itip.rb
66
+ - samples/ex_cpvcard.rb
67
+ - samples/ex_get_vcard_photo.rb
68
+ - samples/ex_mkv21vcard.rb
69
+ - samples/ex_mkvcard.rb
70
+ - samples/ex_mkyourown.rb
71
+ - samples/ics-dump.rb
72
+ - samples/ics-to-rss.rb
73
+ - samples/mutt-aliases-to-vcf.rb
74
+ - samples/osx-wrappers.rb
75
+ - samples/README.mutt
76
+ - samples/reminder.rb
77
+ - samples/rrule.rb
78
+ - samples/tabbed-file-to-vcf.rb
79
+ - samples/vcf-dump.rb
80
+ - samples/vcf-lines.rb
81
+ - samples/vcf-to-ics.rb
82
+ - samples/vcf-to-mutt.rb
83
+ - test/test_agent_atomize.rb
84
+ - test/test_agent_calendars.rb
85
+ - test/test_agent_ics.rb
86
+ - test/test_all.rb
87
+ - test/test_date.rb
88
+ - test/test_dur.rb
89
+ - test/test_field.rb
90
+ - test/test_ical.rb
91
+ - test/test_misc.rb
92
+ - test/test_repo.rb
93
+ - test/test_rrule.rb
94
+ - test/test_vcard.rb
95
+ - test/test_view.rb
96
+ - COPYING
97
+ - README
98
+ - CHANGES
99
+ has_rdoc: true
100
+ homepage: http://vpim.rubyforge.org
101
+ licenses: []
102
+
103
+ post_install_message:
104
+ rdoc_options: []
105
+
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
113
+ version:
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
119
+ version:
120
+ requirements: []
121
+
122
+ rubyforge_project: vpim
123
+ rubygems_version: 1.3.5
124
+ signing_key:
125
+ specification_version: 3
126
+ summary: iCalendar and vCard support for ruby with minor modification for Ruby 1.9 compatibility and extensions to include some useful methods for vCard 3.0 specs
127
+ test_files:
128
+ - test/test_agent_atomize.rb
129
+ - test/test_agent_calendars.rb
130
+ - test/test_agent_ics.rb
131
+ - test/test_all.rb
132
+ - test/test_date.rb
133
+ - test/test_dur.rb
134
+ - test/test_field.rb
135
+ - test/test_ical.rb
136
+ - test/test_misc.rb
137
+ - test/test_repo.rb
138
+ - test/test_rrule.rb
139
+ - test/test_vcard.rb
140
+ - test/test_view.rb