Class: Pod::Podfile

Inherits:
Object
  • Object
show all
Defined in:
lib/dongjia_inspector.rb,
lib/dongjia_import_helper.rb

Instance Method Summary collapse

Instance Method Details

#import_from_local_specObject



20
21
22
23
24
# File 'lib/dongjia_import_helper.rb', line 20

def import_from_local_spec
    $IS_IMPORTING_LOCAL_SPEC = true
    yield if block_given?
    $IS_IMPORTING_LOCAL_SPEC = false
end

#import_wrapper(path = 'components') ⇒ Object

导入 gitlab 上的远程 pod



11
12
13
14
15
16
# File 'lib/dongjia_import_helper.rb', line 11

def import_wrapper(path = 'components')
    $IS_WRAPED = true
    $REMOTE_PATH = path
    yield if block_given?
    $IS_WRAPED = false
end

#original_podObject

Hook pod 方法



12
# File 'lib/dongjia_inspector.rb', line 12

alias_method :original_pod, :pod

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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dongjia_inspector.rb', line 14

def pod(name = nil, *requirements, &block)
  
  if name.start_with?('DJ') && requirements.count > 0
    req = requirements.first
    if req[:branch] && req[:branch] != 'master'
      UI.warn "检测到 #{name} 指向了分支 #{req[:branch]}\n"
      exit -1
    elsif req[:tag]
      UI.warn "检测到 #{name} 指向了标签 #{req[:tag]}\n"
      exit -1
    elsif req[:commit]
      UI.warn "检测到 #{name} 指向了节点 #{req[:commit]}\n"
      exit -1
    end
  end
  
  original_pod(name, *requirements, &block)
end

#pod_alias_by_importObject

Hook



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dongjia_import_helper.rb', line 27

def pod(name = nil, *requirements, &block)
  
  if name.start_with?('DJ') && requirements.count > 0
    req = requirements.first
    if req[:branch] && req[:branch] != 'master'
      UI.warn "检测到 #{name} 指向了分支 #{req[:branch]}\n"
      exit -1
    elsif req[:tag]
      UI.warn "检测到 #{name} 指向了标签 #{req[:tag]}\n"
      exit -1
    elsif req[:commit]
      UI.warn "检测到 #{name} 指向了节点 #{req[:commit]}\n"
      exit -1
    end
  end
  
  original_pod(name, *requirements, &block)
end

#repo_name(name) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/dongjia_import_helper.rb', line 57

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