andyw8-acts_as_event_owner 1.1.15 → 1.1.16

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -7,7 +7,6 @@ Reasons for this fork:
7
7
  * Fix compatibility with Rails >= 3.09 (https://github.com/dburkes/acts_as_event_owner/issues/14)
8
8
  * Use Bundler instead of Jeweler for gem releases (Jeweler appears to be abandoned)
9
9
  * Add CI via Travis
10
- * The rake task for `acts_as_event_owner:generate_events` appeared incomplete/broken. I've fixed it for the simplified case I need where no arguments are required, and it will default to events from now to 30 days in the future.
11
10
 
12
11
  One test was failing for me, which I don't have time to look into at the moment (event_specificiation_spec.rb) so I have marked it as pending.
13
12
 
@@ -98,9 +98,8 @@ module ActsAsEventOwner
98
98
  raise ActsAsEventOwner::Exception.new("Invalid Event Specification") if !valid?
99
99
 
100
100
  opts = options.clone
101
- opts[:from] = Time.now
102
-
103
- opts[:to] ||= (opts[:from] + 90.days) if opts[:from]
101
+ opts[:from] ||= self.start_at
102
+ opts[:to] ||= (opts[:from] + 30.days) if opts[:from]
104
103
  opts[:from] -= 1.second
105
104
  opts[:to] -= 1.second
106
105
  opts[:from] = opts[:to] = nil if opts[:count]
@@ -129,15 +128,15 @@ module ActsAsEventOwner
129
128
  additional[column] = self.attributes[column] if @@OCCURRENCE_COLUMNS.include?(column)
130
129
  additional
131
130
  end
132
-
131
+
133
132
  # puts "*********** #{occurrence.start_time} : #{occurrence.start_time.zone}"
134
133
  # puts "*********** #{Time.zone.at(occurrence.start_time.to_i)}"
135
-
134
+
136
135
  hash = {
137
136
  :owner_id => self.owner_id, :owner_type => self.owner_type, :event_specification_id => self.id,
138
137
  :description => occurrence.description, :start_at => occurrence.start_time.utc,
139
138
  :end_at => occurrence.finish_time.utc}.stringify_keys.merge(additional_columns).merge(attribute_overrides.stringify_keys)
140
-
139
+
141
140
  EventOccurrence.find_or_create_by_owner_id_and_owner_type_and_event_specification_id_and_start_at_and_end_at(hash)
142
141
  end
143
142
  end
@@ -147,7 +146,7 @@ module ActsAsEventOwner
147
146
  spec.generate_events(options)
148
147
  }
149
148
  end
150
-
149
+
151
150
  def repeat
152
151
  self.attributes["repeat"].try(:to_sym)
153
152
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsEventOwner
2
- VERSION = "1.1.15" unless defined? ActsAsEventOwner::VERSION
2
+ VERSION = "1.1.16" unless defined? ActsAsEventOwner::VERSION
3
3
  end
@@ -1,6 +1,14 @@
1
1
  namespace :acts_as_event_owner do
2
+ task :require_from do
3
+ raise "Set FROM to something understandable by Time.parse" if !ENV['FROM']
4
+ end
5
+
6
+ task :require_to do
7
+ raise "Set TO to something understandable by Time.parse" if !ENV['TO']
8
+ end
9
+
2
10
  desc "Generate all events within a certain time window"
3
- task :generate_events => [:environment] do
4
- ActsAsEventOwner::EventSpecification.all(:conditions => "until IS NULL OR until >= '#{Time.zone.now.to_s(:db)}'").each {|spec| spec.generate_events}
11
+ task :generate_events => [:environment, :require_from, :require_to] do
12
+ ActsAsEventOwner::EventSpecification.all(:conditions => "until IS NULL OR until >= '#{Time.zone.now.to_s(:db)}'").each {|spec| spec.generate_events(options)}
5
13
  end
6
- end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andyw8-acts_as_event_owner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.15
4
+ version: 1.1.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: