vpim-rails-reinteractive 0.7

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 (60) 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 +386 -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 +372 -0
  24. data/lib/vpim/rrule.rb +598 -0
  25. data/lib/vpim/vcard.rb +1429 -0
  26. data/lib/vpim/version.rb +18 -0
  27. data/lib/vpim/vevent.rb +187 -0
  28. data/lib/vpim/view.rb +90 -0
  29. data/lib/vpim/vjournal.rb +58 -0
  30. data/lib/vpim/vpim.rb +65 -0
  31. data/lib/vpim/vtodo.rb +103 -0
  32. data/samples/README.mutt +93 -0
  33. data/samples/ab-query.rb +57 -0
  34. data/samples/cmd-itip.rb +156 -0
  35. data/samples/ex_cpvcard.rb +55 -0
  36. data/samples/ex_get_vcard_photo.rb +22 -0
  37. data/samples/ex_mkv21vcard.rb +34 -0
  38. data/samples/ex_mkvcard.rb +64 -0
  39. data/samples/ex_mkyourown.rb +29 -0
  40. data/samples/ics-dump.rb +210 -0
  41. data/samples/ics-to-rss.rb +84 -0
  42. data/samples/mutt-aliases-to-vcf.rb +45 -0
  43. data/samples/osx-wrappers.rb +86 -0
  44. data/samples/reminder.rb +203 -0
  45. data/samples/rrule.rb +71 -0
  46. data/samples/tabbed-file-to-vcf.rb +390 -0
  47. data/samples/vcf-dump.rb +86 -0
  48. data/samples/vcf-lines.rb +61 -0
  49. data/samples/vcf-to-ics.rb +22 -0
  50. data/samples/vcf-to-mutt.rb +121 -0
  51. data/test/test_all.rb +17 -0
  52. data/test/test_date.rb +120 -0
  53. data/test/test_dur.rb +41 -0
  54. data/test/test_field.rb +156 -0
  55. data/test/test_ical.rb +415 -0
  56. data/test/test_repo.rb +158 -0
  57. data/test/test_rrule.rb +1030 -0
  58. data/test/test_vcard.rb +973 -0
  59. data/test/test_view.rb +79 -0
  60. metadata +135 -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,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vpim-rails-reinteractive
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 7
9
+ version: "0.7"
10
+ platform: ruby
11
+ authors:
12
+ - Sam Roberts
13
+ - Fraser Newton
14
+ - Ben Wiseley
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2009-03-28 00:00:00 Z
20
+ dependencies: []
21
+
22
+ description: This is vPim updated for use with Rails applications.
23
+ email: fraser@goclio.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README
30
+ - CHANGES
31
+ - COPYING
32
+ - samples/README.mutt
33
+ files:
34
+ - lib/atom.rb
35
+ - lib/plist.rb
36
+ - lib/vpim/address.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/vcard.rb
55
+ - lib/vpim/version.rb
56
+ - lib/vpim/vevent.rb
57
+ - lib/vpim/view.rb
58
+ - lib/vpim/vjournal.rb
59
+ - lib/vpim/vpim.rb
60
+ - lib/vpim/vtodo.rb
61
+ - lib/vpim.rb
62
+ - samples/ab-query.rb
63
+ - samples/cmd-itip.rb
64
+ - samples/ex_cpvcard.rb
65
+ - samples/ex_get_vcard_photo.rb
66
+ - samples/ex_mkv21vcard.rb
67
+ - samples/ex_mkvcard.rb
68
+ - samples/ex_mkyourown.rb
69
+ - samples/ics-dump.rb
70
+ - samples/ics-to-rss.rb
71
+ - samples/mutt-aliases-to-vcf.rb
72
+ - samples/osx-wrappers.rb
73
+ - samples/README.mutt
74
+ - samples/reminder.rb
75
+ - samples/rrule.rb
76
+ - samples/tabbed-file-to-vcf.rb
77
+ - samples/vcf-dump.rb
78
+ - samples/vcf-lines.rb
79
+ - samples/vcf-to-ics.rb
80
+ - samples/vcf-to-mutt.rb
81
+ - test/test_all.rb
82
+ - test/test_date.rb
83
+ - test/test_dur.rb
84
+ - test/test_field.rb
85
+ - test/test_ical.rb
86
+ - test/test_repo.rb
87
+ - test/test_rrule.rb
88
+ - test/test_vcard.rb
89
+ - test/test_view.rb
90
+ - COPYING
91
+ - README
92
+ - CHANGES
93
+ homepage: http://github.com/fraser/vpim-rails/tree/master
94
+ licenses: []
95
+
96
+ post_install_message:
97
+ rdoc_options: []
98
+
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ requirements: []
120
+
121
+ rubyforge_project:
122
+ rubygems_version: 1.8.17
123
+ signing_key:
124
+ specification_version: 2
125
+ summary: iCalendar and vCard support for rails
126
+ test_files:
127
+ - test/test_all.rb
128
+ - test/test_date.rb
129
+ - test/test_dur.rb
130
+ - test/test_field.rb
131
+ - test/test_ical.rb
132
+ - test/test_repo.rb
133
+ - test/test_rrule.rb
134
+ - test/test_vcard.rb
135
+ - test/test_view.rb