Class: CycloneDX::CocoaPods::Source::CocoaPodsRepository
- Inherits:
-
Object
- Object
- CycloneDX::CocoaPods::Source::CocoaPodsRepository
- Defined in:
- lib/cyclonedx/cocoapods/source.rb,
lib/cyclonedx/cocoapods/bom_builder.rb,
lib/cyclonedx/cocoapods/pod_attributes.rb
Constant Summary collapse
- LEGACY_REPOSITORY =
'https://github.com/CocoaPods/Specs.git'- CDN_REPOSITORY =
'trunk'
Instance Attribute Summary collapse
-
#source_manager ⇒ Object
Returns the value of attribute source_manager.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes_for(pod:) ⇒ Object
-
#initialize(url:) ⇒ CocoaPodsRepository
constructor
A new instance of CocoaPodsRepository.
- #source_qualifier ⇒ Object
Constructor Details
#initialize(url:) ⇒ CocoaPodsRepository
Returns a new instance of CocoaPodsRepository.
28 29 30 |
# File 'lib/cyclonedx/cocoapods/source.rb', line 28 def initialize(url:) @url = url end |
Instance Attribute Details
#source_manager ⇒ Object
Returns the value of attribute source_manager.
28 29 30 |
# File 'lib/cyclonedx/cocoapods/pod_attributes.rb', line 28 def source_manager @source_manager end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
26 27 28 |
# File 'lib/cyclonedx/cocoapods/source.rb', line 26 def url @url end |
Class Method Details
.searchable_source(url:, source_manager:) ⇒ Object
30 31 32 33 34 |
# File 'lib/cyclonedx/cocoapods/pod_attributes.rb', line 30 def self.searchable_source(url:, source_manager:) source = CocoaPodsRepository.new(url: url) source.source_manager = source_manager source end |
Instance Method Details
#attributes_for(pod:) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cyclonedx/cocoapods/pod_attributes.rb', line 36 def attributes_for(pod:) specification_sets = @source_manager.search_by_name("^#{Regexp.escape(pod.root_name)}$") validate_spec_sets(specification_sets, pod) paths = specification_sets[0].specification_paths_for_version(pod.version) if paths.empty? raise SearchError, "Version #{pod.version} not found for pod #{pod.name}; run 'pod repo update' and try again" end ::Pod::Specification.from_file(paths[0]).attributes_hash end |
#source_qualifier ⇒ Object
34 35 36 |
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 34 def source_qualifier url == LEGACY_REPOSITORY || url == CDN_REPOSITORY ? {} : { repository_url: url } end |