class Fastlane::Ref::RefPodInfo
Attributes
deps[R]
files_h[R]
files_h_name[R]
files_m[R]
files_m_name[R]
files_swift[R]
files_swift_name[R]
git[R]
git_path[R]
name[R]
reference_errors[R]
version[R]
Public Class Methods
analysis(lock_path,pods_path,specs_path)
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 94 def self.analysis(lock_path,pods_path,specs_path) #生成pod对象 pods_hash = Hash.new pod_list = Dir.glob("#{pods_path}/**") pod_list.each do |item| pod_name = item.gsub("#{pods_path}/","") if pod_name == "Target Support Files" || pod_name == "Local Podspecs" || pod_name == "Headers" || pod_name == "Pods.xcodeproj" || pod_name == "Manifest.lock" next end #获取版本 Tools.shell("sed -i '' \"s/ //g\" \"#{lock_path}\"") notes = Tools.return_shell("grep -i '#{pod_name}' '#{lock_path}'") notes_tmp = notes.split("(=") if notes_tmp.size > 1 version = notes_tmp[1].split(")").first else tmp = notes.split("(") tmp.each do |t| if t.include?("~") next end if t.include?(")") version = t.split(")").first end end end #获取git地址 pod_git_path = "#{specs_path}/#{pod_name}/#{version}/#{pod_name}.podspec.json" pod_git = nil if File.exist?(pod_git_path) json = File.read(pod_git_path) json_obj = JSON.parse(json) pod_git = json_obj["source"]["git"] end #找到库的代码文件 files_h = Dir.glob("#{item}/**/*.h") files_swift = Dir.glob("#{item}/**/*.swift") files_m = Dir.glob("#{item}/**/*.{m,mm}") files_h_name = [] files_h.each do |file| files_h_name << File.basename(file) end files_swift_name = [] files_swift.each do |file| files_swift_name << File.basename(file) end files_m_name = [] files_m.each do |file| files_m_name << File.basename(file) end pod_info = RefPodInfo.new(pod_name,version,pod_git,pod_git_path,files_h,files_swift,files_m,files_h_name,files_swift_name,files_m_name) pod_info.string pods_hash[pod_name] = pod_info end return pods_hash end
files(pod_hash)
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 164 def self.files(pod_hash) files_hash = Hash.new tmps = [] pod_hash.keys.each do |key| info = pod_hash[key] #忽略第三方库 if info.git == nil tmps << info.name next end files = [] files += info.files_h files += info.files_swift files += info.files_m files_hash[key] = files end Tools.log("跳过第三方库 => #{tmps}") return files_hash end
git_paths(pod_hash)
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 184 def self.git_paths(pod_hash) git_paths = [] pod_hash.values.each do |pod| #忽略第三方库 if pod.git == nil next end git_paths << pod.git_path end return git_paths end
new(name, version, git,git_path,files_h,files_swift,files_m,files_h_name,files_swift_name,files_m_name)
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 46 def initialize(name, version, git,git_path,files_h,files_swift,files_m,files_h_name,files_swift_name,files_m_name) @name=name @version=version @git=git @git_path=git_path @files_h=files_h @files_swift=files_swift @files_m=files_m @files_h_name=files_h_name @files_swift_name=files_swift_name @files_m_name=files_m_name @deps = Hash.new @reference_errors = Hash.new end
Public Instance Methods
add_deps(pod_name,version,file_path,notes,podspec_quote)
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 71 def add_deps(pod_name,version,file_path,notes,podspec_quote) dep_info = RefDepInfo.new(pod_name,version,@name,file_path,File.basename(file_path),notes,podspec_quote) unless @deps.has_key?(pod_name) @deps[pod_name] = [] end @deps[pod_name] << dep_info end
add_reference_errors(pod_name,version,file_path,notes,podspec_quote)
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 63 def add_reference_errors(pod_name,version,file_path,notes,podspec_quote) errors_info = RefDepInfo.new(pod_name,version,@name,file_path,File.basename(file_path),notes,podspec_quote) unless @reference_errors.has_key?(pod_name) @reference_errors[pod_name] = [] end @reference_errors[pod_name] << errors_info end
get_files_h_name()
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 79 def get_files_h_name() unless files_h_name.empty? Tools.logs("#{@name}的头文件",@files_h_name) end end
string()
click to toggle source
# File lib/fastlane/plugin/rocket/ref/ref_pod_info.rb, line 85 def string() string = [] string << "name => #{name}" string << "version => #{version}" string << "git => #{git}" string << "git_path => #{git_path}" Tools.logs("#{name}属性",string) end