ri_cal 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/History.txt +7 -0
  2. data/Rakefile +59 -46
  3. data/VERSION +1 -0
  4. data/component_attributes/component_property_defs.yml +3 -3
  5. data/lib/ri_cal/component/t_z_info_timezone.rb +17 -3
  6. data/lib/ri_cal/core_extensions/date/conversions.rb +0 -14
  7. data/lib/ri_cal/core_extensions/date_time/conversions.rb +0 -6
  8. data/lib/ri_cal/fast_date_time.rb +8 -0
  9. data/lib/ri_cal/properties/alarm.rb +8 -8
  10. data/lib/ri_cal/properties/calendar.rb +3 -3
  11. data/lib/ri_cal/properties/event.rb +62 -65
  12. data/lib/ri_cal/properties/freebusy.rb +19 -20
  13. data/lib/ri_cal/properties/journal.rb +50 -53
  14. data/lib/ri_cal/properties/timezone.rb +10 -11
  15. data/lib/ri_cal/properties/timezone_period.rb +10 -10
  16. data/lib/ri_cal/properties/todo.rb +68 -71
  17. data/lib/ri_cal/property_value.rb +1 -0
  18. data/lib/ri_cal/property_value/date.rb +4 -0
  19. data/lib/ri_cal/property_value/date_time.rb +8 -0
  20. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb +4 -3
  21. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb +5 -1
  22. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb +1 -1
  23. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb +5 -1
  24. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb +5 -1
  25. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb +9 -0
  26. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb +11 -1
  27. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb +4 -0
  28. data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +5 -1
  29. data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +5 -1
  30. data/lib/ri_cal/property_value/zulu_date_time.rb +34 -0
  31. data/parked_specs/ri_cal/claudio_a_bug_spec.rb +100 -0
  32. data/ri_cal.gemspec +218 -21
  33. data/spec/ri_cal/component/event_spec.rb +17 -0
  34. data/spec/ri_cal/component/t_z_info_timezone_spec.rb +5 -4
  35. data/spec/ri_cal/fast_date_time_spec.rb +10 -0
  36. data/spec/ri_cal/inf_loop_spec.rb +78 -0
  37. data/spec/ri_cal/parser_spec.rb +3 -3
  38. metadata +61 -60
@@ -18,15 +18,16 @@ describe RiCal::Component::TZInfoTimezone do
18
18
  BEGIN:VTIMEZONE
19
19
  TZID;X-RICAL-TZSOURCE=TZINFO:America/New_York
20
20
  BEGIN:DAYLIGHT
21
- DTSTART:20070311T030000
22
- RDATE:20070311T030000,20080309T030000
21
+ DTSTART:20070311T020000
22
+ RDATE:20070311T020000
23
+ RDATE:20080309T020000
23
24
  TZOFFSETFROM:-0500
24
25
  TZOFFSETTO:-0400
25
26
  TZNAME:EDT
26
27
  END:DAYLIGHT
27
28
  BEGIN:STANDARD
28
- DTSTART:20071104T010000
29
- RDATE:20071104T010000
29
+ DTSTART:20071104T020000
30
+ RDATE:20071104T020000
30
31
  TZOFFSETFROM:-0400
31
32
  TZOFFSETTO:-0500
32
33
  TZNAME:EST
@@ -5,6 +5,16 @@ require File.join(File.dirname(__FILE__), %w[.. spec_helper])
5
5
  module RiCal
6
6
 
7
7
  describe RiCal::FastDateTime do
8
+ context "#utc" do
9
+ it "should not change if it is already UTC" do
10
+ FastDateTime.new(2009, 5, 29, 19, 3, 0, 0).utc.should == FastDateTime.new(2009, 5, 29, 19, 3, 0, 0)
11
+ end
12
+
13
+ it "should change the time by the offset" do
14
+ FastDateTime.new(2010, 4, 15, 16, 3, 0, -4*60*60).utc.should == FastDateTime.new(2010, 4, 15, 20, 3, 0, 0)
15
+ end
16
+ end
17
+
8
18
  context "#==" do
9
19
  it "should detect equal FastDateTimes" do
10
20
  FastDateTime.new(2009, 5, 29, 19, 3, 0, 0).should ==
@@ -0,0 +1,78 @@
1
+ #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
2
+
3
+ require 'rubygems'
4
+ require File.join(File.dirname(__FILE__), %w[.. spec_helper])
5
+
6
+ describe "an event with unneeded by parts" do
7
+ before(:each) do
8
+ rawdata = <<END_STR
9
+ BEGIN:VCALENDAR
10
+ PRODID:-//Google Inc//Google Calendar 70.9054//EN
11
+ VERSION:2.0
12
+ CALSCALE:GREGORIAN
13
+ METHOD:PUBLISH
14
+ X-WR-CALNAME:RICal teste
15
+ X-WR-TIMEZONE:America/Sao_Paulo
16
+ X-WR-CALDESC:
17
+ BEGIN:VTIMEZONE
18
+ TZID:America/Sao_Paulo
19
+ X-LIC-LOCATION:America/Sao_Paulo
20
+ BEGIN:DAYLIGHT
21
+ TZOFFSETFROM:-0300
22
+ TZOFFSETTO:-0200
23
+ TZNAME:BRST
24
+ DTSTART:19701018T000000
25
+ RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=3SU
26
+ END:DAYLIGHT
27
+ BEGIN:STANDARD
28
+ TZOFFSETFROM:-0300
29
+ TZOFFSETTO:-0300
30
+ TZNAME:BRT
31
+ DTSTART:19700215T000000
32
+ RRULE:FREQ=YEARLY;BYMONTH=2;BYDAY=3SU
33
+ END:STANDARD
34
+ END:VTIMEZONE
35
+ BEGIN:VEVENT
36
+ DTSTART;VALUE=DATE:19400713
37
+ DTEND;VALUE=DATE:19400714
38
+ RRULE:FREQ=YEARLY;BYMONTH=7;BYMONTHDAY=13
39
+ DTSTAMP:20091109T161426Z
40
+ UID:CD0000008B9511D182D800C04FB1625DF48568F41595384496C2570C025DC032
41
+ CREATED:20090924T160743Z
42
+ DESCRIPTION: Description test 12
43
+ LAST-MODIFIED:20090924T160945Z
44
+ LOCATION: Location test 12
45
+ SEQUENCE:0
46
+ STATUS:CONFIRMED
47
+ SUMMARY: Event test 12
48
+ TRANSP:TRANSPARENT
49
+ END:VEVENT
50
+ END:VCALENDAR
51
+ END_STR
52
+ @cal = RiCal.parse_string(rawdata).first
53
+ @event = @cal.events.first
54
+ end
55
+
56
+ it "should enumerate 10 events from July 13, 1940 to July 13, 1949 when count is 10" do
57
+ @event.occurrences(:count => 10).map {|occurrence| occurrence.dtstart}.should == (0..9).map {|y|
58
+ Date.parse("July 13, #{1940+y}")
59
+ }
60
+ end
61
+
62
+ # describe "with a dtstart outside the recurrence rule" do
63
+ # before(:each) do
64
+ # @event.dtstart = Date.parse("July 12, 1940")
65
+ # end
66
+ #
67
+ # it "should enumerate 10 events first July 12, 1940, July 13, 1940, July 13, 1941 when count is 3" do
68
+ # @event.occurrences(:count => 3).map {|occurrence| occurrence.dtstart.to_s}.should == [
69
+ # Date.parse("July 12, 1940").to_s,
70
+ # Date.parse("July 13, 1940").to_s,
71
+ # Date.parse("July 13, 1941").to_s
72
+ # ]
73
+ #
74
+ # end
75
+ #
76
+ # end
77
+
78
+ end
@@ -233,13 +233,13 @@ describe RiCal::Parser do
233
233
  describe_multi_property("VEVENT", "RRULE", {"X-FOO" => "BAR"}, "FREQ=DAILY;COUNT=10", RiCal::PropertyValue::RecurrenceRule)
234
234
 
235
235
  #RFC 2445 section 4.8.7.1 CREATED p129
236
- describe_property("VEVENT", "CREATED", {"X-FOO" => "BAR"}, "19960329T133000Z", RiCal::PropertyValue::DateTime)
236
+ describe_property("VEVENT", "CREATED", {"X-FOO" => "BAR"}, "19960329T133000Z", RiCal::PropertyValue::ZuluDateTime)
237
237
 
238
238
  #RFC 2445 section 4.8.7.2 DTSTAMP p129
239
- describe_property("VEVENT", "DTSTAMP", {"X-FOO" => "BAR"}, "19971210T080000Z", RiCal::PropertyValue::DateTime)
239
+ describe_property("VEVENT", "DTSTAMP", {"X-FOO" => "BAR"}, "19971210T080000Z", RiCal::PropertyValue::ZuluDateTime)
240
240
 
241
241
  #RFC 2445 section 4.8.7.3 LAST-MODIFIED p131
242
- describe_property("VEVENT", "LAST-MODIFIED", {"X-FOO" => "BAR"}, "19960817T133000Z", RiCal::PropertyValue::DateTime)
242
+ describe_property("VEVENT", "LAST-MODIFIED", {"X-FOO" => "BAR"}, "19960817T133000Z", RiCal::PropertyValue::ZuluDateTime)
243
243
 
244
244
  #RFC 2445 section 4.8.7.3 SEQUENCE p131
245
245
  describe_property("VEVENT", "SEQUENCE", {"X-FOO" => "BAR"}, 2, RiCal::PropertyValue::Integer)
metadata CHANGED
@@ -1,75 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ri_cal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 8
8
+ - 6
9
+ version: 0.8.6
5
10
  platform: ruby
6
11
  authors:
7
- - author=Rick DeNatale
12
+ - Rick DeNatale
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-09-28 00:00:00 -04:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: newgem
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.5.2
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: ruby-prof
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 2.3.3
44
- version:
45
- description: |-
46
- A new Ruby implementation of RFC2445 iCalendar.
47
-
48
- The existing Ruby iCalendar libraries (e.g. icalendar, vpim) provide for parsing and generating icalendar files,
49
- but do not support important things like enumerating occurrences of repeating events.
50
-
51
- This is a clean-slate implementation of RFC2445.
52
-
53
- A Google group for discussion of this library has been set up http://groups.google.com/group/rical_gem
54
- email:
55
- - rick.denatale@gmail.com
17
+ date: 2010-04-15 00:00:00 -04:00
18
+ default_executable: ri_cal
19
+ dependencies: []
20
+
21
+ description: "A new Ruby implementation of RFC2445 iCalendar.\n\n\
22
+ The existing Ruby iCalendar libraries (e.g. icalendar, vpim) provide for parsing and generating icalendar files,\n\
23
+ but do not support important things like enumerating occurrences of repeating events.\n\n\
24
+ This is a clean-slate implementation of RFC2445.\n\n\
25
+ A Google group for discussion of this library has been set up http://groups.google.com/group/rical_gem\n "
26
+ email: rick.denatale@gmail.com
56
27
  executables:
57
28
  - ri_cal
58
29
  extensions: []
59
30
 
60
31
  extra_rdoc_files:
61
32
  - History.txt
62
- - Manifest.txt
63
33
  - README.txt
64
34
  - copyrights.txt
65
- - docs/draft-ietf-calsify-2446bis-08.txt
66
- - docs/draft-ietf-calsify-rfc2445bis-09.txt
67
- - docs/incrementers.txt
68
35
  files:
69
36
  - History.txt
70
37
  - Manifest.txt
71
38
  - README.txt
72
39
  - Rakefile
40
+ - VERSION
73
41
  - bin/ri_cal
74
42
  - component_attributes/alarm.yml
75
43
  - component_attributes/calendar.yml
@@ -179,7 +147,9 @@ files:
179
147
  - lib/ri_cal/property_value/text.rb
180
148
  - lib/ri_cal/property_value/uri.rb
181
149
  - lib/ri_cal/property_value/utc_offset.rb
150
+ - lib/ri_cal/property_value/zulu_date_time.rb
182
151
  - lib/ri_cal/required_timezones.rb
152
+ - parked_specs/ri_cal/claudio_a_bug_spec.rb
183
153
  - performance/empty_propval/subject.rb
184
154
  - performance/paris_eastern/subject.rb
185
155
  - performance/penultimate_weekday/subject.rb
@@ -207,6 +177,7 @@ files:
207
177
  - spec/ri_cal/core_extensions/time/calculations_spec.rb
208
178
  - spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb
209
179
  - spec/ri_cal/fast_date_time_spec.rb
180
+ - spec/ri_cal/inf_loop_spec.rb
210
181
  - spec/ri_cal/occurrence_enumerator_spec.rb
211
182
  - spec/ri_cal/parser_spec.rb
212
183
  - spec/ri_cal/property_value/date_spec.rb
@@ -228,33 +199,63 @@ files:
228
199
  - tasks/ri_cal.rake
229
200
  - tasks/spec.rake
230
201
  has_rdoc: true
231
- homepage: http://ri-cal.rubyforge.org/
202
+ homepage: http://github.com/rubyredrick/ri_cal
232
203
  licenses: []
233
204
 
234
205
  post_install_message:
235
206
  rdoc_options:
236
- - --main
237
- - README.txt
207
+ - --charset=UTF-8
238
208
  require_paths:
239
209
  - lib
240
210
  required_ruby_version: !ruby/object:Gem::Requirement
241
211
  requirements:
242
212
  - - ">="
243
213
  - !ruby/object:Gem::Version
214
+ segments:
215
+ - 0
244
216
  version: "0"
245
- version:
246
217
  required_rubygems_version: !ruby/object:Gem::Requirement
247
218
  requirements:
248
219
  - - ">="
249
220
  - !ruby/object:Gem::Version
221
+ segments:
222
+ - 0
250
223
  version: "0"
251
- version:
252
224
  requirements: []
253
225
 
254
- rubyforge_project: ri-cal
255
- rubygems_version: 1.3.5
226
+ rubyforge_project:
227
+ rubygems_version: 1.3.6
256
228
  signing_key:
257
229
  specification_version: 3
258
- summary: A new Ruby implementation of RFC2445 iCalendar
259
- test_files: []
260
-
230
+ summary: a new implementation of RFC2445 in Ruby
231
+ test_files:
232
+ - spec/ri_cal/bugreports_spec.rb
233
+ - spec/ri_cal/component/alarm_spec.rb
234
+ - spec/ri_cal/component/calendar_spec.rb
235
+ - spec/ri_cal/component/event_spec.rb
236
+ - spec/ri_cal/component/freebusy_spec.rb
237
+ - spec/ri_cal/component/journal_spec.rb
238
+ - spec/ri_cal/component/t_z_info_timezone_spec.rb
239
+ - spec/ri_cal/component/timezone_spec.rb
240
+ - spec/ri_cal/component/todo_spec.rb
241
+ - spec/ri_cal/component_spec.rb
242
+ - spec/ri_cal/core_extensions/string/conversions_spec.rb
243
+ - spec/ri_cal/core_extensions/time/calculations_spec.rb
244
+ - spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb
245
+ - spec/ri_cal/fast_date_time_spec.rb
246
+ - spec/ri_cal/inf_loop_spec.rb
247
+ - spec/ri_cal/occurrence_enumerator_spec.rb
248
+ - spec/ri_cal/parser_spec.rb
249
+ - spec/ri_cal/property_value/date_spec.rb
250
+ - spec/ri_cal/property_value/date_time_spec.rb
251
+ - spec/ri_cal/property_value/duration_spec.rb
252
+ - spec/ri_cal/property_value/occurrence_list_spec.rb
253
+ - spec/ri_cal/property_value/period_spec.rb
254
+ - spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb
255
+ - spec/ri_cal/property_value/recurrence_rule_spec.rb
256
+ - spec/ri_cal/property_value/text_spec.rb
257
+ - spec/ri_cal/property_value/utc_offset_spec.rb
258
+ - spec/ri_cal/property_value_spec.rb
259
+ - spec/ri_cal/required_timezones_spec.rb
260
+ - spec/ri_cal_spec.rb
261
+ - spec/spec_helper.rb