rubyredrick-ri_cal 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,5 @@
1
+ === 0.0.4
2
+ * Fixed a bug in imported timezones reported by paulsm on github
1
3
  === 0.0.3
2
4
  * Added tzid method to Ruby Time and DateTime instances, and to ActiveRecord::TimeWithZone if it is defined this method is used to determine the desired
3
5
  timezone when an instance of one of these classes is given as the value of a datetime property. If the tzid is nil then the default tzid is used,
@@ -24,7 +24,7 @@ module RiCal
24
24
  end
25
25
 
26
26
  def rational_utc_offset(local) #:nodoc:
27
- Rational(period_for_local(local, true).utc_offset, 3600) / 24
27
+ Rational(period_for_local(local, true).utc_total_offset, 3600) / 24
28
28
  end
29
29
 
30
30
  # Returns the TimezonePeriod for the given UTC time. utc can either be a DateTime,
data/lib/ri_cal.rb CHANGED
@@ -11,7 +11,7 @@ module RiCal
11
11
  autoload :OccurrenceEnumerator, "#{my_dir}/ri_cal/occurrence_enumerator.rb"
12
12
 
13
13
  # :stopdoc:
14
- VERSION = '0.0.3'
14
+ VERSION = '0.0.4'
15
15
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
16
16
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
17
17
 
data/ri_cal.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ri_cal}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["author=Rick DeNatale"]
9
- s.date = %q{2009-05-14}
9
+ s.date = %q{2009-05-17}
10
10
  s.default_executable = %q{ri_cal}
11
11
  s.description = %q{This is an UNOFFICIAL version. The public official version will be released on RubyForge. Github will be used
12
12
  for interim versions. USE THIS VERSION AT YOUR OWN RISK.
@@ -149,6 +149,70 @@ TZEND
149
149
  end
150
150
  end
151
151
  end
152
-
153
152
  end
154
- end
153
+
154
+ context "Bug report from paulsm" do
155
+ before(:each) do
156
+ cals = RiCal.parse_string <<ENDCAL
157
+ BEGIN:VCALENDAR
158
+ X-WR-TIMEZONE:America/New_York
159
+ PRODID:-//Apple Inc.//iCal 3.0//EN
160
+ CALSCALE:GREGORIAN
161
+ X-WR-CALNAME:test
162
+ VERSION:2.0
163
+ X-WR-RELCALID:1884C7F8-BC8E-457F-94AC-297871967D5E
164
+ X-APPLE-CALENDAR-COLOR:#2CA10B
165
+ BEGIN:VTIMEZONE
166
+ TZID:US/Eastern
167
+ BEGIN:DAYLIGHT
168
+ TZOFFSETFROM:-0500
169
+ TZOFFSETTO:-0400
170
+ DTSTART:20070311T020000
171
+ RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
172
+ TZNAME:EDT
173
+ END:DAYLIGHT
174
+ BEGIN:STANDARD
175
+ TZOFFSETFROM:-0400
176
+ TZOFFSETTO:-0500
177
+ DTSTART:20071104T020000
178
+ RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
179
+ TZNAME:EST
180
+ END:STANDARD
181
+ END:VTIMEZONE
182
+ BEGIN:VEVENT
183
+ SEQUENCE:5
184
+ TRANSP:OPAQUE
185
+ UID:00481E53-9258-4EA7-9F8D-947D3041A3F2
186
+ DTSTART;TZID=US/Eastern:20090224T090000
187
+ DTSTAMP:20090225T000908Z
188
+ SUMMARY:Test Event
189
+ CREATED:20090225T000839Z
190
+ DTEND;TZID=US/Eastern:20090224T100000
191
+ RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20090228T045959Z
192
+ END:VEVENT
193
+ END:VCALENDAR
194
+ ENDCAL
195
+ @event = cals.first.events.first
196
+ end
197
+
198
+ context "the events dtstart" do
199
+ it "should be the right DateTime" do
200
+ @event.dtstart.should == DateTime.civil(2009, 2, 24, 9, 0, 0, Rational(-4, 24))
201
+ end
202
+
203
+ it "should have the right tzid" do
204
+ @event.dtstart.tzid.should == "US/Eastern"
205
+ end
206
+ end
207
+
208
+ context "the events dtend" do
209
+ it "should be the right DateTime" do
210
+ @event.dtend.should == DateTime.civil(2009, 2, 24, 10, 0, 0, Rational(-4, 24))
211
+ end
212
+
213
+ it "should have the right tzid" do
214
+ @event.dtend.tzid.should == "US/Eastern"
215
+ end
216
+ end
217
+ end
218
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyredrick-ri_cal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - author=Rick DeNatale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-14 00:00:00 -07:00
12
+ date: 2009-05-17 00:00:00 -07:00
13
13
  default_executable: ri_cal
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency