module Polisher::GemDiff
Public Instance Methods
diff(other)
click to toggle source
Return diff of content in this gem against other
# File lib/polisher/gem/diff.rb, line 12 def diff(other) require_dep! 'awesome_spawn' require_cmd! diff_cmd out = nil begin this_dir = unpack other_dir = if other.is_a?(Polisher::Gem) other.unpack elsif other.is_a?(Polisher::Git::Repo) other.path else other end result = AwesomeSpawn.run("#{diff_cmd} -r #{this_dir} #{other_dir}") out = result.output.gsub("#{this_dir}", 'a').gsub("#{other_dir}", 'b') rescue ensure FileUtils.rm_rf this_dir unless this_dir.nil? FileUtils.rm_rf other_dir unless other_dir.nil? || !other.is_a?(Polisher::Gem) end out end