Module: Pod::Podfile::DSL

Defined in:
lib/cocoapods-tdf-bin/native/podfile.rb

Overview

TREAT_DEVELOPMENTS_AS_NORMAL = ‘treat_developments_as_normal’.freeze

Instance Method Summary collapse

Instance Method Details

#allow_prerelease!Object



12
13
14
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 12

def allow_prerelease!
  set_internal_hash_value(ALLOW_PRERELEASE, true)
end

#batch_pod(pods, path = "../../", *requirements) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 26

def batch_pod(pods, path = "../../", *requirements)
  isLocal = requirements[0][:isLocal]
  branch = requirements[0][:branch]
  if isLocal.nil?
    isLocal = false
  end
  if branch.nil?
    branch = "master"
  end
  if isLocal
    batch_pod_local(pods, path, branch)
  else
    batch_pod_remote(pods, branch)
  end
end

#batch_pod_local(pods, path = "../../", branch = "master") ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 42

def batch_pod_local(pods, path = "../../", branch = "master")
  pod_hash = Hash.new
  pods.each do |name|
    pod_hash[name] =  [ :path => "#{path}#{name}", :branch => branch ]
  end
  if get_batch_local_pods.nil?
    set_internal_hash_value(BATCH_POD_LOCAL, pod_hash)
  else
    set_internal_hash_value(BATCH_POD_LOCAL, get_internal_hash_value(BATCH_POD_LOCAL).merge(pod_hash))
  end
end

#batch_pod_remote(pods, branch) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 54

def batch_pod_remote(pods, branch)
  pod_hash = Hash.new
  pods.each do |name|
    git_url = Pod::Command::Bin::Batch.find_repo_with_pod(name)
    pod_hash[name] = [ :git => git_url, :branch => "#{branch}" ]
  end
  if get_batch_remote_pods.nil?
    set_internal_hash_value(BATCH_POD_REMOTE, pod_hash)
  else
    set_internal_hash_value(BATCH_POD_REMOTE, get_internal_hash_value(BATCH_POD_REMOTE).merge(pod_hash))
  end
end

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



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 67

def pod(name = nil, *requirements)
  unless name
    raise StandardError, 'A dependency requires a name.'
  end

  local_pod_hash = get_batch_local_pods
  remote_pod_hash = get_batch_remote_pods
  if remote_pod_hash != nil
    requirements = remote_pod_hash[name].nil? ? requirements : remote_pod_hash[name];
  end
  if local_pod_hash != nil
    requirements = local_pod_hash[name].nil? ? requirements : local_pod_hash[name];
  end
  current_target_definition.store_pod(name, *requirements)
end

#pods(pod_list, branch) ⇒ Object

统一使用这种引用方式,跟flutter本地开发方式统一



17
18
19
20
21
22
23
24
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 17

def pods(pod_list, branch)
  # 固定路径
  local_path = "./.tdf_ios/"
  if not Dir.exist? local_path
    Dir.mkdir local_path
  end
  batch_pod_local(pod_list, local_path, branch)
end

#set_configuration_env(env = "dev") ⇒ Object

0 dev 1 debug_iphoneos 2 release_iphoneos 需要在podfile_env 先定义 CONFIGURATION_ENV



103
104
105
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 103

def set_configuration_env(env = "dev")
  set_internal_hash_value(CONFIGURATION_ENV, env)
end

#set_use_source_pods(pods) ⇒ Object



93
94
95
96
97
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 93

def set_use_source_pods(pods)
  hash_pods_use_source = get_internal_hash_value(USE_SOURCE_PODS) || []
  hash_pods_use_source += Array(pods)
  set_internal_hash_value(USE_SOURCE_PODS, hash_pods_use_source)
end

#use_binaries!(flag = true) ⇒ Object



83
84
85
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 83

def use_binaries!(flag = true)
  set_internal_hash_value(USE_BINARIES, flag)
end

#use_binaries_with_spec_selector!(&block) ⇒ Object

Raises:

  • (Informative)


87
88
89
90
91
# File 'lib/cocoapods-tdf-bin/native/podfile.rb', line 87

def use_binaries_with_spec_selector!(&block)
  raise Informative, '必须提供选择需要二进制组件的 block !' unless block_given?

  set_internal_hash_value(USE_BINARIES_SELECTOR, block)
end