Class: Pod::Dependency

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

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, *requirements) ⇒ Dependency

Returns a new instance of Dependency.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cocoapods-localsource/PodSwizzle.rb', line 21

def initialize(name = nil, *requirements)
  # adds requirement hash if it's not present
  requirements << {} unless requirements.last.is_a?(Hash)

  pathComponents = name.split("/")
  baseName = pathComponents[0]

  if LocalModuleManager.all_modules[baseName].present?
    localModule = LocalModuleManager.all_modules[baseName]
    # remove version requirement, if local
    requirements = requirements[1..-1] unless requirements.first.is_a?(Hash)
    # add path to local dependency
    requirements.last[:path] = localModule.module_path
  end

  real_initialize(name, *requirements)
end

Instance Method Details

#real_initializeObject



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

alias_method :real_initialize, :initialize