icalendar 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 1.2.1 2012-11-12
2
+ * Adds uid property to alarms to support iCloud - Jeroen Jacobs
3
+ * Fix up testing docs - Eric Carty-Fickes
4
+ * Fix parsing property params that have : in them - Sean Dague
5
+ * Clean up warnings in test suite - Sean Dague
6
+
1
7
  === 1.2.0 2012-08-30
2
8
  * Fix calendar handling for dates < 1000 - Ryan Ahearn
3
9
  * Updated license to GPL/BSD/Ruby at users option
@@ -259,6 +259,21 @@ It's all about rubygems:
259
259
 
260
260
  $ sudo gem install icalendar
261
261
 
262
+ == Testing
263
+
264
+ You cannot use the most recent version of rake (10.x +), so you must install an
265
+ older version, such as 0.9.2.2:
266
+
267
+ gem install rake -v=0.9.2.2
268
+
269
+ The gem `hoe` is required as well:
270
+
271
+ gem install hoe
272
+
273
+ To run the tests:
274
+
275
+ rake _0.9.2.2_ test
276
+
262
277
  == License
263
278
 
264
279
  This library is released under the same license as Ruby itself.
data/Rakefile CHANGED
@@ -6,7 +6,6 @@ require './lib/icalendar'
6
6
 
7
7
  Hoe.plugin :newgem
8
8
  Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
9
 
11
10
  # Generate all the Rake tasks
12
11
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
@@ -14,7 +13,6 @@ $hoe = Hoe.spec 'icalendar' do
14
13
  self.developer 'Sean Dague', 'sean@dague.net'
15
14
  self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
15
  self.rubyforge_name = self.name # TODO this is default value
17
- # self.extra_deps = [['activesupport','>= 2.0.2']]
18
16
  self.extra_rdoc_files = ["README.rdoc"]
19
17
  self.readme_file = "README.rdoc"
20
18
  end
@@ -23,10 +21,3 @@ if ENV['UNDER_HUDSON']
23
21
  require 'ci/reporter/rake/test_unit'
24
22
  task :test => ["ci:setup:testunit"]
25
23
  end
26
-
27
- require 'newgem/tasks'
28
- Dir['tasks/**/*.rake'].each { |t| load t }
29
-
30
- # TODO - want other tests/tasks run by default? Add them to the list
31
- # remove_task :default
32
- # task :default => [:spec, :features]
@@ -10,7 +10,7 @@ require 'logger'
10
10
 
11
11
  module Icalendar #:nodoc:
12
12
 
13
- VERSION = '1.2.0'
13
+ VERSION = '1.2.1'
14
14
 
15
15
  # A simple error class to differentiate iCalendar library exceptions
16
16
  # from ruby language exceptions or others.
@@ -137,24 +137,24 @@ module Icalendar
137
137
 
138
138
  # Property name
139
139
  unless multiline_property?(key)
140
- prelude = "#{key.gsub(/_/, '-').upcase}" +
141
-
142
- # Possible parameters
143
- print_parameters(val)
144
-
145
- # Property value
146
- value = ":#{val.to_ical}"
147
- value = escape_chars(value) unless ["rrule", "categories"].include?(key)
148
- add_sliced_text(s, prelude + value)
149
- else
150
- prelude = "#{key.gsub(/_/, '-').upcase}"
151
- val.each do |v|
152
- params = print_parameters(v)
153
- value = ":#{v.to_ical}"
154
- value = escape_chars(value) unless key == "rrule"
155
- add_sliced_text(s, prelude + params + value)
156
- end
157
- end
140
+ prelude = "#{key.gsub(/_/, '-').upcase}" +
141
+
142
+ # Possible parameters
143
+ print_parameters(val)
144
+
145
+ # Property value
146
+ value = ":#{val.to_ical}"
147
+ value = escape_chars(value) unless %w[rrule categories exdate].include?(key)
148
+ add_sliced_text(s, prelude + value)
149
+ else
150
+ prelude = "#{key.gsub(/_/, '-').upcase}"
151
+ val.each do |v|
152
+ params = print_parameters(v)
153
+ value = ":#{v.to_ical}"
154
+ value = escape_chars(value) unless key == "rrule"
155
+ add_sliced_text(s, prelude + params + value)
156
+ end
157
+ end
158
158
  end
159
159
  s
160
160
  end
@@ -171,12 +171,12 @@ module Icalendar
171
171
  add_to.gsub!(/ *$/, '')
172
172
  end
173
173
 
174
- # Print the parameters for a specific property
175
- def print_parameters(val)
174
+ # Print the parameters for a specific property.
175
+ def print_parameters(value)
176
176
  s = ""
177
- return s unless val.respond_to?(:ical_params) and not val.ical_params.nil?
177
+ return s unless value.respond_to?(:ical_params) and not value.ical_params.nil?
178
178
 
179
- val.ical_params.each do |key,val|
179
+ value.ical_params.each do |key, val|
180
180
  s << ";#{key}"
181
181
  val = [ val ] unless val.is_a?(Array)
182
182
 
@@ -17,6 +17,7 @@ module Icalendar
17
17
  ical_property :description
18
18
  ical_property :trigger
19
19
  ical_property :summary
20
+ ical_property :uid
20
21
 
21
22
  # Single but must appear together
22
23
  ical_property :duration
@@ -154,7 +154,6 @@ module Icalendar
154
154
 
155
155
  # Lookup the property name to see if we have a string to
156
156
  # object parser for this property type.
157
- orig_value = value
158
157
  if @parsers.has_key?(name)
159
158
  value = @parsers[name].call(name, params, value)
160
159
  end
@@ -196,7 +195,7 @@ module Icalendar
196
195
  QSTR = '"[^"]*"'
197
196
 
198
197
  # Contentline
199
- LINE = "(#{NAME})(.*(?:#{QSTR})|(?:[^:]*))\:(.*)"
198
+ LINE = "(#{NAME})((?:(?:[^:]*?)(?:#{QSTR})(?:[^:]*?))+|(?:[^:]*))\:(.*)"
200
199
 
201
200
  # *<Any character except CTLs, DQUOTE, ";", ":", ",">
202
201
  PTEXT = '[^";:,]*'
@@ -11,18 +11,6 @@ unless defined? 1.days
11
11
  end
12
12
  end
13
13
 
14
- # Define a test event
15
- testEvent = <<EOS
16
- BEGIN:VEVENT
17
- UID:19970901T130000Z-123401@host.com
18
- DTSTAMP:19970901T1300Z
19
- DTSTART:19970903T163000Z
20
- DTEND:19970903T190000Z
21
- SUMMARY:Annual Employee Review
22
- CLASS:PRIVATE
23
- CATEGORIES:BUSINESS,HUMAN RESOURCES
24
- END:VEVENT
25
- EOS
26
14
 
27
15
  class TestEvent < Test::Unit::TestCase
28
16
 
@@ -9,7 +9,7 @@ class TestTodo < Test::Unit::TestCase
9
9
 
10
10
  cal = Calendar.new
11
11
 
12
- t = cal.todo do
12
+ cal.todo do
13
13
  summary "Plan next vacations"
14
14
  description "Let's have a break"
15
15
  percent 50
@@ -37,7 +37,7 @@ class TestCalendar < Test::Unit::TestCase
37
37
  event.dtend "19970903T190000Z", {:TZID => "Europe/Copenhagen"}
38
38
  event.summary "This is my summary"
39
39
 
40
- ev = cal.events.each do |ev|
40
+ cal.events.each do |ev|
41
41
  assert_equal("19970903T190000Z", ev.dtend)
42
42
  assert_equal("This is my summary", ev.summary)
43
43
  end
@@ -18,9 +18,11 @@ CATEGORIES:foo,bar,baz
18
18
  DESCRIPTION:desc
19
19
  DTSTAMP:20060720T174052
20
20
  DTSTART:20060720
21
+ EXDATE:20121012T170000Z,20121102T170000Z
21
22
  GEO:46.01\\;8.57
22
23
  LAST-MODIFIED:19960817T133000
23
24
  ORGANIZER:mailto:joe@example.com?subject=Ruby
25
+ RRULE:FREQ=WEEKLY;UNTIL=20130220T180000Z;BYDAY=FR
24
26
  SEQUENCE:2
25
27
  UID:foobar
26
28
  X-TIME-OF-DAY:101736
@@ -63,6 +65,11 @@ EOS
63
65
  x_time_of_day Time.at(123456).utc
64
66
 
65
67
  uid "foobar"
68
+
69
+ add_rrule "FREQ=WEEKLY;UNTIL=20130220T180000Z;BYDAY=FR"
70
+
71
+ add_exdate "20121012T170000Z"
72
+ add_exdate "20121102T170000Z"
66
73
  end
67
74
 
68
75
  assert_equal(RESULT.gsub("\n", "\r\n"), @cal.to_ical)
@@ -6,28 +6,35 @@ require 'date'
6
6
  require 'test/unit'
7
7
  require 'icalendar'
8
8
 
9
- class TestComponent < Test::Unit::TestCase
9
+ class TestParameter < Test::Unit::TestCase
10
10
 
11
11
  # Create a calendar with an event for each test.
12
- def setup
13
- @cal = Icalendar::Calendar.new
14
- @event = Icalendar::Event.new
15
- end
12
+ def setup
13
+ @cal = Icalendar::Calendar.new
14
+ @event = Icalendar::Event.new
15
+ end
16
+
17
+ def test_property_parameters
18
+ tests = [
19
+ {"ALTREP" =>['"http://my.language.net"'],
20
+ "LANGUAGE" => ["SPANISH"]},
21
+ {"ALTREP" =>['"http://my.language.net"'],
22
+ "LANGUAGE" => ['"SPANISH:CATILLAN"']},
23
+ {"ALTREP" =>["foo"],
24
+ "LANGUAGE" => ["SPANISH"]}
25
+ ]
16
26
 
17
- def test_property_parameters
18
- params = {"ALTREP" =>['"http://my.language.net"'], "LANGUAGE" => ["SPANISH"]}
19
- # params = {"ALTREP" =>["foo"], "LANGUAGE" => ["SPANISH"]}
27
+ tests.each do |params|
20
28
  @event.summary("This is a test summary.", params)
21
-
29
+
22
30
  assert_equal params, @event.summary.ical_params
23
-
31
+
24
32
  @cal.add_event @event
25
33
  cal_str = @cal.to_ical
26
- # puts cal_str
27
-
34
+
28
35
  cals = Icalendar::Parser.new(cal_str).parse
29
- # pp cals
30
36
  event = cals.first.events.first
31
37
  assert_equal params, event.summary.ical_params
32
- end
38
+ end
39
+ end
33
40
  end
metadata CHANGED
@@ -1,109 +1,79 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: icalendar
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sean Dague
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-08-31 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rdoc
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 3
31
- - 10
32
- version: "3.10"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: newgem
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 5
44
- segments:
45
- - 1
46
- - 5
47
- - 3
48
- version: 1.5.3
49
- type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.10'
30
+ - !ruby/object:Gem::Dependency
52
31
  name: hoe
53
- prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
55
33
  none: false
56
- requirements:
34
+ requirements:
57
35
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 3
62
- - 0
63
- version: "3.0"
36
+ - !ruby/object:Gem::Version
37
+ version: '3.3'
64
38
  type: :development
65
- version_requirements: *id003
66
- description: |-
67
- This is a Ruby library for dealing with iCalendar files. Rather than
68
- explaining myself, here is the introduction from RFC-2445, which
69
- defines the format:
70
-
71
- The use of calendaring and scheduling has grown considerably in the
72
- last decade. Enterprise and inter-enterprise business has become
73
- dependent on rapid scheduling of events and actions using this
74
- information technology. However, the longer term growth of calendaring
75
- and scheduling, is currently limited by the lack of Internet standards
76
- for the message content types that are central to these knowledgeware
77
- applications. This memo is intended to progress the level of
78
- interoperability possible between dissimilar calendaring and
79
- scheduling applications. This memo defines a MIME content type for
80
- exchanging electronic calendaring and scheduling information. The
81
- Internet Calendaring and Scheduling Core Object Specification, or
82
- iCalendar, allows for the capture and exchange of information normally
83
- stored within a calendaring and scheduling application; such as a
84
- Personal Information Manager (PIM) or a Group Scheduling product.
85
-
86
- The iCalendar format is suitable as an exchange format between
87
- applications or systems. The format is defined in terms of a MIME
88
- content type. This will enable the object to be exchanged using
89
- several transports, including but not limited to SMTP, HTTP, a file
90
- system, desktop interactive protocols such as the use of a memory-
91
- based clipboard or drag/drop interactions, point-to-point asynchronous
92
- communication, wired-network transport, or some form of unwired
93
- transport such as infrared might also be used.
94
- email:
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.3'
46
+ description: ! "This is a Ruby library for dealing with iCalendar files. Rather than\nexplaining
47
+ myself, here is the introduction from RFC-2445, which\ndefines the format:\n\nThe
48
+ use of calendaring and scheduling has grown considerably in the\nlast decade. Enterprise
49
+ and inter-enterprise business has become\ndependent on rapid scheduling of events
50
+ and actions using this\ninformation technology. However, the longer term growth
51
+ of calendaring\nand scheduling, is currently limited by the lack of Internet standards\nfor
52
+ the message content types that are central to these knowledgeware\napplications.
53
+ This memo is intended to progress the level of\ninteroperability possible between
54
+ dissimilar calendaring and\nscheduling applications. This memo defines a MIME content
55
+ type for\nexchanging electronic calendaring and scheduling information. The\nInternet
56
+ Calendaring and Scheduling Core Object Specification, or\niCalendar, allows for
57
+ the capture and exchange of information normally\nstored within a calendaring and
58
+ scheduling application; such as a\nPersonal Information Manager (PIM) or a Group
59
+ Scheduling product. \n\nThe iCalendar format is suitable as an exchange format between\napplications
60
+ or systems. The format is defined in terms of a MIME\ncontent type. This will enable
61
+ the object to be exchanged using\nseveral transports, including but not limited
62
+ to SMTP, HTTP, a file\nsystem, desktop interactive protocols such as the use of
63
+ a memory-\nbased clipboard or drag/drop interactions, point-to-point asynchronous\ncommunication,
64
+ wired-network transport, or some form of unwired\ntransport such as infrared might
65
+ also be used."
66
+ email:
95
67
  - sean@dague.net
96
68
  executables: []
97
-
98
69
  extensions: []
99
-
100
- extra_rdoc_files:
70
+ extra_rdoc_files:
101
71
  - History.txt
102
72
  - Manifest.txt
103
73
  - PostInstall.txt
104
74
  - README.rdoc
105
75
  - website/index.txt
106
- files:
76
+ files:
107
77
  - COPYING
108
78
  - GPL
109
79
  - History.txt
@@ -168,45 +138,37 @@ files:
168
138
  - .gemtest
169
139
  homepage: http://github.com/sdague/icalendar
170
140
  licenses: []
171
-
172
141
  post_install_message: PostInstall.txt
173
- rdoc_options:
142
+ rdoc_options:
174
143
  - --main
175
144
  - README.rdoc
176
- require_paths:
145
+ require_paths:
177
146
  - lib
178
- required_ruby_version: !ruby/object:Gem::Requirement
147
+ required_ruby_version: !ruby/object:Gem::Requirement
179
148
  none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- hash: 3
184
- segments:
185
- - 0
186
- version: "0"
187
- required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
154
  none: false
189
- requirements:
190
- - - ">="
191
- - !ruby/object:Gem::Version
192
- hash: 3
193
- segments:
194
- - 0
195
- version: "0"
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
196
159
  requirements: []
197
-
198
160
  rubyforge_project: icalendar
199
- rubygems_version: 1.8.15
161
+ rubygems_version: 1.8.23
200
162
  signing_key:
201
163
  specification_version: 3
202
164
  summary: This is a Ruby library for dealing with iCalendar files
203
- test_files:
165
+ test_files:
166
+ - test/test_calendar.rb
167
+ - test/test_conversions.rb
204
168
  - test/test_component.rb
205
- - test/component/test_timezone.rb
169
+ - test/test_helper.rb
206
170
  - test/component/test_todo.rb
171
+ - test/component/test_timezone.rb
207
172
  - test/component/test_event.rb
208
- - test/test_calendar.rb
209
- - test/test_helper.rb
210
- - test/test_conversions.rb
211
- - test/test_parser.rb
212
173
  - test/test_parameter.rb
174
+ - test/test_parser.rb