Sha256: 1a0a8d3459362d9645eceb3dcbfcd0a1cfe6dd0bbd24891f9ebb30770f72c2fe
Contents?: true
Size: 667 Bytes
Versions: 3
Compression:
Stored size: 667 Bytes
Contents
# Filesystem-based project # # Analyze a folder on the filesystem for license information module Licensee class FSProject < Project attr_reader :path def initialize(path, **args) @path = path super(**args) end private def find_file files = [] Dir.foreach(path) do |file| next unless ::File.file?(::File.join(path, file)) if (score = yield file) > 0 files.push(name: file, score: score) end end return if files.empty? files.sort! { |a, b| b[:score] <=> a[:score] } f = files.first [::File.read(::File.join(path, f[:name])), f[:name]] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
licensee-8.0.0 | lib/licensee/projects/fs_project.rb |
licensee-7.0.1 | lib/licensee/projects/fs_project.rb |
licensee-7.0.0 | lib/licensee/projects/fs_project.rb |