class PPL::Scanner
Public Class Methods
git()
click to toggle source
# File lib/pod-pipeline/util/scanner.rb, line 55 def self.git @@git end
linter()
click to toggle source
# File lib/pod-pipeline/util/scanner.rb, line 47 def self.linter @@linter end
new(projectPath, channels)
click to toggle source
# File lib/pod-pipeline/util/scanner.rb, line 15 def initialize(projectPath, channels) @projectPath = projectPath @channels = channels end
podspec()
click to toggle source
# File lib/pod-pipeline/util/scanner.rb, line 51 def self.podspec @@podspec end
workspace()
click to toggle source
# File lib/pod-pipeline/util/scanner.rb, line 59 def self.workspace @@workspace end
Public Instance Methods
run()
click to toggle source
# File lib/pod-pipeline/util/scanner.rb, line 20 def run @channels = ["all"] if @channels.count.zero? puts "\n[扫描 #{@channels.join(", ")} 内容]" @channels.each do |channel| case channel when "all" @@linter = scan_pod @projectPath @@podspec = @@linter.spec @@git = scan_git @projectPath @@workspace = scan_workspace @projectPath when "pod" @@linter = scan_pod @projectPath @@podspec = @@linter.spec when "git" @@git = scan_git @projectPath when "workspace" @@workspace = scan_workspace @projectPath else raise "暂不支持#{channel}内容扫描" end end end
Private Instance Methods
scan_git(projectPath)
click to toggle source
检查项目的 Git
库
@param [String] projectPath 项目根目录
@return [Git::Base] 新 {Git::Base} 实例
# File lib/pod-pipeline/util/scanner.rb, line 94 def scan_git(projectPath) Git.open(projectPath) end
scan_pod(projectPath)
click to toggle source
检查项目的 podspec 文件
@param [String] projectPath 项目根目录
@return [Pod::Specification] 新 {Pod::Specification} 实例
# File lib/pod-pipeline/util/scanner.rb, line 74 def scan_pod(projectPath) podspec_files = Pathname.glob(projectPath + '/*.podspec{.json,}') if podspec_files.count.zero? || podspec_files.count > 1 raise '未找到或存在多个 *.podspec 文件' end podspec_file = podspec_files.first linter = Pod::Specification::Linter.new(podspec_file) unless linter.spec raise 'podspec文件异常' end linter end
scan_workspace(projectPath)
click to toggle source
检查项目的 workspace
@param [String] projectPath 项目根目录
@return [Xcodeproj::Workspace] 新的 {Xcodeproj::Workspace} 实例
# File lib/pod-pipeline/util/scanner.rb, line 105 def scan_workspace(projectPath) workspace_files = Dir[projectPath + '/Example/*.xcworkspace'] if workspace_files.count.zero? || workspace_files.count > 1 raise '未找到或存在多个 *.xcworkspace 文件' end workspace_file = workspace_files.first Xcodeproj::Workspace.open(workspace_file) end