module Pod::Podfile::DSL

Public Instance Methods

bd_fetch_pod_list(with_patch_feature = true) click to toggle source

从网络获取 pod 列表,并插入 podfile 中

会以 podfile 同级中的 integration.yml 文件为参数,请求内容 (yml 中读取 top level 的 history_id

# File lib/bd_pod_extentions/integration_area.rb, line 11
def bd_fetch_pod_list(with_patch_feature = true)
    # 默认带 patch 功能
    if with_patch_feature
        bd_use_patch_file_begin!
        BD::FetchPodList.new(self).main
        bd_use_patch_file_end!
    else
        BD::FetchPodList.new(self).main
    end
end
bd_fix_module_for_binary_pod!() click to toggle source

Cocoapods have a bug: doesn't generate modulemap for pure binary pod code.byted.org/iOS_Library/MobileDev/issues/256

This function could fix this bug. Module if recommanded for swift project, so that you can use import XXX directly

# File lib/bd_pod_extension_net.rb, line 1248
def bd_fix_module_for_binary_pod!
    if Pod::VERSION.start_with? "1.4"
        raise "bd_fix_module_for_binary_pod! doesn't support cocoapods 1.4, use 1.5 or 1.6"
    end
    tmp_path = ENV["TMPDIR"]

    if Pod::VERSION.start_with? "1.5"
        file_path = Pathname.new(tmp_path) + "bd_fix_module_1_5.rb"
        File.write(file_path, $BD_fix_module_code_1_5)
        load file_path.to_s
        File.delete file_path
    else
        # 1.6 or above
        file_path = Pathname.new(tmp_path) + "bd_fix_module_1_6.rb"
        File.write(file_path, $BD_fix_module_code_1_6)
        load file_path.to_s
        File.delete file_path
    end
end
bd_platform_pod(name = nil, *requirements)
Alias for: pod
bd_use_patch_file_begin!(patchfile_path = "Podfile.patch") click to toggle source

podfile patch feature

MUST be used with `bd_use_patch_file_end!` together.

call `bd_use_patch_file_begin!` before pods configuration call `bd_use_patch_file_end!` at the very end of podfile

More info at code.byted.org/iOS_Library/cocoapods-podfile_patch

# File lib/bd_pod_extension_net.rb, line 966
def bd_use_patch_file_begin!(patchfile_path = "Podfile.patch")
    @bd_current_patch_files ||= []
    if @bd_current_patch_files.include? patchfile_path
        # Yes, you could even use it recureively, but don't use the same patch file.
        raise "`use_patch_file!` called recursively. Most case is it's used in Patch file."
        return 
    end
    
    @bd_current_patch_files << patchfile_path
    require 'cocoapods-podfile_patch/podfile_patch'
    @bd_current_patch_target = BD::PodfilePatch.new.load_patch_target self, patchfile_path
    @bd_current_patch_files.delete(patchfile_path)
end
bd_use_patch_file_end!() click to toggle source

call it at the very end of podfile

# File lib/bd_pod_extension_net.rb, line 981
def bd_use_patch_file_end!
    if not @bd_current_patch_target.nil?
        BD::PodfilePatch.new.merge_patch_and_original_podfile(self, @bd_current_patch_target)
    end
end
pod(name = nil, *requirements) click to toggle source
# File lib/bd_pod_extension_net.rb, line 838
def pod(name = nil, *requirements)
  if requirements.size != 0
    version = requirements[0]
    if version.class != Hash
      if version.include?("1-binary")||version.include?("1.binary")
        Binary << name
      end
    end
  end
  bd_platform_pod(name,*requirements)
end
Also aliased as: bd_platform_pod, bd_platform_pod, bd_platform_pod, bd_platform_pod
target(name, options = nil) { || ... } click to toggle source
# File lib/bd_pod_extension_net.rb, line 817
def target(name, options = nil)

  if options
    raise Informative, "Unsupported options `#{options}` for " \
      "target `#{name}`."
  end
  parent = current_target_definition
  definition = TargetDefinition.new(name, parent)
  self.current_target_definition = definition
  $CurrentDevPodsMap = Target_Dev_Pods_Map[name]
  $CurrentDevPods = Target_Dev_Pod_Container[name]
  pod_install_dev
  yield if block_given?
ensure
  self.current_target_definition = parent
end