Class: Pod::Podfile

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_env_entry.rb,
lib/dev_env_utils.rb,
lib/resolver_universal_dependency.rb

Defined Under Namespace

Modules: DSL Classes: TargetDefinition

Class Method Summary collapse

Class Method Details

.cleanParrentLockFileObject



83
84
85
# File 'lib/resolver_universal_dependency.rb', line 83

def self.cleanParrentLockFile()
    $parentPodlockDependencyHash = Hash.new
end

.readParrentLockFileObject

类方法



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/resolver_universal_dependency.rb', line 88

def self.readParrentLockFile()
    # 获取路径(之后外边直接配置)
    localPath = Pathname.new(Dir.pwd + "/" + $parrentPath)
    lockPath ||= localPath + "Podfile.lock"
    # 读取lockfile
    _lockfile = Lockfile.from_file(lockPath)
    if _lockfile == nil
        UI.message "dev_env, 读取父库的lockfile找不到对应路径的lock文件:" + lockPath.inspect
        return
    end
    # 读取lockfile中的依赖信息,用于之后提取使用,其中数据为 Pod::Dependency类型
    localPodsMaps = Hash.new()
    localpods = _lockfile.dependencies
    localpods.each do |dep|
        # 数据为 Pod::Dependency类型
        if (dep.external_source == nil && dep.requirement == nil) || localPodsMaps.has_key?(dep.root_name)
            next
        end
        if dep.external_source == nil && dep.requirement.to_s == '>= 0'
            # dependence里可能没有版本信息(很奇怪,从version里单独取一下,写死版本限制)
            version = _lockfile.version(dep.root_name)
            dep.setRequirement(Requirement.new(version))
            dep.podspec_repo = _lockfile.spec_repo(dep.root_name)
        end
        if dep.local?
            dep.external_source[:path] = $parrentPath + dep.external_source[:path]
        end
        # 测试代码 UI.puts "测试获取父项目podlock里的pod依赖列表: " + dep.inspect
        localPodsMaps[dep.root_name] = dep
    end
    $parentPodlockDependencyHash = localPodsMaps
    # 读取 示例: ydASRInfo = localPodsMaps['YDASR']
    # UI.puts ydASRInfo.inspect
    # UI.puts "YDASR path:\n" + ydASRInfo.external_source[:path]
end