Class: Proxy::Omaha::Syncer
- Inherits:
-
Object
- Object
- Proxy::Omaha::Syncer
- Includes:
- Log
- Defined in:
- lib/smart_proxy_omaha/syncer.rb
Instance Method Summary collapse
- #run ⇒ Object
- #sync_release(track, release) ⇒ Object
- #update_current_release(track, release) ⇒ Object
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/smart_proxy_omaha/syncer.rb', line 10 def run if sync_count == 0 logger.info "Syncing is disabled." return end Proxy::Omaha::Track.all.each do |track| logger.debug "Syncing track: #{track}..." releases = release_provider(track).releases releases.last(sync_count).each do |release| sync_release(track, release) end update_current_release(track, releases.last) if releases.any? end end |
#sync_release(track, release) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/smart_proxy_omaha/syncer.rb', line 26 def sync_release(track, release) if release.exists? if !release.valid? logger.info "#{track} release #{release} is invalid. Purging." release.purge elsif release.complete? logger.info "#{track} release #{release} exists, is complete and valid. Skipping sync." return end end release.create end |
#update_current_release(track, release) ⇒ Object
39 40 41 42 |
# File 'lib/smart_proxy_omaha/syncer.rb', line 39 def update_current_release(track, release) logger.debug "#{track}: Updating current release to #{release}" release.mark_as_current! end |