CycloneDX / cyclonedx-cocoapods

Creates CycloneDX Software Bill-of-Materials (SBOM) from Objective-C and Swift projects that use CocoaPods.
Apache License 2.0
20 stars 12 forks source link

Missing Podfile in <directory> ... #71

Open antonioholling opened 1 month ago

antonioholling commented 1 month ago

Due to the commit ea90242 which tried to fix lint issues, the path joining of the working directory with the Podfile and Podfile.lock does not work as expected.

Within podfile_analyzer.rb, the method validate_optionsdoes the following: options[:podfile_path] = "#{project_dir}Podfile" in line 108 and options[:podfile_lock_path] = "#{project_dir}Podfile.lock" in line 114

Previously, the paths were joined using +, which is a possible operator for joining paths when working with Pathname objects. What the code now does is to simply concatenate the strings, resulting in a wrong directory name, thus finding the Podfile or Podfile.lock becomes impossible.

macblazer commented 1 month ago

Thanks for the bug report! There are no unit tests around the podfile_path and podfile_lock_path options, so not terribly surprising that we missed this change.

We can write some unit tests that exercise these options to ensure it doesn't break in the future.

Nookaraju commented 2 weeks ago

@macblazer any update on this? I too, am facing the same issue:

ERROR -- : Missing Podfile in /Users/nookaraju.maddila/Documents/OxfordGit/App. Please use the --path option if not running from the CocoaPods project directory. /opt/homebrew/lib/ruby/gems/3.2.0/gems/cyclonedx-cocoapods-1.3.0/lib/cyclonedx/cocoapods/podfile_analyzer.rb:110:in validate_options' /opt/homebrew/lib/ruby/gems/3.2.0/gems/cyclonedx-cocoapods-1.3.0/lib/cyclonedx/cocoapods/podfile_analyzer.rb:44:inensure_podfile_and_lock_are_present' /opt/homebrew/lib/ruby/gems/3.2.0/gems/cyclonedx-cocoapods-1.3.0/lib/cyclonedx/cocoapods/cli_runner.rb:135:in analyze' /opt/homebrew/lib/ruby/gems/3.2.0/gems/cyclonedx-cocoapods-1.3.0/lib/cyclonedx/cocoapods/cli_runner.rb:42:inrun' /opt/homebrew/lib/ruby/gems/3.2.0/gems/cyclonedx-cocoapods-1.3.0/exe/cyclonedx-cocoapods:25:in <top (required)>' /opt/homebrew/lib/ruby/gems/3.2.0/bin/cyclonedx-cocoapods:25:inload' /opt/homebrew/lib/ruby/gems/3.2.0/bin/cyclonedx-cocoapods:25:in `

'