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