diff options
| author | Can Eldem <eldemcan@users.noreply.github.com> | 2020-05-18 10:04:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-18 10:04:25 +0100 |
| commit | baa882c452ea6311b4c934ca388e04757c7c436d (patch) | |
| tree | 2322da54fb505427915c65f296eb1a88afdd533b /lib | |
| parent | 6b392af62854d28b9f12fe292e21b79baa25c63b (diff) | |
| parent | f1cbf51f1a185d70c45959c3e2199b29ccbacd1d (diff) | |
Merge pull request #20 from spandx/bugs-bunnyv0.13.2
Fix bugs.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/spandx/core/git.rb | 2 | ||||
| -rw-r--r-- | lib/spandx/core/guess.rb | 13 | ||||
| -rw-r--r-- | lib/spandx/core/parser.rb | 2 | ||||
| -rw-r--r-- | lib/spandx/python/pypi.rb | 2 | ||||
| -rw-r--r-- | lib/spandx/version.rb | 2 |
5 files changed, 15 insertions, 6 deletions
diff --git a/lib/spandx/core/git.rb b/lib/spandx/core/git.rb index 51949a0..f98734d 100644 --- a/lib/spandx/core/git.rb +++ b/lib/spandx/core/git.rb @@ -42,7 +42,5 @@ module Spandx end end end - - Database = Git end end diff --git a/lib/spandx/core/guess.rb b/lib/spandx/core/guess.rb index 62967ce..81862b1 100644 --- a/lib/spandx/core/guess.rb +++ b/lib/spandx/core/guess.rb @@ -10,7 +10,14 @@ module Spandx end def license_for(raw) - raw.is_a?(Hash) ? from_hash(raw) : from_string(raw) + case raw + when Hash + from_hash(raw) + when Array + from_array(raw) + else + from_string(raw) + end end private @@ -21,6 +28,10 @@ module Spandx unknown(hash[:name] || hash[:url]) end + def from_array(array) + from_string(array.join(' AND ')) + end + def from_string(raw) return if raw.nil? diff --git a/lib/spandx/core/parser.rb b/lib/spandx/core/parser.rb index 4c92854..00d0278 100644 --- a/lib/spandx/core/parser.rb +++ b/lib/spandx/core/parser.rb @@ -21,6 +21,8 @@ module Spandx include Registerable def for(path) + return UNKNOWN if !File.exist?(path) || File.size(path).zero? + find { |x| x.matches?(File.basename(path)) } || UNKNOWN end end diff --git a/lib/spandx/python/pypi.rb b/lib/spandx/python/pypi.rb index 3c1006b..7849f29 100644 --- a/lib/spandx/python/pypi.rb +++ b/lib/spandx/python/pypi.rb @@ -96,7 +96,5 @@ module Spandx Nokogiri::HTML(http.get(url).body) end end - - PyPI = Pypi end end diff --git a/lib/spandx/version.rb b/lib/spandx/version.rb index d26e19a..e2f8abb 100644 --- a/lib/spandx/version.rb +++ b/lib/spandx/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Spandx - VERSION = '0.13.1' + VERSION = '0.13.2' end |
