in lib/licensee/commands/diff.rb [7:38]
def diff(_path = nil)
say "Comparing to #{expected_license.name}:"
rows = []
left = expected_license.content_normalized(wrap: 80)
right = license_to_diff.content_normalized(wrap: 80)
similarity = expected_license.similarity(license_to_diff)
similarity = Licensee::ContentHelper.format_percent(similarity)
rows << ['Input Length:', license_to_diff.length]
rows << ['License length:', expected_license.length]
rows << ['Similarity:', similarity]
print_table rows
if left == right
say 'Exact match!', :green
exit
end
Dir.mktmpdir do |dir|
path = File.expand_path 'LICENSE', dir
Dir.chdir(dir) do
`git init`
File.write(path, left)
`git add LICENSE`
`git commit -m 'left'`
File.write(path, right)
say `git diff --word-diff`
end
end
end