Class: CycloneDX::CocoaPods::PodspecAnalyzer
- Inherits:
-
Object
- Object
- CycloneDX::CocoaPods::PodspecAnalyzer
- Defined in:
- lib/cyclonedx/cocoapods/podspec_analyzer.rb
Overview
Analyzes CocoaPods podspec files to extract component information for CycloneDX BOM generation
The PodspecAnalyzer is responsible for:
-
Validating and loading podspec files from a given path
-
Parsing podspec contents to extract pod metadata
-
Converting podspec source information into standardized Source objects
Instance Method Summary collapse
- #ensure_podspec_is_present(options) ⇒ Object
-
#initialize(logger:) ⇒ PodspecAnalyzer
constructor
A new instance of PodspecAnalyzer.
- #parse_podspec(podspec) ⇒ Object
Constructor Details
#initialize(logger:) ⇒ PodspecAnalyzer
47 48 49 |
# File 'lib/cyclonedx/cocoapods/podspec_analyzer.rb', line 47 def initialize(logger:) @logger = logger end |
Instance Method Details
#ensure_podspec_is_present(options) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/cyclonedx/cocoapods/podspec_analyzer.rb', line 51 def ensure_podspec_is_present() project_dir = Pathname.new([:path] || Dir.pwd) (project_dir, ) initialize_cocoapods_config(project_dir) [:podspec_path].nil? ? nil : ::Pod::Specification.from_file([:podspec_path]) end |
#parse_podspec(podspec) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cyclonedx/cocoapods/podspec_analyzer.rb', line 59 def parse_podspec(podspec) return nil if podspec.nil? @logger.debug "Parsing podspec from #{podspec.defined_in_file}" Pod.new( name: podspec.name, version: podspec.version.to_s, source: source_from_podspec(podspec), checksum: nil ) end |