Module: Pod::Specification::DSL

Defined in:
lib/cocoapods-tdfire-binary/specification_dsl.rb

Instance Method Summary collapse

Instance Method Details

#tdfire_binary(configurator, &block) ⇒ Object

二进制依赖配置



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/cocoapods-tdfire-binary/specification_dsl.rb', line 41

def tdfire_binary(configurator, &block)
  return

  tdfire_set_binary_strategy_flag

  if !tdfire_use_source?
    # if !Pod::Tdfire::BinaryStateStore.printed_pods.include?(root.name)
    #   # 这里会执行两次,一次是最新的 podspec ,一次是指定的 podspec,所以这里版本没必要输出
    #   UI.message "Binary".cyan.bold + " dependecy for " + "#{root.name} #{version}".green.bold
    #   Pod::Tdfire::BinaryStateStore.printed_pods << root.name
    # end

    # name 一定要有,否则 subspec dependecy 会出现 split nil 错误
    @tdfire_reference_spec = Specification.new(nil, 'TdfireSpecification')
    configurator.call @tdfire_reference_spec

    # 如果存在 subspec,则生成 default subpsec ,并将所有的 subspec 配置转移到此 subspec 中
    # 已存在的 subspec 依赖此 subspec
    unless @tdfire_reference_spec.recursive_subspecs.empty?
      tdfire_refactor.configure_binary_default_subspec(@tdfire_reference_spec)
    else
      tdfire_refactor.configure_binary(@tdfire_reference_spec)
    end

    yield self if block_given?
  end
end

#tdfire_set_binary_download_configurationsObject

配置二进制文件下载、cache 住解压好的 framework

Raises:

  • (Pod::Informative)


71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/cocoapods-tdfire-binary/specification_dsl.rb', line 71

def tdfire_set_binary_download_configurations
  return

  tdfire_set_binary_strategy_flag

  tdfire_refactor.set_preserve_paths(tdfire_reference_spec)

  # 没有发布的pod,没有二进制版本,不进行下载配置
  return if tdfire_should_skip_download?

  raise Pod::Informative, "You must invoke the method after setting name and version" if root.name.nil? || version.nil?

  tdfire_refactor.set_framework_download_script
end

#tdfire_source(configurator) ⇒ Object

源码依赖配置



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cocoapods-tdfire-binary/specification_dsl.rb', line 22

def tdfire_source(configurator)
  configurator.call self
  return 
  
  tdfire_set_binary_strategy_flag

  if tdfire_use_source?
    # if !Pod::Tdfire::BinaryStateStore.printed_pods.include?(root.name)
    #   UI.message "Source".magenta.bold + " dependecy for " + "#{root.name} #{version}".green.bold
    #   Pod::Tdfire::BinaryStateStore.printed_pods << root.name
    # end

    configurator.call self

    tdfire_refactor.configure_source
  end
end

#tdfire_use_frameworks?Boolean

此次操作,Podfile 是否使用了 use_frameworks!

Returns:

  • (Boolean)


17
18
19
# File 'lib/cocoapods-tdfire-binary/specification_dsl.rb', line 17

def tdfire_use_frameworks?
  Tdfire::BinaryStateStore.use_frameworks
end