Class: Pod::Podfile

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-spm/def/podfile.rb,
lib/cocoapods-spm/def/target_definition.rb

Defined Under Namespace

Classes: TargetDefinition

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#spm_resolverObject

Returns the value of attribute spm_resolver.



5
6
7
# File 'lib/cocoapods-spm/def/podfile.rb', line 5

def spm_resolver
  @spm_resolver
end

Instance Method Details

#config_cocoapods_spm(options) ⇒ Object



8
9
10
# File 'lib/cocoapods-spm/def/podfile.rb', line 8

def config_cocoapods_spm(options)
  SPM::Config.instance.dsl_config = options
end

#macro_podsObject



12
13
14
# File 'lib/cocoapods-spm/def/podfile.rb', line 12

def macro_pods
  @macro_pods ||= {}
end

#origin_podObject



7
# File 'lib/cocoapods-spm/def/podfile.rb', line 7

alias origin_pod pod

#pod(name = nil, *requirements) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/cocoapods-spm/def/podfile.rb', line 16

def pod(name = nil, *requirements)
  macro = requirements[0].delete(:macro) if requirements.first.is_a?(Hash)
  macro ||= {}
  unless macro.empty?
    requirements[0][:path] = prepare_macro_pod_dir(name, macro)
    macro_pods[name] = macro
  end
  origin_pod(name, *requirements)
end

#spm_pkg(name, options) ⇒ Object



26
27
28
# File 'lib/cocoapods-spm/def/podfile.rb', line 26

def spm_pkg(name, options)
  current_target_definition.store_spm_pkg(name, options)
end

#spm_pkgs_by_aggregate_targetObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cocoapods-spm/def/podfile.rb', line 34

def spm_pkgs_by_aggregate_target
  @spm_pkgs_by_aggregate_target ||= begin
    dict = {}
    to_visit = root_target_definitions.map { |t| [t, []] }
    until to_visit.empty?
      target, acc = to_visit.pop
      dict[target.to_s] = (target.spm_pkgs + acc).uniq
      to_visit += target.children.map { |t| [t, dict[target.to_s]] }
    end
    dict
  end
end

#spm_pkgs_for(target) ⇒ Object



30
31
32
# File 'lib/cocoapods-spm/def/podfile.rb', line 30

def spm_pkgs_for(target)
  spm_pkgs_by_aggregate_target[target.to_s]
end