lib/zold/commands/remote.rb in zold-0.18.6 vs lib/zold/commands/remote.rb in zold-0.18.7

- old
+ new

@@ -227,11 +227,11 @@ if scores.empty? @log.info("No winners elected out of #{@remotes.all.count} remotes") else scores.each { |s| @log.info("Elected: #{s.reduced(4)}") } end - scores + scores.sort_by(&:value).reverse end def trim(opts) all = @remotes.all all.each do |r| @@ -255,18 +255,25 @@ score = Score.parse_json(json['score']) r.assert_valid_score(score) r.assert_score_ownership(score) r.assert_score_strength(score) unless opts['ignore-score-weakness'] @remotes.rescore(score.host, score.port, score.value) - gem = Zold::Gem.new - if Semantic::Version.new(VERSION) < Semantic::Version.new(json['version']) || - Semantic::Version.new(VERSION) < Semantic::Version.new(gem.last_version) + if Semantic::Version.new(VERSION) < Semantic::Version.new(json['version']) if opts['reboot'] @log.info("#{r}: their version #{json['version']} is higher than mine #{VERSION}, reboot! \ (use --never-reboot to avoid this from happening)") terminate end @log.debug("#{r}: their version #{json['version']} is higher than mine #{VERSION}, \ +it's recommended to reboot, but I don't do it because of --never-reboot") + end + if Semantic::Version.new(VERSION) < Semantic::Version.new(Zold::Gem.new.last_version) + if opts['reboot'] + @log.info("#{r}: the version of the gem is higher than mine #{VERSION}, reboot! \ +(use --never-reboot to avoid this from happening)") + terminate + end + @log.debug("#{r}: gem version is higher than mine #{VERSION}, \ it's recommended to reboot, but I don't do it because of --never-reboot") end if cycle.positive? json['all'].each do |s| next if @remotes.exists?(s['host'], s['port'])