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) ⇒ ProjectFinder

Returns a new instance of ProjectFinder.



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

def initialize(main_project_path)
  @package_managers = LicenseFinder::PackageManager.package_managers
  @main_project_path = main_project_path
end

Instance Method Details

#collect_project_path(all_paths) ⇒ Object



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

def collect_project_path(all_paths)
  potential_project_path = all_paths.first
  if active_project?(potential_project_path)
    remove_nested(potential_project_path, all_paths)
    return potential_project_path.to_s
  end
end

#find_projectsObject



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

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