Skip to content

Commit

Permalink
[Added] Zlib License
Browse files Browse the repository at this point in the history
  • Loading branch information
blooper05 committed May 20, 2021
1 parent b0a61a2 commit 0f004b5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/license_finder/license/definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def all
ruby,
simplifiedbsd,
wtfpl,
zerobsd
zerobsd,
zlib
]
end

Expand Down Expand Up @@ -349,6 +350,17 @@ def zerobsd
matcher: matcher
)
end

def zlib
License.new(
short_name: 'Zlib',
pretty_name: 'zlib/libpng license',
other_names: [
'zlib License'
],
url: 'https://opensource.org/licenses/Zlib'
)
end
end
end
end
17 changes: 17 additions & 0 deletions lib/license_finder/license/templates/Zlib.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Copyright (c) <year> <copyright holders>

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
37 changes: 37 additions & 0 deletions spec/lib/license_finder/license/definitions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,40 @@
expect(described_class.find_by_name('Zero-Clause BSD').url).to be
end
end

describe LicenseFinder::License, 'Zlib' do
it 'should be recognized' do
expect(described_class.find_by_name('Zlib').url).to be
expect(described_class.find_by_name('zlib/libpng license').url).to be
expect(described_class.find_by_name('zlib License').url).to be
end

it 'should match regardless of year or copyright holder names' do
license = <<-LICENSE
SOFTWARE NAME - Copyright (c) 1995-2017 - COPYRIGHT HOLDER NAME
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but
is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any
source distribution.
LICENSE

expect(described_class.find_by_name('Zlib')).to be_matches_text license
expect(described_class.find_by_name('Zlib')).not_to be_matches_text 'SOME OTHER LICENSE'
end
end

0 comments on commit 0f004b5

Please sign in to comment.