vpim-rails 0.661

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. data/CHANGES +504 -0
  2. data/COPYING +58 -0
  3. data/README +182 -0
  4. data/lib/atom.rb +728 -0
  5. data/lib/plist.rb +22 -0
  6. data/lib/vpim.rb +13 -0
  7. data/lib/vpim/address.rb +219 -0
  8. data/lib/vpim/attachment.rb +102 -0
  9. data/lib/vpim/date.rb +222 -0
  10. data/lib/vpim/dirinfo.rb +277 -0
  11. data/lib/vpim/duration.rb +119 -0
  12. data/lib/vpim/enumerator.rb +32 -0
  13. data/lib/vpim/field.rb +614 -0
  14. data/lib/vpim/icalendar.rb +382 -0
  15. data/lib/vpim/maker/vcard.rb +16 -0
  16. data/lib/vpim/property/base.rb +193 -0
  17. data/lib/vpim/property/common.rb +315 -0
  18. data/lib/vpim/property/location.rb +38 -0
  19. data/lib/vpim/property/priority.rb +43 -0
  20. data/lib/vpim/property/recurrence.rb +69 -0
  21. data/lib/vpim/property/resources.rb +24 -0
  22. data/lib/vpim/repo.rb +181 -0
  23. data/lib/vpim/rfc2425.rb +367 -0
  24. data/lib/vpim/rrule.rb +599 -0
  25. data/lib/vpim/time.rb +40 -0
  26. data/lib/vpim/vcard.rb +1429 -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 +126 -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,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vpim-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.661"
5
+ platform: ruby
6
+ authors:
7
+ - Sam Roberts
8
+ - Fraser Newton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-03-28 00:00:00 -06:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: This is vPim updated for use with Rails applications.
18
+ email: fraser@goclio.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - README
25
+ - CHANGES
26
+ - COPYING
27
+ - samples/README.mutt
28
+ files:
29
+ - lib/atom.rb
30
+ - lib/plist.rb
31
+ - lib/vpim/address.rb
32
+ - lib/vpim/attachment.rb
33
+ - lib/vpim/date.rb
34
+ - lib/vpim/dirinfo.rb
35
+ - lib/vpim/duration.rb
36
+ - lib/vpim/enumerator.rb
37
+ - lib/vpim/field.rb
38
+ - lib/vpim/icalendar.rb
39
+ - lib/vpim/maker/vcard.rb
40
+ - lib/vpim/property/base.rb
41
+ - lib/vpim/property/common.rb
42
+ - lib/vpim/property/location.rb
43
+ - lib/vpim/property/priority.rb
44
+ - lib/vpim/property/recurrence.rb
45
+ - lib/vpim/property/resources.rb
46
+ - lib/vpim/repo.rb
47
+ - lib/vpim/rfc2425.rb
48
+ - lib/vpim/rrule.rb
49
+ - lib/vpim/time.rb
50
+ - lib/vpim/vcard.rb
51
+ - lib/vpim/version.rb
52
+ - lib/vpim/vevent.rb
53
+ - lib/vpim/view.rb
54
+ - lib/vpim/vjournal.rb
55
+ - lib/vpim/vpim.rb
56
+ - lib/vpim/vtodo.rb
57
+ - lib/vpim.rb
58
+ - samples/ab-query.rb
59
+ - samples/cmd-itip.rb
60
+ - samples/ex_cpvcard.rb
61
+ - samples/ex_get_vcard_photo.rb
62
+ - samples/ex_mkv21vcard.rb
63
+ - samples/ex_mkvcard.rb
64
+ - samples/ex_mkyourown.rb
65
+ - samples/ics-dump.rb
66
+ - samples/ics-to-rss.rb
67
+ - samples/mutt-aliases-to-vcf.rb
68
+ - samples/osx-wrappers.rb
69
+ - samples/README.mutt
70
+ - samples/reminder.rb
71
+ - samples/rrule.rb
72
+ - samples/tabbed-file-to-vcf.rb
73
+ - samples/vcf-dump.rb
74
+ - samples/vcf-lines.rb
75
+ - samples/vcf-to-ics.rb
76
+ - samples/vcf-to-mutt.rb
77
+ - test/test_all.rb
78
+ - test/test_date.rb
79
+ - test/test_dur.rb
80
+ - test/test_field.rb
81
+ - test/test_ical.rb
82
+ - test/test_repo.rb
83
+ - test/test_rrule.rb
84
+ - test/test_vcard.rb
85
+ - test/test_view.rb
86
+ - COPYING
87
+ - README
88
+ - CHANGES
89
+ has_rdoc: true
90
+ homepage: http://github.com/fraser/vpim-rails/tree/master
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options: []
95
+
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: "0"
103
+ version:
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: "0"
109
+ version:
110
+ requirements: []
111
+
112
+ rubyforge_project:
113
+ rubygems_version: 1.3.5
114
+ signing_key:
115
+ specification_version: 2
116
+ summary: iCalendar and vCard support for rails
117
+ test_files:
118
+ - test/test_all.rb
119
+ - test/test_date.rb
120
+ - test/test_dur.rb
121
+ - test/test_field.rb
122
+ - test/test_ical.rb
123
+ - test/test_repo.rb
124
+ - test/test_rrule.rb
125
+ - test/test_vcard.rb
126
+ - test/test_view.rb