Module: Pod::Podfile::DSL

Defined in:
lib/pod/pod.rb

Instance Method Summary collapse

Instance Method Details

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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pod/pod.rb', line 10

def pod(name = nil, *requirements, &block)
  #
  # Logic:
  # Lookup a link for the given pod name. If a link exists then the pod will be installed
  # via the link instead of the provided requirements (e.g. it will setup local pod development
  # for the link). If the link does not exist, then the pod will be installed normally
  #

  unless ENV['GIT_2_LOCAL'] == "true"
    real_pod(name, *requirements, &block)
    return
  end
  # link = Pod::Command::Links.get_link(linked_name)
  unless requirements[0].instance_of? String
    unless requirements[0].key?(:git)  && (requirements[0].key?(:commit) || requirements[0].key?(:branch))
      real_pod(name, *requirements, &block)
    else
      git = requirements[0].fetch(:git)
      commit = requirements[0].key?(:commit) ? requirements[0].fetch(:commit) : nil
      branch = requirements[0].key?(:branch) ? requirements[0].fetch(:branch) : nil
      component = git.split("/")[4].split(".")[0]
      gitclone(git, branch, commit)
      requirements[0].delete(:git)
      requirements[0].key?(:commit) && requirements[0].delete(:commit)
      requirements[0].key?(:branch) && requirements[0].delete(:branch)
      requirements[0][:path] = "../"+component+"/"
      real_pod(name, *requirements, &block)
    end
  else
    real_pod(name, *requirements, &block)
  end
end

#real_podObject



9
# File 'lib/pod/pod.rb', line 9

alias_method :real_pod, :pod