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.



5
6
7
8
9
# File 'lib/license_finder/project_finder.rb', line 5

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



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

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

  potential_project_path.to_s
end

#find_projectsObject



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

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