Module: Pod

Defined in:
lib/helper/pod.rb,
lib/helper/podfile.rb,
lib/helper/installer.rb,
lib/helper/podfile_options.rb,
lib/helper/Core/podfile/dsl.rb,
lib/cocoapods-dongjia/command/demo.rb,
lib/cocoapods-dongjia/command/open.rb,
lib/cocoapods-dongjia/command/strip.rb,
lib/cocoapods-dongjia/command/release.rb,
lib/cocoapods-dongjia/command/reinstall.rb

Defined Under Namespace

Classes: Command, Image, Installer, LocalSpec, Podfile

Class Method Summary collapse

Class Method Details

.inject_local_path(name, requirements) ⇒ Object

注入本地路径



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/helper/pod.rb', line 15

def self.inject_local_path(name, requirements)
  local_path = nil
  local_root = ENV['POD_LOCAL_ROOT']
  if !local_root
    UI.warn '环境变量中未发现 POD_LOCAL_ROOT 定义'
  elsif local_root.length
    local_path = File.join(local_root, repo_name(name))
  end
  if local_path
    cfg = requirements.pop
    if cfg.is_a?(Hash)
      cfg.reject! { |key, value|
        [:git, :branch, :tag, :commit, :podspec].include?(key)
      }
    else
      cfg = {:path => local_path}
    end
    cfg.merge!({:path => local_path})
    requirements.push(cfg)
  end
end

.inject_remote_git(name, requirements) ⇒ Object

注入远程仓库地址



38
39
40
41
42
43
# File 'lib/helper/pod.rb', line 38

def self.inject_remote_git(name, requirements)
  name = name.split('/').first
  options = requirements.pop
  options[:git] = "[email protected]:ios-team/components/#{name}.git"
  requirements.push(options)
end

.repo_name(name) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/helper/pod.rb', line 5

def self.repo_name(name)
  pos = name.index('/')
  ret = pos == nil ? name : name[0, pos]
  if ret == 'ProtocolBuffers'
    ret = 'protobuf-objc'
  end
  ret
end