Sha256: 3297630434e799b7505209db3496e376354b4ec0e088a887ea242d2a4c53a72e
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
# -*- encoding : utf-8 -*- module Gitdocs class Synchronizer include Celluloid finalizer :stop_timers # @param [Gitdocs::Share] share def initialize(share) @git_notifier = GitNotifier.new(share.path, share.notification) @repository = Repository.new(share) @sync_type = share.sync_type # Always to an initial synchronization when beginning. synchronize @timer = every(share.polling_interval) { synchronize } end # @return [void] def stop_timers return unless @timer @timer.cancel end # @return [void] def synchronize return unless @repository.valid? result = @repository.synchronize(@sync_type) @git_notifier.for_merge(result[:merge]) @git_notifier.for_push(result[:push]) rescue => e # Rescue any standard exceptions which come from the push related # commands. This will prevent problems on a single share from killing # the entire daemon. @git_notifier.on_error(e) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gitdocs-0.6.2 | lib/gitdocs/synchronizer.rb |
gitdocs-0.6.1 | lib/gitdocs/synchronizer.rb |
gitdocs-0.6.0 | lib/gitdocs/synchronizer.rb |