Class: Pod::SPM::MacroMetadata

Inherits:
Pod::Swift::PackageDescription show all
Defined in:
lib/cocoapods-spm/macro/metadata.rb

Instance Attribute Summary

Attributes inherited from Pod::Swift::PackageDescriptionBaseObject

#parent, #raw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Swift::PackageDescription

#artifacts_dir, #checkouts_dir, #dependencies, from_dir, #macro_impl_name, #products, #slug, #src_dir, #targets, #targets_of_product, #use_default_xcode_linking?

Methods included from Config::SPMConfigMixin

#local_macro_pod?, #local_macro_pod_dir, #macro_pods, #spm_config

Methods included from Config::PodConfigMixin

#pod_config

Methods included from PathMixn

#prepare_dir

Methods included from Config::ProjectConfigMixin

#project_config

Methods inherited from Pod::Swift::PackageDescriptionBaseObject

#[], #dup_with_attrs, from_file, from_s, #initialize, #inspect, #name, #pkg_name, #root

Constructor Details

This class inherits a constructor from Pod::Swift::PackageDescriptionBaseObject

Class Method Details

.for_pod(name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/cocoapods-spm/macro/metadata.rb', line 6

def self.for_pod(name)
  path = Config.instance.macro_root_dir / name / "metadata.json"
  unless path.exist?
    UI.message "Will fetch macro #{name} because its metadata does not exist at #{path}"
    require "cocoapods-spm/macro/fetcher"
    MacroFetcher.new(name: name, can_cache: true).run
  end
  from_file(path)
end

Instance Method Details

#platform_build_settingsObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cocoapods-spm/macro/metadata.rb', line 20

def platform_build_settings
  ds = {
    "ios" => "IPHONEOS_DEPLOYMENT_TARGET",
    "macos" => "MACOSX_DEPLOYMENT_TARGET",
    "tvos" => "TVOS_DEPLOYMENT_TARGET",
    "watchos" => "WATCHOS_DEPLOYMENT_TARGET",
    "visionos" => "XROS_DEPLOYMENT_TARGET",
    "driverkit" => "DRIVERKIT_DEPLOYMENT_TARGET",
  }
  platforms.transform_keys { |k| ds[k] }.reject { |k, _| k.nil? }
end

#platformsObject



16
17
18
# File 'lib/cocoapods-spm/macro/metadata.rb', line 16

def platforms
  raw["platforms"].to_h { |ds| [ds["platformName"], ds["version"]] }
end