class YJCocoa::PodRelease
Usage
Attributes
podfile[RW]
pods[RW]
Public Class Methods
new(argv)
click to toggle source
初始化
Calls superclass method
# File lib/yjcocoa/pod/pod_release.rb, line 35 def initialize(argv) super self.podfile = argv.option('podfile') self.pods = argv.option('pods') self.pods = self.pods.split(",").reject {|i| i.empty? } if self.pods end
options()
click to toggle source
Calls superclass method
YJCocoa::Command::options
# File lib/yjcocoa/pod/pod_release.rb, line 26 def self.options [['--podfile', '包含 pods 库的 podfile 文件路径'], ['--pods', 'pods 库,多 pod 用 "," 分隔']] + super end
Public Instance Methods
run()
click to toggle source
businrss
# File lib/yjcocoa/pod/pod_release.rb, line 54 def run content = [] File.open(self.podfile, "r") { |file| while line = file.gets #标准输入流 result = check(self.pods, line) content << "#{result}" if result end } puts "YJCocoa Pod Release".green puts content.sort * "\n" end
validate!()
click to toggle source
Calls superclass method
# File lib/yjcocoa/pod/pod_release.rb, line 42 def validate! super puts "podfile 为空".red unless self.podfile puts "pods 为空".red unless self.pods self.banner! unless self.podfile && self.pods unless File.exist?(self.podfile) puts "podfile 文件路径 #{self.podfile} 不存在".red self.banner! end end
Private Instance Methods
check(pods, line)
click to toggle source
# File lib/yjcocoa/pod/pod_release.rb, line 66 def check (pods, line) pods.each { |pod| if line.include?(pod) line.split(',').each { |item| if item.include?("tag") || item.include?("branch") pods.delete(pod) return "#{pod}, #{item.chomp}" end } end } return nil end