Class: Pod::Installer::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-localsource/PodSwizzle.rb

Instance Method Summary collapse

Instance Method Details

#allDependenciesFor(name, localModules = LocalModuleManager.all_modules) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cocoapods-localsource/PodSwizzle.rb', line 44

def allDependenciesFor(name, localModules = LocalModuleManager.all_modules)
  if LocalModuleManager.resolved?(name)
    # if the local dependency has already been resolved, we don't need to resolve the dependencies again.
    return []
  end

  pathComponents = name.split("/")
  baseName = pathComponents[0]
  importingSubspec = pathComponents.length > 1

  localModule = localModules[baseName]

  podspec = nil
  # Position in the modules directory to generate the subspecs correctly
  Dir.chdir(localModule.module_path) do
    podspec = eval File.read("#{baseName}.podspec")
  end

  # Use the subspec if we're importing it
  if importingSubspec
    podspec = podspec.subspec_by_name(name)
  end

  # Get all local dependencies of the spec/subspec
  allDependencies = podspec.all_dependencies.select { |d| LocalModuleManager.local?(d.name) }

  # Get other dependencies recursively
  allDependencies.each do |dependency|
    allDependencies += allDependenciesFor(dependency.name, localModules)
  end

  LocalModuleManager.set_resolved(name)
  return allDependencies.uniq
end

#dependencies_to_fetch(podfile_state) ⇒ Object



81
82
83
84
85
86
87
88
89
# File 'lib/cocoapods-localsource/PodSwizzle.rb', line 81

def dependencies_to_fetch(podfile_state)
  real_dependencies_to_fetch(podfile_state)

  resolvedLocalDependencies = @deps_to_fetch.map do |key, value|
    allDependenciesFor(key.name)
  end.flatten.uniq

  @deps_to_fetch = (@deps_to_fetch | resolvedLocalDependencies).uniq
end

#real_dependencies_to_fetchObject



79
# File 'lib/cocoapods-localsource/PodSwizzle.rb', line 79

alias_method :real_dependencies_to_fetch, :dependencies_to_fetch