class Gitdocs::Synchronizer
Public Class Methods
new(share)
click to toggle source
@param [Gitdocs::Share] share
# File lib/gitdocs/synchronizer.rb, line 8 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
Public Instance Methods
stop_timers()
click to toggle source
@return [void]
# File lib/gitdocs/synchronizer.rb, line 20 def stop_timers return unless @timer @timer.cancel end
synchronize()
click to toggle source
@return [void]
# File lib/gitdocs/synchronizer.rb, line 26 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