icalendar 1.1.5 → 1.1.6

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.
@@ -1,3 +1,7 @@
1
+ === 1.1.6 2011-03-10
2
+ * Fix todo handling (thanks to Frank Schwarz)
3
+ * clean up a number of warnings during test runs
4
+
1
5
  === 1.1.5 2010-06-21
2
6
  * Fix for windows line endings (thanks to Rowan Collins)
3
7
 
data/Rakefile CHANGED
@@ -19,6 +19,11 @@ $hoe = Hoe.spec 'icalendar' do
19
19
  self.readme_file = "README.rdoc"
20
20
  end
21
21
 
22
+ if ENV['UNDER_HUDSON']
23
+ require 'ci/reporter/rake/test_unit'
24
+ task :test => ["ci:setup:testunit"]
25
+ end
26
+
22
27
  require 'newgem/tasks'
23
28
  Dir['tasks/**/*.rake'].each { |t| load t }
24
29
 
@@ -10,7 +10,7 @@ require 'logger'
10
10
 
11
11
  module Icalendar #:nodoc:
12
12
 
13
- VERSION = '1.1.5'
13
+ VERSION = '1.1.6'
14
14
 
15
15
  # A simple error class to differentiate iCalendar library exceptions
16
16
  # from ruby language exceptions or others.
@@ -29,11 +29,11 @@ module Icalendar
29
29
  e = Event.new
30
30
  # Note: I'm not sure this is the best way to pass this down, but it works
31
31
  e.tzid = self.timezones[0].tzid if self.timezones.length > 0
32
-
32
+
33
33
  self.add_component e
34
34
 
35
35
  if block
36
- e.instance_eval &block
36
+ e.instance_eval(&block)
37
37
  if e.tzid
38
38
  e.dtstart.ical_params = { "TZID" => e.tzid }
39
39
  e.dtend.ical_params = { "TZID" => e.tzid }
@@ -42,7 +42,7 @@ module Icalendar
42
42
 
43
43
  e
44
44
  end
45
-
45
+
46
46
  def find_event(uid)
47
47
  self.events.find {|e| e.uid == uid}
48
48
  end
@@ -51,7 +51,7 @@ module Icalendar
51
51
  e = Todo.new
52
52
  self.add_component e
53
53
 
54
- e.instance_eval &block if block
54
+ e.instance_eval(&block) if block
55
55
 
56
56
  e
57
57
  end
@@ -59,12 +59,12 @@ module Icalendar
59
59
  def find_todo(uid)
60
60
  self.todos.find {|t| t.uid == uid}
61
61
  end
62
-
62
+
63
63
  def journal(&block)
64
64
  e = Journal.new
65
65
  self.add_component e
66
66
 
67
- e.instance_eval &block if block
67
+ e.instance_eval(&block) if block
68
68
 
69
69
  e
70
70
  end
@@ -77,7 +77,7 @@ module Icalendar
77
77
  e = Freebusy.new
78
78
  self.add_component e
79
79
 
80
- e.instance_eval &block if block
80
+ e.instance_eval(&block) if block
81
81
 
82
82
  e
83
83
  end
@@ -90,11 +90,11 @@ module Icalendar
90
90
  e = Timezone.new
91
91
  self.add_component e
92
92
 
93
- e.instance_eval &block if block
93
+ e.instance_eval(&block) if block
94
94
 
95
95
  e
96
96
  end
97
-
97
+
98
98
  # The "PUBLISH" method in a "VEVENT" calendar component is an
99
99
  # unsolicited posting of an iCalendar object. Any CU may add published
100
100
  # components to their calendar. The "Organizer" MUST be present in a
@@ -144,7 +144,7 @@ module Icalendar
144
144
 
145
145
  # Property value
146
146
  value = ":#{val.to_ical}"
147
- value = escape_chars(value) unless key == "rrule"
147
+ value = escape_chars(value) unless ["rrule", "categories"].include?(key)
148
148
  add_sliced_text(s, prelude + value)
149
149
  else
150
150
  prelude = "#{key.gsub(/_/, '-').upcase}"
@@ -19,7 +19,7 @@ module Icalendar
19
19
  ## Single instance properties
20
20
 
21
21
  # Access classification (PUBLIC, PRIVATE, CONFIDENTIAL...)
22
- ical_property :ip_class, :klass
22
+ ical_property :ip_class, :klass
23
23
 
24
24
  # Date & time of creation
25
25
  ical_property :created
@@ -29,13 +29,13 @@ module Icalendar
29
29
 
30
30
  # Specifies the timezone for the event
31
31
  attr_accessor :tzid
32
-
32
+
33
33
  # Specifies date-time when calendar component begins
34
34
  ical_property :dtstart, :start
35
35
 
36
36
  # Latitude & longitude for specified activity
37
37
  ical_property :geo, :geo_location
38
-
38
+
39
39
  # Date & time this item was last modified
40
40
  ical_property :last_modified
41
41
 
@@ -67,7 +67,7 @@ module Icalendar
67
67
  ical_property :recurrence_id, :recurid
68
68
 
69
69
  ## Single but mutually exclusive properties (Not testing though)
70
-
70
+
71
71
  # Specifies a date and time that this item ends
72
72
  ical_property :dtend, :end
73
73
 
@@ -81,7 +81,7 @@ module Icalendar
81
81
 
82
82
  # Defines an attendee for this calendar item
83
83
  ical_multiline_property :attendee, :attendee, :attendees
84
-
84
+
85
85
  # Defines the categories for a calendar component (school, work...)
86
86
  ical_multi_property :categories, :category, :categories
87
87
 
@@ -102,7 +102,7 @@ module Icalendar
102
102
  # recurring calendar item.
103
103
  ical_multi_property :rdate, :recurrence_date, :recurrence_dates
104
104
  ical_multi_property :rrule, :recurrence_rule, :recurrence_rules
105
-
105
+
106
106
  def initialize()
107
107
  super("VEVENT")
108
108
 
@@ -116,11 +116,11 @@ module Icalendar
116
116
  a = Alarm.new
117
117
  self.add a
118
118
 
119
- a.instance_eval &block if block
119
+ a.instance_eval(&block) if block
120
120
 
121
121
  a
122
122
  end
123
-
123
+
124
124
  def occurrences_starting(time)
125
125
  recurrence_rules.first.occurrences_of_event_starting(self, time)
126
126
  end
@@ -28,7 +28,7 @@ module Icalendar
28
28
  ical_property :tzoffsetfrom, :timezone_offset_from
29
29
  ical_property :tzid, :timezone_id
30
30
  ical_property :tzname, :timezone_name
31
-
31
+
32
32
  ical_property :created
33
33
  ical_property :last_modified
34
34
  ical_property :timestamp
@@ -57,18 +57,18 @@ module Icalendar
57
57
  s
58
58
  end
59
59
  end
60
-
60
+
61
61
 
62
62
  def initialize(name = "VTIMEZONE")
63
63
  super(name)
64
64
  end
65
-
65
+
66
66
  # Allow block syntax for declaration of standard and daylight components of timezone
67
67
  def standard(&block)
68
68
  e = Standard.new
69
69
  self.add_component e
70
70
 
71
- e.instance_eval &block if block
71
+ e.instance_eval(&block) if block
72
72
 
73
73
  e
74
74
  end
@@ -77,14 +77,14 @@ module Icalendar
77
77
  e = Daylight.new
78
78
  self.add_component e
79
79
 
80
- e.instance_eval &block if block
80
+ e.instance_eval(&block) if block
81
81
 
82
82
  e
83
83
  end
84
84
  end
85
85
 
86
86
  # A Standard component is a sub-component of the Timezone component which
87
- # is used to describe the standard time offset.
87
+ # is used to describe the standard time offset.
88
88
  class Standard < Timezone
89
89
 
90
90
  def initialize()
@@ -25,10 +25,10 @@ module Icalendar
25
25
  ical_property :last_modified
26
26
  ical_property :location
27
27
  ical_property :organizer
28
- ical_property :percent
28
+ ical_property :percent_complete, :percent
29
29
  ical_property :priority
30
30
  ical_property :recurid, :recurrence_id
31
- ical_property :seq, :sequence
31
+ ical_property :sequence, :seq
32
32
  ical_property :status
33
33
  ical_property :summary
34
34
  ical_property :uid, :user_id
@@ -1,6 +1,6 @@
1
1
  # A set of methods to help create meta-programming gizmos.
2
2
  class Object
3
- # The metaclass is the singleton behind every object.
3
+ # The metaclass is the singleton behind every object.
4
4
  def metaclass
5
5
  class << self
6
6
  self
@@ -8,8 +8,8 @@ class Object
8
8
  end
9
9
 
10
10
  # Evaluates the block in the context of the metaclass
11
- def meta_eval &blk
12
- metaclass.instance_eval &blk
11
+ def meta_eval(&blk)
12
+ metaclass.instance_eval(&blk)
13
13
  end
14
14
 
15
15
  # Acts like an include except it adds the module's methods
@@ -1,13 +1,31 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ require 'date'
2
4
 
3
5
  class TestTodo < Test::Unit::TestCase
6
+ include Icalendar
7
+
8
+ def test_todo_fields
9
+
10
+ cal = Calendar.new
11
+
12
+ t = cal.todo do
13
+ summary "Plan next vacations"
14
+ description "Let's have a break"
15
+ percent 50
16
+ seq 1
17
+ add_category "TRAVEL"
18
+ add_category "SPORTS"
19
+ end
4
20
 
5
- def setup
6
- @cal = Icalendar::Calendar.new
7
- @todo = Icalendar::Todo.new
8
- end
21
+ calString = cal.to_ical
9
22
 
10
- def test_new
11
- assert(@todo)
12
- end
23
+ assert_match(/PERCENT-COMPLETE:50/, calString)
24
+ assert_match(/DESCRIPTION:Let's have a break/, calString)
25
+ assert_match(/CATEGORIES:TRAVEL,SPORTS/, calString)
26
+ assert_match(/SEQUENCE:1/, calString)
27
+
28
+ end
13
29
  end
30
+
31
+
@@ -5,7 +5,6 @@ require 'test/unit'
5
5
  require 'icalendar'
6
6
 
7
7
  class TestComponent < Test::Unit::TestCase
8
-
9
8
  # Create a calendar with an event for each test.
10
9
  def setup
11
10
  @cal = Icalendar::Calendar.new
@@ -14,7 +14,7 @@ CALSCALE:GREGORIAN
14
14
  PRODID:iCalendar-Ruby
15
15
  VERSION:2.0
16
16
  BEGIN:VEVENT
17
- CATEGORIES:foo\\,bar\\,baz
17
+ CATEGORIES:foo,bar,baz
18
18
  DESCRIPTION:desc
19
19
  DTSTAMP:20060720T174052
20
20
  DTSTART:20060720
@@ -33,7 +33,7 @@ EOS
33
33
  end
34
34
 
35
35
  def test_to_ical_conversions
36
- @cal.event do
36
+ @cal.event do
37
37
  # String
38
38
  description "desc"
39
39
 
@@ -42,17 +42,17 @@ EOS
42
42
 
43
43
  # Float by way of Geo class
44
44
  geo(Geo.new(46.01, 8.57))
45
-
45
+
46
46
  # Array
47
47
  categories ["foo", "bar"]
48
48
  add_category "baz"
49
49
 
50
- # Last Modified
50
+ # Last Modified
51
51
  last_modified DateTime.parse("1996-08-17T13:30:00")
52
52
 
53
53
  # URI
54
54
  organizer(URI::MailTo.build(['joe@example.com', 'subject=Ruby']))
55
-
55
+
56
56
  # Date
57
57
  start Date.parse("2006-07-20")
58
58
 
@@ -64,13 +64,13 @@ EOS
64
64
 
65
65
  uid "foobar"
66
66
  end
67
-
67
+
68
68
  assert_equal(RESULT.gsub("\n", "\r\n"), @cal.to_ical)
69
69
  end
70
70
 
71
71
  def test_to_ical_folding
72
72
  @cal.x_wr_calname = 'Test Long Description'
73
-
73
+
74
74
  @cal.event do
75
75
  url 'http://test.com/events/644'
76
76
  dtend DateTime.parse('20061215T180000')
@@ -80,18 +80,18 @@ EOS
80
80
  uid 'foobar'
81
81
  summary 'DigiWorld 2006'
82
82
 
83
- description "FULL DETAILS:\nhttp://test.com/events/570\n\n" +
84
- "Cary Brothers walks the same musical ground as Pete Yorn, Nick Drake, " +
85
- "Jeff Buckley and others; crafting emotional melodies, with strong vocals " +
86
- "and thoughtful lyrics. Brett Dennen has &quot;that thing.&quot; " +
87
- "Inspired fans describe it: &quot;lush shimmering vocals, an intricately " +
88
- "groovin&#39; guitar style, a lyrical beauty rare in a young songwriter," +
89
- "&quot; and &quot;this soulful blend of everything that feels good.&quot; " +
83
+ description "FULL DETAILS:\nhttp://test.com/events/570\n\n" +
84
+ "Cary Brothers walks the same musical ground as Pete Yorn, Nick Drake, " +
85
+ "Jeff Buckley and others; crafting emotional melodies, with strong vocals " +
86
+ "and thoughtful lyrics. Brett Dennen has &quot;that thing.&quot; " +
87
+ "Inspired fans describe it: &quot;lush shimmering vocals, an intricately " +
88
+ "groovin&#39; guitar style, a lyrical beauty rare in a young songwriter," +
89
+ "&quot; and &quot;this soulful blend of everything that feels good.&quot; " +
90
90
  "Rising up around him is music; transcending genres, genders and generations."
91
91
  end
92
-
92
+
93
93
  folded = File.read(File.join(File.dirname(__FILE__), 'fixtures/folding.ics')).gsub("\n", "\r\n")
94
94
  assert_equal(folded, @cal.to_ical)
95
95
  end
96
-
96
+
97
97
  end
@@ -1,3 +1,7 @@
1
1
  require 'stringio'
2
2
  require 'test/unit'
3
+ if ENV['UNDER_HUDSON']
4
+ require 'rubygems'
5
+ require 'ci/reporter/rake/test_unit_loader'
6
+ end
3
7
  require File.dirname(__FILE__) + '/../lib/icalendar'
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 6
10
+ version: 1.1.6
5
11
  platform: ruby
6
12
  authors:
7
13
  - Sean Dague
@@ -9,39 +15,57 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-06-21 00:00:00 -04:00
18
+ date: 2011-03-10 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rubyforge
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 9
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 3
23
34
  version: 2.0.3
24
- version:
35
+ type: :development
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: gemcutter
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 0
48
+ - 3
49
+ - 0
33
50
  version: 0.3.0
34
- version:
51
+ type: :development
52
+ version_requirements: *id002
35
53
  - !ruby/object:Gem::Dependency
36
54
  name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
40
58
  requirements:
41
59
  - - ">="
42
60
  - !ruby/object:Gem::Version
61
+ hash: 27
62
+ segments:
63
+ - 2
64
+ - 5
65
+ - 0
43
66
  version: 2.5.0
44
- version:
67
+ type: :development
68
+ version_requirements: *id003
45
69
  description: |-
46
70
  This is a Ruby library for dealing with iCalendar files. Rather than
47
71
  explaining myself, here is the introduction from RFC-2445, which
@@ -155,21 +179,27 @@ rdoc_options:
155
179
  require_paths:
156
180
  - lib
157
181
  required_ruby_version: !ruby/object:Gem::Requirement
182
+ none: false
158
183
  requirements:
159
184
  - - ">="
160
185
  - !ruby/object:Gem::Version
186
+ hash: 3
187
+ segments:
188
+ - 0
161
189
  version: "0"
162
- version:
163
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
+ none: false
164
192
  requirements:
165
193
  - - ">="
166
194
  - !ruby/object:Gem::Version
195
+ hash: 3
196
+ segments:
197
+ - 0
167
198
  version: "0"
168
- version:
169
199
  requirements: []
170
200
 
171
201
  rubyforge_project: icalendar
172
- rubygems_version: 1.3.5
202
+ rubygems_version: 1.3.7
173
203
  signing_key:
174
204
  specification_version: 3
175
205
  summary: This is a Ruby library for dealing with iCalendar files