lib/licensee/matchers/gemspec_matcher.rb in licensee-5.0.0 vs lib/licensee/matchers/gemspec_matcher.rb in licensee-6.0.0b1
- old
+ new
@@ -1,16 +1,16 @@
class Licensee
- class GemspecMatcher < PackageMatcher
+ module Matchers
+ class Gemspec < Package
+ # We definitely don't want to be evaling arbitrary Gemspec files
+ # While not 100% accurate, use some lenient regex to try to grep the
+ # license declaration from the Gemspec as a string, if any
+ LICENSE_REGEX = /^\s*[a-z0-9_]+\.license\s*\=\s*[\'\"]([a-z\-0-9\.]+)[\'\"]\s*$/i
- # We definitely don't want to be evaling arbitrary Gemspec files
- # While not 100% accurate, use some lenient regex to try to grep the
- # license declaration from the Gemspec as a string, if any
- LICENSE_REGEX = /^\s*[a-z0-9_]+\.license\s*\=\s*[\'\"]([a-z\-0-9\.]+)[\'\"]\s*$/i
-
- private
-
- def license_property
- match = file.content.match LICENSE_REGEX
- match[1].downcase if match && match[1]
+ private
+ def license_property
+ match = @file.content.match LICENSE_REGEX
+ match[1].downcase if match && match[1]
+ end
end
end
end