vpim 0.695 → 24.2.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/{README → README.rdoc} +2 -13
  3. data/bin/reminder +1 -1
  4. data/lib/vpim/address.rb +3 -2
  5. data/lib/vpim/agent/atomize.rb +4 -0
  6. data/lib/vpim/agent/base.rb +74 -0
  7. data/lib/vpim/agent/calendars.rb +1 -0
  8. data/lib/vpim/agent/handler.rb +27 -0
  9. data/lib/vpim/agent/ics.rb +162 -0
  10. data/lib/vpim/attachment.rb +1 -0
  11. data/lib/vpim/date.rb +3 -2
  12. data/lib/vpim/dirinfo.rb +5 -4
  13. data/lib/vpim/duration.rb +1 -0
  14. data/lib/vpim/enumerator.rb +2 -1
  15. data/lib/vpim/field.rb +3 -2
  16. data/lib/vpim/icalendar.rb +18 -7
  17. data/lib/vpim/maker/vcard.rb +1 -0
  18. data/lib/vpim/property/base.rb +1 -0
  19. data/lib/vpim/property/common.rb +1 -0
  20. data/lib/vpim/property/location.rb +10 -0
  21. data/lib/vpim/property/priority.rb +2 -1
  22. data/lib/vpim/property/recurrence.rb +2 -1
  23. data/lib/vpim/property/resources.rb +1 -2
  24. data/lib/vpim/repo.rb +3 -2
  25. data/lib/vpim/rfc2425.rb +32 -24
  26. data/lib/vpim/rrule.rb +9 -8
  27. data/lib/vpim/time.rb +1 -0
  28. data/lib/vpim/vcard.rb +14 -12
  29. data/lib/vpim/version.rb +2 -2
  30. data/lib/vpim/vevent.rb +4 -2
  31. data/lib/vpim/view.rb +4 -3
  32. data/lib/vpim/vjournal.rb +1 -0
  33. data/lib/vpim/vpim.rb +2 -1
  34. data/lib/vpim/vtodo.rb +47 -0
  35. data/lib/vpim.rb +1 -0
  36. data/samples/agent.ru +10 -0
  37. data/samples/reminder.rb +1 -1
  38. data/test/test_all.rb +2 -0
  39. data/test/test_date.rb +6 -5
  40. data/test/test_dur.rb +1 -0
  41. data/test/test_field.rb +3 -2
  42. data/test/test_ical.rb +23 -2
  43. data/test/test_misc.rb +13 -0
  44. data/test/test_repo.rb +22 -2
  45. data/test/test_rrule.rb +1 -0
  46. data/test/test_vcard.rb +53 -1
  47. metadata +42 -53
  48. data/lib/vpim/agent/app.rb +0 -194
  49. data/lib/vpim/agent/main.rb +0 -327
  50. data/lib/vpim/agent/scraps.rb +0 -292
  51. data/test/test_agent_app.rb +0 -74
  52. data/test/test_agent_atomize.rb +0 -84
  53. data/test/test_agent_calendars.rb +0 -128
  54. data/test/test_view.rb +0 -79
data/test/test_vcard.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  #!/usr/bin/env ruby
2
3
 
3
4
  require 'vpim/vcard'
@@ -690,7 +691,14 @@ END:VCARD
690
691
  assert_equal('', card.name.given)
691
692
  assert_equal('', card.name.fullname)
692
693
 
693
- assert_raises(TypeError) do
694
+ # As of Ruby 1.9, modifying a frozen object raises a RuntimeError instead of
695
+ # a TypeError.
696
+ if RUBY_VERSION >= "1.9"
697
+ expected_error = RuntimeError
698
+ else
699
+ expected_error = TypeError
700
+ end
701
+ assert_raises(expected_error) do
694
702
  card.name.given = 'given'
695
703
  end
696
704
 
@@ -718,6 +726,28 @@ END:VCARD
718
726
  assert_equal('well given', card.name.fullname)
719
727
  end
720
728
 
729
+ def test_add_tel
730
+ phones = ["1", "2", "3"]
731
+ card = Vpim::Vcard::Maker.make2 do |maker|
732
+ maker.add_name do |name|
733
+ name.given = "self.first_name"
734
+ name.family = "self.last_name"
735
+ end
736
+ phones.each do |phone|
737
+ maker.add_tel(phone) do |tel|
738
+ tel.location = 'home'
739
+ tel.preferred = true
740
+ end
741
+ end
742
+ end
743
+ card = Vpim::Vcard.decode(card.encode).first
744
+ # pp card
745
+ card.telephones.each do |phone|
746
+ assert_equal(phone, phones.delete(phone))
747
+ end
748
+ assert_equal(0, phones.size)
749
+ end
750
+
721
751
  def test_add_note
722
752
  note = "hi\' \ \"\",,;; \n \n field"
723
753
 
@@ -896,6 +926,28 @@ __
896
926
 
897
927
  end
898
928
 
929
+ def test_quoted_printable
930
+ c = <<'__'
931
+ BEGIN:VCARD
932
+ VERSION:2.1
933
+ N:Quinn;Charles
934
+ FN:Charles Quinn
935
+ NOTE;ENCODING=QUOTED-PRINTABLE: =0D=0Acbq+highgroove@example.com <mailto:cbq+highgroove@example.com>=0D=0A555-555-2=
936
+ 500 - Office=0D=0A555-555-2502 - Fax
937
+ TEL;WORK;VOICE:555 555 2500
938
+ TEL;WORK;FAX:555 555 2502
939
+ EMAIL;PREF;INTERNET:cbq+highgroove@example.com
940
+ REV:20100210T201157Z
941
+ END:VCARD
942
+ __
943
+ card = Vpim::Vcard.decode(c).first
944
+ assert_equal("Quinn", card.name.family)
945
+ assert_equal(
946
+ "=0D=0Acbq+highgroove@example.com <mailto:cbq+highgroove@example.com>=0D=0A555-555-2=500 - Office=0D=0A555-555-2502 - Fax",
947
+ card.note
948
+ )
949
+ end
950
+
899
951
  def _test_gmail_vcard_export
900
952
  # GOOGLE BUG - Whitespace before the LABEL field values is a broken
901
953
  # line continuation.
metadata CHANGED
@@ -1,37 +1,41 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vpim
3
- version: !ruby/object:Gem::Version
4
- version: "0.695"
3
+ version: !ruby/object:Gem::Version
4
+ version: 24.2.20
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Sam Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2009-03-01 00:00:00 -08:00
13
- default_executable:
11
+ date: 2024-02-21 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
- description: This is a pure-ruby library for decoding and encoding vCard and iCalendar data ("personal information") called vPim.
13
+ description: |
14
+ This is a pure-ruby library for decoding and encoding vCard and iCalendar data
15
+ ("personal information") called vPim.
17
16
  email: vieuxtech@gmail.com
18
- executables:
17
+ executables:
19
18
  - reminder
20
19
  - rrule
21
20
  extensions: []
22
-
23
- extra_rdoc_files:
24
- - README
21
+ extra_rdoc_files:
22
+ - README.rdoc
25
23
  - CHANGES
26
24
  - COPYING
27
25
  - samples/README.mutt
28
- files:
26
+ files:
27
+ - CHANGES
28
+ - COPYING
29
+ - README.rdoc
30
+ - bin/reminder
31
+ - bin/rrule
32
+ - lib/vpim.rb
29
33
  - lib/vpim/address.rb
30
- - lib/vpim/agent/app.rb
31
34
  - lib/vpim/agent/atomize.rb
35
+ - lib/vpim/agent/base.rb
32
36
  - lib/vpim/agent/calendars.rb
33
- - lib/vpim/agent/main.rb
34
- - lib/vpim/agent/scraps.rb
37
+ - lib/vpim/agent/handler.rb
38
+ - lib/vpim/agent/ics.rb
35
39
  - lib/vpim/attachment.rb
36
40
  - lib/vpim/date.rb
37
41
  - lib/vpim/dirinfo.rb
@@ -57,10 +61,9 @@ files:
57
61
  - lib/vpim/vjournal.rb
58
62
  - lib/vpim/vpim.rb
59
63
  - lib/vpim/vtodo.rb
60
- - lib/vpim.rb
61
- - bin/reminder
62
- - bin/rrule
64
+ - samples/README.mutt
63
65
  - samples/ab-query.rb
66
+ - samples/agent.ru
64
67
  - samples/cmd-itip.rb
65
68
  - samples/ex_cpvcard.rb
66
69
  - samples/ex_get_vcard_photo.rb
@@ -71,7 +74,6 @@ files:
71
74
  - samples/ics-to-rss.rb
72
75
  - samples/mutt-aliases-to-vcf.rb
73
76
  - samples/osx-wrappers.rb
74
- - samples/README.mutt
75
77
  - samples/reminder.rb
76
78
  - samples/rrule.rb
77
79
  - samples/tabbed-file-to-vcf.rb
@@ -79,57 +81,44 @@ files:
79
81
  - samples/vcf-lines.rb
80
82
  - samples/vcf-to-ics.rb
81
83
  - samples/vcf-to-mutt.rb
82
- - test/test_agent_app.rb
83
- - test/test_agent_atomize.rb
84
- - test/test_agent_calendars.rb
85
84
  - test/test_all.rb
86
85
  - test/test_date.rb
87
86
  - test/test_dur.rb
88
87
  - test/test_field.rb
89
88
  - test/test_ical.rb
89
+ - test/test_misc.rb
90
90
  - test/test_repo.rb
91
91
  - test/test_rrule.rb
92
92
  - test/test_vcard.rb
93
- - test/test_view.rb
94
- - COPYING
95
- - README
96
- - CHANGES
97
- has_rdoc: true
98
93
  homepage: http://vpim.rubyforge.org
94
+ licenses: []
95
+ metadata: {}
99
96
  post_install_message:
100
97
  rdoc_options: []
101
-
102
- require_paths:
98
+ require_paths:
103
99
  - lib
104
- required_ruby_version: !ruby/object:Gem::Requirement
105
- requirements:
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
106
102
  - - ">="
107
- - !ruby/object:Gem::Version
108
- version: "0"
109
- version:
110
- required_rubygems_version: !ruby/object:Gem::Requirement
111
- requirements:
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
112
107
  - - ">="
113
- - !ruby/object:Gem::Version
114
- version: "0"
115
- version:
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
116
110
  requirements: []
117
-
118
- rubyforge_project: vpim
119
- rubygems_version: 1.3.1
111
+ rubygems_version: 3.0.3
120
112
  signing_key:
121
- specification_version: 2
113
+ specification_version: 4
122
114
  summary: iCalendar and vCard support for ruby
123
- test_files:
124
- - test/test_agent_app.rb
125
- - test/test_agent_atomize.rb
126
- - test/test_agent_calendars.rb
127
- - test/test_all.rb
115
+ test_files:
128
116
  - test/test_date.rb
129
117
  - test/test_dur.rb
130
118
  - test/test_field.rb
131
- - test/test_ical.rb
132
119
  - test/test_repo.rb
133
- - test/test_rrule.rb
134
120
  - test/test_vcard.rb
135
- - test/test_view.rb
121
+ - test/test_misc.rb
122
+ - test/test_all.rb
123
+ - test/test_ical.rb
124
+ - test/test_rrule.rb
@@ -1,194 +0,0 @@
1
- =begin
2
- Copyright (C) 2009 Sam Roberts
3
-
4
- This library is free software; you can redistribute it and/or modify it
5
- under the same terms as the ruby language itself, see the file COPYING for
6
- details.
7
- =end
8
-
9
- require 'sinatra'
10
- require 'vpim/agent/atomize'
11
- require 'vpim/repo'
12
- require 'vpim/view'
13
-
14
- require 'cgi'
15
-
16
- configure do
17
- server = Sinatra::Application.server
18
- set :server, Proc.new {
19
- if ENV.include?("PHP_FCGI_CHILDREN")
20
- break "fastcgi" # Must NOT be the correct class name!
21
- elsif ENV.include?("REQUEST_METHOD")
22
- break "cgi" # Must NOT be the correct class name!
23
- else
24
- # Fall back on whatever it was going to be.
25
- server
26
- end
27
- }
28
- end
29
-
30
- # I could wrap the Repo/Calendar/Atomize in a small class that would memoize
31
- # ical data and atom output. Maybe even do an HTTP head for fast detection of
32
- # change? Does a calendar have updated information? Can we memoize atom when
33
- # ics doesn't change?
34
-
35
- module Vpim
36
- module Agent
37
- module App
38
- def self.atomize(caluri, feeduri)
39
- repo = Vpim::Repo::Uri.new(caluri)
40
- cal = repo.find{true}
41
- cal = View.week(cal)
42
- feed = Agent::Atomize.calendar(cal, feeduri, caluri, cal.name)
43
- return feed.to_xml, Agent::Atomize::MIME
44
- end
45
- end
46
- end
47
- end
48
-
49
- get '/ics' do
50
- from = env['QUERY_STRING']
51
-
52
- url = URI.parse(request.url)
53
- url.query = nil
54
- url_base = url.to_s
55
- url_atom = nil
56
-
57
- @url_ics = from # ics from here
58
- @url_atom = nil
59
-
60
- if not from.empty?
61
- # Error out if we can't atomize the feed
62
- Vpim::Agent::App.atomize(from, "http://example.com")
63
-
64
- url = URI.parse(request.url)
65
- url.path << "/atom"
66
- url_atom = url.to_s
67
- end
68
-
69
- @url_base = url_base # clean input form
70
- @url_atom = url_atom # atomized ics from here
71
-
72
- haml :"ics.haml"
73
- end
74
-
75
- post '/ics' do
76
- from = params[:url]
77
- url = URI.parse(request.url)
78
- url.query = from
79
- redirect url.to_s
80
- end
81
-
82
- # When we support other forms..
83
- #get '/ics/:form' do
84
- # form = params[:form]
85
- get '/ics/atom' do
86
- from = env['QUERY_STRING']
87
- port = env["SERVER_PORT"].to_i
88
- here = request.url
89
-
90
- if from.empty?
91
- url = URI.parse(here)
92
- url.path.sub(/atom$/, "")
93
- redirect here.to_s
94
- end
95
-
96
- xml, xmltype = Vpim::Agent::App.atomize(from, here)
97
-
98
- content_type xmltype
99
- body xml
100
- end
101
-
102
- get '/ics/style.css' do
103
- content_type 'text/css'
104
- sass :"ics.sass"
105
- end
106
-
107
- error do
108
- @url_error = CGI.escapeHTML(env['sinatra.error'].inspect)
109
- haml :"ics.haml"
110
- end
111
-
112
- use_in_file_templates!
113
-
114
- # FIXME - hard-coded :action paths below, bad!
115
-
116
- __END__
117
- @@ics.sass
118
- body
119
- :background-color gray
120
- :font-size medium
121
- a
122
- :color black
123
- :font-style italic
124
- a:hover
125
- :color darkred
126
-
127
- #header
128
- :border-bottom 3px solid darkred
129
- #title
130
- :color black
131
- :font-size large
132
-
133
- .text
134
- :width 80%
135
- -#:color yellow
136
-
137
- #submit
138
- :margin-top 30px
139
- :margin-left 5%
140
- #form
141
- :padding
142
- :top 10px
143
- :bottom 10px
144
- :left 10px
145
- :right 10px
146
- :text-align left
147
- #url
148
- :width 80%
149
- #button
150
- :font-weight bold
151
- :text-align center
152
-
153
- #subscribe
154
- :margin-left 5%
155
- -#.feed
156
- -# :margin-left 10%
157
-
158
- #footer
159
- :border-top 3px solid darkred
160
- :margin-top 20px
161
- @@ics.haml
162
- %html
163
- %head
164
- %title Subscribe to calendar feeds as atom feeds
165
- %link{:href => '/ics/style.css', :media => 'screen', :type => 'text/css'}
166
- %body
167
- #header
168
- %span#title Subscribe to calendar feeds as atom feeds
169
- #submit
170
- .text Calendar feeds are great, but sometimes all you want is an atom feed of what's coming up in the next week.
171
- .text Paste the URL of the calendar below, submit it, and subscribe.
172
- %form#form{:method => 'POST', :action => '/ics'}
173
- %input#url{:name => 'url', :value => params[:url]}
174
- %input#button{:type => 'submit', :value => 'Submit'}
175
- - if @url_atom
176
- #subscribe
177
- .text
178
- Subscribe to
179
- %a{:href => @url_ics}= @url_ics
180
- as:
181
- %ul.feed
182
- %a{:href => @url_atom}= @url_atom
183
- (atom feed)
184
- - if @url_error
185
- #error.text
186
- #preamble Sorry, trying to access:
187
- #source= @url_ics
188
- #transition resulted in:
189
- #destination= @url_error
190
- #footer
191
- .text
192
- :textile
193
- Coming from the "Octet Cloud":http://octetcloud.com/ using "vPim":http://vpim.rubyforge.org/, piloted by cloud monkey "Sam Roberts":mailto:vieuxtech@gmail.com
194
-