icalendar 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.rdoc +8 -7
- data/Rakefile +3 -4
- data/lib/icalendar/base.rb +2 -1
- data/lib/icalendar/component.rb +12 -11
- data/test/component/test_event.rb +3 -3
- data/test/component/test_timezone.rb +6 -2
- data/test/test_parameter.rb +2 -2
- metadata +3 -4
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 1.1.4 2010-04-23
|
2
|
+
* Fix for RRULE escaping
|
3
|
+
* Fix tests so they run under 1.8.7 in multiple environments
|
4
|
+
* Readme fix
|
5
|
+
|
1
6
|
=== 1.1.3 2010-03-15
|
2
7
|
* Revert component sorting behavior that I was trying to make
|
3
8
|
the tests run more consistantly on different platforms.
|
data/README.rdoc
CHANGED
@@ -32,9 +32,10 @@ based clipboard or drag/drop interactions, point-to-point asynchronous
|
|
32
32
|
communication, wired-network transport, or some form of unwired
|
33
33
|
transport such as infrared might also be used.
|
34
34
|
|
35
|
-
Now for some examples:
|
36
35
|
|
37
|
-
|
36
|
+
== EXAMPLES
|
37
|
+
|
38
|
+
=== Probably want to start with this
|
38
39
|
|
39
40
|
require 'rubygems' # Unless you install from the tarball or zip.
|
40
41
|
require 'icalendar'
|
@@ -42,7 +43,7 @@ Now for some examples:
|
|
42
43
|
|
43
44
|
include Icalendar # Probably do this in your class to limit namespace overlap
|
44
45
|
|
45
|
-
|
46
|
+
=== Creating calendars and events is easy.
|
46
47
|
|
47
48
|
# Create a calendar with an event (standard method)
|
48
49
|
cal = Calendar.new
|
@@ -56,7 +57,7 @@ Now for some examples:
|
|
56
57
|
|
57
58
|
cal.publish
|
58
59
|
|
59
|
-
|
60
|
+
=== Or you can make events like this
|
60
61
|
event = Event.new
|
61
62
|
event.start = DateTime.civil(2006, 6, 23, 8, 30)
|
62
63
|
event.summary = "A great event!"
|
@@ -80,9 +81,9 @@ Now for some examples:
|
|
80
81
|
cal_string = cal.to_ical
|
81
82
|
puts cal_string
|
82
83
|
|
83
|
-
|
84
|
+
== ALARMS
|
84
85
|
|
85
|
-
|
86
|
+
=== Within an event, you can create e-mail notification alarms like this...
|
86
87
|
|
87
88
|
cal.event.do
|
88
89
|
# ...other event properties
|
@@ -134,7 +135,7 @@ Now for some examples:
|
|
134
135
|
# TRIGGER:-PT15M
|
135
136
|
# END:VALARM
|
136
137
|
|
137
|
-
|
138
|
+
== Timezones
|
138
139
|
|
139
140
|
# Create a timezone definition (previous convention)
|
140
141
|
cal = Calendar.new
|
data/Rakefile
CHANGED
@@ -4,10 +4,8 @@ require 'hoe'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require './lib/icalendar'
|
6
6
|
|
7
|
-
ENV['VERSION'] = Icalendar::VERSION
|
8
|
-
|
9
7
|
Hoe.plugin :newgem
|
10
|
-
Hoe.plugin :website
|
8
|
+
# Hoe.plugin :website
|
11
9
|
# Hoe.plugin :cucumberfeatures
|
12
10
|
|
13
11
|
# Generate all the Rake tasks
|
@@ -17,7 +15,8 @@ $hoe = Hoe.spec 'icalendar' do
|
|
17
15
|
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
18
16
|
self.rubyforge_name = self.name # TODO this is default value
|
19
17
|
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
20
|
-
|
18
|
+
self.extra_rdoc_files = ["README.rdoc"]
|
19
|
+
self.readme_file = "README.rdoc"
|
21
20
|
end
|
22
21
|
|
23
22
|
require 'newgem/tasks'
|
data/lib/icalendar/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
=begin
|
2
2
|
Copyright (C) 2005 Jeff Rose
|
3
|
+
Copyright (C) 2009-2010 Sean Dague
|
3
4
|
|
4
5
|
This library is free software; you can redistribute it and/or modify it
|
5
6
|
under the same terms as the ruby language itself, see the file COPYING for
|
@@ -9,7 +10,7 @@ require 'logger'
|
|
9
10
|
|
10
11
|
module Icalendar #:nodoc:
|
11
12
|
|
12
|
-
VERSION = '1.1.
|
13
|
+
VERSION = '1.1.4'
|
13
14
|
|
14
15
|
# A simple error class to differentiate iCalendar library exceptions
|
15
16
|
# from ruby language exceptions or others.
|
data/lib/icalendar/component.rb
CHANGED
@@ -125,33 +125,34 @@ module Icalendar
|
|
125
125
|
"END:#{@name.upcase}\r\n"
|
126
126
|
end
|
127
127
|
|
128
|
-
# Print this components properties
|
129
128
|
def print_properties
|
130
129
|
s = ""
|
131
130
|
|
132
|
-
@properties.sort.each do |key,val|
|
131
|
+
@properties.sort.each do |key,val|
|
133
132
|
# Take out underscore for property names that conflicted
|
134
133
|
# with built-in words.
|
135
134
|
if key =~ /ip_.*/
|
136
135
|
key = key[3..-1]
|
137
136
|
end
|
138
|
-
|
137
|
+
|
139
138
|
# Property name
|
140
139
|
unless multiline_property?(key)
|
141
|
-
prelude = "#{key.gsub(/_/, '-').upcase}" +
|
140
|
+
prelude = "#{key.gsub(/_/, '-').upcase}" +
|
142
141
|
|
143
142
|
# Possible parameters
|
144
|
-
print_parameters(val)
|
143
|
+
print_parameters(val)
|
145
144
|
|
146
145
|
# Property value
|
147
|
-
value = ":#{val.to_ical}"
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
146
|
+
value = ":#{val.to_ical}"
|
147
|
+
value = escape_chars(value) unless key == "rrule"
|
148
|
+
add_sliced_text(s, prelude + value)
|
149
|
+
else
|
150
|
+
prelude = "#{key.gsub(/_/, '-').upcase}"
|
151
|
+
val.each do |v|
|
152
152
|
params = print_parameters(v)
|
153
153
|
value = ":#{v.to_ical}"
|
154
|
-
|
154
|
+
value = escape_chars(value) unless key == "rrule"
|
155
|
+
add_sliced_text(s, prelude + params + value)
|
155
156
|
end
|
156
157
|
end
|
157
158
|
end
|
@@ -82,7 +82,7 @@ EOS
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_dtstart_tzid_should_be_correct
|
85
|
-
puts "#{@event.dtstart.icalendar_tzid} #{@event.dtstart}"
|
85
|
+
# puts "#{@event.dtstart.icalendar_tzid} #{@event.dtstart}"
|
86
86
|
assert_equal("America/Chicago",@event.dtstart.icalendar_tzid)
|
87
87
|
end
|
88
88
|
|
@@ -120,7 +120,7 @@ EOS
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def test_dtstart_tzid_should_be_correct
|
123
|
-
puts "#{@event.dtstart.icalendar_tzid} #{@event.dtstart}"
|
123
|
+
# puts "#{@event.dtstart.icalendar_tzid} #{@event.dtstart}"
|
124
124
|
assert_equal("UTC",@event.dtstart.icalendar_tzid)
|
125
125
|
end
|
126
126
|
|
@@ -158,7 +158,7 @@ EOS
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def test_dtstart_tzid_should_be_nil
|
161
|
-
puts "#{@event.dtstart.icalendar_tzid.inspect} #{@event.dtstart}"
|
161
|
+
# puts "#{@event.dtstart.icalendar_tzid.inspect} #{@event.dtstart}"
|
162
162
|
assert_nil(@event.dtstart.icalendar_tzid)
|
163
163
|
end
|
164
164
|
|
@@ -9,7 +9,7 @@ class TestTimezone < Test::Unit::TestCase
|
|
9
9
|
def setup
|
10
10
|
@cal = Icalendar::Calendar.new
|
11
11
|
# Define a test timezone
|
12
|
-
@testTimezone = %Q(BEGIN:VTIMEZONE\r\nTZID:America/Chicago\r\nBEGIN:STANDARD\r\nDTSTART:19701101T020000\r\nRRULE:FREQ=YEARLY
|
12
|
+
@testTimezone = %Q(BEGIN:VTIMEZONE\r\nTZID:America/Chicago\r\nBEGIN:STANDARD\r\nDTSTART:19701101T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:CST\r\nTZOFFSETFROM:-0500\r\nTZOFFSETTO:-0600\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:19700308TO20000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:CDT\r\nTZOFFSETFROM:-0600\r\nTZOFFSETTO:-0500\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\n)
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_new
|
@@ -65,6 +65,10 @@ class TestTimezone < Test::Unit::TestCase
|
|
65
65
|
add_recurrence_rule "FREQ=YEARLY;BYMONTH=11;BYDAY=1SU"
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
|
+
# This isn't completely correct, but close enough to get around the ordering issue
|
70
|
+
array1 = @testTimezone.split("\r\n").sort
|
71
|
+
array2 = @cal.timezones.first.to_ical.split("\r\n").sort
|
72
|
+
assert_equal(array1, array2)
|
69
73
|
end
|
70
74
|
end
|
data/test/test_parameter.rb
CHANGED
@@ -23,10 +23,10 @@ class TestComponent < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
@cal.add_event @event
|
25
25
|
cal_str = @cal.to_ical
|
26
|
-
puts cal_str
|
26
|
+
# puts cal_str
|
27
27
|
|
28
28
|
cals = Icalendar::Parser.new(cal_str).parse
|
29
|
-
pp cals
|
29
|
+
# pp cals
|
30
30
|
event = cals.first.events.first
|
31
31
|
assert_equal params, event.summary.ical_params
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icalendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Dague
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-23 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,8 +70,6 @@ description: |-
|
|
70
70
|
based clipboard or drag/drop interactions, point-to-point asynchronous
|
71
71
|
communication, wired-network transport, or some form of unwired
|
72
72
|
transport such as infrared might also be used.
|
73
|
-
|
74
|
-
Now for some examples:
|
75
73
|
email:
|
76
74
|
- sean@dague.net
|
77
75
|
executables: []
|
@@ -83,6 +81,7 @@ extra_rdoc_files:
|
|
83
81
|
- Manifest.txt
|
84
82
|
- PostInstall.txt
|
85
83
|
- website/index.txt
|
84
|
+
- README.rdoc
|
86
85
|
files:
|
87
86
|
- COPYING
|
88
87
|
- GPL
|