Class: CycloneDX::CocoaPods::Source::GitRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/cyclonedx/cocoapods/source.rb,
lib/cyclonedx/cocoapods/bom_builder.rb,
lib/cyclonedx/cocoapods/pod_attributes.rb

Constant Summary collapse

VALID_TYPES =
%i[branch tag commit].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, type: nil, label: nil) ⇒ GitRepository

Returns a new instance of GitRepository.

Raises:

  • (ArgumentError)


38
39
40
41
42
43
44
# File 'lib/cyclonedx/cocoapods/source.rb', line 38

def initialize(url:, type: nil, label: nil)
  raise ArgumentError, 'Invalid checkout information' if !type.nil? && !VALID_TYPES.include?(type)

  @url = url
  @type = type
  @label = label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



36
37
38
# File 'lib/cyclonedx/cocoapods/source.rb', line 36

def label
  @label
end

#typeObject (readonly)

Returns the value of attribute type.



36
37
38
# File 'lib/cyclonedx/cocoapods/source.rb', line 36

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



36
37
38
# File 'lib/cyclonedx/cocoapods/source.rb', line 36

def url
  @url
end

Instance Method Details

#attributes_for(pod:) ⇒ Object



65
66
67
# File 'lib/cyclonedx/cocoapods/pod_attributes.rb', line 65

def attributes_for(pod:)
  ::Pod::Config.instance.sandbox.specification(pod.name).attributes_hash
end

#source_qualifierObject



40
41
42
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 40

def source_qualifier
  { vcs_url: (label.nil? ? url : "#{url}@#{label}") }
end