Class: CocoaPodsAcknowledgements::AddOns::SwiftPackageAccumulator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods_acknowledgements/addons/swift_package_accumulator.rb

Instance Method Summary collapse

Constructor Details

#initialize(xcodeproj_path = nil) ⇒ SwiftPackageAccumulator

Returns a new instance of SwiftPackageAccumulator.

Parameters:

  • xcodeproj_path (Pathname) (defaults to: nil)

    the directory to look for podspecs.



10
11
12
13
14
15
16
17
18
# File 'lib/cocoapods_acknowledgements/addons/swift_package_accumulator.rb', line 10

def initialize(xcodeproj_path = nil)
  if xcodeproj_path.nil?
    @files = []
  else
    build_dir = %x{xcodebuild -project "#{xcodeproj_path}" -showBuildSettings | grep -m 1 BUILD_DIR | grep -oEi "\/.*"}.strip
    source_packages_dir = Pathname(build_dir) + "../../SourcePackages/checkouts"
    @files = Dir[source_packages_dir + "*/*.podspec"] # skip nested git submodules
  end
end

Instance Method Details

#acknowledgementsArray<Acknowledgement>

Returns the array of Acknowledgement objects.

Returns:



22
23
24
# File 'lib/cocoapods_acknowledgements/addons/swift_package_accumulator.rb', line 22

def acknowledgements
  @files.map { |file| Acknowledgement.new(file) }
end