Class: Pod::SPM::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-spm/main.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Hook

Returns a new instance of Hook.



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

def initialize(context)
  @context = context
end

Instance Method Details

#all_specsObject



24
25
26
# File 'lib/cocoapods-spm/main.rb', line 24

def all_specs
  @all_specs ||= @context.umbrella_targets.flat_map(&:specs).uniq
end

#configObject



20
21
22
# File 'lib/cocoapods-spm/main.rb', line 20

def config
  Config.instance
end

#pods_projectObject



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

def pods_project
  @context.pods_project
end

#runObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/cocoapods-spm/main.rb', line 28

def run
  all_specs.each do |spec|
    if spec.spm_dependencies
      target = pods_project.targets.find { |t| t.name == spec.name }
      add_spm_dependencies(target, spec.spm_dependencies)
    end
  end
  update_import_paths
  pods_project.save
end

#sandboxObject



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

def sandbox
  @context.sandbox
end