Merge pull request #146 from JCook21/issue134

Fix for issue134
This commit is contained in:
Jeremy Cook
2015-10-25 15:21:26 -04:00
3 changed files with 7 additions and 4 deletions

View File

@@ -25,10 +25,13 @@ module Homesick
exit(1)
end
# Hack in support for diffing symlinks
# Also adds support for checking if destination or content is a directory
shell_metaclass = class << shell; self; end
shell_metaclass.send(:define_method, :show_diff) do |destination, content|
destination = Pathname.new(destination)
return super unless destination.symlink?
content = Pathname.new(content)
return 'Unable to create diff: destination or content is a directory' if destination.directory? || content.directory?
return super(destination, content) unless destination.symlink?
say "- #{destination.readlink}", :red, true
say "+ #{content.expand_path}", :green, true
end