Skip to content

Commit

Permalink
🔧 allow to specify cocoadpods acknowledgment through ENV
Browse files Browse the repository at this point in the history
 > in multi projects folder of iOS projects, it looks like the cocoapods plugin is unable
to find the proper Pods-...-acknowledgments.plist file. As it takes only the 1st item of the dir,
We should be able to also specify the one we want trought an environment variable ACKNOWLEDGEMENT_PATH
just like what it is done in the SPM plugin where we do need to specify the environment variables for
DerivedDatas & Package.resolved files.
  • Loading branch information
etiennecadicidean committed Jan 19, 2022
1 parent cfbc7d3 commit 67bd3fb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/license_finder/package_managers/cocoa_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ def license_texts
end

def acknowledgements_path
search_paths = ['Pods/Pods-acknowledgements.plist',
'Pods/Target Support Files/Pods/Pods-acknowledgements.plist',
'Pods/Target Support Files/Pods-*/Pods-*-acknowledgements.plist']

result = Dir[*search_paths.map { |path| File.join(project_path, path) }].first
raise "Found a Podfile but no Pods directory in #{project_path}. Try running pod install before running license_finder." if result.nil?
if !ENV['ACKNOWLEDGEMENTS_PATH'].nil?
result = Dir[*ENV['ACKNOWLEDGEMENTS_PATH']].first
else
search_paths = ['Pods/Pods-acknowledgements.plist',
'Pods/Target Support Files/Pods/Pods-acknowledgements.plist',
'Pods/Target Support Files/Pods-*/Pods-*-acknowledgements.plist']

result = Dir[*search_paths.map { |path| File.join(project_path, path) }].first
raise "Found a Podfile but no Pods directory in #{project_path}. Try running pod install before running license_finder." if result.nil?
end
result
end

Expand Down

0 comments on commit 67bd3fb

Please sign in to comment.