Class: LicenseFinder::ProjectFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/license_finder/project_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(main_project_path, strict_matching = false) ⇒ ProjectFinder

Returns a new instance of ProjectFinder.



3
4
5
6
7
# File 'lib/license_finder/project_finder.rb', line 3

def initialize(main_project_path, strict_matching = false)
  @package_managers = LicenseFinder::Scanner::PACKAGE_MANAGERS
  @strict_matching = strict_matching
  @main_project_path = main_project_path
end

Instance Method Details

#collect_project_path(all_paths) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/license_finder/project_finder.rb', line 19

def collect_project_path(all_paths)
  potential_project_path = all_paths.first
  is_active_project = active_project?(potential_project_path)
  return unless is_active_project

  remove_nested(potential_project_path, all_paths)
  potential_project_path.to_s
end

#find_projectsObject



9
10
11
12
13
14
15
16
17
# File 'lib/license_finder/project_finder.rb', line 9

def find_projects
  project_paths = []
  all_paths = find_all_paths
  until all_paths.empty?
    project_paths << collect_project_path(all_paths)
    all_paths.shift
  end
  project_paths.compact
end