@@ -4,6 +4,8 @@ rvm: |
||
| 4 | 4 |
- 2.0.0 |
| 5 | 5 |
- 2.1.1 |
| 6 | 6 |
- 1.9.3 |
| 7 |
+before_install: |
|
| 8 |
+ - travis_retry gem install bundler |
|
| 7 | 9 |
before_script: |
| 8 | 10 |
- mysql -e 'create database huginn_test;' |
| 9 | 11 |
- bundle exec rake db:migrate db:test:prepare |
@@ -8,4 +8,4 @@ dj: bundle exec script/delayed_job run |
||
| 8 | 8 |
# web: bundle exec unicorn -c config/unicorn/production.rb |
| 9 | 9 |
# schedule: bundle exec rails runner bin/schedule.rb |
| 10 | 10 |
# twitter: bundle exec rails runner bin/twitter_stream.rb |
| 11 |
-# dj: bundle exec script/delayed_job run |
|
| 11 |
+# dj: bundle exec script/delayed_job run |
@@ -83,10 +83,6 @@ class Agent < ActiveRecord::Base |
||
| 83 | 83 |
raise "Implement me in your subclass" |
| 84 | 84 |
end |
| 85 | 85 |
|
| 86 |
- def validate_options |
|
| 87 |
- # Implement me in your subclass to test for valid options. |
|
| 88 |
- end |
|
| 89 |
- |
|
| 90 | 86 |
def event_created_within?(days) |
| 91 | 87 |
last_event_at && last_event_at > days.to_i.days.ago |
| 92 | 88 |
end |
@@ -193,17 +189,7 @@ class Agent < ActiveRecord::Base |
||
| 193 | 189 |
update_column :last_error_log_at, nil |
| 194 | 190 |
end |
| 195 | 191 |
|
| 196 |
- # Validations and Callbacks |
|
| 197 |
- |
|
| 198 |
- def sources_are_owned |
|
| 199 |
- errors.add(:sources, "must be owned by you") unless sources.all? {|s| s.user == user }
|
|
| 200 |
- end |
|
| 201 |
- |
|
| 202 |
- def validate_schedule |
|
| 203 |
- unless cannot_be_scheduled? |
|
| 204 |
- errors.add(:schedule, "is not a valid schedule") unless SCHEDULES.include?(schedule.to_s) |
|
| 205 |
- end |
|
| 206 |
- end |
|
| 192 |
+ # Callbacks |
|
| 207 | 193 |
|
| 208 | 194 |
def set_default_schedule |
| 209 | 195 |
self.schedule = default_schedule unless schedule.present? || cannot_be_scheduled? |
@@ -222,6 +208,24 @@ class Agent < ActiveRecord::Base |
||
| 222 | 208 |
def possibly_update_event_expirations |
| 223 | 209 |
update_event_expirations! if keep_events_for_changed? |
| 224 | 210 |
end |
| 211 |
+ |
|
| 212 |
+ #Validation Methods |
|
| 213 |
+ |
|
| 214 |
+ private |
|
| 215 |
+ |
|
| 216 |
+ def sources_are_owned |
|
| 217 |
+ errors.add(:sources, "must be owned by you") unless sources.all? {|s| s.user == user }
|
|
| 218 |
+ end |
|
| 219 |
+ |
|
| 220 |
+ def validate_schedule |
|
| 221 |
+ unless cannot_be_scheduled? |
|
| 222 |
+ errors.add(:schedule, "is not a valid schedule") unless SCHEDULES.include?(schedule.to_s) |
|
| 223 |
+ end |
|
| 224 |
+ end |
|
| 225 |
+ |
|
| 226 |
+ def validate_options |
|
| 227 |
+ # Implement me in your subclass to test for valid options. |
|
| 228 |
+ end |
|
| 225 | 229 |
|
| 226 | 230 |
# Class Methods |
| 227 | 231 |
|