Skip to content

Commit

Permalink
Merge pull request #873 from etiennecadicidean/fix/pods_acknowledgmen…
Browse files Browse the repository at this point in the history
…t_in_multi_project_folder

🔧 allow to specify cocoadpods acknowledgment through ENV
  • Loading branch information
xtreme-shane-lattanzio authored Feb 22, 2022
2 parents 4b02ca4 + ad6cef5 commit 09c03f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ languages, as long as that language has a package definition in the project dire
* `build.gradle` (for `gradle`)
* `settings.gradle` that specifies `rootProject.buildFileName` (for `gradle`)
* `bower.json` (for `bower`)
* `Podfile` (for `pod`)
* `Podfile` (for `pod`) (set `ACKNOWLEDGEMENTS_PATH` variable if you want to target a particular `Pods-acknowledgements-<TARGET>.plist`. Can be useful in multi-target pods projects.)
* `Cartfile` (for `carthage`)
* `workspace-state.json` under build directory (provided as enviroment variable `SPM_DERIVED_DATA` for Xcode, or default `.build` for non-Xcode projects), (for `spm`)
* `rebar.config` (for `rebar`)
Expand Down
15 changes: 9 additions & 6 deletions lib/license_finder/package_managers/cocoa_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ 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 09c03f6

Please sign in to comment.