Class: Licensee::Projects::FSProject

Inherits:
Project
  • Object
show all
Defined in:
lib/licensee/projects/fs_project.rb

Constant Summary

Constants inherited from Project

Project::HASH_METHODS

Instance Attribute Summary

Attributes inherited from Project

#detect_packages, #detect_readme

Instance Method Summary collapse

Methods inherited from Project

#license, #license_file, #license_files, #licenses, #matched_file, #matched_files, #package_file, #readme_file

Methods included from HashHelper

#to_h

Constructor Details

#initialize(path, **args) ⇒ FSProject

Returns a new instance of FSProject.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/licensee/projects/fs_project.rb', line 13

def initialize(path, **args)
  if ::File.file?(path)
    @pattern = File.basename(path)
    @dir = File.expand_path File.dirname(path)
  else
    @pattern = '*'
    @dir = File.expand_path(path)
  end

  @root = File.expand_path(args.delete(:search_root) || @dir)
  raise 'Search root must be the project path directory or its ancestor' unless valid_search_root?

  super(**args)
end