Sha256: 75e09d6cdefb8372c17d0953f787bb3a6e0076c776988bfaa78fd58f47f7fecc

Contents?: true

Size: 489 Bytes

Versions: 13

Compression:

Stored size: 489 Bytes

Contents

module LicenseFinder
  class PossibleLicenseFile
    def initialize(path, options = {})
      @path = Pathname(path)
      @logger = options[:logger]
    end

    def path
      @path.to_s
    end

    def license
      License.find_by_text(text)
    end

    def text
      if @path.exist?
        @text ||= (@path.respond_to?(:binread) ? @path.binread : @path.read)
      else
        @logger.info('ERROR', "#{@path} does not exists", color: :red)
        ''
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
license_finder-5.4.1 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.4.0 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.3.0 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.2.3 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.2.1 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.2.0 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.1.1 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.1.0 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.0.3 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.0.2 lib/license_finder/package_utils/possible_license_file.rb
license_finder-5.0.0 lib/license_finder/package_utils/possible_license_file.rb
license_finder-4.0.2 lib/license_finder/packages/possible_license_file.rb
license_finder-4.0.1 lib/license_finder/packages/possible_license_file.rb