Sha256: 6e81eb018d9c1996f94f879d67281e75443b08e1454e16c61f8b6cbfa0af2ea1

Contents?: true

Size: 885 Bytes

Versions: 4

Compression:

Stored size: 885 Bytes

Contents

module Braid
  module Commands
    class Diff < Command
      def run(path = nil, options = {})
        path ? diff_one(path, options) : diff_all(options)
      end

      protected

      def diff_all(options = {})
        config.mirrors.each do |path|
          separator
          msg "Diffing #{path}\n"
          separator
          diff = perform_diff(path, options)
          puts diff unless diff.empty?
        end
      end

      def diff_one(path, options = {})
        diff = perform_diff(path, options)
        puts diff unless diff.empty?
      end

      def separator
        puts "=======================================================\n"
      end

      def perform_diff(path, options = {})
        mirror = config.get!(path)
        setup_remote(mirror)

        diff = mirror.diff

        clear_remote(mirror, options)

        diff
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
braid-1.0.20 lib/braid/commands/diff.rb
braid-1.0.19 lib/braid/commands/diff.rb
braid-1.0.18 lib/braid/commands/diff.rb
braid-1.0.17 lib/braid/commands/diff.rb