mirror of https://github.com/licensee/licensee.git
fix for multiple copyrights
This commit is contained in:
parent
a22b239cd1
commit
48b44457f0
|
@ -60,7 +60,9 @@ module Licensee
|
|||
return unless content
|
||||
@content_normalized ||= begin
|
||||
string = content_without_title_and_version.downcase
|
||||
string = strip_copyright(string)
|
||||
while string =~ Matchers::Copyright::REGEX
|
||||
string = strip_copyright(string)
|
||||
end
|
||||
string = strip_hrs(string)
|
||||
string, _partition, _instructions = string.partition(END_OF_TERMS_REGEX)
|
||||
strip_whitespace(string)
|
||||
|
@ -88,7 +90,7 @@ module Licensee
|
|||
end
|
||||
|
||||
def strip_copyright(string)
|
||||
string.gsub(/\A#{Matchers::Copyright::REGEX}$/i, '').strip
|
||||
string.gsub(Matchers::Copyright::REGEX, '').strip
|
||||
end
|
||||
|
||||
# Strip HRs from MPL
|
||||
|
|
|
@ -116,5 +116,14 @@ EOS
|
|||
expect(normalized_content).to eql('foo')
|
||||
end
|
||||
end
|
||||
|
||||
context 'multiple copyrights' do
|
||||
let(:content) { "Copyright 2016 Ben Balter\nCopyright 2017 Bob\nFoo" }
|
||||
|
||||
it 'strips multiple copyrights' do
|
||||
expect(normalized_content).to_not match('Ben')
|
||||
expect(normalized_content).to eql('foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue