diff --git a/lib/abf_worker/observer_helper.rb b/lib/abf_worker/base_observer.rb similarity index 80% rename from lib/abf_worker/observer_helper.rb rename to lib/abf_worker/base_observer.rb index 994586a34..da8e38bf7 100644 --- a/lib/abf_worker/observer_helper.rb +++ b/lib/abf_worker/base_observer.rb @@ -1,12 +1,12 @@ module AbfWorker - module ObserverHelper + class BaseObserver BUILD_COMPLETED = 0 BUILD_FAILED = 1 BUILD_PENDING = 2 BUILD_STARTED = 3 BUILD_CANCELED = 4 - def update_results(subject, options) + def self.update_results(subject, options) results = (subject.results || [])+ options['results'] subject.results = results.sort_by{ |r| r['file_name'] } subject.save! diff --git a/lib/abf_worker/iso_worker_observer.rb b/lib/abf_worker/iso_worker_observer.rb index 93eca869a..46eb87dcb 100644 --- a/lib/abf_worker/iso_worker_observer.rb +++ b/lib/abf_worker/iso_worker_observer.rb @@ -1,6 +1,5 @@ module AbfWorker - class IsoWorkerObserver - extend AbfWorker::ObserverHelper + class IsoWorkerObserver < AbfWorker::BaseObserver @queue = :iso_worker_observer def self.perform(options) diff --git a/lib/abf_worker/publish_build_list_container_observer.rb b/lib/abf_worker/publish_build_list_container_observer.rb index cbc6d509e..d6eef87a2 100644 --- a/lib/abf_worker/publish_build_list_container_observer.rb +++ b/lib/abf_worker/publish_build_list_container_observer.rb @@ -1,6 +1,5 @@ module AbfWorker - class PublishBuildListContainerObserver - extend AbfWorker::ObserverHelper + class PublishBuildListContainerObserver < AbfWorker::BaseObserver @queue = :publish_build_list_container_observer def self.perform(options) diff --git a/lib/abf_worker/rpm_worker_observer.rb b/lib/abf_worker/rpm_worker_observer.rb index b468d676c..5635ec733 100644 --- a/lib/abf_worker/rpm_worker_observer.rb +++ b/lib/abf_worker/rpm_worker_observer.rb @@ -1,6 +1,5 @@ module AbfWorker - class RpmWorkerObserver - extend AbfWorker::ObserverHelper + class RpmWorkerObserver < AbfWorker::BaseObserver @queue = :rpm_worker_observer def self.perform(options)