ice_cube 0.7.0 → 0.8.0

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.
@@ -0,0 +1,28 @@
1
+ module Deprecated
2
+
3
+ # Define a deprecated alias for a method
4
+ # @param [Symbol] name - name of method to define
5
+ # @param [Symbol] replacement - name of method to replace (alias)
6
+ def deprecated_alias(name, replacement)
7
+ # Create a wrapped version
8
+ define_method(name) do |*args, &block|
9
+ warn "IceCube: ##{name} deprecated (please use ##{replacement})"
10
+ send replacement, *args, &block
11
+ end
12
+ end
13
+
14
+ # Deprecate a defined method
15
+ # @param [Symbol] name - name of deprecated method
16
+ # @param [Symbol] replacement - name of the desired replacement
17
+ def deprecated(name, replacement)
18
+ # Replace old method
19
+ old_name = :"#{name}_without_deprecation"
20
+ alias_method old_name, name
21
+ # And replace it with a wrapped version
22
+ define_method(name) do |*args, &block|
23
+ warn "IceCube: ##{name} deprecated (please use ##{replacement})"
24
+ send old_name, *args, &block
25
+ end
26
+ end
27
+
28
+ end
data/lib/ice_cube/rule.rb CHANGED
@@ -12,8 +12,10 @@ module IceCube
12
12
  end
13
13
 
14
14
  def ==(rule)
15
- hash = to_hash
16
- hash && hash == rule.to_hash
15
+ if rule.is_a? Rule
16
+ hash = to_hash
17
+ hash && hash == rule.to_hash
18
+ end
17
19
  end
18
20
 
19
21
  def hash
@@ -28,12 +30,12 @@ module IceCube
28
30
 
29
31
  # Yaml implementation
30
32
  def to_yaml(*args)
31
- defined?(Psych) ? Psych::dump(to_hash) : YAML::dump(to_hash, *args)
33
+ IceCube::use_psych? ? Psych::dump(to_hash) : YAML::dump(to_hash, *args)
32
34
  end
33
35
 
34
36
  # From yaml
35
37
  def self.from_yaml(yaml)
36
- from_hash defined?(Psych) ? Psych::load(yaml) : YAML::load(yaml)
38
+ from_hash IceCube::use_psych? ? Psych::load(yaml) : YAML::load(yaml)
37
39
  end
38
40
 
39
41
  # Expected to be overridden by subclasses
@@ -66,6 +68,11 @@ module IceCube
66
68
  next_time(time, schedule, time) == time
67
69
  end
68
70
 
71
+ # Whether this rule requires a full run
72
+ def full_required?
73
+ !@count.nil?
74
+ end
75
+
69
76
  # Convenience methods for creating Rules
70
77
  class << self
71
78
 
@@ -90,8 +97,8 @@ module IceCube
90
97
  end
91
98
 
92
99
  # Weekly Rule
93
- def weekly(interval = 1)
94
- WeeklyRule.new(interval)
100
+ def weekly(interval = 1, week_start = :sunday)
101
+ WeeklyRule.new(interval, week_start)
95
102
  end
96
103
 
97
104
  # Monthly Rule
@@ -4,8 +4,8 @@ module IceCube
4
4
 
5
5
  include Validations::WeeklyInterval
6
6
 
7
- def initialize(interval = 1)
8
- interval(interval)
7
+ def initialize(interval = 1, week_start = :sunday)
8
+ interval(interval, week_start)
9
9
  schedule_lock(:wday, :hour, :min, :sec)
10
10
  end
11
11
 
@@ -4,17 +4,20 @@ module IceCube
4
4
 
5
5
  class Schedule
6
6
 
7
+ extend ::Deprecated
8
+
7
9
  # Get the start time
8
10
  attr_accessor :start_time
9
- alias :start_date :start_time
10
- alias :start_date= :start_time=
11
+ deprecated_alias :start_date, :start_time
12
+ deprecated_alias :start_date=, :start_time=
11
13
 
12
14
  # Get the duration
13
15
  attr_accessor :duration
14
16
 
15
17
  # Get the end time
16
18
  attr_accessor :end_time
17
- alias :end_date :end_time
19
+ deprecated_alias :end_date, :end_time
20
+ deprecated_alias :end_date=, :end_time=
18
21
 
19
22
  # Create a new schedule
20
23
  def initialize(start_time = nil, options = {})
@@ -32,8 +35,9 @@ module IceCube
32
35
  add_recurrence_rule rule
33
36
  time
34
37
  end
35
- alias :rdate :add_recurrence_time
36
- alias :add_recurrence_date :add_recurrence_time
38
+ alias :rtime :add_recurrence_time
39
+ deprecated_alias :rdate, :rtime
40
+ deprecated_alias :add_recurrence_date, :add_recurrence_time
37
41
 
38
42
  # Add an exception time to the schedule
39
43
  def add_exception_time(time)
@@ -42,8 +46,9 @@ module IceCube
42
46
  add_exception_rule rule
43
47
  time
44
48
  end
45
- alias :exdate :add_exception_time
46
- alias :add_exception_date :add_exception_time
49
+ alias :extime :add_exception_time
50
+ deprecated_alias :exdate, :extime
51
+ deprecated_alias :add_exception_date, :add_exception_time
47
52
 
48
53
  # Add a recurrence rule to the schedule
49
54
  def add_recurrence_rule(rule)
@@ -85,8 +90,9 @@ module IceCube
85
90
  def recurrence_times
86
91
  @all_recurrence_rules.select { |r| r.is_a?(SingleOccurrenceRule) }.map(&:time)
87
92
  end
88
- alias :rdates :recurrence_times
89
- alias :recurrence_dates :recurrence_times
93
+ alias :rtimes :recurrence_times
94
+ deprecated_alias :rdates, :rtimes
95
+ deprecated_alias :recurrence_dates, :recurrence_times
90
96
 
91
97
  # Remove a recurrence time
92
98
  def remove_recurrence_time(time)
@@ -96,15 +102,17 @@ module IceCube
96
102
  end
97
103
  time if found
98
104
  end
99
- alias :remove_recurrence_date :remove_recurrence_time
100
- alias :remove_rdate :remove_recurrence_time
105
+ alias :remove_rtime :remove_recurrence_time
106
+ deprecated_alias :remove_recurrence_date, :remove_recurrence_time
107
+ deprecated_alias :remove_rdate, :remove_rtime
101
108
 
102
109
  # Get the exception times that are on the schedule
103
110
  def exception_times
104
111
  @all_exception_rules.select { |r| r.is_a?(SingleOccurrenceRule) }.map(&:time)
105
112
  end
106
- alias :exdates :exception_times
107
- alias :exception_dates :exception_times
113
+ alias :extimes :exception_times
114
+ deprecated_alias :exdates, :extimes
115
+ deprecated_alias :exception_dates, :exception_times
108
116
 
109
117
  # Remove an exception time
110
118
  def remove_exception_time(time)
@@ -114,8 +122,9 @@ module IceCube
114
122
  end
115
123
  time if found
116
124
  end
117
- alias :remove_exception_date :remove_exception_time
118
- alias :remove_exdate :remove_exception_time
125
+ alias :remove_extime :remove_exception_time
126
+ deprecated_alias :remove_exception_date, :remove_exception_time
127
+ deprecated_alias :remove_exdate, :remove_extime
119
128
 
120
129
  # Get all of the occurrences from the start_time up until a
121
130
  # given Time
@@ -125,9 +134,7 @@ module IceCube
125
134
 
126
135
  # All of the occurrences
127
136
  def all_occurrences
128
- unless end_time || recurrence_rules.all?(&:terminating?)
129
- raise ArgumentError.new('Rule must specify either an until date or a count to use #all_occurrences')
130
- end
137
+ raise ArgumentError.new('Rule must specify either an until date or a count to use #all_occurrences') unless terminating?
131
138
  find_occurrences(start_time)
132
139
  end
133
140
 
@@ -180,6 +187,43 @@ module IceCube
180
187
  end
181
188
  end
182
189
 
190
+ # Determine if this schedule conflicts with another schedule
191
+ # @param [IceCube::Schedule] other_schedule - The schedule to compare to
192
+ # @param [Time] closing_time - the last time to consider
193
+ # @return [Boolean] whether or not the schedules conflict at all
194
+ def conflicts_with?(other_schedule, closing_time = nil)
195
+ unless terminating? || other_schedule.terminating? || closing_time
196
+ raise ArgumentError.new 'At least one schedule must be terminating to use #conflicts_with?'
197
+ end
198
+ # Pick the terminating schedule, and other schedule
199
+ # No need to reverse if terminating? or there is a closing time
200
+ terminating_schedule = self
201
+ unless terminating? || closing_time
202
+ terminating_schedule, other_schedule = other_schedule, terminating_schedule
203
+ end
204
+ # Go through each occurrence of the terminating schedule and determine
205
+ # if the other occurs at that time
206
+ last_time = nil
207
+ terminating_schedule.each_occurrence do |time|
208
+ if closing_time && time > closing_time
209
+ last_time = closing_time
210
+ break
211
+ end
212
+ last_time = time
213
+ return true if other_schedule.occurring_at?(time)
214
+ end
215
+ # Due to durations, we need to walk up to the end time, and verify in the
216
+ # other direction
217
+ if last_time
218
+ other_schedule.each_occurrence do |time|
219
+ break if time > last_time
220
+ return true if terminating_schedule.occurring_at?(time)
221
+ end
222
+ end
223
+ # No conflict, return false
224
+ false
225
+ end
226
+
183
227
  # Determine if the schedule occurs at a specific time
184
228
  def occurs_at?(time)
185
229
  occurs_between?(time, time)
@@ -194,12 +238,12 @@ module IceCube
194
238
  # String serialization
195
239
  def to_s
196
240
  pieces = []
197
- ed = exdates; rd = rdates - ed
241
+ ed = extimes; rd = rtimes - ed
198
242
  pieces.concat rd.sort.map { |t| t.strftime(TO_S_TIME_FORMAT) }
199
243
  pieces.concat rrules.map { |t| t.to_s }
200
244
  pieces.concat exrules.map { |t| "not #{t.to_s}" }
201
245
  pieces.concat ed.sort.map { |t| "not on #{t.strftime(TO_S_TIME_FORMAT)}" }
202
- pieces << "until #{end_time.strftime(TIME_FORMAT)}" if end_time
246
+ pieces << "until #{end_time.strftime(TO_S_TIME_FORMAT)}" if end_time
203
247
  pieces.join(' / ')
204
248
  end
205
249
 
@@ -218,12 +262,12 @@ module IceCube
218
262
 
219
263
  # Convert the schedule to yaml
220
264
  def to_yaml(*args)
221
- defined?(Psych) ? Psych::dump(to_hash) : YAML::dump(to_hash, *args)
265
+ IceCube::use_psych? ? Psych::dump(to_hash, *args) : YAML::dump(to_hash, *args)
222
266
  end
223
267
 
224
268
  # Load the schedule from yaml
225
269
  def self.from_yaml(yaml, options = {})
226
- from_hash defined?(Psych) ? Psych::load(yaml) : YAML::load(yaml), options
270
+ from_hash IceCube::use_psych? ? Psych::load(yaml) : YAML::load(yaml), options
227
271
  end
228
272
 
229
273
  # Convert the schedule to a hash
@@ -234,10 +278,10 @@ module IceCube
234
278
  data[:duration] = duration if duration
235
279
  data[:rrules] = recurrence_rules.map(&:to_hash)
236
280
  data[:exrules] = exception_rules.map(&:to_hash)
237
- data[:rdates] = recurrence_times.map do |rt|
281
+ data[:rtimes] = recurrence_times.map do |rt|
238
282
  TimeUtil.serialize_time(rt)
239
283
  end
240
- data[:exdates] = exception_times.map do |et|
284
+ data[:extimes] = exception_times.map do |et|
241
285
  TimeUtil.serialize_time(et)
242
286
  end
243
287
  data
@@ -252,6 +296,13 @@ module IceCube
252
296
  schedule.end_time = TimeUtil.deserialize_time(data[:end_time]) if data[:end_time]
253
297
  data[:rrules] && data[:rrules].each { |h| schedule.rrule(IceCube::Rule.from_hash(h)) }
254
298
  data[:exrules] && data[:exrules].each { |h| schedule.exrule(IceCube::Rule.from_hash(h)) }
299
+ data[:rtimes] && data[:rtimes].each do |t|
300
+ schedule.add_recurrence_time TimeUtil.deserialize_time(t)
301
+ end
302
+ data[:extimes] && data[:extimes].each do |t|
303
+ schedule.add_exception_time TimeUtil.deserialize_time(t)
304
+ end
305
+ # Also serialize old format for backward compat
255
306
  data[:rdates] && data[:rdates].each do |t|
256
307
  schedule.add_recurrence_time TimeUtil.deserialize_time(t)
257
308
  end
@@ -261,6 +312,20 @@ module IceCube
261
312
  schedule
262
313
  end
263
314
 
315
+ # Determine if the schedule will end
316
+ # @return [Boolean] true if ending, false if repeating forever
317
+ def terminating?
318
+ end_time || recurrence_rules.all?(&:terminating?)
319
+ end
320
+
321
+ def self.dump(schedule)
322
+ schedule.to_yaml
323
+ end
324
+
325
+ def self.load(yaml)
326
+ from_yaml(yaml) unless yaml.nil? || yaml.empty?
327
+ end
328
+
264
329
  private
265
330
 
266
331
  # Reset all rules for another run
@@ -276,17 +341,21 @@ module IceCube
276
341
  answers = []
277
342
  # ensure the bounds are proper
278
343
  if end_time
279
- closing_time = end_time unless closing_time && closing_time < @end_time
344
+ closing_time = end_time unless closing_time && closing_time < end_time
280
345
  end
281
346
  opening_time = start_time if opening_time < start_time
282
- # And off we go
283
- time = opening_time
347
+ # walk up to the opening time - and off we go
348
+ # If we have rules with counts, we need to walk from the beginning of time,
349
+ # otherwise opening_time
350
+ time = full_required? ? start_time : opening_time
284
351
  loop do
285
352
  res = next_time(time, closing_time)
286
353
  break unless res
287
354
  break if closing_time && res > closing_time
288
- block_given? ? block.call(res) : (answers << res)
289
- break if limit && answers.length == limit
355
+ if res >= opening_time
356
+ block_given? ? block.call(res) : (answers << res)
357
+ break if limit && answers.length == limit
358
+ end
290
359
  time = res + 1
291
360
  end
292
361
  # and return our answers
@@ -324,6 +393,12 @@ module IceCube
324
393
  min_time
325
394
  end
326
395
 
396
+ # Return a boolean indicating if any rule needs to be run from the start of time
397
+ def full_required?
398
+ @all_recurrence_rules.any?(&:full_required?) ||
399
+ @all_exception_rules.any?(&:full_required?)
400
+ end
401
+
327
402
  # Return a boolean indicating whether or not a specific time
328
403
  # is excluded from the schedule
329
404
  def exception_time?(time)
@@ -64,6 +64,18 @@ module IceCube
64
64
  day
65
65
  end
66
66
 
67
+ # Convert a symbol to an ical day (SU, MO)
68
+ def self.week_start(sym)
69
+ raise "No such day: #{sym}" unless DAYS.keys.include?(sym)
70
+ day = sym.to_s.upcase[0..1]
71
+ day
72
+ end
73
+
74
+ # Convert weekday from base sunday to the schedule's week start.
75
+ def self.normalize_weekday(daynum, week_start)
76
+ (daynum - symbol_to_day(week_start)) % 7
77
+ end
78
+
67
79
  # Return the count of the number of times wday appears in the month,
68
80
  # and which of those time falls on
69
81
  def self.which_occurrence_in_month(time, wday)
@@ -93,7 +105,7 @@ module IceCube
93
105
  def self.days_in_month_year(month, year)
94
106
  is_leap?(year) ? LEAP_YEAR_MONTH_DAYS[month - 1] : COMMON_YEAR_MONTH_DAYS[month - 1]
95
107
  end
96
-
108
+
97
109
  # Number of days in a year
98
110
  def self.days_in_year(time)
99
111
  is_leap?(time.year) ? 366 : 365
@@ -190,7 +202,7 @@ module IceCube
190
202
  yield
191
203
  end
192
204
  end
193
-
205
+
194
206
  def clear_sec
195
207
  @time -= @time.sec
196
208
  end
@@ -24,11 +24,14 @@ module IceCube
24
24
  end
25
25
 
26
26
  def build_hash(builder)
27
- builder.validations[:interval] = interval
27
+ builder[:interval] = interval
28
28
  end
29
29
 
30
30
  def build_ical(builder)
31
31
  builder['FREQ'] << 'DAILY'
32
+ unless interval == 1
33
+ builder['INTERVAL'] << interval
34
+ end
32
35
  end
33
36
 
34
37
  def type
@@ -25,7 +25,7 @@ module IceCube
25
25
  end
26
26
 
27
27
  def build_s(builder)
28
- builder.piece(:day) << "#{Date::DAYNAMES[day]}s"
28
+ builder.piece(:day) << day
29
29
  end
30
30
 
31
31
  def build_hash(builder)
@@ -44,8 +44,18 @@ module IceCube
44
44
  :wday
45
45
  end
46
46
 
47
- StringBuilder.register_formatter(:day) do |segments|
48
- "on #{StringBuilder.sentence(segments)}"
47
+ StringBuilder.register_formatter(:day) do |validation_days|
48
+ # sort the days
49
+ validation_days.sort!
50
+ # pick the right shortening, if applicable
51
+ if validation_days == [0, 6]
52
+ 'on Weekends'
53
+ elsif validation_days == (1..5).to_a
54
+ 'on Weekdays'
55
+ else
56
+ segments = validation_days.map { |d| "#{Date::DAYNAMES[d]}s" }
57
+ "on #{StringBuilder.sentence(segments)}"
58
+ end
49
59
  end
50
60
 
51
61
  end
@@ -6,7 +6,7 @@ module IceCube
6
6
  validations_for(:interval) << Validation.new(interval)
7
7
  clobber_base_validations(:hour)
8
8
  self
9
- end
9
+ end
10
10
 
11
11
  class Validation
12
12
 
@@ -21,11 +21,14 @@ module IceCube
21
21
  end
22
22
 
23
23
  def build_hash(builder)
24
- builder.validations[:interval] = interval
24
+ builder[:interval] = interval
25
25
  end
26
26
 
27
27
  def build_ical(builder)
28
28
  builder['FREQ'] << 'HOURLY'
29
+ unless interval == 1
30
+ builder['INTERVAL'] << interval
31
+ end
29
32
  end
30
33
 
31
34
  def initialize(interval)
@@ -37,7 +40,10 @@ module IceCube
37
40
  end
38
41
 
39
42
  def validate(time, schedule)
40
- hours = (time.to_i - schedule.start_time.to_i) / IceCube::ONE_HOUR
43
+ start_time = schedule.start_time
44
+ sec = (time.to_i - time.to_i % ONE_HOUR) -
45
+ (start_time.to_i - start_time.to_i % ONE_HOUR)
46
+ hours = sec / ONE_HOUR
41
47
  unless hours % interval == 0
42
48
  interval - (hours % interval)
43
49
  end
@@ -26,10 +26,13 @@ module IceCube
26
26
 
27
27
  def build_ical(builder)
28
28
  builder['FREQ'] << 'MINUTELY'
29
+ unless interval == 1
30
+ builder['INTERVAL'] << interval
31
+ end
29
32
  end
30
33
 
31
34
  def build_hash(builder)
32
- builder.validations[:interval] = interval
35
+ builder[:interval] = interval
33
36
  end
34
37
 
35
38
  def initialize(interval)
@@ -37,7 +40,10 @@ module IceCube
37
40
  end
38
41
 
39
42
  def validate(time, schedule)
40
- minutes = (time.to_i - schedule.start_time.to_i) / IceCube::ONE_MINUTE
43
+ start_time = schedule.start_time
44
+ sec = (time.to_i - time.to_i % ONE_MINUTE) -
45
+ (start_time.to_i - start_time.to_i % ONE_MINUTE)
46
+ minutes = sec / ONE_MINUTE
41
47
  unless minutes % interval == 0
42
48
  interval - (minutes % interval)
43
49
  end
@@ -22,10 +22,13 @@ module IceCube
22
22
 
23
23
  def build_ical(builder)
24
24
  builder['FREQ'] << 'MONTHLY'
25
+ unless interval == 1
26
+ builder['INTERVAL'] << interval
27
+ end
25
28
  end
26
29
 
27
30
  def build_hash(builder)
28
- builder.validations[:interval] = interval
31
+ builder[:interval] = interval
29
32
  end
30
33
 
31
34
  def initialize(interval)
@@ -26,10 +26,13 @@ module IceCube
26
26
 
27
27
  def build_ical(builder)
28
28
  builder['FREQ'] << 'SECONDLY'
29
+ unless interval == 1
30
+ builder['INTERVAL'] << interval
31
+ end
29
32
  end
30
33
 
31
34
  def build_hash(builder)
32
- builder.validations[:interval] = interval
35
+ builder[:interval] = interval
33
36
  end
34
37
 
35
38
  def initialize(interval)
@@ -2,11 +2,13 @@ module IceCube
2
2
 
3
3
  module Validations::Until
4
4
 
5
+ extend ::Deprecated
6
+
5
7
  # accessor
6
8
  def until_time
7
9
  @until
8
10
  end
9
- alias :until_date :until_time
11
+ deprecated_alias :until_date, :until_time
10
12
 
11
13
  def until(time)
12
14
  @until = time
@@ -4,14 +4,15 @@ module IceCube
4
4
 
5
5
  module Validations::WeeklyInterval
6
6
 
7
- def interval(interval)
8
- validations_for(:interval) << Validation.new(interval)
7
+ def interval(interval, week_start = :sunday)
8
+ validations_for(:interval) << Validation.new(interval, week_start)
9
9
  clobber_base_validations(:day)
10
+ self
10
11
  end
11
12
 
12
13
  class Validation
13
14
 
14
- attr_reader :interval
15
+ attr_reader :interval, :week_start
15
16
 
16
17
  def type
17
18
  :day
@@ -23,21 +24,29 @@ module IceCube
23
24
 
24
25
  def build_ical(builder)
25
26
  builder['FREQ'] << 'WEEKLY'
27
+ unless interval == 1
28
+ builder['INTERVAL'] << interval
29
+ builder['WKST'] << TimeUtil.week_start(week_start)
30
+ end
26
31
  end
27
32
 
28
33
  def build_hash(builder)
29
- builder.validations[:interval] = interval
34
+ builder[:interval] = interval
30
35
  end
31
36
 
32
- def initialize(interval)
37
+ def initialize(interval, week_start)
33
38
  @interval = interval
39
+ @week_start = week_start
34
40
  end
35
41
 
36
42
  def validate(time, schedule)
37
43
  date = Date.new(time.year, time.month, time.day)
38
44
  st = schedule.start_time
39
45
  start_date = Date.new(st.year, st.month, st.day)
40
- weeks = ((date - date.wday) - (start_date - start_date.wday)) / 7
46
+ weeks = (
47
+ (date - TimeUtil.normalize_weekday(date.wday, week_start)) -
48
+ (start_date - TimeUtil.normalize_weekday(start_date.wday, week_start))
49
+ ) / 7
41
50
  unless weeks % interval == 0
42
51
  (interval - (weeks % interval)) * 7
43
52
  end
@@ -20,11 +20,14 @@ module IceCube
20
20
  end
21
21
 
22
22
  def build_hash(builder)
23
- builder.validations[:interval] = interval
23
+ builder[:interval] = interval
24
24
  end
25
25
 
26
26
  def build_ical(builder)
27
27
  builder['FREQ'] << 'YEARLY'
28
+ unless interval == 1
29
+ builder['INTERVAL'] << interval
30
+ end
28
31
  end
29
32
 
30
33
  def initialize(interval)
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
 
5
5
  end
data/lib/ice_cube.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'date'
2
+ require 'ice_cube/deprecated'
2
3
 
3
4
  # Use psych if we can
4
5
  begin
@@ -71,4 +72,8 @@ module IceCube
71
72
  # Formatting
72
73
  TO_S_TIME_FORMAT = '%B %e, %Y'
73
74
 
75
+ def self.use_psych?
76
+ @use_psych ||= defined?(Psych) && defined?(Psych::VERSION)
77
+ end
78
+
74
79
  end
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,11 @@
1
- require File.dirname(__FILE__) + '/../lib/ice_cube'
2
-
3
1
  begin
4
- require 'cover_me'
5
- # https://github.com/markbates/cover_me/issues/50
6
- at_exit do
7
- CoverMe.complete!
8
- end
2
+ require 'simplecov'
3
+ SimpleCov.start
9
4
  rescue LoadError
5
+ # okay
10
6
  end
11
7
 
8
+ require File.dirname(__FILE__) + '/../lib/ice_cube'
9
+
12
10
  DAY = Time.utc(2010, 3, 1)
13
11
  WEDNESDAY = Time.utc(2010, 6, 23, 5, 0, 0)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ice_cube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-08 00:00:00.000000000 -05:00
13
- default_executable:
12
+ date: 2012-03-25 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
- requirement: &70154139759660 !ruby/object:Gem::Requirement
16
+ requirement: &70300114106600 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '0'
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *70154139759660
24
+ version_requirements: *70300114106600
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: active_support
28
- requirement: &70154139758460 !ruby/object:Gem::Requirement
27
+ requirement: &70300114105840 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: 3.0.0
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: *70154139758460
35
+ version_requirements: *70300114105840
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: tzinfo
39
- requirement: &70154139757400 !ruby/object:Gem::Requirement
38
+ requirement: &70300114105260 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,7 +43,7 @@ dependencies:
44
43
  version: '0'
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *70154139757400
46
+ version_requirements: *70300114105260
48
47
  description: ice_cube is a recurring date library for Ruby. It allows for quick,
49
48
  programatic expansion of recurring date rules.
50
49
  email: john@crepezzi.com
@@ -55,6 +54,7 @@ files:
55
54
  - lib/ice_cube/builders/hash_builder.rb
56
55
  - lib/ice_cube/builders/ical_builder.rb
57
56
  - lib/ice_cube/builders/string_builder.rb
57
+ - lib/ice_cube/deprecated.rb
58
58
  - lib/ice_cube/errors/count_exceeded.rb
59
59
  - lib/ice_cube/errors/until_exceeded.rb
60
60
  - lib/ice_cube/rule.rb
@@ -91,7 +91,6 @@ files:
91
91
  - lib/ice_cube/version.rb
92
92
  - lib/ice_cube.rb
93
93
  - spec/spec_helper.rb
94
- has_rdoc: true
95
94
  homepage: http://seejohnrun.github.com/ice_cube/
96
95
  licenses: []
97
96
  post_install_message:
@@ -112,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
111
  version: '0'
113
112
  requirements: []
114
113
  rubyforge_project: ice-cube
115
- rubygems_version: 1.6.2
114
+ rubygems_version: 1.8.17
116
115
  signing_key:
117
116
  specification_version: 3
118
117
  summary: Ruby Date Recurrence Library